I expect that the isCondCodeLegal checks should match that CC of
the node that we're going to create.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Looks like a good fix, but I think it would be better to use switch/case on these to reduce the duplication. Something like (make sure this matches the existing logic):
bool IsNegInf = CFP->getValueAPF().isNegative(); ISD::CondCode NewCond; switch (Cond) { // X == -Inf --> X <= -Inf or X == Inf --> X >= Inf case ISD::SETOEQ: NewCond = IsNegInf ? ISD::SETOLE : ISD::SETOGE; break; case ISD::SETUEQ: NewCond = IsNegInf ? ISD::SETULE : ISD::SETUGE; break; // X != -Inf --> X > -Inf or X != Inf --> X < Inf case ISD::SETONE: NewCond = IsNegInf ? ISD::SETOGT : ISD::SETOLT; break; case ISD::SETUNE: NewCond = IsNegInf ? ISD::SETUGT : ISD::SETULT; break; default: NewCond = ISD::SETCC_INVALID; break; } if (NewCond != ISD::SETCC_INVALID && isCondCodeLegal(NewCond, N0.getSimpleValueType())) return DAG.getSetCC(dl, VT, N0, N1, NewCond);