[llvm] 71c5e7b - [msan] Do not deppend on arguments evaluation order
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 10 13:52:00 PDT 2022
Author: Vitaly Buka
Date: 2022-09-10T13:50:32-07:00
New Revision: 71c5e7b26abaf85d85294170785335dee1ab8afa
URL: https://github.com/llvm/llvm-project/commit/71c5e7b26abaf85d85294170785335dee1ab8afa
DIFF: https://github.com/llvm/llvm-project/commit/71c5e7b26abaf85d85294170785335dee1ab8afa.diff
LOG: [msan] Do not deppend on arguments evaluation order
Clang and GCC do this differently making IR inconsistent.
https://lab.llvm.org/buildbot#builders/6/builds/13120
Added:
Modified:
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index bdb410b48ace..62367dc9bc1c 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -3313,9 +3313,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Acc = IRB.CreateOr(Acc, More);
}
- Value *Origin = IRB.CreateSelect(
- IRB.CreateICmpNE(Acc, Constant::getNullValue(Acc->getType())),
- getOrigin(PassThru), IRB.CreateLoad(MS.OriginTy, OriginPtr));
+ Value *NotNull =
+ IRB.CreateICmpNE(Acc, Constant::getNullValue(Acc->getType()));
+ Value *PtrOrigin = IRB.CreateLoad(MS.OriginTy, OriginPtr);
+ Value *Origin =
+ IRB.CreateSelect(NotNull, getOrigin(PassThru), PtrOrigin);
setOrigin(&I, Origin);
} else {
More information about the llvm-commits
mailing list