[PATCH] D75122: [SCCP] Go to overdef for undef constants. (WIP)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 08:07:47 PST 2020


fhahn created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75122

Files:
  llvm/lib/Transforms/Scalar/SCCP.cpp


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SCCP.cpp
+++ llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -436,7 +436,9 @@
 
     if (auto *C = dyn_cast<Constant>(V)) {
       // Undef values remain unknown.
-      if (!isa<UndefValue>(V))
+      if (isa<UndefValue>(V))
+        LV.markOverdefined();
+      else
         LV.markConstant(C);          // Constants are constant
     }
 
@@ -750,6 +752,10 @@
       continue;
 
     LatticeVal &Res = getValueState(&PN);
+    if (isa<UndefValue>(PN.getIncomingValue(i))) {
+      if (isConstant(Res))
+        continue;
+    }
     Changed |= Res.mergeIn(IV, DL);
     if (Res.isOverdefined())
       break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75122.246473.patch
Type: text/x-patch
Size: 745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200225/95ba26ae/attachment.bin>


More information about the llvm-commits mailing list