Skip to content

urem+udiv miscompile with global isel on arm64 #55287

@regehr

Description

@regehr

this is being miscompiled by the arm64 backend with global isel:

define i32 @test1(i32 %0) {
  %2 = urem i32 %0, %0
  %3 = udiv i32 %2, %0
  ret i32 %3
}

we want it to just return 0 (or something else that always produces 0) but we get:

regehr@john-home:~$ llc foo.ll -o - -global-isel --march=arm64
	.text
	.file	"foo.ll"
	.globl	test1                           // -- Begin function test1
	.p2align	2
	.type	test1,@function
test1:                                  // @test1
	.cfi_startproc
// %bb.0:
	udiv	w0, w0, w0
	ret
.Lfunc_end0:
	.size	test1, .Lfunc_end0-test1
	.cfi_endproc
                                        // -- End function
	.section	".note.GNU-stack","",@progbits
regehr@john-home:~$ 

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

Metadata

Metadata

Assignees

Type

No type
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