[llvm] [CodeGen] Tail Duplication: Remove irrelevant phi node workaround (PR #86981)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 22 07:22:54 PDT 2024
https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/86981
>From 66737d97da3411681fbcc80fc8e6b657c318b851 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Mon, 22 Apr 2024 10:21:53 -0400
Subject: [PATCH 1/2] Pre-commit edit affected test (NFC)
---
llvm/test/CodeGen/Hexagon/tail-dup-subreg-abort.ll | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/llvm/test/CodeGen/Hexagon/tail-dup-subreg-abort.ll b/llvm/test/CodeGen/Hexagon/tail-dup-subreg-abort.ll
index 82dae2cc586a51..e9284c0ec5233b 100644
--- a/llvm/test/CodeGen/Hexagon/tail-dup-subreg-abort.ll
+++ b/llvm/test/CodeGen/Hexagon/tail-dup-subreg-abort.ll
@@ -1,5 +1,5 @@
-; RUN: llc -march=hexagon -O2 -disable-cgp < %s
-; REQUIRES: asserts
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc -march=hexagon -O2 -disable-cgp < %s | FileCheck %s
;
; Tail duplication can ignore subregister information on PHI nodes, and as
; a result, generate COPY instructions between registers of different classes.
@@ -7,6 +7,12 @@
; src/dst combination.
;
define i32 @foo(i32 %x, i64 %y) nounwind {
+; CHECK-LABEL: foo:
+; CHECK: // %bb.0: // %entry
+; CHECK-NEXT: {
+; CHECK-NEXT: r1:0 = combine(r3,r2)
+; CHECK-NEXT: jumpr r31
+; CHECK-NEXT: }
entry:
%a = icmp slt i32 %x, 0
%lo = trunc i64 %y to i32
>From be6f67622f64c824e96064c7cfbc34ba3f7309d6 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Thu, 28 Mar 2024 13:00:29 -0400
Subject: [PATCH 2/2] [CodeGen] Tail Duplication: Remove irrelevant phi node
workaround
The comment is quite old, and removing it and then running the old test, it passed without asserting.
---
llvm/lib/CodeGen/TailDuplicator.cpp | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp
index f5dd21cb927012..2d5549a22cdbec 100644
--- a/llvm/lib/CodeGen/TailDuplicator.cpp
+++ b/llvm/lib/CodeGen/TailDuplicator.cpp
@@ -669,27 +669,6 @@ bool TailDuplicator::shouldTailDuplicate(bool IsSimple,
return false;
}
- // Check if any of the successors of TailBB has a PHI node in which the
- // value corresponding to TailBB uses a subregister.
- // If a phi node uses a register paired with a subregister, the actual
- // "value type" of the phi may differ from the type of the register without
- // any subregisters. Due to a bug, tail duplication may add a new operand
- // without a necessary subregister, producing an invalid code. This is
- // demonstrated by test/CodeGen/Hexagon/tail-dup-subreg-abort.ll.
- // Disable tail duplication for this case for now, until the problem is
- // fixed.
- for (auto *SB : TailBB.successors()) {
- for (auto &I : *SB) {
- if (!I.isPHI())
- break;
- unsigned Idx = getPHISrcRegOpIdx(&I, &TailBB);
- assert(Idx != 0);
- MachineOperand &PU = I.getOperand(Idx);
- if (PU.getSubReg() != 0)
- return false;
- }
- }
-
if (HasIndirectbr && PreRegAlloc)
return true;
More information about the llvm-commits
mailing list