From 74a806cd3dc7ba2d64705b91b40616ca53925924 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 11 Aug 2004 07:34:50 +0000 Subject: [PATCH] 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 --- lib/Target/PowerPC/PPC32ISelSimple.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp index 8fd947f1162..96067f600ff 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(Val)) { Val = ConstantExpr::getCast(C, Type::IntTy); - Ty = Type::IntTy; + if (isa(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