[PATCH] D55102: [MachineLICM][X86][AMDGPU] Fix subtle bug in the updating of PhysRegClobbers in post-RA LICM

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 29 18:41:08 PST 2018


craig.topper created this revision.
craig.topper added reviewers: arsenm, efriedma, MatzeB.
Herald added subscribers: jfb, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.

It looks like MCRegAliasIterator can visit the same physical register twice. When this happens in this code in LICM we end up setting the PhysRegDef and then later in the same loop visit the register again. Now we see that PhysRegDef is set from the earlier iteration so now set PhysRegClobber.

This patch splits the loop so we have one that uses the previous value of PhysRegDef to update PhysRegClobber and second loop that updates PhysRegDef.

The X86 atomic test is an improvement. I had to add sideeffect to the two shrink wrapping tests to prevent hoisting from occurring. I'm not sure about the AMDGPU tests. It looks like the branch instruction changed at end the of the loops. And in the branch-relaxation test I think there is now "and vcc, exec, -1" instruction that wasn't there before.


https://reviews.llvm.org/D55102

Files:
  lib/CodeGen/MachineLICM.cpp
  test/CodeGen/AMDGPU/branch-relaxation.ll
  test/CodeGen/AMDGPU/infinite-loop.ll
  test/CodeGen/X86/atomic_mi.ll
  test/CodeGen/X86/x86-shrink-wrapping.ll
  test/CodeGen/X86/x86-win64-shrink-wrapping.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55102.176024.patch
Type: text/x-patch
Size: 6414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181130/b4a07797/attachment.bin>


More information about the llvm-commits mailing list