[PATCH] D148187: [GISel] Legalize G_FSUB to G_FADD + G_FNEG even if G_FNEG is illegal
Sergei Barannikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 12 18:42:56 PDT 2023
barannikov88 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
barannikov88 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`G_FNEG` used to be legalized to `G_FSUB -0, x` causing infinite loop.
This is no longer the case after D84287 <https://reviews.llvm.org/D84287>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148187
Files:
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
Index: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -3333,10 +3333,6 @@
LLT Ty = MRI.getType(Res);
// Lower (G_FSUB LHS, RHS) to (G_FADD LHS, (G_FNEG RHS)).
- // First, check if G_FNEG is marked as Lower. If so, we may
- // end up with an infinite loop as G_FSUB is used to legalize G_FNEG.
- if (LI.getAction({G_FNEG, {Ty}}).Action == Lower)
- return UnableToLegalize;
auto Neg = MIRBuilder.buildFNeg(Ty, RHS);
if (MI.getOpcode() == TargetOpcode::G_STRICT_FSUB)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148187.513037.patch
Type: text/x-patch
Size: 679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/c6a4fab7/attachment.bin>
More information about the llvm-commits
mailing list