[llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp
Chris Lattner
sabre at nondot.org
Sun Jan 14 17:55:55 PST 2007
Changes in directory llvm/lib/Transforms:
ExprTypeConvert.cpp updated: 1.119 -> 1.120
---
Log message:
Eliminate calls to isInteger, generalizing code and tightening checks as needed.
---
Diffs of the changes: (+7 -8)
ExprTypeConvert.cpp | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
Index: llvm/lib/Transforms/ExprTypeConvert.cpp
diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.119 llvm/lib/Transforms/ExprTypeConvert.cpp:1.120
--- llvm/lib/Transforms/ExprTypeConvert.cpp:1.119 Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/ExprTypeConvert.cpp Sun Jan 14 19:55:30 2007
@@ -69,19 +69,19 @@
case Instruction::Add:
case Instruction::Sub:
- if (!Ty->isInteger() && !Ty->isFloatingPoint()) return false;
+ if (!Ty->isIntegral() && !Ty->isFloatingPoint()) return false;
if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD) ||
!ExpressionConvertibleToType(I->getOperand(1), Ty, CTMap, TD))
return false;
break;
case Instruction::LShr:
case Instruction::AShr:
- if (!Ty->isInteger()) return false;
+ if (!Ty->isIntegral()) return false;
if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD))
return false;
break;
case Instruction::Shl:
- if (!Ty->isInteger()) return false;
+ if (!Ty->isIntegral()) return false;
if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD))
return false;
break;
@@ -458,7 +458,7 @@
case Instruction::Add:
case Instruction::Sub: {
- if (!Ty->isInteger() && !Ty->isFloatingPoint()) return false;
+ if (!Ty->isIntegral() && !Ty->isFloatingPoint()) return false;
Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
return ValueConvertibleToType(I, Ty, CTMap, TD) &&
@@ -476,7 +476,7 @@
case Instruction::AShr:
case Instruction::Shl:
if (I->getOperand(1) == V) return false; // Cannot change shift amount type
- if (!Ty->isInteger()) return false;
+ if (!Ty->isIntegral()) return false;
return ValueConvertibleToType(I, Ty, CTMap, TD);
case Instruction::Free:
@@ -634,8 +634,7 @@
// arguments if possible.
//
for (unsigned i = 0, NA = FTy->getNumParams(); i < NA; ++i)
- if (!FTy->getParamType(i)->canLosslesslyBitCastTo(
- I->getOperand(i+1)->getType()))
+ if (FTy->getParamType(i) != I->getOperand(i+1)->getType())
return false; // Operands must have compatible types!
// Okay, at this point, we know that all of the arguments can be
@@ -655,7 +654,7 @@
// If we get this far, we know the value is in the varargs section of the
// function! We can convert if we don't reinterpret the value...
//
- return Ty->canLosslesslyBitCastTo(V->getType());
+ return isa<PointerType>(Ty) && isa<PointerType>(V->getType());
}
}
return false;
More information about the llvm-commits
mailing list