[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #11 from Andrew Pinski --- The bpf verifier is just plain broken when it comes to subreg usage. So after every 32bit usage you need to output a zero extend. To fix that.

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #10 from Andrew Pinski --- The only way to fix this is to add extra zero extends all the time.

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread jemarch at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 Jose E. Marchesi changed: What|Removed |Added Ever confirmed|0 |1 Status|RESOLVED

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #8 from Andrew Pinski --- (In reply to Andrew Pinski from comment #7) > The problem is the verifier: > Mär 26 23:57:12 H systemd[1]: 17: (ac) w0 ^= w3 ; > R0_w=scalar() > R3_w=scalar(smin=smin32=0,smax=umax=smax32

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #7 from Andrew Pinski --- The problem is the verifier: Mär 26 23:57:12 H systemd[1]: 17: (ac) w0 ^= w3 ; R0_w=scalar() R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=1,var_off=(0x0; 0x1)) Mär 26 23:57:12 H syst

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #5 from Andrew Pinski --- here is one which makes similar code for both gcc and clang: ``` int foo2 () { int quux = bar (); unsigned long t3 = (unsigned int)quux; t3+=-1; asm("":"+r"(t3)); t3 = t3>>63; unsigned char t =

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #4 from Andrew Pinski --- ``` int foo2 () { int quux = bar (); unsigned long t3 = (unsigned int)quux; t3+=-1; t3 = t3>>63; unsigned char t = t3; unsigned long t4 = (unsigned int)baz; t4 = -t4; t4 = t4>>63; unsigned

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #3 from Andrew Pinski --- ``` int foo1 () { int quux = bar (); _Bool t = quux == 0; _Bool t1 = baz != 0; int t2 = t; t2 ^= t1; return t2; } ``` Produces the same resulting asm. The way clang produces comparisons is: ```

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #2 from Andrew Pinski --- > - Disable the optimization for BPF until the verifier fixes the limitation if > possible. NO.

[Bug target/114523] bpf: ssa-phiopt optimization generates unverifiable code.

2024-03-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114523 --- Comment #1 from Andrew Pinski --- There is nothing magical about phiopt (in this case) is doing that can't be produced by an user. What does the final code from the backend looks like?