[SCEV] Fix stylistic issue in MatchBinaryAddToConst; NFCI
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 23 Oct 2015 20:09:57 +0000 (20:09 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 23 Oct 2015 20:09:57 +0000 (20:09 +0000)
Instead of checking `(FlagsPresent & ExpectedFlags) != 0`, check
`(FlagsPresent & ExpectedFlags) == ExpectedFlags`.  Right now they're
equivalent since `ExpectedFlags` can only be either `FlagNUW` or
`FlagNSW`, but if we ever pass in `ExpectedFlags` as `FlagNUW | FlagNSW`
then checking `(FlagsPresent & ExpectedFlags) != 0` would be wrong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251142 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 1ea1876576f24bba5b7c105b1b1da8c050517837..ee08c8107130ddbed3f50b05d3cff1f08b3f39f9 100644 (file)
@@ -7191,7 +7191,7 @@ bool ScalarEvolution::isKnownPredicateViaNoOverflow(ICmpInst::Predicate Pred,
       return false;
 
     OutY = cast<SCEVConstant>(ConstOp)->getValue()->getValue();
-    return (FlagsPresent & ExpectedFlags) != 0;
+    return (FlagsPresent & ExpectedFlags) == ExpectedFlags;
   };
 
   APInt C;