[llvm-bugs] [Bug 50165] New: PEI clobbers live EFLAGS when using "probe-stack"="inline-asm"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 29 01:54:11 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50165

            Bug ID: 50165
           Summary: PEI clobbers live EFLAGS when using
                    "probe-stack"="inline-asm"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: tomasz.miasko at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

Created attachment 24813
  --> https://bugs.llvm.org/attachment.cgi?id=24813&action=edit
positdiv32 LLVM IR

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 https://github.com/rust-lang/rust/issues/84667

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210429/f1d16da8/attachment-0001.html>


More information about the llvm-bugs mailing list