| Issue |
56457
|
| Summary |
LLVM 14 Regression: Invalid ctlz result on riscv64
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
topolarity
|
Minimal reduction:
```llvm
; ModuleID = 'test'
source_filename = "test"
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
target triple = "riscv64-unknown-linux-unknown"
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare i15 @llvm.ctlz.i15(i15 %0, i1 immarg %1) #2
; Function Attrs: nobuiltin noredzone nounwind
define external fastcc void @"_start"() unnamed_addr #1 {
Entry:
%value = alloca i15, align 2
store i15 -16384, i15* %value, align 2
call fastcc void @foo()
%0 = load i15, i15* %value, align 2
%1 = call i15 @llvm.ctlz.i15(i15 %0, i1 false)
%2 = zext i15 %1 to i64
call i64 asm sideeffect "ecall", "={x10},{x17},{x10},~{memory}"(i64 94, i64 %2)
unreachable
}
; Function Attrs: nobuiltin noredzone nounwind
define internal fastcc void @foo() unnamed_addr #1 {
Entry:
ret void
}
attributes #1 = { nobuiltin noredzone nounwind "target-features"="+m"}
attributes #2 = { nofree nosync nounwind readnone speculatable willreturn }
```
This program exits with 0 on LLVM 13.0.1, but with 7 on LLVM 14.0.5 and trunk
```
$ llc-13 test.ll -o test.o -filetype=obj -mtriple=riscv64-linux-none -O0
$ ld.lld test.o -o test && qemu-riscv64 ./test
$ echo $?
0
$ llc-14 test.ll -o test.o -filetype=obj -mtriple=riscv64-linux-none -O0
$ ld.lld test.o -o test && qemu-riscv64 ./test
$ echo $?
7
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs