File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp/ir/implementation
csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,14 +61,12 @@ newtype TValueNumber =
6161 */
6262class CongruentCopyInstruction extends CopyInstruction {
6363 CongruentCopyInstruction ( ) {
64- strictcount ( this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) ) = 1 and
6564 this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) instanceof MustExactlyOverlap
6665 }
6766}
6867
6968class LoadTotalOverlapInstruction extends LoadInstruction {
7069 LoadTotalOverlapInstruction ( ) {
71- strictcount ( this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) ) = 1 and
7270 this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) instanceof MustTotallyOverlap
7371 }
7472}
Original file line number Diff line number Diff line change @@ -61,14 +61,12 @@ newtype TValueNumber =
6161 */
6262class CongruentCopyInstruction extends CopyInstruction {
6363 CongruentCopyInstruction ( ) {
64- strictcount ( this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) ) = 1 and
6564 this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) instanceof MustExactlyOverlap
6665 }
6766}
6867
6968class LoadTotalOverlapInstruction extends LoadInstruction {
7069 LoadTotalOverlapInstruction ( ) {
71- strictcount ( this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) ) = 1 and
7270 this .getSourceValueOperand ( ) .getDefinitionOverlap ( ) instanceof MustTotallyOverlap
7371 }
7472}
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ private module Cached {
9696 }
9797
9898 cached
99- Instruction getMemoryOperandDefinition (
99+ private Instruction getMemoryOperandDefinition0 (
100100 Instruction instruction , MemoryOperandTag tag , Overlap overlap
101101 ) {
102102 exists ( OldInstruction oldInstruction , OldIR:: NonPhiMemoryOperand oldOperand |
@@ -142,6 +142,19 @@ private module Cached {
142142 overlap instanceof MustExactlyOverlap
143143 }
144144
145+ cached
146+ Instruction getMemoryOperandDefinition (
147+ Instruction instruction , MemoryOperandTag tag , Overlap overlap
148+ ) {
149+ // getMemoryOperandDefinition0 currently has a bug where it can match with multiple overlaps.
150+ // This predicate ensures that the chosen overlap is the most conservative if there's any doubt.
151+ result = getMemoryOperandDefinition0 ( instruction , tag , overlap ) and
152+ not (
153+ overlap instanceof MustExactlyOverlap and
154+ exists ( MustTotallyOverlap o | exists ( getMemoryOperandDefinition0 ( instruction , tag , o ) ) )
155+ )
156+ }
157+
145158 /**
146159 * Holds if `instr` is part of a cycle in the operand graph that doesn't go
147160 * through a phi instruction and therefore should be impossible.
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ private module Cached {
9696 }
9797
9898 cached
99- Instruction getMemoryOperandDefinition (
99+ private Instruction getMemoryOperandDefinition0 (
100100 Instruction instruction , MemoryOperandTag tag , Overlap overlap
101101 ) {
102102 exists ( OldInstruction oldInstruction , OldIR:: NonPhiMemoryOperand oldOperand |
@@ -142,6 +142,19 @@ private module Cached {
142142 overlap instanceof MustExactlyOverlap
143143 }
144144
145+ cached
146+ Instruction getMemoryOperandDefinition (
147+ Instruction instruction , MemoryOperandTag tag , Overlap overlap
148+ ) {
149+ // getMemoryOperandDefinition0 currently has a bug where it can match with multiple overlaps.
150+ // This predicate ensures that the chosen overlap is the most conservative if there's any doubt.
151+ result = getMemoryOperandDefinition0 ( instruction , tag , overlap ) and
152+ not (
153+ overlap instanceof MustExactlyOverlap and
154+ exists ( MustTotallyOverlap o | exists ( getMemoryOperandDefinition0 ( instruction , tag , o ) ) )
155+ )
156+ }
157+
145158 /**
146159 * Holds if `instr` is part of a cycle in the operand graph that doesn't go
147160 * through a phi instruction and therefore should be impossible.
You can’t perform that action at this time.
0 commit comments