Skip to content

miscompile from arm64 backend with (icmp ult (sub -6, -8) 3) #55490

Description

@regehr

here's a function that needs to return true:

define i1 @f() {
  %1 = sub i4 -6, -8
  %2 = icmp ult i4 %1, 3
  ret i1 %2
}

however, since the 14 release the arm64 backend got a regression causing it to return false:

regehr@john-home:~/tmp$ ~/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/llc foo.ll -o - -march=arm64
	.text
	.file	"foo.ll"
	.globl	f                               // -- Begin function f
	.p2align	2
	.type	f,@function
f:                                      // @f
	.cfi_startproc
// %bb.0:
	mov	w0, #1
	ret
.Lfunc_end0:
	.size	f, .Lfunc_end0-f
	.cfi_endproc
                                        // -- End function
	.section	".note.GNU-stack","",@progbits
regehr@john-home:~/tmp$ ~/llvm-project/for-alive/bin/llc foo.ll -o - -march=arm64
	.text
	.file	"foo.ll"
	.globl	f                               // -- Begin function f
	.p2align	2
	.type	f,@function
f:                                      // @f
	.cfi_startproc
// %bb.0:
	mov	w0, wzr
	ret
.Lfunc_end0:
	.size	f, .Lfunc_end0-f
	.cfi_endproc
                                        // -- End function
	.section	".note.GNU-stack","",@progbits
regehr@john-home:~/tmp$ 

cc @ornata @nunoplopes @ryan-berger @nbushehri @zhengyang92 @aqjune @Hatsunespica

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions