diff options
| author | Dibyendu Majumdar <dibyendumajumdar@users.noreply.github.com> | 2024-04-29 00:11:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-28 16:11:36 -0700 |
| commit | e31c37890a86aedfb209cf543baf05b1b60a27d2 (patch) | |
| tree | 5c1151adb45e839a8f4b0f7cc918bf49771e52f1 /chapter10/src/test | |
| parent | 17f9d743c06170f20773863bd1eca4f25ef41490 (diff) | |
| download | Simple-e31c37890a86aedfb209cf543baf05b1b60a27d2.tar.gz Simple-e31c37890a86aedfb209cf543baf05b1b60a27d2.zip | |
Ch10update (#75)
* Store-after-Store peep
* Load-after-Store peephole
* Fix graph viz mem edge color bug
* Scalar replace loop carried dependence
* #67 Dead Not node hanging around - if we add a Not in the upcast then add it to the IterPeeps worklist to ensure it gets cleaned up. We don't see the Not node in the parser hence we cannot do a peep on it there.
* #67 Update visuals. Add description of Store-Store and Store-Load peeps. Add examples.
* #67 Undo the change that wasn't supposed to be committed!
* #67 Update description of the Store-Store and Store-Load peepholes
---------
Co-authored-by: Cliff Click <cliffc@acm.org>
Diffstat (limited to 'chapter10/src/test')
| -rw-r--r-- | chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java index 6bafe72a..36ad19ae 100644 --- a/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java +++ b/chapter10/src/test/java/com/seaofnodes/simple/Chapter10Test.java @@ -30,9 +30,9 @@ bar.a = 1; bar.a = 2; return bar.a; """); - StopNode stop = parser.parse(true).iterate(true); + StopNode stop = parser.parse(false).iterate(true); System.out.println(IRPrinter.prettyPrint(stop, 99, true)); - assertEquals("return .a;", stop.toString()); + assertEquals("return 2;", stop.toString()); } @Test @@ -86,8 +86,8 @@ while (arg) { } return bar.a; """); - StopNode stop = parser.parse(true).iterate(true); - assertEquals("return .a;", stop.toString()); + StopNode stop = parser.parse(false).iterate(true); + assertEquals("return Phi(Loop10,0,(Phi_a+2));", stop.toString()); } @Test @@ -190,6 +190,31 @@ v1=new s0; } @Test + public void testIter() { + // Build and use an iterator + Parser parser = new Parser( +""" +struct Iter { + int x; + int len; +} +Iter i = new Iter; +i.len = arg; +int sum=0; +while( i.x < i.len ) { + sum = sum + i.x; + i.x = i.x + 1; +} +return sum; +"""); + StopNode stop = parser.parse().iterate(true); + assertEquals("return Phi(Loop14,0,(Phi(Loop,0,(Phi_x+1))+Phi_sum));", stop.toString()); + } + + + + + @Test public void test1() { Parser parser = new Parser(""" struct s0 {int v0;} |
