[PATCH] D110603: [GlobalISel][IRTranslator] Emit trap intrinsic for unreachable
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 02:34:35 PDT 2021
uabelho added a comment.
Hi,
I think there is something broken after the relanding of this.
For my out-of-tree target I have a testcase where there exists a block that is unreachable from entry, but that is referenced in a PHI:
body: |
bb.0:
liveins: $a0h, $r0
%0:all(s16) = COPY $a0h
%1:all(s16) = COPY $r0
brr_uncond %bb.2
bb.1:
brr_uncond %bb.2
bb.2:
%2:all(s16) = G_PHI %0(s16), %bb.0, %1(s16), %bb.1
$a0h = COPY %2
So %bb.1 is dead, but jumps to %bb.2 so the G_PHI in %bb.2 references %bb.1
With this patch we get this result:
body: |
; Instruction count: 5
bb.0:
successors: %bb.2(0x80000000)
liveins: $a0h, $r0
%0:anh_rn = COPY $a0h
%1:anh_rn = COPY $r0
brr_uncond %bb.2
bb.2:
%2:anh_rn = PHI %0, %bb.0, %1, %bb.-1
$a0h = COPY %2
So %bb.1 is removed, but the PHI now looks broken because %bb.1 has been replace with %bb.-1 instead of the operand being removed completely.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110603/new/
https://reviews.llvm.org/D110603
More information about the llvm-commits
mailing list