summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-10-03 01:27:49 +0000
committerDan Gohman <gohman@apple.com>2008-10-03 01:27:49 +0000
commitb01a9c94d4a8264f26aad8a0e3783bdf083a0558 (patch)
tree8b87d798a9d0e23f259ae27b7a3485db8baca719 /llvm/lib/Target
parent4893c9a78eeb086e5111888a7c1e4ee9b903942f (diff)
downloadbcm5719-llvm-b01a9c94d4a8264f26aad8a0e3783bdf083a0558.tar.gz
bcm5719-llvm-b01a9c94d4a8264f26aad8a0e3783bdf083a0558.zip
Fix X86FastISel to handle dynamic allocas that have avoided
getting inserted into the ValueMap. This avoids infinite recursion in some rare cases. llvm-svn: 56989
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86FastISel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp
index 68d0d85501e..ed4168e262a 100644
--- a/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/llvm/lib/Target/X86/X86FastISel.cpp
@@ -1365,6 +1365,16 @@ unsigned X86FastISel::TargetMaterializeConstant(Constant *C) {
}
unsigned X86FastISel::TargetMaterializeAlloca(AllocaInst *C) {
+ // Fail on dynamic allocas. At this point, getRegForValue has already
+ // checked its CSE maps, so if we're here trying to handle a dynamic
+ // alloca, we're not going to succeed. X86SelectAddress has a
+ // check for dynamic allocas, because it's called directly from
+ // various places, but TargetMaterializeAlloca also needs a check
+ // in order to avoid recursion between getRegForValue,
+ // X86SelectAddrss, and TargetMaterializeAlloca.
+ if (!StaticAllocaMap.count(C))
+ return 0;
+
X86AddressMode AM;
if (!X86SelectAddress(C, AM, false))
return 0;
OpenPOWER on IntegriCloud