[PATCH] D22269: [SCCP] Replace structs with constants if all the lattice values are constant

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 19:14:23 PDT 2016


reames added a subscriber: reames.
reames added a comment.

Minor post commit style comments.  The patch title caught my eye so I took a quick read through.


================
Comment at: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp:1572
@@ +1571,3 @@
+                                  ? V.getConstant()
+                                  : UndefValue::get(ST->getElementType(i)));
+        }
----------------
Why must it be that any non-constant must be undef?  I suspect this is either a well known invariant in the code (with which I'm unfamiliar), or a possibly missing assert.

================
Comment at: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp:1580
@@ -1555,3 +1579,3 @@
 
-      Constant *Const = IV.isConstant()
-        ? IV.getConstant() : UndefValue::get(Inst->getType());
+        Const = IV.isConstant() ? IV.getConstant()
+                                : UndefValue::get(Inst->getType());
----------------
Is there a helper function which could common out this shared code?


Repository:
  rL LLVM

https://reviews.llvm.org/D22269





More information about the llvm-commits mailing list