[PATCH] D29747: PredicateInfo: Support switch statements

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 10:22:10 PST 2017


davide added inline comments.


================
Comment at: lib/Transforms/Scalar/NewGVN.cpp:1152
       LastPredInfo = PI;
+
       // TODO: Along the false edge, we may know more things too, like icmp of
----------------
Spurious newline


================
Comment at: lib/Transforms/Utils/PredicateInfo.cpp:56-59
+  if (auto *PEdge = dyn_cast<PredicateWithEdge>(PB))
+    return PEdge->From;
+  llvm_unreachable("Only branches and switches should have PHIOnly defs that "
+                   "require branch blocks");
----------------
`assert(isa<>)`  + `return static_cast<>` ?


================
Comment at: lib/Transforms/Utils/PredicateInfo.cpp:65-67
+  if (auto *PEdge = dyn_cast<PredicateWithEdge>(PB))
+    return PEdge->From->getTerminator();
+  llvm_unreachable("Not a predicate info type we know how to handle");
----------------
Also here and in the other places.


================
Comment at: lib/Transforms/Utils/PredicateInfo.cpp:442-450
+  for (auto i = SI->case_begin(), e = SI->case_end(); i != e; ++i) {
+    BasicBlock *TargetBlock = i.getCaseSuccessor();
+    if (SwitchEdges.lookup(TargetBlock) == 1) {
+      PredicateSwitch *PS = new PredicateSwitch(
+          Op, SI->getParent(), TargetBlock, i.getCaseValue(), SI);
+      addInfoFor(OpsToRename, Op, PS);
+      if (!TargetBlock->getSinglePredecessor())
----------------
range for?


https://reviews.llvm.org/D29747





More information about the llvm-commits mailing list