diff options
| author | Cliff Click <cliffc@acm.org> | 2024-09-12 10:11:51 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2024-09-12 12:04:37 -0700 |
| commit | ce4c47a5bec87ca404fbb49a2d91f34ab6f4e545 (patch) | |
| tree | 8cfddded5827858d444915c97b8da42faa0e642f /chapter14/src/test/java | |
| parent | 180e0612d0395ad23f7b5782e799c05a145734c7 (diff) | |
| download | Simple-ce4c47a5bec87ca404fbb49a2d91f34ab6f4e545.tar.gz Simple-ce4c47a5bec87ca404fbb49a2d91f34ab6f4e545.zip | |
Fix GCM of CSE stores
Stop CSE of stores.
Backports to ch11,12,13,14
Diffstat (limited to 'chapter14/src/test/java')
| -rw-r--r-- | chapter14/src/test/java/com/seaofnodes/simple/Chapter11Test.java | 17 | ||||
| -rw-r--r-- | chapter14/src/test/java/com/seaofnodes/simple/Chapter13Test.java | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/chapter14/src/test/java/com/seaofnodes/simple/Chapter11Test.java b/chapter14/src/test/java/com/seaofnodes/simple/Chapter11Test.java index 3b9cac7d..ca0db829 100644 --- a/chapter14/src/test/java/com/seaofnodes/simple/Chapter11Test.java +++ b/chapter14/src/test/java/com/seaofnodes/simple/Chapter11Test.java @@ -511,4 +511,21 @@ return v; StopNode stop = parser.parse(false).iterate(true); //assertEquals("return new S;", stop.toString()); } + + @Test + public void testSplit() { + Parser parser = new Parser( + """ +struct S { int f; } +S s = new S; +if( arg==0 ) s.f = 1; +else if (arg == 1) s.f = 1; +return s.f; +"""); + StopNode stop = parser.parse(false).iterate(true); + assertEquals("return Phi(Region37,1,Phi(Region35,1,0));", stop.toString()); + assertEquals(1L, Evaluator.evaluate(stop, 0)); + assertEquals(1L, Evaluator.evaluate(stop, 1)); + assertEquals(0L, Evaluator.evaluate(stop, 2)); + } } diff --git a/chapter14/src/test/java/com/seaofnodes/simple/Chapter13Test.java b/chapter14/src/test/java/com/seaofnodes/simple/Chapter13Test.java index f9aa3016..11ab5621 100644 --- a/chapter14/src/test/java/com/seaofnodes/simple/Chapter13Test.java +++ b/chapter14/src/test/java/com/seaofnodes/simple/Chapter13Test.java @@ -35,7 +35,7 @@ while( arg ) { return head.next.i; """); try { parser.parse(true).iterate(true); fail(); } - catch( Exception e ) { assertEquals("Might be null accessing 'i'",e.getMessage()); } + catch( Exception e ) { assertEquals("Might be null accessing 'next'",e.getMessage()); } } @Test |
