[PATCH] D144336: [GlobalISel] Fix DIVREM combine from inserting a divrem before its operands' defs.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 18 14:26:10 PST 2023


aemerson created this revision.
aemerson added reviewers: arsenm, cdevadas, paquette.
aemerson added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
aemerson requested review of this revision.
Herald added a subscriber: wdng.

In some rare corner cases where in between the div/rem pair there's a def of
the second instruction's source (but a different vreg due to the combine's
eqivalence checks), it will place the DIVREM at the first instruction's point,
causing a use-before-def. There wasn't an obvious fix that stood out to me
without doing more involved analysis than a combine should really be doing.

Fixes issue #60516

I'm open to new suggestions on how to approach this, as I'm not too happy
at bailing out here. It's not the first time we run into issues with value liveness
that the DAG world isn't affected by.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144336

Files:
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-divrem-insertpt-conflict.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144336.498632.patch
Type: text/x-patch
Size: 7085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230218/8875bd6d/attachment.bin>


More information about the llvm-commits mailing list