summaryrefslogtreecommitdiff
path: root/chapter05/src/test/java/com
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2023-10-30 09:01:57 -0700
committerDibyendu Majumdar <dibyendumajumdar@users.noreply.github.com>2023-11-01 18:56:50 +0000
commit4410e4e3d7a4b9e0424de7678633e2a7240695cd (patch)
treeb7a9944f86abd8f0cb1eb986d9fd2db0cf68792a /chapter05/src/test/java/com
parentb59828ac09a88310640d8b8d3d95a8be0cee1187 (diff)
downloadSimple-4410e4e3d7a4b9e0424de7678633e2a7240695cd.tar.gz
Simple-4410e4e3d7a4b9e0424de7678633e2a7240695cd.zip
Bug fix last peephole
Diffstat (limited to 'chapter05/src/test/java/com')
-rw-r--r--chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java b/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java
index 7089e000..a4bf89ec 100644
--- a/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java
+++ b/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java
@@ -69,7 +69,14 @@ return c;
StopNode stop = parser.parse();
assertEquals("return Phi(Region33,Phi(Region21,2,3),Phi(Region31,4,5));", stop.toString());
}
-
+
+ @Test
+ public void testChapter5Merge4() {
+ Parser parser = new Parser("int a=0;int b=0;if(arg)a=1;if(arg==0)b=2;return arg+a+b;#showGraph;", TypeInteger.BOT);
+ StopNode stop = parser.parse();
+ assertEquals("return ((arg+Phi(Region13,1,0))+Phi(Region23,2,0));", stop.toString());
+ }
+
@Test
public void testChapter5True() {
StopNode stop = new Parser("return true;").parse();