Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
and branch.

Richard.

2016-11-07  Richard Biener  <rguent...@suse.de>

        PR target/78229
        * config/i386/i386.c (ix86_gimple_fold_builtin): Do not adjust
        EH info.

        * g++.dg/pr78229.C: New testcase.

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c      (revision 241891)
+++ gcc/config/i386/i386.c      (working copy)
@@ -37664,7 +37664,7 @@ ix86_gimple_fold_builtin (gimple_stmt_it
          gsi_insert_before (gsi, g, GSI_SAME_STMT);
          g = gimple_build_assign (gimple_call_lhs (stmt), NOP_EXPR, lhs);
          gimple_set_location (g, loc);
-         gsi_replace (gsi, g, true);
+         gsi_replace (gsi, g, false);
          return true;
        }
       break;
Index: gcc/testsuite/g++.dg/pr78229.C
===================================================================
--- gcc/testsuite/g++.dg/pr78229.C      (revision 0)
+++ gcc/testsuite/g++.dg/pr78229.C      (working copy)
@@ -0,0 +1,24 @@
+/* { dg-do compile { target x86_64-*-* i?86-*-* } } */
+/* { dg-options "-O2 -mbmi -w" } */
+
+void a();
+inline int b(int c) {
+    int d = c;
+    return __builtin_ia32_tzcnt_u32(d);
+}
+struct e {};
+int f, g, h;
+void fn3() {
+    float j;
+    &j;
+      {
+       e k;
+       while (h) {
+           if (g == 0)
+             continue;
+           int i = b(g);
+           f = i;
+       }
+       a();
+      }
+}

Reply via email to