[PATCH] D75435: [TargetLowering] Fix what look like copy/paste mistakes in compare with infinity handling SimplifySetCC.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 05:52:08 PST 2020
spatel added a comment.
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);
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75435/new/
https://reviews.llvm.org/D75435
More information about the llvm-commits
mailing list