[llvm] 71792dc - [NFC][msan] Workaround arg evaluation order diff GCC vs Clang (#113378)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 22 13:31:49 PDT 2024
Author: Vitaly Buka
Date: 2024-10-22T13:31:46-07:00
New Revision: 71792dc570c5b0eca0937efbd57d9ea1457dc87f
URL: https://github.com/llvm/llvm-project/commit/71792dc570c5b0eca0937efbd57d9ea1457dc87f
DIFF: https://github.com/llvm/llvm-project/commit/71792dc570c5b0eca0937efbd57d9ea1457dc87f.diff
LOG: [NFC][msan] Workaround arg evaluation order diff GCC vs Clang (#113378)
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 9e174e2415e719..63810e875ae0a2 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2750,12 +2750,12 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
// its undefined bits. Let [b0, b1] be the interval of possible values of B.
// Then (A cmp B) is defined iff (a0 cmp b1) == (a1 cmp b0).
bool IsSigned = I.isSigned();
- Value *S1 = IRB.CreateICmp(I.getPredicate(),
- getLowestPossibleValue(IRB, A, Sa, IsSigned),
- getHighestPossibleValue(IRB, B, Sb, IsSigned));
- Value *S2 = IRB.CreateICmp(I.getPredicate(),
- getHighestPossibleValue(IRB, A, Sa, IsSigned),
- getLowestPossibleValue(IRB, B, Sb, IsSigned));
+ Value *Amin = getLowestPossibleValue(IRB, A, Sa, IsSigned);
+ Value *Bmax = getHighestPossibleValue(IRB, B, Sb, IsSigned);
+ Value *S1 = IRB.CreateICmp(I.getPredicate(), Amin, Bmax);
+ Value *Amax = getHighestPossibleValue(IRB, A, Sa, IsSigned);
+ Value *Bmin = getLowestPossibleValue(IRB, B, Sb, IsSigned);
+ Value *S2 = IRB.CreateICmp(I.getPredicate(), Amax, Bmin);
Value *Si = IRB.CreateXor(S1, S2);
setShadow(&I, Si);
setOriginForNaryOp(I);
More information about the llvm-commits
mailing list