summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authordehao <dehao@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-24 15:04:09 +0000
committerdehao <dehao@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-24 15:04:09 +0000
commit601ee7b3581bed05a7b6ecb5acd63673468588a1 (patch)
tree6f0955f1b454bbe3c182be036de20ee646ce268b /gcc/testsuite/gcc.dg
parent77b3b9e90abdd460636bc1135218011bfee6a979 (diff)
downloadgcc-601ee7b3581bed05a7b6ecb5acd63673468588a1.tar.gz
Change the discriminator assignment algorithm to make it more robust.
2013-05-24 Dehao Chen <dehao@google.com> * gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c: New Testcase. * gcc/tree-cfg.c (locus_descrim_hasher::hash): Change discrminator hash function. (locus_descrim_hasher::equal): Likewise. (build_gimple_cfg): New discrminator assignmnet algorithm (make_edges): Likewise. (next_discriminator_for_locus): Likewise. (same_line_p): Likewise. (assign_discriminators): Likewise. (make_cond_expr_edges): Likewise. (make_gimple_switch_edges): Likewise. (make_goto_expr_edges): Likewise. (make_gimple_asm_edges): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199295 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c b/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c
new file mode 100644
index 00000000000..64434d2801e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/discriminator.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-O0 -gdwarf-2" } */
+/* { dg-final { scan-assembler "loc \[0-9] 9 \[0-9]( is_stmt \[0-9])?\n" } } */
+/* { dg-final { scan-assembler "loc \[0-9] 9 \[0-9]( is_stmt \[0-9])? discriminator 2\n" } } */
+/* { dg-final { scan-assembler "loc \[0-9] 9 \[0-9]( is_stmt \[0-9])? discriminator 1\n" } } */
+
+int foo(int n) {
+ int i, ret = 0;
+ for (i = 0; i < n; i++) {
+ if (i % 10 == 1)
+ ret++;
+ else
+ ret--;
+ }
+ return ret;
+}