[PATCH] ifcvt: Call fixup_partitions (PR83361)
Segher Boessenkool
segher@kernel.crashing.org
Mon Dec 11 15:49:00 GMT 2017
After converting a conditional branch to an unconditional trap to a
conditional trap, if the original trap is still reachable from another
path, it may be that it is in a hot basic block and only reachable from
cold blocks. Fix that up.
This fixes PR83361. Bootstrapping on powerpc64-linux {-m32,-m64}; okay
for trunk if it succeeds?
Segher
2017-12-11 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/83361
* ifcvt.c (if_convert): Call fixup_partitions.
gcc/testsuite/
PR rtl-optimization/83361
* gcc.dg/pr83361.c: New testcase.
---
gcc/ifcvt.c | 4 ++++
gcc/testsuite/gcc.dg/pr83361.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/pr83361.c
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 91360d8..eb3da68 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -5446,6 +5446,10 @@ if_convert (bool after_combine)
if (optimize == 1)
df_remove_problem (df_live);
+ /* Some non-cold blocks may now be only reachable from cold blocks.
+ Fix that up. */
+ fixup_partitions ();
+
checking_verify_flow_info ();
}
diff --git a/gcc/testsuite/gcc.dg/pr83361.c b/gcc/testsuite/gcc.dg/pr83361.c
new file mode 100644
index 0000000..2a6f807
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83361.c
@@ -0,0 +1,40 @@
+/* PR rtl-optimization/83361 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -freorder-blocks-and-partition" } */
+
+#include <limits.h>
+
+int yz;
+
+void
+tq (int z3)
+{
+ unsigned long long int n8 = (unsigned long long int)INT_MAX + 1;
+ int *ey = &yz;
+
+ if (yz == 0)
+ {
+ int bc;
+
+ yz = 1;
+ while (yz != 0)
+ {
+ *ey *= bc;
+ n8 = !!(1 / ((unsigned long long int)yz == n8));
+ ey = &z3;
+ }
+
+ while (z3 != 0)
+ {
+ }
+ }
+
+ z3 = (n8 != 0) && (*ey != 0);
+ z3 = yz / z3;
+ if (z3 < 0)
+ {
+ if (yz != 0)
+ yz = 0;
+ yz /= 0;
+ }
+}
--
1.8.3.1
More information about the Gcc-patches
mailing list