summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPC32ISelSimple.cpp
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
commit74a806cd3dc7ba2d64705b91b40616ca53925924 (patch)
tree84b6fb83ba7ace03893ffc273eb5046569b18c1d /lib/Target/PowerPC/PPC32ISelSimple.cpp
parentc96bb817aa6a1539b4ea4e167ef994058345d8a5 (diff)
downloadllvm-74a806cd3dc7ba2d64705b91b40616ca53925924.tar.gz
llvm-74a806cd3dc7ba2d64705b91b40616ca53925924.tar.bz2
llvm-74a806cd3dc7ba2d64705b91b40616ca53925924.tar.xz
Fix a case where constantexprs could leak into the PPC isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPC32ISelSimple.cpp')
-rw-r--r--lib/Target/PowerPC/PPC32ISelSimple.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 8fd947f116..96067f600f 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/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