C++: Exclude void-typed instructions from 'DataFlow::Node'. These nodes can never contain any data so we don't need dataflow nodes for them.

This commit is contained in:
Mathias Vorreiter Pedersen
2022-10-28 13:00:23 +02:00
parent fafc0b5575
commit 3261612a8c
2 changed files with 8 additions and 1094 deletions

View File

@@ -33,7 +33,14 @@ private module Cached {
*/
cached
newtype TIRDataFlowNode =
TInstructionNode(Instruction i) { not Ssa::ignoreInstruction(i) } or
TInstructionNode(Instruction i) {
not Ssa::ignoreInstruction(i) and
// We exclude `void`-typed instructions because they cannot contain data.
// However, if the instruction is a glvalue, and their type is `void`, then the result
// type of the instruction is really `void*`, and thus we still want to have a dataflow
// node for it.
(not i.getResultType() instanceof VoidType or i.isGLValue())
} or
TOperandNode(Operand op) { not Ssa::ignoreOperand(op) } or
TVariableNode(Variable var) or
TPostFieldUpdateNode(FieldAddress operand, int indirectionIndex) {