summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-06 19:53:32 +0000
committerChris Lattner <sabre@nondot.org>2007-01-06 19:53:32 +0000
commit7051d758debeb7f7b96005f6b816b079ab4095cc (patch)
tree81224aa17b412caad6f11b987bb1c71b2341afad /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parentbb162f48ba071b6691e9149e3ea6dfd0e79f1960 (diff)
downloadbcm5719-llvm-7051d758debeb7f7b96005f6b816b079ab4095cc.tar.gz
bcm5719-llvm-7051d758debeb7f7b96005f6b816b079ab4095cc.zip
Fix regressions in InstCombine/call-cast-target.ll and InstCombine/2003-11-13-ConstExprCastCall.ll
llvm-svn: 32959
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 9bdf0d8d383..66fbe1482d9 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7208,7 +7208,10 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// 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 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
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() &&
OpenPOWER on IntegriCloud