diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll index 42198d12372..9355493303a 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll @@ -553,9 +553,11 @@ class SsaPhiNode extends Node, TSsaPhiNode { cached final Node getAnInput(boolean fromBackEdge) { localFlowStep(result, this) and - if phi.getBasicBlock().dominates(result.getBasicBlock()) - then fromBackEdge = true - else fromBackEdge = false + exists(IRBlock bPhi, IRBlock bResult | + bPhi = phi.getBasicBlock() and bResult = result.getBasicBlock() + | + if bPhi.dominates(bResult) then fromBackEdge = true else fromBackEdge = false + ) } /** Gets a node that is used as input to this phi node. */