[Bug tree-optimization/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107172 --- Comment #3 from Aldy Hernandez --- (In reply to Martin Liška from comment #2) > Started with r13-1268-g8c99e307b20c502e. Disabling DOM with -fno-tree-dominator-opts still causes the crash, so it's not this patch that caused the problem. Furthermore, the IL at the *.optimized dump looks fine, so this may be an RTL problem. I also disabled VRP's exporting of global ranges to make sure it's not RTL-land making decisions based on global SSA ranges. Also, the revision before r13-1268-g8c99e307b20c502e also fails with -fno-tree-dominator-opts -O1 -ftree-vrp. I tried bisecting this further with -fno-tree-dominator-opts -O1 -ftree-vrp, and ran into: commit f1652e3343b1ec47035370801d9b9aca1f8b613f Author: Roger Sayle Date: Mon May 30 21:26:37 2022 +0100 PR rtl-optimization/101617: Use neg/sbb in ix86_expand_int_movcc. This patch resolves PR rtl-optimization/101617 where we should generate the exact same code for (X ? -1 : 1) as we do for ((X ? -1 : 0) | 1). The cause of the current difference on x86_64 is actually in ix86_expand_int_movcc that doesn't know that negl;sbbl can be used to create a -1/0 result depending on whether the input is zero/nonzero.
[Bug tree-optimization/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107172 Richard Biener changed: What|Removed |Added Priority|P3 |P1
[Bug tree-optimization/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107172 Martin Liška changed: What|Removed |Added CC||aldyh at gcc dot gnu.org, ||marxin at gcc dot gnu.org Summary|[13 Regression] wrong code |[13 Regression] wrong code |with "-O1 -ftree-vrp" on|with "-O1 -ftree-vrp" on |x86_64-linux-gnu|x86_64-linux-gnu since ||r13-1268-g8c99e307b20c502e --- Comment #2 from Martin Liška --- Started with r13-1268-g8c99e307b20c502e.
[Bug tree-optimization/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107172 Andrew Pinski changed: What|Removed |Added Summary|wrong code with "-O1|[13 Regression] wrong code |-ftree-vrp" on |with "-O1 -ftree-vrp" on |x86_64-linux-gnu|x86_64-linux-gnu Status|UNCONFIRMED |NEW Last reconfirmed||2022-10-06 Ever confirmed|0 |1 Target Milestone|--- |13.0 --- Comment #1 from Andrew Pinski --- Confirmed. Reduced a little bit more: ``` int a, c, d; int main() { long e = 1; int f = a = 1; L1: if (a) a = 2; int h = e = ~e; c = -1; if (e >= a) goto L2; if (-1 > a) goto L1; if (a) f = -1; L2: d = (-f + d) & h; if (d) __builtin_abort(); return 0; } ``` Note the store for c is important there. I suspect otherwise the load to e is figured out and does the correct thing.