[PATCH] D55996: [PowerPC] Fix CR Bit spill pseudo expansion

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 21 04:17:57 PST 2018


nemanjai created this revision.
nemanjai added reviewers: hfinkel, uweigand, jsji.
Herald added subscribers: kbarton, qcolombet.

A client that uses LLVM for a very large code base has reported an issue where a spill of a CR bit causes a copy into another CR bit in the same CR field to be deleted as it appears to be dead.

The situation is illustrated in the MIR test case attached to this patch, but in a nutshell is the following:

  1: $cr5lt = <some defining instr>
  2: $cr5gt = COPY $cr1eq
  3: SPILL_CRBIT $cr5lt
  4: $cr1 = <some cr-field defining instr>
  5: SPILL_CRBIT $cr5gt
  ...

In the current implementation, the COPY at `2` will be deleted since:

- The source of the copy cannot be forwarded to the spill at `5`
- It is clobbered by the spill (due to the addition of the KILL instrucntion)

This patch just ensures this no longer happens by not emitting the KILL instruction and achieving what was presumably the purpose of that instruction by:

- Making the CR field that contains the bit being spilled an `undef` use
- Retaining the kill flag on the spilled bit through an implicit use


Repository:
  rL LLVM

https://reviews.llvm.org/D55996

Files:
  lib/Target/PowerPC/PPCRegisterInfo.cpp
  test/CodeGen/PowerPC/NoCRFieldRedefWhenSpillingCRBIT.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55996.179266.patch
Type: text/x-patch
Size: 6747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181221/0f44d847/attachment.bin>


More information about the llvm-commits mailing list