[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner sabre at nondot.org
Sat Jan 6 11:53:47 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.584 -> 1.585
---
Log message:

Fix regressions in InstCombine/call-cast-target.ll and InstCombine/2003-11-13-ConstExprCastCall.ll


---
Diffs of the changes:  (+5 -1)

 InstructionCombining.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.584 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.585
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.584	Fri Jan  5 20:11:56 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sat Jan  6 13:53:32 2007
@@ -7208,7 +7208,10 @@
   // Check to see if we are changing the return type...
   if (OldRetTy != FT->getReturnType()) {
     if (Callee->isExternal() && !Caller->use_empty() && 
-        OldRetTy != FT->getReturnType())
+        OldRetTy != FT->getReturnType() &&
+        // Conversion is ok if changing from pointer to int of same size.
+        !(isa<PointerType>(FT->getReturnType()) &&
+          TD->getIntPtrType() == OldRetTy))
       return false;   // Cannot transform this return value.
 
     // If the callsite is an invoke instruction, and the return value is used by
@@ -7235,6 +7238,7 @@
     ConstantInt *c = dyn_cast<ConstantInt>(*AI);
     //Either we can cast directly, or we can upconvert the argument
     bool isConvertible = ActTy == ParamTy ||
+      (isa<PointerType>(ParamTy) && isa<PointerType>(ActTy)) ||
       (ParamTy->isIntegral() && ActTy->isIntegral() &&
        ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize()) ||
       (c && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize() &&






More information about the llvm-commits mailing list