summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-11 07:34:50 +0000
committerChris Lattner <sabre@nondot.org>2004-08-11 07:34:50 +0000
commit6f0291792e3994dfad9d548cbe1e32ee4a7bc948 (patch)
treea1cb37ff432a6c5b156a97bdad3b5ce9df71fbb4 /llvm/lib/Target/PowerPC
parenteb34c59930791e6a7f173367dc5d2410ac2daed0 (diff)
downloadbcm5719-llvm-6f0291792e3994dfad9d548cbe1e32ee4a7bc948.tar.gz
bcm5719-llvm-6f0291792e3994dfad9d548cbe1e32ee4a7bc948.zip
Fix a case where constantexprs could leak into the PPC isel.
llvm-svn: 15661
Diffstat (limited to 'llvm/lib/Target/PowerPC')
-rw-r--r--llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 8fd947f1162..96067f600ff 100644
--- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -1260,7 +1260,10 @@ void ISel::promote32(unsigned targetReg, const ValueRecord &VR) {
if (Val) {
if (Constant *C = dyn_cast<Constant>(Val)) {
Val = ConstantExpr::getCast(C, Type::IntTy);
- Ty = Type::IntTy;
+ if (isa<ConstantExpr>(Val)) // Could not fold
+ Val = C;
+ else
+ Ty = Type::IntTy; // Folded!
}
// If this is a simple constant, just emit a load directly to avoid the copy
OpenPOWER on IntegriCloud