[PATCH] D144045: [InstCombine] avoid sinking fdiv into a loop
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 14 14:06:31 PST 2023
spatel created this revision.
spatel added reviewers: craig.topper, sdesmalen, david-arm, nikic, efriedma.
Herald added subscribers: ormris, StephenFan, asbirlea, steven_wu, zzheng, hiraditya, mcrosier.
Herald added a project: All.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This an alternate to D87479 <https://reviews.llvm.org/D87479> that uses LoopInfo to more precisely target the problematic transform.
Allowing the transform early in the optimization pipeline (because there may not be any LoopInfo yet) doesn't seem like a bad thing, so I added a test comment about that. That potentially lets reassociation and other passes see a better optimization. But we want to avoid the sinking later because it conflicts with LICM.
As discussed in D143631 <https://reviews.llvm.org/D143631>, there's a larger issue between reassociation/combining/LICM because this doesn't solve a more general problem that we can show in an example with no fdivs:
https://godbolt.org/z/xrs9xfGrf
...but this does manage to avoid the problem in the motivating test for D143631 <https://reviews.llvm.org/D143631>.
https://reviews.llvm.org/D144045
Files:
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/fmul.ll
llvm/test/Transforms/PhaseOrdering/X86/vdiv-nounroll.ll
llvm/test/Transforms/PhaseOrdering/lto-licm.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144045.497429.patch
Type: text/x-patch
Size: 6094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230214/82aa0cf5/attachment.bin>
More information about the llvm-commits
mailing list