Skip to content

PEI clobbers live EFLAGS when using "probe-stack"="inline-asm" #49509

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 50165
Version trunk
OS Linux
Attachments positdiv32 LLVM IR
Reporter LLVM Bugzilla Contributor
CC @alex,@topperc,@cuviper,@RKSimon,@phoebewang,@rotateright

Extended Description

When building attached llvm IR the eflags used by
liveins: $edi, $eflags, $esi
renamable $r15b = SETCCr 8, implicit $eflags

are clobbered after prologue insertion:
$rsp = frame-setup SUB64ri8 $rsp(tied-def 0), 8, implicit-def dead $eflags
renamable $r15b = SETCCr 8, implicit $eflags

Before Prologue/Epilogue Insertion & Frame Finalization (prologepilog)

bb.4.bb16.i:
; predecessors: %bb.2
successors: %bb.8(0x40000000), %bb.5(0x40000000); %bb.8(50.00%), %bb.5(50.00%)
liveins: $edi, $eflags, $esi
renamable $r15b = SETCCr 8, implicit $eflags
TEST32rr renamable $esi, renamable $esi, implicit-def $eflags
renamable $r14b = SETCCr 8, implicit $eflags
renamable $edx = COPY renamable $edi, implicit-def $rdx
renamable $edx = NEG32r renamable $edx(tied-def 0), implicit-def $eflags, implicit killed $rdx, implicit-def $rdx
renamable $edx = CMOV32rr renamable $edx(tied-def 0), killed renamable $edi, 12, implicit $eflags, implicit killed $rdx, implicit-def $rdx
renamable $eax = COPY renamable $esi, implicit-def $rax
renamable $eax = NEG32r renamable $eax(tied-def 0), implicit-def $eflags, implicit killed $rax, implicit-def $rax
renamable $eax = CMOV32rr renamable $eax(tied-def 0), killed renamable $esi, 12, implicit $eflags, implicit killed $rax, implicit-def $rax
renamable $ecx = LEA64_32r $noreg, 4, renamable $rdx, 0, $noreg, implicit-def $rcx
TEST32ri renamable $edx, 1073741824, implicit-def $eflags, implicit killed $rdx
JCC_1 %bb.8, 4, implicit $eflags
JMP_1 %bb.5

After Prologue/Epilogue Insertion & Frame Finalization (prologepilog):

bb.4.bb16.i:
; predecessors: %bb.2
successors: %bb.8(0x40000000), %bb.5(0x40000000); %bb.8(50.00%), %bb.5(50.00%)
liveins: $edi, $eflags, $esi, $rbp, $r15, $r14, $rbx
frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
$rsp = frame-setup SUB64ri8 $rsp(tied-def 0), 8, implicit-def dead $eflags
renamable $r15b = SETCCr 8, implicit $eflags
TEST32rr renamable $esi, renamable $esi, implicit-def $eflags
renamable $r14b = SETCCr 8, implicit $eflags
renamable $edx = COPY renamable $edi, implicit-def $rdx
renamable $edx = NEG32r renamable $edx(tied-def 0), implicit-def $eflags, implicit killed $rdx, implicit-def $rdx
renamable $edx = CMOV32rr renamable $edx(tied-def 0), killed renamable $edi, 12, implicit $eflags, implicit killed $rdx, implicit-def $rdx
renamable $eax = COPY renamable $esi, implicit-def $rax
renamable $eax = NEG32r renamable $eax(tied-def 0), implicit-def $eflags, implicit killed $rax, implicit-def $rax
renamable $eax = CMOV32rr renamable $eax(tied-def 0), killed renamable $esi, 12, implicit $eflags, implicit killed $rax, implicit-def $rax
renamable $ecx = LEA64_32r $noreg, 4, renamable $rdx, 0, $noreg, implicit-def $rcx
TEST32ri renamable $edx, 1073741824, implicit-def $eflags, implicit killed $rdx
JCC_1 %bb.8, 4, implicit $eflags
JMP_1 %bb.5

Originally reported in rust-lang/rust#84667

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions