summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/Sink.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-03-21 15:51:51 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-03-21 15:51:51 +0000
commitedfd81d9656217cc9d14d7854b401bb3d5d559f7 (patch)
treefcc328690303b62c195383763400fe18cee8562a /llvm/lib/Transforms/Scalar/Sink.cpp
parent13985964f449256a45eb83941ea2c2b622b27387 (diff)
downloadbcm5719-llvm-edfd81d9656217cc9d14d7854b401bb3d5d559f7.tar.gz
bcm5719-llvm-edfd81d9656217cc9d14d7854b401bb3d5d559f7.zip
Sink: Don't sink static allocas from the entry block
CodeGen treats allocas outside the entry block as dynamically sized stack objects. llvm-svn: 204473
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Sink.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/Sink.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/Sink.cpp b/llvm/lib/Transforms/Scalar/Sink.cpp
index 5e1e4564bba..41073749abc 100644
--- a/llvm/lib/Transforms/Scalar/Sink.cpp
+++ b/llvm/lib/Transforms/Scalar/Sink.cpp
@@ -216,6 +216,13 @@ bool Sinking::IsAcceptableTarget(Instruction *Inst,
/// instruction out of its current block into a successor.
bool Sinking::SinkInstruction(Instruction *Inst,
SmallPtrSet<Instruction *, 8> &Stores) {
+
+ // Don't sink static alloca instructions. CodeGen assumes allocas outside the
+ // entry block are dynamically sized stack objects.
+ if (AllocaInst *AI = dyn_cast<AllocaInst>(Inst))
+ if (AI->isStaticAlloca())
+ return false;
+
// Check if it's safe to move the instruction.
if (!isSafeToMove(Inst, AA, Stores))
return false;
OpenPOWER on IntegriCloud