aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-01 15:38:23 +0000
committerChris Lattner <sabre@nondot.org>2002-05-01 15:38:23 +0000
commit68d024dde4b88830e94e6807aa277116b90ddae7 (patch)
treed8993fe4755b5ecfd74567668296b3a976e07d0d
parent5061263285a53e97d7573675ef854f20b29020c4 (diff)
Fixed bug: test/Regression/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2423 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index ee8300215f..294c39a08f 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -79,6 +79,9 @@ static inline bool isSafeAlloca(const AllocaInst *AI) {
// Only allow nonindexed memory access instructions...
if (MemAccessInst *MAI = dyn_cast<MemAccessInst>(*UI)) {
+ if (MAI->getPointerOperand() != (Value*)AI)
+ return false; // Reject stores of alloca pointer into some other loc.
+
if (MAI->hasIndices()) { // indexed?
// Allow the access if there is only one index and the index is
// zero.