Open RKSimon opened 10 months ago
@llvm/issue-subscribers-backend-x86
Author: Simon Pilgrim (RKSimon)
It's the same as https://github.com/llvm/llvm-project/issues/42534. COPY
instruction is in the unreachable basic block:
# *** IR Dump Before X86 EFLAGS copy lowering (x86-flags-copy-lowering) ***:
# Machine code for function func: IsSSA, TracksLiveness
bb.0.entry:
successors: %bb.5(0x80000000); %bb.5(100.00%)
JMP_1 %bb.5
bb.6.bb5:
successors: %bb.5(0x80000000), %bb.2(0x00000000); %bb.5(100.00%), %bb.2(0.00%)
%0:gr8 = MOV8ri 1
TEST8rr %0:gr8, %0:gr8, implicit-def $eflags
JCC_1 %bb.5, 5, implicit $eflags
JMP_1 %bb.2
bb.2.bb7:
; predecessors: %bb.6
successors: %bb.3(0x80000000); %bb.3(100.00%)
bb.3.bb8:
; predecessors: %bb.2, %bb.3
successors: %bb.3(0x80000000), %bb.4(0x00000000); %bb.3(100.00%), %bb.4(0.00%)
%1:gr32 = MOV32r0 implicit-def dead $eflags
%2:gr64 = SUBREG_TO_REG 0, killed %1:gr32, %subreg.sub_32bit
CMP64rm %2:gr64, $noreg, 1, $noreg, 0, $noreg, implicit-def $eflags :: (load (s64) from `ptr null`, align 4)
%4:gr64 = MOV32ri64 1
%5:gr64 = SBB64rm %4:gr64(tied-def 0), $noreg, 1, $noreg, 8, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64) from `ptr null` + 8, align 4)
%6:gr64 = COPY $eflags
%7:gr8 = SETCCr 12, implicit $eflags
%8:gr32 = MOVZX32rr8 killed %7:gr8
%9:gr64 = SUBREG_TO_REG 0, killed %8:gr32, %subreg.sub_32bit
%10:gr64 = NEG64r %9:gr64(tied-def 0), implicit-def dead $eflags
%11:gr64 = SHL64ri %10:gr64(tied-def 0), 4, implicit-def dead $eflags
$eflags = COPY %6:gr64
%12:gr64 = IMPLICIT_DEF
MOV64mr killed %12:gr64, 1, $noreg, 0, $noreg, killed %11:gr64 :: (store (s64) into `ptr undef`)
JCC_1 %bb.3, 12, implicit $eflags
JMP_1 %bb.4
bb.4.BB2:
; predecessors: %bb.3
bb.5.overflow:
; predecessors: %bb.6, %bb.0
RET 0
However I can't reproduce https://github.com/llvm/llvm-project/issues/42534 since llc 17.0.1
, as there is no COPY $eflags
instruction anymore: https://godbolt.org/z/Yjxo9s3as
Reduced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64822
llc -mtriple=x86_64--