[llvm-dev] Potentially unsafe loop optimization
Richard Kenner via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 17 16:41:12 PST 2021
> Long story short, from what I can see there is no miscompilation
> or change in semantics for that matter.
So why does the .s file not contain the loop exit test?
.text
.file "c26006a.adb"
.globl _ada_c26006a # -- Begin function _ada_c26006a
.p2align 4, 0x90
.type _ada_c26006a, at function
_ada_c26006a: # @_ada_c26006a
.cfi_startproc
# %bb.0: # %entry
pushq %rbx
.cfi_def_cfa_offset 16
subq $32, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -16
movw $8257, 16(%rsp) # imm = 0x2041
movb $49, 18(%rsp)
movw $8257, (%rsp) # imm = 0x2041
movb $50, 2(%rsp)
xorl %ebx, %ebx
jmp .LBB0_1
.p2align 4, 0x90
.LBB0_3: # %loop.cond.iter
# in Loop: Header=BB0_1 Depth=1
incb %bl
.LBB0_1: # %loop.cond
# =>This Inner Loop Header: Depth=1
movb %bl, 17(%rsp)
movb %bl, 1(%rsp)
movzwl (%rsp), %eax
xorw 16(%rsp), %ax
movzbl 2(%rsp), %ecx
xorb 18(%rsp), %cl
movzbl %cl, %ecx
orw %ax, %cx
jne .LBB0_3
# %bb.2: # in Loop: Header=BB0_1 Depth=1
callq abort
jmp .LBB0_3
.Lfunc_end0:
.size _ada_c26006a, .Lfunc_end0-_ada_c26006a
.cfi_endproc
# -- End function
.section ".note.GNU-stack","", at progbits
More information about the llvm-dev
mailing list