diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -4191,8 +4191,9 @@ // Now that we have an instruction, try combining it to simplify it. Builder.SetInsertPoint(I); - Builder.CollectMetadataToCopy( - I, {LLVMContext::MD_dbg, LLVMContext::MD_annotation}); + Builder.CollectMetadataToCopy(I, {LLVMContext::MD_dbg, + LLVMContext::MD_annotation, + LLVMContext::MD_nosanitize}); #ifndef NDEBUG std::string OrigI; @@ -4208,7 +4209,8 @@ << " New = " << *Result << '\n'); Result->copyMetadata(*I, - {LLVMContext::MD_dbg, LLVMContext::MD_annotation}); + {LLVMContext::MD_dbg, LLVMContext::MD_annotation, + LLVMContext::MD_nosanitize}); // Everything uses the new instruction now. I->replaceAllUsesWith(Result);