Hello.
I added missing gimple_asm_string comparison for a function with an asm
statement.
Bootstrap and regression tests still running, ready for trunk after it finishes?
Thank you,
Martin
gcc/ChangeLog:
2014-10-19 Martin Liska <[email protected]>
* ipa-icf-gimple.c (func_checker::compare_gimple_asm):
Gimple tempate string is compared.
gcc/testsuite/ChangeLog:
2014-10-19 Martin Liska <[email protected]>
* gcc.dg/ipa/pr63595.c: New test.
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 792a3e4..1369b74 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -863,6 +863,9 @@ func_checker::compare_gimple_asm (gimple g1, gimple g2)
if (gimple_asm_nclobbers (g1) != gimple_asm_nclobbers (g2))
return false;
+ if (strcmp (gimple_asm_string (g1), gimple_asm_string (g2)) != 0)
+ return return_false_with_msg ("ASM strings are different");
+
for (unsigned i = 0; i < gimple_asm_ninputs (g1); i++)
{
tree input1 = gimple_asm_input_op (g1, i);
diff --git a/gcc/testsuite/gcc.dg/ipa/pr63595.c b/gcc/testsuite/gcc.dg/ipa/pr63595.c
new file mode 100644
index 0000000..9c9f3bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr63595.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-icf-details" } */
+
+static int f(int t) __attribute__((noinline));
+
+static int g(int t) __attribute__((noinline));
+static int g(int t)
+{
+ asm("addl %0, 1": "+r"(t));
+ return t;
+}
+static int f(int t)
+{
+ asm("addq %0, -1": "+r"(t));
+ return t;
+}
+
+
+int h(int t)
+{
+ return f(t) + g(t);
+}
+
+/* { dg-final { scan-ipa-dump "ASM strings are different" "icf" } } */
+/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */
+/* { dg-final { cleanup-ipa-dump "icf" } } */