mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-08 00:01:37 +00:00
just eliminate the uitofp checks. This code isn't doing
the required validity checks in the first place, and supporting a condition large enough to require the 32'nd bit isn't worth it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100280 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cf9abd210d
commit
a40e4a0c8a
@ -623,21 +623,6 @@ void IndVarSimplify::SinkUnusedInvariants(Loop *L) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true if it is OK to use SIToFPInst for an induction variable
|
|
||||||
/// with given initial and exit values.
|
|
||||||
static bool CanUseSIToFP(ConstantFP *InitV, ConstantFP *ExitV,
|
|
||||||
uint64_t intIV, uint64_t intEV) {
|
|
||||||
|
|
||||||
if (InitV->getValueAPF().isNegative() || ExitV->getValueAPF().isNegative())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// If the iteration range can be handled by SIToFPInst then use it.
|
|
||||||
if (abs64(intEV - intIV) < INT32_MAX)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// convertToInt - Convert APF to an integer, if possible.
|
/// convertToInt - Convert APF to an integer, if possible.
|
||||||
static bool convertToInt(const APFloat &APF, uint64_t &intVal) {
|
static bool convertToInt(const APFloat &APF, uint64_t &intVal) {
|
||||||
bool isExact = false;
|
bool isExact = false;
|
||||||
@ -720,9 +705,9 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PN) {
|
|||||||
case CmpInst::FCMP_OEQ:
|
case CmpInst::FCMP_OEQ:
|
||||||
case CmpInst::FCMP_UEQ: NewPred = CmpInst::ICMP_EQ; break;
|
case CmpInst::FCMP_UEQ: NewPred = CmpInst::ICMP_EQ; break;
|
||||||
case CmpInst::FCMP_OGT:
|
case CmpInst::FCMP_OGT:
|
||||||
case CmpInst::FCMP_UGT: NewPred = CmpInst::ICMP_UGT; break;
|
case CmpInst::FCMP_UGT: NewPred = CmpInst::ICMP_SGT; break;
|
||||||
case CmpInst::FCMP_OGE:
|
case CmpInst::FCMP_OGE:
|
||||||
case CmpInst::FCMP_UGE: NewPred = CmpInst::ICMP_UGE; break;
|
case CmpInst::FCMP_UGE: NewPred = CmpInst::ICMP_SGE; break;
|
||||||
case CmpInst::FCMP_OLT:
|
case CmpInst::FCMP_OLT:
|
||||||
case CmpInst::FCMP_ULT: NewPred = CmpInst::ICMP_ULT; break;
|
case CmpInst::FCMP_ULT: NewPred = CmpInst::ICMP_ULT; break;
|
||||||
case CmpInst::FCMP_OLE:
|
case CmpInst::FCMP_OLE:
|
||||||
@ -767,15 +752,9 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PN) {
|
|||||||
// We give preference to sitofp over uitofp because it is faster on most
|
// We give preference to sitofp over uitofp because it is faster on most
|
||||||
// platforms.
|
// platforms.
|
||||||
if (WeakPH) {
|
if (WeakPH) {
|
||||||
if (CanUseSIToFP(InitValueVal, ExitValueVal, InitValue, ExitValue)) {
|
Value *Conv = new SIToFPInst(NewPHI, PN->getType(), "indvar.conv",
|
||||||
SIToFPInst *Conv = new SIToFPInst(NewPHI, PN->getType(), "indvar.conv",
|
PN->getParent()->getFirstNonPHI());
|
||||||
PN->getParent()->getFirstNonPHI());
|
PN->replaceAllUsesWith(Conv);
|
||||||
PN->replaceAllUsesWith(Conv);
|
|
||||||
} else {
|
|
||||||
UIToFPInst *Conv = new UIToFPInst(NewPHI, PN->getType(), "indvar.conv",
|
|
||||||
PN->getParent()->getFirstNonPHI());
|
|
||||||
PN->replaceAllUsesWith(Conv);
|
|
||||||
}
|
|
||||||
RecursivelyDeleteTriviallyDeadInstructions(PN);
|
RecursivelyDeleteTriviallyDeadInstructions(PN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user