Restructure code from r224097. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224133 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Steven Wu 2014-12-12 17:21:54 +00:00
parent 5dc8ac87f1
commit 00b3170e70

View File

@ -1269,19 +1269,19 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) {
// type of OpI doesn't enter into things at all. We simply evaluate // type of OpI doesn't enter into things at all. We simply evaluate
// in whichever source type is larger, then convert to the // in whichever source type is larger, then convert to the
// destination type. // destination type.
if (SrcWidth != OpWidth) { if (SrcWidth == OpWidth) {
if (LHSWidth < SrcWidth) break;
LHSOrig = Builder->CreateFPExt(LHSOrig, RHSOrig->getType()); }
else if (RHSWidth <= SrcWidth) if (LHSWidth < SrcWidth)
RHSOrig = Builder->CreateFPExt(RHSOrig, LHSOrig->getType()); LHSOrig = Builder->CreateFPExt(LHSOrig, RHSOrig->getType());
if (LHSOrig != OpI->getOperand(0) || RHSOrig != OpI->getOperand(1)) { else if (RHSWidth <= SrcWidth)
Value *ExactResult = Builder->CreateFRem(LHSOrig, RHSOrig); RHSOrig = Builder->CreateFPExt(RHSOrig, LHSOrig->getType());
if (Instruction *RI = dyn_cast<Instruction>(ExactResult)) if (LHSOrig != OpI->getOperand(0) || RHSOrig != OpI->getOperand(1)) {
RI->copyFastMathFlags(OpI); Value *ExactResult = Builder->CreateFRem(LHSOrig, RHSOrig);
return CastInst::CreateFPCast(ExactResult, CI.getType()); if (Instruction *RI = dyn_cast<Instruction>(ExactResult))
} RI->copyFastMathFlags(OpI);
return CastInst::CreateFPCast(ExactResult, CI.getType());
} }
break;
} }
// (fptrunc (fneg x)) -> (fneg (fptrunc x)) // (fptrunc (fneg x)) -> (fneg (fptrunc x))