Skip to content

Commit bda00bb

Browse files
C++: Split out SSA IR tests
The IR tests were getting kind of unwieldy. We were using "ir.cpp" to contain test cases that covered both IR construction (every language construct imaginable) and SSA construction. We would then build and dump all three flavors of IR. For IR construction tests, examining the SSA dumps when you add a new test case is tedious. To make this easier to manage, I've split the SSA-specific test cases out into a separate directory. "ir.cpp" should now contain only IR construction test cases, and "ssa.cpp" should contain only SSA construction test cases. We dump just the raw IR for "ir.cpp", and just the two SSA flavors for "ssa.cpp". We still run all three flavors of the IR sanity tests for "ir.cpp", though. I also removed the "ssa_block_count.ql" test, which wasn't really adding any coverage, because any change to the block count would be reflected in the dump as well.
1 parent 986afa1 commit bda00bb

16 files changed

+574
-9907
lines changed

cpp/ql/test/library-tests/ir/ir/PrintAST.expected

Lines changed: 0 additions & 235 deletions
Original file line numberDiff line numberDiff line change
@@ -6591,238 +6591,3 @@ ir.cpp:
65916591
# 983| ValueCategory = prvalue(load)
65926592
# 983| 1: { ... }
65936593
# 985| 3: return ...
6594-
# 1005| int ChiPhiNode(Point*, bool, bool)
6595-
# 1005| params:
6596-
# 1005| 0: p
6597-
# 1005| Type = Point *
6598-
# 1005| 1: which1
6599-
# 1005| Type = bool
6600-
# 1005| 2: which2
6601-
# 1005| Type = bool
6602-
# 1005| body: { ... }
6603-
# 1006| 0: if (...) ...
6604-
# 1006| 0: which1
6605-
# 1006| Type = bool
6606-
# 1006| ValueCategory = prvalue(load)
6607-
# 1006| 1: { ... }
6608-
# 1007| 0: ExprStmt
6609-
# 1007| 0: ... ++
6610-
# 1007| Type = int
6611-
# 1007| ValueCategory = prvalue
6612-
# 1007| 0: x
6613-
# 1007| Type = int
6614-
# 1007| ValueCategory = lvalue
6615-
# 1007| -1: p
6616-
# 1007| Type = Point *
6617-
# 1007| ValueCategory = prvalue(load)
6618-
# 1008| 2: { ... }
6619-
# 1009| 0: ExprStmt
6620-
# 1009| 0: ... ++
6621-
# 1009| Type = int
6622-
# 1009| ValueCategory = prvalue
6623-
# 1009| 0: y
6624-
# 1009| Type = int
6625-
# 1009| ValueCategory = lvalue
6626-
# 1009| -1: p
6627-
# 1009| Type = Point *
6628-
# 1009| ValueCategory = prvalue(load)
6629-
# 1012| 1: if (...) ...
6630-
# 1012| 0: which2
6631-
# 1012| Type = bool
6632-
# 1012| ValueCategory = prvalue(load)
6633-
# 1012| 1: { ... }
6634-
# 1013| 0: ExprStmt
6635-
# 1013| 0: ... ++
6636-
# 1013| Type = int
6637-
# 1013| ValueCategory = prvalue
6638-
# 1013| 0: x
6639-
# 1013| Type = int
6640-
# 1013| ValueCategory = lvalue
6641-
# 1013| -1: p
6642-
# 1013| Type = Point *
6643-
# 1013| ValueCategory = prvalue(load)
6644-
# 1014| 2: { ... }
6645-
# 1015| 0: ExprStmt
6646-
# 1015| 0: ... ++
6647-
# 1015| Type = int
6648-
# 1015| ValueCategory = prvalue
6649-
# 1015| 0: y
6650-
# 1015| Type = int
6651-
# 1015| ValueCategory = lvalue
6652-
# 1015| -1: p
6653-
# 1015| Type = Point *
6654-
# 1015| ValueCategory = prvalue(load)
6655-
# 1018| 2: return ...
6656-
# 1018| 0: ... + ...
6657-
# 1018| Type = int
6658-
# 1018| ValueCategory = prvalue
6659-
# 1018| 0: x
6660-
# 1018| Type = int
6661-
# 1018| ValueCategory = prvalue(load)
6662-
# 1018| -1: p
6663-
# 1018| Type = Point *
6664-
# 1018| ValueCategory = prvalue(load)
6665-
# 1018| 1: y
6666-
# 1018| Type = int
6667-
# 1018| ValueCategory = prvalue(load)
6668-
# 1018| -1: p
6669-
# 1018| Type = Point *
6670-
# 1018| ValueCategory = prvalue(load)
6671-
# 1021| int UnreachableViaGoto()
6672-
# 1021| params:
6673-
# 1021| body: { ... }
6674-
# 1022| 0: goto ...
6675-
# 1023| 1: return ...
6676-
# 1023| 0: 1
6677-
# 1023| Type = int
6678-
# 1023| Value = 1
6679-
# 1023| ValueCategory = prvalue
6680-
# 1024| 2: label ...:
6681-
# 1025| 3: return ...
6682-
# 1025| 0: 0
6683-
# 1025| Type = int
6684-
# 1025| Value = 0
6685-
# 1025| ValueCategory = prvalue
6686-
# 1028| int UnreachableIf(bool)
6687-
# 1028| params:
6688-
# 1028| 0: b
6689-
# 1028| Type = bool
6690-
# 1028| body: { ... }
6691-
# 1029| 0: declaration
6692-
# 1029| 0: definition of x
6693-
# 1029| Type = int
6694-
# 1029| init: initializer for x
6695-
# 1029| expr: 5
6696-
# 1029| Type = int
6697-
# 1029| Value = 5
6698-
# 1029| ValueCategory = prvalue
6699-
# 1030| 1: declaration
6700-
# 1030| 0: definition of y
6701-
# 1030| Type = int
6702-
# 1030| init: initializer for y
6703-
# 1030| expr: 10
6704-
# 1030| Type = int
6705-
# 1030| Value = 10
6706-
# 1030| ValueCategory = prvalue
6707-
# 1031| 2: if (...) ...
6708-
# 1031| 0: b
6709-
# 1031| Type = bool
6710-
# 1031| ValueCategory = prvalue(load)
6711-
# 1031| 1: { ... }
6712-
# 1032| 0: if (...) ...
6713-
# 1032| 0: ... == ...
6714-
# 1032| Type = bool
6715-
# 1032| ValueCategory = prvalue
6716-
# 1032| 0: x
6717-
# 1032| Type = int
6718-
# 1032| ValueCategory = prvalue(load)
6719-
# 1032| 1: y
6720-
# 1032| Type = int
6721-
# 1032| ValueCategory = prvalue(load)
6722-
# 1032| 1: { ... }
6723-
# 1033| 0: return ...
6724-
# 1033| 0: 1
6725-
# 1033| Type = int
6726-
# 1033| Value = 1
6727-
# 1033| ValueCategory = prvalue
6728-
# 1035| 2: { ... }
6729-
# 1036| 0: return ...
6730-
# 1036| 0: 0
6731-
# 1036| Type = int
6732-
# 1036| Value = 0
6733-
# 1036| ValueCategory = prvalue
6734-
# 1039| 2: { ... }
6735-
# 1040| 0: if (...) ...
6736-
# 1040| 0: ... < ...
6737-
# 1040| Type = bool
6738-
# 1040| ValueCategory = prvalue
6739-
# 1040| 0: x
6740-
# 1040| Type = int
6741-
# 1040| ValueCategory = prvalue(load)
6742-
# 1040| 1: y
6743-
# 1040| Type = int
6744-
# 1040| ValueCategory = prvalue(load)
6745-
# 1040| 1: { ... }
6746-
# 1041| 0: return ...
6747-
# 1041| 0: 0
6748-
# 1041| Type = int
6749-
# 1041| Value = 0
6750-
# 1041| ValueCategory = prvalue
6751-
# 1043| 2: { ... }
6752-
# 1044| 0: return ...
6753-
# 1044| 0: 1
6754-
# 1044| Type = int
6755-
# 1044| Value = 1
6756-
# 1044| ValueCategory = prvalue
6757-
# 1049| int DoWhileFalse()
6758-
# 1049| params:
6759-
# 1049| body: { ... }
6760-
# 1050| 0: declaration
6761-
# 1050| 0: definition of i
6762-
# 1050| Type = int
6763-
# 1050| init: initializer for i
6764-
# 1050| expr: 0
6765-
# 1050| Type = int
6766-
# 1050| Value = 0
6767-
# 1050| ValueCategory = prvalue
6768-
# 1051| 1: do (...) ...
6769-
# 1053| 0: 0
6770-
# 1053| Type = bool
6771-
# 1053| Value = 0
6772-
# 1053| ValueCategory = prvalue
6773-
# 1051| 1: { ... }
6774-
# 1052| 0: ExprStmt
6775-
# 1052| 0: ... ++
6776-
# 1052| Type = int
6777-
# 1052| ValueCategory = prvalue
6778-
# 1052| 0: i
6779-
# 1052| Type = int
6780-
# 1052| ValueCategory = lvalue
6781-
# 1055| 2: return ...
6782-
# 1055| 0: i
6783-
# 1055| Type = int
6784-
# 1055| ValueCategory = prvalue(load)
6785-
# 1058| void chiNodeAtEndOfLoop(int, char*)
6786-
# 1058| params:
6787-
# 1058| 0: n
6788-
# 1058| Type = int
6789-
# 1058| 1: p
6790-
# 1058| Type = char *
6791-
# 1058| body: { ... }
6792-
# 1059| 0: while (...) ...
6793-
# 1059| 0: ... > ...
6794-
# 1059| Type = bool
6795-
# 1059| ValueCategory = prvalue
6796-
# 1059| 0: ... --
6797-
# 1059| Type = int
6798-
# 1059| ValueCategory = prvalue
6799-
# 1059| 0: n
6800-
# 1059| Type = int
6801-
# 1059| ValueCategory = lvalue
6802-
# 1059| 1: 0
6803-
# 1059| Type = int
6804-
# 1059| Value = 0
6805-
# 1059| ValueCategory = prvalue
6806-
# 1060| 1: ExprStmt
6807-
# 1060| 0: ... = ...
6808-
# 1060| Type = char
6809-
# 1060| ValueCategory = lvalue
6810-
# 1060| 0: * ...
6811-
# 1060| Type = char
6812-
# 1060| ValueCategory = lvalue
6813-
# 1060| 0: ... ++
6814-
# 1060| Type = char *
6815-
# 1060| ValueCategory = prvalue
6816-
# 1060| 0: p
6817-
# 1060| Type = char *
6818-
# 1060| ValueCategory = lvalue
6819-
# 1060| 1: (char)...
6820-
# 1060| Conversion = integral conversion
6821-
# 1060| Type = char
6822-
# 1060| Value = 0
6823-
# 1060| ValueCategory = prvalue
6824-
# 1060| expr: 0
6825-
# 1060| Type = int
6826-
# 1060| Value = 0
6827-
# 1060| ValueCategory = prvalue
6828-
# 1061| 1: return ...

0 commit comments

Comments
 (0)