llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

assertion failing in multiple backends "We are expecting that A is always less than all-ones for SVT"

Open regehr opened this issue 2 years ago • 5 comments

both the AArch64 and x86-64 backends assert out on this input:

define i32 @f(i1 %0) {
  %new0 = srem i1 %0, true
  %last = zext i1 %new0 to i32
  %2 = icmp ne i32 %last, 0
  %3 = select i1 %2, i32 0, i32 1
  ret i32 %3
}

regehr avatar Mar 11 '24 21:03 regehr

@llvm/issue-subscribers-backend-aarch64

Author: John Regehr (regehr)

both the AArch64 and x86-64 backends assert out on this input: ``` define i32 @f(i1 %0) { %new0 = srem i1 %0, true %last = zext i1 %new0 to i32 %2 = icmp ne i32 %last, 0 %3 = select i1 %2, i32 0, i32 1 ret i32 %3 } ```

llvmbot avatar Mar 11 '24 21:03 llvmbot

@llvm/issue-subscribers-backend-x86

Author: John Regehr (regehr)

both the AArch64 and x86-64 backends assert out on this input: ``` define i32 @f(i1 %0) { %new0 = srem i1 %0, true %last = zext i1 %new0 to i32 %2 = icmp ne i32 %last, 0 %3 = select i1 %2, i32 0, i32 1 ret i32 %3 } ```

llvmbot avatar Mar 11 '24 21:03 llvmbot

They appear to be failing in llvm::TargetLowering::prepareSREMEqFold https://clang.godbolt.org/z/Pjf8bnrnE

RKSimon avatar Mar 11 '24 22:03 RKSimon

Bisected to #82706 cc: @resistor

svs-quic avatar Mar 12 '24 03:03 svs-quic

Almost certainly the assertion just needs to be moved above the special case.

resistor avatar Mar 12 '24 03:03 resistor