[PATCH] D83365: [PowerPC] start and end may exist in different block before

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 20:03:21 PDT 2020


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

In `fixupIsDeadOrKill`, we assume `StartMI` and `EndMI` not exist in same basic block, so we add an assertion in that function.This is right after RA.

We extend this assumption to before RA in https://reviews.llvm.org/D81723. This is not right, as before RA the true definition may exist in another block through copy like instructions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83365

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


Index: llvm/test/CodeGen/PowerPC/fixup-kill-dead-flag-crash.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/fixup-kill-dead-flag-crash.mir
@@ -0,0 +1,21 @@
+# RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs -start-before ppc-mi-peepholes \
+# RUN:   -stop-after ppc-mi-peepholes %s -o - | FileCheck %s
+
+---
+name: test
+#CHECK : name : test
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+    liveins: $x3
+    %0:g8rc = COPY $x3
+    %1:gprc = COPY %0.sub_32:g8rc
+    %2:g8rc = LI8 63
+
+  bb.1:
+    %3:gprc = COPY %2.sub_32:g8rc
+    ; CHECK: %4:gprc = LI 0
+    %4:gprc = XORI killed %3:gprc, 63
+    STW killed %4:gprc, %4:gprc, 100
+    BLR8 implicit $lr8, implicit $rm
+...
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -2655,10 +2655,9 @@
 
 void PPCInstrInfo::fixupIsDeadOrKill(MachineInstr &StartMI, MachineInstr &EndMI,
                                      unsigned RegNo) const {
-
-  // Instructions between [StartMI, EndMI] should be in same basic block.
-  assert((StartMI.getParent() == EndMI.getParent()) &&
-         "Instructions are not in same basic block");
+  // FIXME: fix up kill/dead flag crossing basic blocks.
+  if (StartMI.getParent() != EndMI.getParent())
+    return;
 
   bool IsKillSet = false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83365.276304.patch
Type: text/x-patch
Size: 1490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200708/bf01d2df/attachment.bin>


More information about the llvm-commits mailing list