File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed
cpp/ql/src/semmle/code/cpp/ir/implementation Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -180,10 +180,20 @@ private cached module Cached {
180180 )
181181 }
182182
183+ pragma [ noinline]
184+ private predicate blockIdentity ( TIRBlock b1 , TIRBlock b2 ) { b1 = b2 }
185+
186+ pragma [ noopt]
183187 cached predicate backEdgeSuccessor ( TIRBlock pred , TIRBlock succ , EdgeKind kind ) {
184188 backEdgeSuccessorRaw ( pred , succ , kind )
185189 or
186- forwardEdgeRaw + ( pred , pred ) and
190+ // See the QLDoc on `backEdgeSuccessorRaw`.
191+ exists ( TIRBlock pred2 |
192+ // Joining with `blockIdentity` is a performance trick to get
193+ // `forwardEdgeRaw` on the RHS of a join, where it's fast.
194+ blockIdentity ( pred , pred2 ) and
195+ forwardEdgeRaw + ( pred , pred2 )
196+ ) and
187197 blockSuccessor ( pred , succ , kind )
188198 }
189199
Original file line number Diff line number Diff line change @@ -180,10 +180,20 @@ private cached module Cached {
180180 )
181181 }
182182
183+ pragma [ noinline]
184+ private predicate blockIdentity ( TIRBlock b1 , TIRBlock b2 ) { b1 = b2 }
185+
186+ pragma [ noopt]
183187 cached predicate backEdgeSuccessor ( TIRBlock pred , TIRBlock succ , EdgeKind kind ) {
184188 backEdgeSuccessorRaw ( pred , succ , kind )
185189 or
186- forwardEdgeRaw + ( pred , pred ) and
190+ // See the QLDoc on `backEdgeSuccessorRaw`.
191+ exists ( TIRBlock pred2 |
192+ // Joining with `blockIdentity` is a performance trick to get
193+ // `forwardEdgeRaw` on the RHS of a join, where it's fast.
194+ blockIdentity ( pred , pred2 ) and
195+ forwardEdgeRaw + ( pred , pred2 )
196+ ) and
187197 blockSuccessor ( pred , succ , kind )
188198 }
189199
Original file line number Diff line number Diff line change @@ -180,10 +180,20 @@ private cached module Cached {
180180 )
181181 }
182182
183+ pragma [ noinline]
184+ private predicate blockIdentity ( TIRBlock b1 , TIRBlock b2 ) { b1 = b2 }
185+
186+ pragma [ noopt]
183187 cached predicate backEdgeSuccessor ( TIRBlock pred , TIRBlock succ , EdgeKind kind ) {
184188 backEdgeSuccessorRaw ( pred , succ , kind )
185189 or
186- forwardEdgeRaw + ( pred , pred ) and
190+ // See the QLDoc on `backEdgeSuccessorRaw`.
191+ exists ( TIRBlock pred2 |
192+ // Joining with `blockIdentity` is a performance trick to get
193+ // `forwardEdgeRaw` on the RHS of a join, where it's fast.
194+ blockIdentity ( pred , pred2 ) and
195+ forwardEdgeRaw + ( pred , pred2 )
196+ ) and
187197 blockSuccessor ( pred , succ , kind )
188198 }
189199
You can’t perform that action at this time.
0 commit comments