[PATCH] D10903: [LICM] Replace incoming values with undef if the incoming BB is unreachable

Chandler Carruth chandlerc at gmail.com
Fri Jul 10 23:35:03 PDT 2015


chandlerc added inline comments.

================
Comment at: lib/Transforms/Scalar/LICM.cpp:614-621
@@ -612,1 +613,10 @@
 
+    // Replace incoming values with undef if the incoming BB is unreachable.
+    Use &U = UI.getUse();
+    BasicBlock *BB = PN->getIncomingBlock(U);
+    if (!DT->isReachableFromEntry(BB)) {
+      // Replace the use with an undef value.
+      U = UndefValue::get(I.getType());
+      continue;
+    }
+
----------------
Why do this here rather than in InstSimplify? Do we form these too late for that to clean it up? If so, should we add it to InstSimplify and call that here?


http://reviews.llvm.org/D10903







More information about the llvm-commits mailing list