2 Test PHI nodes work in the IR interpreter.
7 from lldbsuite.test.lldbtest import *
8 import lldbsuite.test.lldbutil as lldbutil
11 class IRInterpreterPHINodesTestCase(TestBase):
12 mydir = TestBase.compute_mydir(__file__)
14 def test_phi_node_support(self):
15 """Test support for PHI nodes in the IR interpreter."""
18 exe = self.getBuildArtifact("a.out")
19 self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)
21 # Break on the first assignment to i
22 line = line_number('main.cpp', 'i = 5')
23 lldbutil.run_break_set_by_file_and_line(
24 self, 'main.cpp', line, num_expected_locations=1, loc_exact=True)
26 self.runCmd('run', RUN_SUCCEEDED)
28 # The stop reason of the thread should be breakpoint
29 self.expect('thread list', STOPPED_DUE_TO_BREAKPOINT,
30 substrs=['stopped', 'stop reason = breakpoint'])
34 # The logical 'or' causes a PHI node to be generated. Execute without JIT
35 # to test that the interpreter can handle this
36 self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true'])
39 self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['false'])
41 self.expect('expr -j 0 -- i == 3 || i == 5', substrs=['true'])