C++: restrict IR generation to global vars w inits

This commit is contained in:
Robert Marsh
2022-03-21 14:26:29 -04:00
parent c27dfb5120
commit a36c6f2dab
8 changed files with 35 additions and 49 deletions

View File

@@ -672,7 +672,7 @@ newtype TTranslatedElement =
} or
// The side effect that initializes newly-allocated memory.
TTranslatedAllocationSideEffect(AllocationExpr expr) { not ignoreSideEffects(expr) } or
TTranslatedGlobalOrNamespaceVarInit(GlobalOrNamespaceVariable var) { any() }
TTranslatedGlobalOrNamespaceVarInit(GlobalOrNamespaceVariable var) { var.hasInitializer() }
/**
* Gets the index of the first explicitly initialized element in `initList`

View File

@@ -10,10 +10,6 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt |
| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g |
| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 |
| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -10,10 +10,6 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt |
| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g |
| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 |
| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -4658,7 +4658,15 @@
| ir.cpp:1034:6:1034:20 | ChiTotal | total:m1034_2 |
| ir.cpp:1034:6:1034:20 | SideEffect | m1034_3 |
| ir.cpp:1035:15:1035:15 | Address | &:r1035_1 |
| ir.cpp:1038:6:1038:8 | Address | &:r1038_2 |
| ir.cpp:1038:12:1038:18 | Address | &:r1038_3 |
| ir.cpp:1038:12:1038:18 | Address | &:r1038_3 |
| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_4 |
| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_7 |
| ir.cpp:1038:12:1038:18 | ChiTotal | total:m1038_5 |
| ir.cpp:1038:12:1038:18 | ChiTotal | total:~m? |
| ir.cpp:1038:12:1038:18 | Load | ~m1038_5 |
| ir.cpp:1038:12:1038:18 | StoreValue | r1038_6 |
| ir.cpp:1038:14:1038:14 | Address | &:r1038_5 |
| ir.cpp:1038:14:1038:14 | Address | &:r1038_5 |
| ir.cpp:1038:14:1038:14 | Address | &:r1038_5 |
@@ -7437,8 +7445,14 @@
| ir.cpp:1668:17:1668:17 | Load | m1661_14 |
| ir.cpp:1668:17:1668:17 | Load | ~m1666_6 |
| ir.cpp:1668:17:1668:17 | StoreValue | r1668_4 |
| ir.cpp:1674:5:1674:12 | Address | &:r1674_2 |
| ir.cpp:1674:16:1674:16 | ChiPartial | partial:m1674_4 |
| ir.cpp:1674:16:1674:16 | ChiTotal | total:~m? |
| ir.cpp:1674:16:1674:16 | StoreValue | r1674_3 |
| ir.cpp:1676:11:1676:18 | Address | &:r1676_2 |
| ir.cpp:1676:22:1676:22 | ChiPartial | partial:m1676_4 |
| ir.cpp:1676:22:1676:22 | ChiTotal | total:~m? |
| ir.cpp:1676:22:1676:22 | StoreValue | r1676_3 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_7 |
@@ -7682,7 +7696,27 @@
| smart_ptr.cpp:47:43:47:63 | SideEffect | ~m47_16 |
| smart_ptr.cpp:47:43:47:63 | Unary | r47_5 |
| smart_ptr.cpp:47:43:47:63 | Unary | r47_6 |
| struct_init.cpp:9:13:9:25 | Left | r9_2 |
| struct_init.cpp:9:13:9:25 | Left | r9_2 |
| struct_init.cpp:10:5:10:21 | Address | &:r10_1 |
| struct_init.cpp:10:5:10:21 | Address | &:r10_6 |
| struct_init.cpp:10:7:10:9 | ChiPartial | partial:m10_4 |
| struct_init.cpp:10:7:10:9 | ChiTotal | total:~m? |
| struct_init.cpp:10:7:10:9 | StoreValue | r10_3 |
| struct_init.cpp:10:7:10:9 | Unary | r10_2 |
| struct_init.cpp:10:12:10:19 | ChiPartial | partial:m10_8 |
| struct_init.cpp:10:12:10:19 | ChiTotal | total:m10_5 |
| struct_init.cpp:10:12:10:19 | StoreValue | r10_7 |
| struct_init.cpp:11:5:11:22 | Address | &:r11_1 |
| struct_init.cpp:11:5:11:22 | Address | &:r11_6 |
| struct_init.cpp:11:7:11:9 | ChiPartial | partial:m11_4 |
| struct_init.cpp:11:7:11:9 | ChiTotal | total:m10_9 |
| struct_init.cpp:11:7:11:9 | StoreValue | r11_3 |
| struct_init.cpp:11:7:11:9 | Unary | r11_2 |
| struct_init.cpp:11:12:11:20 | ChiPartial | partial:m11_9 |
| struct_init.cpp:11:12:11:20 | ChiTotal | total:m11_5 |
| struct_init.cpp:11:12:11:20 | StoreValue | r11_8 |
| struct_init.cpp:11:13:11:20 | Unary | r11_7 |
| struct_init.cpp:16:6:16:20 | ChiPartial | partial:m16_3 |
| struct_init.cpp:16:6:16:20 | ChiTotal | total:m16_2 |
| struct_init.cpp:16:6:16:20 | SideEffect | ~m17_5 |

View File

@@ -7,10 +7,6 @@ duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ../../../include/memory.h:68:25:68:33 | CopyValue: (reference to) | Instruction 'CopyValue: (reference to)' has no successors in function '$@'. | ../../../include/memory.h:67:5:67:5 | void std::unique_ptr<int, std::default_delete<int>>::~unique_ptr() | void std::unique_ptr<int, std::default_delete<int>>::~unique_ptr() |
| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt |
| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g |
| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 |
| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -108,13 +108,6 @@ bad_asts.cpp:
clang.cpp:
# 3| int globalInt
# 3| Block 0
# 3| v3_1(void) = EnterFunction :
# 3| r3_2(glval<int>) = VariableAddress[globalInt] :
# 3| Block 1
# 3| v3_3(void) = ReturnVoid :
# 3| v3_4(void) = ExitFunction :
# 5| int* globalIntAddress()
# 5| Block 0
@@ -2202,13 +2195,6 @@ ir.cpp:
# 341| v341_12(void) = ExitFunction :
# 346| int g
# 346| Block 0
# 346| v346_1(void) = EnterFunction :
# 346| r346_2(glval<int>) = VariableAddress[g] :
# 346| Block 1
# 346| v346_3(void) = ReturnVoid :
# 346| v346_4(void) = ExitFunction :
# 348| int* AddressOf()
# 348| Block 0
@@ -8694,13 +8680,6 @@ ir.cpp:
# 1645| v1645_6(void) = ExitFunction :
# 1672| int global_1
# 1672| Block 0
# 1672| v1672_1(void) = EnterFunction :
# 1672| r1672_2(glval<int>) = VariableAddress :
# 1672| Block 1
# 1672| v1672_3(void) = ReturnVoid :
# 1672| v1672_4(void) = ExitFunction :
# 1674| int global_2
# 1674| Block 0
@@ -8964,13 +8943,6 @@ struct_init.cpp:
# 9| v9_4(void) = ExitFunction :
# 14| Info* global_pointer
# 14| Block 0
# 14| v14_1(void) = EnterFunction :
# 14| r14_2(glval<Info *>) = VariableAddress[global_pointer] :
# 14| Block 1
# 14| v14_3(void) = ReturnVoid :
# 14| v14_4(void) = ExitFunction :
# 16| void let_info_escape(Info*)
# 16| Block 0

View File

@@ -6,10 +6,6 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt |
| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g |
| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 |
| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -6,10 +6,6 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt |
| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g |
| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 |
| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction