Jlm
Loading...
Searching...
No Matches
Functions
TraceTests.cpp File Reference
#include <gtest/gtest.h>
#include <jlm/rvsdg/bitstring/constant.hpp>
#include <jlm/rvsdg/gamma.hpp>
#include <jlm/rvsdg/simple-node.hpp>
#include <jlm/rvsdg/TestOperations.hpp>
#include <jlm/rvsdg/TestType.hpp>
#include <jlm/rvsdg/theta.hpp>
#include <jlm/rvsdg/Trace.hpp>
#include <jlm/rvsdg/view.hpp>
Include dependency graph for TraceTests.cpp:

Go to the source code of this file.

Functions

 TEST (TraceTests, TestTraceOutputIntraProcedural_Gamma)
 
 TEST (TraceTests, TestTraceOutputIntraProcedural_Theta)
 
 TEST (TraceTests, TestTraceNestedStructuralNodes)
 
 TEST (TraceTests, TestIndirectLoopInvariantOutput)
 
 TEST (TraceTests, TestIndirectLoopInvariance)
 
 TEST (TraceTests, TestEnterThetaSubregion)
 
 TEST (TraceTests, GammaCachingTest)
 
 TEST (TraceTests, ThetaCachingTest)
 
 TEST (TraceTests, RegionPredicationThetaTest)
 
 TEST (TraceTests, RegionPredicationThetaToGammaTest)
 
 TEST (TraceTests, ImpossibleSubregions)
 

Function Documentation

◆ TEST() [1/11]

TEST ( TraceTests  ,
GammaCachingTest   
)

Definition at line 389 of file TraceTests.cpp.

◆ TEST() [2/11]

TEST ( TraceTests  ,
ImpossibleSubregions   
)

Creates an RVSDG that looks like

        TestOp  Int(10)
          v       v

+-theta----—x----—x----------------------------------------------------------—+ | | | | TestOp | | | v v | | +-gamma0---------------------------------—x--------—+---------------—x–+ | | | TestOp | | | | | | v | | | | | | +-gamma1---------------—+----------------------—+ | | | | | | | | | | | | | | | | CTRL(0) CTRL(1) Int(20) | CTRL(1) CTRL(0) Int(30) | | | | | | | | v v v | v v v | | | | | | | +—x----—x-----—x-—+–x----—x-----—x--—+ | CTRL(0) CTRL(0) | | | | | v v v | v v v | | | +------—x----—x--—x----------------------------—+–x----—x----—x–+ | | | | | | | v v v | +--—x----—x----—x----------------------------------------------------------—+ | | v v +-gamma2--—x-—+-—x-------—+ | v | v | | target A | target B | +--------------—+------------—+

Tracing from the "target A" region should reach the pre argument of the loop variable, while tracing from "target B" should reach the Int(20) inside gamma0.

Definition at line 689 of file TraceTests.cpp.

◆ TEST() [3/11]

TEST ( TraceTests  ,
RegionPredicationThetaTest   
)

Creates an RVSDG that looks like

        Int(1)  Int(2)  Int(3)
          v       v       v

+-theta----—x----—x----—x----------------—+ | | | | | | TestOp | | | | | v v v v | | +-gamma—x–x–x---—+------—x–x---—x-+ | | | | | | | | | | | | CTRL(0) | | Int(4) | CTRL(1) | Int(5) | | | | | v v v v | v v v v | | | +—x--—x–x–x---—+—x--—x-—x-—x-+ | | | | | | | | v v v v | +--—x----—x----—x----—x----------------—+ | | | v v v exp(x) exp(y) exp(z)

and checks that tracing from "x" leads all the way to Int(1), tracing from "y" leads to to the pre of the second loop variable, and tracing from "z" leads to Int(4)

Definition at line 479 of file TraceTests.cpp.

◆ TEST() [4/11]

TEST ( TraceTests  ,
RegionPredicationThetaToGammaTest   
)

Creates an RVSDG that looks like

        TestOp  TestOp
          v       v

+-theta----—x----—x-----------------------------------------------------—+ | | | TestOp | | v | | +-gamma---------------—+---------------------—+---------------------—+ | | | | | | | | | CTRL(0) CTRL(0) Int(1) | CTRL(0) CTRL(1) Int(2) | CTRL(1) CTRL(0) Int(3) | | | | v v v | v v v | v v v | | | +—x----—x----—x-—+—x----—x----—x-—+—x----—x----—x-—+ | | | | | | | v v v | +--—x----—x----—x-----------------------------------------------------—+ | | v v +-gamma----—x-—+-—x-—+ | v | v | | here | here | +---------------—+------—+

And traces from the entry variable arguments in the subregions of the second gamma. In the left subregion, tracing should lead back to Int(1), while the right subregion should lead back to Int(2).

Definition at line 592 of file TraceTests.cpp.

◆ TEST() [5/11]

TEST ( TraceTests  ,
TestEnterThetaSubregion   
)

Tests tracing into the subregion of a theta node from the theta's outputs, when the loop variable is not invariant.

Creates a graph with a single theta node that looks like

 import(i1)
     |
     |
     v

+-theta-x-—+ | | | TestNode | | v | +----—x-—+ v export(x1)

The loop variable is not invariant: its post value comes from a node inside the subregion, not from its pre argument. Tracing x1 from the root region:

  • with mayEnterSubregions=true continues into the theta subregion and stops at the node output inside it.
  • with mayEnterSubregions=false stops at the theta output itself.

Definition at line 336 of file TraceTests.cpp.

◆ TEST() [6/11]

TEST ( TraceTests  ,
TestIndirectLoopInvariance   
)

Tests tracing through and out of theta nodes where a loop variable is not invariant, but takes its post value from an invariant loop variable, with whom it shares input.

Creates a graph with a single theta node that looks like

 20
 |\
 | \
 V  V

+---------—+ | | V | | | USER1 | | |\ | | | \ | | V V | +---------—+ V USER2

Tracing from either USER1 and USER2 should lead to the constant integer 20, despite the loop variable not being directly invariant.

Definition at line 279 of file TraceTests.cpp.

◆ TEST() [7/11]

TEST ( TraceTests  ,
TestIndirectLoopInvariantOutput   
)

Tests tracing through and out of theta nodes where a loop variable is not invariant, but takes its post value from an invariant loop variable. The two variables do not share input origin.

Creates a graph with a single theta node that looks like

 20 40
 |  |
 |  |
 V  V

+---------—+ | | V | | | USER1 | | |\ | | | \ | | V V | +---------—+ V USER2

Tracing from USER1 should stop at the theta pre argument, while tracing from USER2 should lead to the constant 20.

Definition at line 221 of file TraceTests.cpp.

◆ TEST() [8/11]

TEST ( TraceTests  ,
TestTraceNestedStructuralNodes   
)

Creates a graph with a gamma node inside a theta node, where some values are invariant.

Definition at line 117 of file TraceTests.cpp.

◆ TEST() [9/11]

TEST ( TraceTests  ,
TestTraceOutputIntraProcedural_Gamma   
)

Tests tracing out of and through a single gamma node. One of the gamma's exit vars is trivially invariant, and can be traced through the gamma.

Definition at line 21 of file TraceTests.cpp.

◆ TEST() [10/11]

TEST ( TraceTests  ,
TestTraceOutputIntraProcedural_Theta   
)

Tests tracing out of and through a single theta node.

Definition at line 75 of file TraceTests.cpp.

◆ TEST() [11/11]

TEST ( TraceTests  ,
ThetaCachingTest   
)

Definition at line 437 of file TraceTests.cpp.