Skip to content

Commit 838720b

Browse files
jbjRobert Marsh
authored andcommitted
C++: de-inline getDefinitionOrChiInstruction
Still has bad join order
1 parent 3d2cc7b commit 838720b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -563,28 +563,28 @@ module DefUse {
563563
/**
564564
* Gets the `Instruction` for the definition at offset `defOffset` in block `defBlock`.
565565
*/
566-
bindingset[defOffset, defLocation]
567-
pragma[inline]
568566
Instruction getDefinitionOrChiInstruction(
569567
OldBlock defBlock, int defOffset, Alias::MemoryLocation defLocation,
570568
Alias::MemoryLocation actualDefLocation
571569
) {
572-
defOffset >= 0 and
573-
exists(OldInstruction oldInstr |
574-
oldInstr = defBlock.getInstruction(defOffset / 2) and
575-
if (defOffset % 2) > 0
576-
then (
577-
// An odd offset corresponds to the `Chi` instruction.
578-
result = Chi(oldInstr) and
579-
actualDefLocation = defLocation.getVirtualVariable()
580-
) else (
581-
// An even offset corresponds to the original instruction.
582-
result = getNewInstruction(oldInstr) and
583-
actualDefLocation = defLocation
584-
)
570+
exists(OldInstruction oldInstr, int oldOffset |
571+
oldInstr = defBlock.getInstruction(oldOffset) and
572+
hasNonPhiDefinition(_, defLocation, defBlock, defOffset) and
573+
oldOffset >= 0
574+
|
575+
// An odd offset corresponds to the `Chi` instruction.
576+
defOffset = oldOffset * 2 + 1 and
577+
result = Chi(oldInstr) and
578+
actualDefLocation = defLocation.getVirtualVariable()
579+
or
580+
// An even offset corresponds to the original instruction.
581+
defOffset = oldOffset * 2 and
582+
result = getNewInstruction(oldInstr) and
583+
actualDefLocation = defLocation
585584
)
586585
or
587-
defOffset < 0 and
586+
defOffset = -1 and
587+
hasDefinition(_, defLocation, defBlock, defOffset) and
588588
result = Phi(defBlock, defLocation) and
589589
actualDefLocation = defLocation
590590
}

0 commit comments

Comments
 (0)