1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

mplement a theoretical fixme.

llvm-svn: 93024
This commit is contained in:
Chris Lattner 2010-01-08 19:28:47 +00:00
parent 474cd30fb7
commit fd117b63f7

View File

@ -476,9 +476,13 @@ static unsigned CanEvaluateSExtd(Value *V, const Type *Ty,
/// insert the code to evaluate the expression.
Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type *Ty,
bool isSigned) {
// FIXME: use libanalysis constant folding.
if (Constant *C = dyn_cast<Constant>(V))
return ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/);
if (Constant *C = dyn_cast<Constant>(V)) {
C = ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/);
// If we got a constantexpr back, try to simplify it with TD info.
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
C = ConstantFoldConstantExpression(CE, TD);
return C;
}
// Otherwise, it must be an instruction.
Instruction *I = cast<Instruction>(V);