Skip to content

Commit 71792dc

Browse files
authored
[NFC][msan] Workaround arg evaluation order diff GCC vs Clang (#113378)
1 parent c3aa8b7 commit 71792dc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,12 +2750,12 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
27502750
// its undefined bits. Let [b0, b1] be the interval of possible values of B.
27512751
// Then (A cmp B) is defined iff (a0 cmp b1) == (a1 cmp b0).
27522752
bool IsSigned = I.isSigned();
2753-
Value *S1 = IRB.CreateICmp(I.getPredicate(),
2754-
getLowestPossibleValue(IRB, A, Sa, IsSigned),
2755-
getHighestPossibleValue(IRB, B, Sb, IsSigned));
2756-
Value *S2 = IRB.CreateICmp(I.getPredicate(),
2757-
getHighestPossibleValue(IRB, A, Sa, IsSigned),
2758-
getLowestPossibleValue(IRB, B, Sb, IsSigned));
2753+
Value *Amin = getLowestPossibleValue(IRB, A, Sa, IsSigned);
2754+
Value *Bmax = getHighestPossibleValue(IRB, B, Sb, IsSigned);
2755+
Value *S1 = IRB.CreateICmp(I.getPredicate(), Amin, Bmax);
2756+
Value *Amax = getHighestPossibleValue(IRB, A, Sa, IsSigned);
2757+
Value *Bmin = getLowestPossibleValue(IRB, B, Sb, IsSigned);
2758+
Value *S2 = IRB.CreateICmp(I.getPredicate(), Amax, Bmin);
27592759
Value *Si = IRB.CreateXor(S1, S2);
27602760
setShadow(&I, Si);
27612761
setOriginForNaryOp(I);

0 commit comments

Comments
 (0)