[llvm-branch-commits] [llvm-branch] r80551 - in /llvm/branches/release_26: lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/sink-alloca.ll

Tanya Lattner tonic at nondot.org
Sun Aug 30 23:28:24 PDT 2009


Author: tbrethou
Date: Mon Aug 31 01:28:24 2009
New Revision: 80551

URL: http://llvm.org/viewvc/llvm-project?rev=80551&view=rev
Log:
Merge from mainline.
Special-case static allocas in IndVarSimplify's loop invariant
sinking code, since they are special. If the loop preheader happens
to be the entry block of a function, don't sink static allocas
out of it. This fixes PR4775.

Added:
    llvm/branches/release_26/test/Transforms/IndVarSimplify/sink-alloca.ll
      - copied unchanged from r80010, llvm/trunk/test/Transforms/IndVarSimplify/sink-alloca.ll
Modified:
    llvm/branches/release_26/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/branches/release_26/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=80551&r1=80550&r2=80551&view=diff

==============================================================================
--- llvm/branches/release_26/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/branches/release_26/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Aug 31 01:28:24 2009
@@ -552,6 +552,11 @@
     // dominates the exit block.
     if (I->mayHaveSideEffects() || I->mayReadFromMemory())
       continue;
+    // Don't sink static AllocaInsts out of the entry block, which would
+    // turn them into dynamic allocas!
+    if (AllocaInst *AI = dyn_cast<AllocaInst>(I))
+      if (AI->isStaticAlloca())
+        continue;
     // Determine if there is a use in or before the loop (direct or
     // otherwise).
     bool UsedInLoop = false;





More information about the llvm-branch-commits mailing list