aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-08-30 04:20:23 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-03-18 19:02:28 +0100
commit1609176c9dbddd280c20a49fce81c9e1dd9b9c78 (patch)
tree8a22908818b9ab131f815b8a48febe0fc72b15e0 /validation
parenta9a56d3994dfd86dbb5b74ab85b3709e4c3d4cee (diff)
downloadsparse-dev-1609176c9dbddd280c20a49fce81c9e1dd9b9c78.tar.gz
fix-return: remove special case for single return
During the linearization of a function, returns are directly linearized as phi-sources and the exit BB contains the corresponding phi-node and the unique OP_RET. There is also a kind of optimization that is done if there is only a single a return statement and thus a single phi-source: the phi-source and the phi-node is simply ignored and the unique value is directly used by the OP_RET instruction. While this optimization make sense it also has some cons: - the phi-node and the phi-source are created anyway and will need to be removed during cleanup. - the corresponding optimization need to be done anyway during simplification - it's only a tiny special case which save very litte. So, keep things simple and generic and leave this sort of simplification for the cleanup/simplification phase. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/linear/degen-function.c6
-rw-r--r--validation/optim/inline-return.c (renamed from validation/linear/inline-return.c)4
2 files changed, 5 insertions, 5 deletions
diff --git a/validation/linear/degen-function.c b/validation/linear/degen-function.c
index 4fb2d564..a7cff443 100644
--- a/validation/linear/degen-function.c
+++ b/validation/linear/degen-function.c
@@ -20,7 +20,7 @@ fa:
.L1:
phi.64 %r2 <- %phi1(return)
- ret.64 %r1
+ ret.64 %r2
f0:
@@ -32,7 +32,7 @@ f0:
.L3:
phi.64 %r4 <- %phi2(return)
- ret.64 %r3
+ ret.64 %r4
f1:
@@ -44,7 +44,7 @@ f1:
.L5:
phi.64 %r6 <- %phi3(return)
- ret.64 %r5
+ ret.64 %r6
* check-output-end
diff --git a/validation/linear/inline-return.c b/validation/optim/inline-return.c
index b1e4d844..d075715d 100644
--- a/validation/linear/inline-return.c
+++ b/validation/optim/inline-return.c
@@ -16,9 +16,9 @@ int bar(void)
/*
* check-name: inline-return.c
- * check-command: test-linearize -fdump-ir=linearize -Wno-decl $file
+ * check-command: test-linearize -Wno-decl $file
*
* check-output-ignore
- * check-output-contains: ret\\..*\\$1
+ * check-output-pattern(2): ret\\..*\\$1
* check-output-excludes: ret\\..*\\$0
*/