[PATCH] D85659: [PowerPC] before RA, get def instructions by calling getVRegDef

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 09:06:47 PDT 2020


shchenz created this revision.
shchenz added reviewers: jsji, nemanjai, steven.zhang, PowerPC.
Herald added subscribers: llvm-commits, wuzish, kbarton, hiraditya.
Herald added a project: LLVM.
shchenz requested review of this revision.

This fixes https://bugs.llvm.org/show_bug.cgi?id=47041

  %1:gprc_and_gprc_nor0 = LI 0        ------>DefMI
  %2:gprc = COPY %1:gprc_and_gprc_nor0
  %3:gprc = ORI killed %2:gprc, 1      ------>MI

`%3:gprc` can be simplified to `LI 1`, so killed flag for `%2:gprc` should be hoisted up to other use or to def.
Because we set `StartMI` as `DefMI` which is through `COPY` like instructions before RA, so `StartMI` is `%1:gprc_and_gprc_nor0` instead of `%2:gprc`, then when we fixup killed/dead flag for `%2:gprc`, we get `%2:gprc` redefine asserts.

This patch fixes this assertion, before RA, get real definition by calling `getVRegDef` instead of using `StartMI`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85659

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/lib/Target/PowerPC/PPCInstrInfo.h
  llvm/test/CodeGen/PowerPC/fixup-kill-dead-flag-crash.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85659.284396.patch
Type: text/x-patch
Size: 6805 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200810/53de84fc/attachment.bin>


More information about the llvm-commits mailing list