Author: resistor
Date: Mon Jul 16 18:34:39 2007
New Revision: 39945

URL: http://llvm.org/viewvc/llvm-project?rev=39945&view=rev
Log:
Take advantage of undefined behavior if the source program tries to GEP
beyond the end of an alloca to make FastDSE faster and more aggressive.

Modified:
    llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp?rev=39945&r1=39944&r2=39945&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp Mon Jul 16 18:34:39 2007
@@ -61,17 +61,10 @@
       
       // See through pointer-to-pointer bitcasts
       while (isa<BitCastInst>(v) || isa<GetElementPtrInst>(v))
-        if (BitCastInst* C = dyn_cast<BitCastInst>(v)) {
-          if (isa<PointerType>(C->getSrcTy()))
-            v = C->getOperand(0);
-          else
-            break;
-        } else if (GetElementPtrInst* G = dyn_cast<GetElementPtrInst>(v)) {
-          if (G->hasAllZeroIndices())
-            v = G->getOperand(0);
-          else
-            break;
-        }
+        if (BitCastInst* C = dyn_cast<BitCastInst>(v))
+          v = C->getOperand(0);
+        else if (GetElementPtrInst* G = dyn_cast<GetElementPtrInst>(v))
+          v = G->getOperand(0);
     }
 
     // getAnalysisUsage - We require post dominance frontiers (aka Control


_______________________________________________
llvm-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to