[PATCH] D18066: Add some shortcuts in Value Propagation for alloca

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 17:42:25 PDT 2016


reames requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: lib/Analysis/LazyValueInfo.cpp:1381
@@ +1380,3 @@
+static bool isKnownNonConstant(Value *V) {
+  BitCastInst *CastInst;
+  if (isa<AllocaInst>(V) || ((CastInst = dyn_cast<BitCastInst>(V)) &&
----------------
Use stripPointerCasts

================
Comment at: lib/Analysis/LazyValueInfo.cpp:1390
@@ -1381,1 +1389,3 @@
                                      Instruction *CxtI) {
+  if (isKnownNonConstant(V))
+    return nullptr;
----------------
This bail is reasonable.  Needs commented and code cleanup, but otherwise ready to go in.  (I am purposely *not* saying LGTM yet.)

================
Comment at: lib/Analysis/LazyValueInfo.cpp:1512
@@ +1511,3 @@
+    return true;
+  if (isa<GetElementPtrInst>(V) ||
+      ((CastInst = dyn_cast<BitCastInst>(V)) &&
----------------
This check is wrong.  Just use ValueTracking

================
Comment at: lib/Analysis/LazyValueInfo.cpp:1523
@@ +1522,3 @@
+  PointerType *Type;
+  if ((Type = dyn_cast<PointerType>(V->getType())) &&
+      (C == ConstantPointerNull::get(Type)) && isKnownNonNull(V)) {
----------------
if (V->getType()->isPointerTy() &&
 C->isNullValue() && isKnownNonNull(V))

Use isKnownNonNull from ValueTracking.  

Comment why this is here.  In particular, this is only a fastpath, falling through would be correct.


Repository:
  rL LLVM

http://reviews.llvm.org/D18066





More information about the llvm-commits mailing list