summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-27 01:33:51 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-27 01:33:51 +0000
commit73beaf7bbc5a4344c9c68b1c262c11c33d3cf72d (patch)
tree296bbd7c4cb891529fa1057330b0991fa61fc0b2 /llvm/lib/Transforms
parent04b78e9f2063d3592a7ac6be4b7f9c6e770f9107 (diff)
downloadbcm5719-llvm-73beaf7bbc5a4344c9c68b1c262c11c33d3cf72d.tar.gz
bcm5719-llvm-73beaf7bbc5a4344c9c68b1c262c11c33d3cf72d.zip
It is not safe to sink an alloca into a stacksave/stackrestore pair, so don't do that. <rdar://problem/10352360>
llvm-svn: 143093
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 75fa011a14b..874a135110d 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1680,11 +1680,12 @@ void IndVarSimplify::SinkUnusedInvariants(Loop *L) {
if (isa<LandingPadInst>(I))
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;
+ // Don't sink alloca: we never want to sink static alloca's out of the
+ // entry block, and correctly sinking dynamic alloca's requires
+ // checks for stacksave/stackrestore intrinsics.
+ // FIXME: Refactor this check somehow?
+ if (isa<AllocaInst>(I))
+ continue;
// Determine if there is a use in or before the loop (direct or
// otherwise).
OpenPOWER on IntegriCloud