[PATCH] D36478: [NewGVN] Use a cast instead of a dyn_cast.

Chad Rosier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 11:12:36 PDT 2017

mcrosier created this revision.
Herald added a subscriber: Prazek.



Index: lib/Transforms/Scalar/NewGVN.cpp
--- lib/Transforms/Scalar/NewGVN.cpp
+++ lib/Transforms/Scalar/NewGVN.cpp
@@ -1711,7 +1711,9 @@
   return createAggregateValueExpression(I);
 const Expression *NewGVN::performSymbolicCmpEvaluation(Instruction *I) const {
-  auto *CI = dyn_cast<CmpInst>(I);
+  assert(isa<CmpInst>(I) && "Expected a cmp instruction.");
+  auto *CI = cast<CmpInst>(I);
   // See if our operands are equal to those of a previous predicate, and if so,
   // if it implies true or false.
   auto Op0 = lookupOperandLeader(CI->getOperand(0));

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36478.110238.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170808/594beb17/attachment.bin>

More information about the llvm-commits mailing list