aboutsummaryrefslogtreecommitdiff
path: root/test/alias1.ssa
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2024-03-07 16:40:51 +0100
committerQuentin Carbonneaux <[email protected]>2024-03-07 16:40:51 +0100
commitbd7a73d0ea885285b77f10531464d5d354896a2b (patch)
tree7137bdf8a1a6d6d271518e3a36fc1929235701ca /test/alias1.ssa
parent2d683e0c53907ebca9abde876dd87af70719e42d (diff)
fix bug in alias analysis
The handling of phi was incorrect and we would sometimes miss escapes. We now handle phis at the very end of the pass to make sure the defs for their arguments have all been processed.
Diffstat (limited to 'test/alias1.ssa')
-rw-r--r--test/alias1.ssa21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/alias1.ssa b/test/alias1.ssa
new file mode 100644
index 0000000..a064fac
--- /dev/null
+++ b/test/alias1.ssa
@@ -0,0 +1,21 @@
+export function w $main() {
+@start
+ %a =l alloc4 4
+ %b =l alloc4 4
+ storew 4, %a
+ storew 5, %b
+
+@loop
+ # %mem will be %a and %b successively,
+ # but we do not know it when processing
+ # the phi because %b goes through a cpy
+ %mem =l phi @start %a, @loop %bcpy
+
+ %w =w load %mem
+ %eq5 =w ceqw %w, 5
+ %bcpy =l copy %b
+ jnz %eq5, @exit, @loop
+
+@exit
+ ret 0
+}