Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bbf191e

Browse files
author
Robert Marsh
committed
C++: fix join order in hasMemoryOperandDefinition
1 parent d91bc4b commit bbf191e

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,23 @@ private module Cached {
7575
)
7676
}
7777

78-
private predicate hasMemoryOperandDefinition (OldInstruction oldInstruction, OldIR::NonPhiMemoryOperand oldOperand,
79-
Overlap overlap, Instruction instr) {
80-
oldOperand = oldInstruction.getAnOperand() and
78+
pragma[noopt]
79+
private predicate hasMemoryOperandDefinition(
80+
OldInstruction oldInstruction, OldIR::NonPhiMemoryOperand oldOperand, Overlap overlap,
81+
Instruction instr
82+
) {
83+
oldOperand = oldInstruction.getAnOperand() and
84+
oldOperand instanceof OldIR::NonPhiMemoryOperand and
8185
exists(
8286
OldBlock useBlock, int useRank, Alias::MemoryLocation useLocation,
8387
Alias::MemoryLocation defLocation, OldBlock defBlock, int defRank, int defOffset
8488
|
8589
useLocation = Alias::getOperandMemoryLocation(oldOperand) and
86-
hasDefinitionAtRank(useLocation, defLocation, defBlock, defRank, defOffset) and
8790
hasUseAtRank(useLocation, useBlock, useRank, oldInstruction) and
8891
definitionReachesUse(useLocation, defBlock, defRank, useBlock, useRank) and
89-
overlap = Alias::getOverlap(defLocation, useLocation) and
90-
instr = getDefinitionOrChiInstruction(defBlock, defOffset, defLocation, _)
92+
hasDefinitionAtRank(useLocation, defLocation, defBlock, defRank, defOffset) and
93+
instr = getDefinitionOrChiInstruction(defBlock, defOffset, defLocation, _) and
94+
overlap = Alias::getOverlap(defLocation, useLocation)
9195
)
9296
}
9397

@@ -102,8 +106,7 @@ private module Cached {
102106
(
103107
(
104108
if exists(Alias::getOperandMemoryLocation(oldOperand))
105-
then
106-
hasMemoryOperandDefinition(oldInstruction, oldOperand, overlap, result)
109+
then hasMemoryOperandDefinition(oldInstruction, oldOperand, overlap, result)
107110
else (
108111
result = instruction.getEnclosingIRFunction().getUnmodeledDefinitionInstruction() and
109112
overlap instanceof MustTotallyOverlap

0 commit comments

Comments
 (0)