Skip to content

Commit 3f608ab

Browse files
committed
[hwasan] Replace &LI with *LI, to fix build breakage
My patch (b3b6ede) broke the build (https://lab.llvm.org/buildbot/#/builders/5/builds/37053) because it incorrectly assumed LoopInfo could not be null and used a reference. This fixes forward by replacing &LI with *LI.
1 parent 689ace5 commit 3f608ab

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,19 @@ class HWAddressSanitizer {
305305

306306
int64_t getAccessInfo(bool IsWrite, unsigned AccessSizeIndex);
307307
ShadowTagCheckInfo insertShadowTagCheck(Value *Ptr, Instruction *InsertBefore,
308-
DomTreeUpdater &DTU, LoopInfo &LI);
308+
DomTreeUpdater &DTU, LoopInfo *LI);
309309
void instrumentMemAccessOutline(Value *Ptr, bool IsWrite,
310310
unsigned AccessSizeIndex,
311311
Instruction *InsertBefore,
312-
DomTreeUpdater &DTU, LoopInfo &LI);
312+
DomTreeUpdater &DTU, LoopInfo *LI);
313313
void instrumentMemAccessInline(Value *Ptr, bool IsWrite,
314314
unsigned AccessSizeIndex,
315315
Instruction *InsertBefore, DomTreeUpdater &DTU,
316-
LoopInfo &LI);
316+
LoopInfo *LI);
317317
bool ignoreMemIntrinsic(MemIntrinsic *MI);
318318
void instrumentMemIntrinsic(MemIntrinsic *MI);
319319
bool instrumentMemAccess(InterestingMemoryOperand &O, DomTreeUpdater &DTU,
320-
LoopInfo &LI);
320+
LoopInfo *LI);
321321
bool ignoreAccess(Instruction *Inst, Value *Ptr);
322322
void getInterestingMemoryOperands(
323323
Instruction *I, SmallVectorImpl<InterestingMemoryOperand> &Interesting);
@@ -872,7 +872,7 @@ int64_t HWAddressSanitizer::getAccessInfo(bool IsWrite,
872872

873873
HWAddressSanitizer::ShadowTagCheckInfo
874874
HWAddressSanitizer::insertShadowTagCheck(Value *Ptr, Instruction *InsertBefore,
875-
DomTreeUpdater &DTU, LoopInfo &LI) {
875+
DomTreeUpdater &DTU, LoopInfo *LI) {
876876
ShadowTagCheckInfo R;
877877

878878
IRBuilder<> IRB(InsertBefore);
@@ -893,7 +893,7 @@ HWAddressSanitizer::insertShadowTagCheck(Value *Ptr, Instruction *InsertBefore,
893893

894894
R.TagMismatchTerm = SplitBlockAndInsertIfThen(
895895
TagMismatch, InsertBefore, false,
896-
MDBuilder(*C).createBranchWeights(1, 100000), &DTU, &LI);
896+
MDBuilder(*C).createBranchWeights(1, 100000), &DTU, LI);
897897

898898
return R;
899899
}
@@ -902,7 +902,7 @@ void HWAddressSanitizer::instrumentMemAccessOutline(Value *Ptr, bool IsWrite,
902902
unsigned AccessSizeIndex,
903903
Instruction *InsertBefore,
904904
DomTreeUpdater &DTU,
905-
LoopInfo &LI) {
905+
LoopInfo *LI) {
906906
assert(!UsePageAliases);
907907
const int64_t AccessInfo = getAccessInfo(IsWrite, AccessSizeIndex);
908908

@@ -924,7 +924,7 @@ void HWAddressSanitizer::instrumentMemAccessInline(Value *Ptr, bool IsWrite,
924924
unsigned AccessSizeIndex,
925925
Instruction *InsertBefore,
926926
DomTreeUpdater &DTU,
927-
LoopInfo &LI) {
927+
LoopInfo *LI) {
928928
assert(!UsePageAliases);
929929
const int64_t AccessInfo = getAccessInfo(IsWrite, AccessSizeIndex);
930930

@@ -935,7 +935,7 @@ void HWAddressSanitizer::instrumentMemAccessInline(Value *Ptr, bool IsWrite,
935935
IRB.CreateICmpUGT(TCI.MemTag, ConstantInt::get(Int8Ty, 15));
936936
Instruction *CheckFailTerm = SplitBlockAndInsertIfThen(
937937
OutOfShortGranuleTagRange, TCI.TagMismatchTerm, !Recover,
938-
MDBuilder(*C).createBranchWeights(1, 100000), &DTU, &LI);
938+
MDBuilder(*C).createBranchWeights(1, 100000), &DTU, LI);
939939

940940
IRB.SetInsertPoint(TCI.TagMismatchTerm);
941941
Value *PtrLowBits = IRB.CreateTrunc(IRB.CreateAnd(TCI.PtrLong, 15), Int8Ty);
@@ -944,7 +944,7 @@ void HWAddressSanitizer::instrumentMemAccessInline(Value *Ptr, bool IsWrite,
944944
Value *PtrLowBitsOOB = IRB.CreateICmpUGE(PtrLowBits, TCI.MemTag);
945945
SplitBlockAndInsertIfThen(PtrLowBitsOOB, TCI.TagMismatchTerm, false,
946946
MDBuilder(*C).createBranchWeights(1, 100000), &DTU,
947-
&LI, CheckFailTerm->getParent());
947+
LI, CheckFailTerm->getParent());
948948

949949
IRB.SetInsertPoint(TCI.TagMismatchTerm);
950950
Value *InlineTagAddr = IRB.CreateOr(TCI.AddrLong, 15);
@@ -953,7 +953,7 @@ void HWAddressSanitizer::instrumentMemAccessInline(Value *Ptr, bool IsWrite,
953953
Value *InlineTagMismatch = IRB.CreateICmpNE(TCI.PtrTag, InlineTag);
954954
SplitBlockAndInsertIfThen(InlineTagMismatch, TCI.TagMismatchTerm, false,
955955
MDBuilder(*C).createBranchWeights(1, 100000), &DTU,
956-
&LI, CheckFailTerm->getParent());
956+
LI, CheckFailTerm->getParent());
957957

958958
IRB.SetInsertPoint(CheckFailTerm);
959959
InlineAsm *Asm;
@@ -1030,7 +1030,7 @@ void HWAddressSanitizer::instrumentMemIntrinsic(MemIntrinsic *MI) {
10301030

10311031
bool HWAddressSanitizer::instrumentMemAccess(InterestingMemoryOperand &O,
10321032
DomTreeUpdater &DTU,
1033-
LoopInfo &LI) {
1033+
LoopInfo *LI) {
10341034
Value *Addr = O.getPtr();
10351035

10361036
LLVM_DEBUG(dbgs() << "Instrumenting: " << O.getInsn() << "\n");
@@ -1564,7 +1564,7 @@ void HWAddressSanitizer::sanitizeFunction(Function &F,
15641564
LoopInfo *LI = FAM.getCachedResult<LoopAnalysis>(F);
15651565
DomTreeUpdater DTU(DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy);
15661566
for (auto &Operand : OperandsToInstrument)
1567-
instrumentMemAccess(Operand, DTU, *LI);
1567+
instrumentMemAccess(Operand, DTU, LI);
15681568
DTU.flush();
15691569

15701570
if (ClInstrumentMemIntrinsics && !IntrinToInstrument.empty()) {

0 commit comments

Comments
 (0)