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