@@ -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