tree-optimization/110777 - abnormals and recent PRE optimization
Checks
Commit Message
The following avoids propagating abnormals with the recent tweak
to look through PRE introduced copies between equal values.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/110777
* tree-ssa-sccvn.cc (eliminate_dom_walker::eliminate_avail):
Avoid propagating abnormals.
* gcc.dg/pr110777.c: New testcase.
---
gcc/testsuite/gcc.dg/pr110777.c | 22 ++++++++++++++++++++++
gcc/tree-ssa-sccvn.cc | 4 +++-
2 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/pr110777.c
new file mode 100644
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -w" } */
+
+void pm_message (int);
+int *findOrAddBackgroundInPalette_palette_pnm;
+static void findOrAddBackgroundInPalette(unsigned *paletteSizeP,
+ int *backgroundIndexP) {
+ if (*paletteSizeP) {
+ *backgroundIndexP = (*paletteSizeP)++;
+ pm_message(0);
+ }
+ pm_message(findOrAddBackgroundInPalette_palette_pnm[*backgroundIndexP]);
+}
+void computeColorMap(int *backgroundIndexP) {
+ unsigned paletteSize;
+ findOrAddBackgroundInPalette(&paletteSize, backgroundIndexP);
+}
+int main() {
+ unsigned backgroundIndex;
+ _setjmp();
+ computeColorMap(&backgroundIndex);
+}
@@ -6608,7 +6608,9 @@ eliminate_dom_walker::eliminate_avail (basic_block, tree op)
if (gimple_assign_rhs_class (ass) == GIMPLE_SINGLE_RHS)
{
tree rhs1 = gimple_assign_rhs1 (ass);
- if (CONSTANT_CLASS_P (rhs1) || TREE_CODE (rhs1) == SSA_NAME)
+ if (CONSTANT_CLASS_P (rhs1)
+ || (TREE_CODE (rhs1) == SSA_NAME
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1)))
av = rhs1;
}
return av;