We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cat case.c bisections static int a, b = -2, c[1]; void foo(void); int main() { if ((c[0] &= (1 % b == 0)) > 1) foo(); b = 1; }
trunk can no longer eliminate foo:
clang-12 -v clang version 12.0.1 (https://github.com/llvm/llvm-project.git fed4134) Target: x86_64-unknown-linux-gnu
clang-12 case.c -S -O3 -o /dev/stdout ...
main: # @main .cfi_startproc
movzbl b(%rip), %eax andl %eax, c.0(%rip) movb $1, b(%rip) xorl %eax, %eax retq
clang-trunk -v clang version 14.0.0 (https://github.com/llvm/llvm-project.git 73346f5) Target: x86_64-unknown-linux-gnu
clang-trunk case.c -S -O3 -o /dev/stdout ... main: # @main .cfi_startproc
pushq %rax .cfi_def_cfa_offset 16 movzbl b(%rip), %eax andl c.0(%rip), %eax movl %eax, c.0(%rip) cmpl $2, %eax jb .LBB0_2
callq foo
.LBB0_2: movb $1, b(%rip) xorl %eax, %eax popq %rcx .cfi_def_cfa_offset 8 retq
183bbad introduced this regression
The text was updated successfully, but these errors were encountered:
https://alive2.llvm.org/ce/z/WpYtHs
define i8 @src(i1 %b) { %s = select i1 %b, i8 1, i8 -2 %r = srem i8 1, %s ret i8 %r }
define i8 @tgt(i1 %b) { %s = select i1 %b, i8 0, i8 1 ret i8 %s }
I'm not sure if this is the whole problem, but we seem to be missing an instcombine fold to allow "FoldOpIntoSelect" for srem with constant numerator.
Sorry, something went wrong.
Current IR for the C source: https://godbolt.org/z/5hrYeTG4T
Note that we can't hoist integer div/rem above a select in general because that could leak poison or cause UB: https://alive2.llvm.org/ce/z/smpA4p
So we'll need some extra safety checks to make that transform work.
Should be fixed with: f65be72
No branches or pull requests
Extended Description
cat case.c bisections
static int a, b = -2, c[1];
void foo(void);
int main() {
if ((c[0] &= (1 % b == 0)) > 1)
foo();
b = 1;
}
trunk can no longer eliminate foo:
clang-12 -v
clang version 12.0.1 (https://github.com/llvm/llvm-project.git fed4134)
Target: x86_64-unknown-linux-gnu
clang-12 case.c -S -O3 -o /dev/stdout
...
main: # @main
.cfi_startproc
%bb.0:
clang-trunk -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git 73346f5)
Target: x86_64-unknown-linux-gnu
clang-trunk case.c -S -O3 -o /dev/stdout
...
main: # @main
.cfi_startproc
%bb.0:
%bb.1:
.LBB0_2:
movb $1, b(%rip)
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
183bbad introduced this regression
The text was updated successfully, but these errors were encountered: