[PATCH] D37265: [SCEV] Ensure ScalarEvolution::createAddRecFromPHIWithCastsImpl properly handles out of range truncations of the start and accum values

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 15:05:27 PDT 2017


mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.

LGTM with nits: use `isa` for boolean type checks, not `dyn_cast`.



================
Comment at: lib/Analysis/ScalarEvolution.cpp:4516
+  } else
+    assert(dyn_cast<SCEVConstant>(PHISCEV) && "Expected constant SCEV");
 
----------------
Use `assert(isa<SCEVConstant>(PHISCEV) && ...)`


================
Comment at: unittests/Analysis/ScalarEvolutionTest.cpp:1149
+  EXPECT_NE(nullptr, Expr);
+  EXPECT_NE(nullptr, dyn_cast<SCEVUnknown>(Expr));
+  auto Result = SE.createAddRecFromPHIWithCasts(cast<SCEVUnknown>(Expr));
----------------
Use `EXPECT_TRUE(isa<SCEVUnknown>(Expr))`, as in the function above.


https://reviews.llvm.org/D37265





More information about the llvm-commits mailing list