From 46af41f5427d25ebd01aaa856d3e88f2e2945e63 Mon Sep 17 00:00:00 2001 From: Matthew Nagy Date: Wed, 7 Aug 2024 15:38:59 +0000 Subject: [PATCH] Fixed a codegen bug --- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 774820ae689245..1c55ecef1c5f12 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1877,10 +1877,6 @@ void AddressSanitizer::instrumentAddress(Instruction *OrigIns, } InstrumentationIRBuilder IRB(InsertBefore); - if (CLAsanDormant) - IRB.SetInsertPoint(SplitBlockAndInsertIfThen( - IRB.CreateNot(IRB.CreateLoad(IRB.getInt1Ty(), DormantAsanFlag)), - InsertBefore, false)); size_t AccessSizeIndex = TypeStoreSizeToSizeIndex(TypeStoreSize); const ASanAccessInfo AccessInfo(IsWrite, CompileKernel, AccessSizeIndex); @@ -1965,6 +1961,11 @@ void AddressSanitizer::instrumentUnusualSizeOrAlignment( TypeSize TypeStoreSize, bool IsWrite, Value *SizeArgument, bool UseCalls, uint32_t Exp, RuntimeCallInserter &RTCI) { InstrumentationIRBuilder IRB(InsertBefore); + if (CLAsanDormant) + IRB.SetInsertPoint(SplitBlockAndInsertIfThen( + IRB.CreateNot(IRB.CreateLoad(IRB.getInt1Ty(), DormantAsanFlag)), + InsertBefore, false)); + Value *NumBits = IRB.CreateTypeSize(IntptrTy, TypeStoreSize); Value *Size = IRB.CreateLShr(NumBits, ConstantInt::get(IntptrTy, 3));