File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,19 @@ private module Cached {
102102 result = getMemoryOperandDefinition ( instr , _, _)
103103 }
104104
105+ /**
106+ * Gets a non-phi instruction that defines an operand of `instr` but only if
107+ * both `instr` and the result have neighbor on the other side of the edge
108+ * between them. This is a necessary condition for being in a cycle, and it
109+ * removes about two thirds of the tuples that would otherwise be in this
110+ * predicate.
111+ */
112+ private Instruction getNonPhiOperandDefOfIntermediate ( Instruction instr ) {
113+ result = getNonPhiOperandDef ( instr ) and
114+ exists ( getNonPhiOperandDef ( result ) ) and
115+ instr = getNonPhiOperandDef ( _)
116+ }
117+
105118 /**
106119 * Holds if `instr` is part of a cycle in the operand graph that doesn't go
107120 * through a phi instruction and therefore should be impossible.
@@ -115,7 +128,7 @@ private module Cached {
115128 cached
116129 predicate isInCycle ( Instruction instr ) {
117130 instr instanceof Instruction and
118- getNonPhiOperandDef + ( instr ) = instr
131+ getNonPhiOperandDefOfIntermediate + ( instr ) = instr
119132 }
120133
121134 cached
You can’t perform that action at this time.
0 commit comments