Merge pull request #2510 from jbj/getTempVariable-perf

C++: Fix getTempVariable join order in IR
This commit is contained in:
Geoffrey White
2019-12-10 16:06:52 +00:00
committed by GitHub

View File

@@ -684,9 +684,17 @@ abstract class TranslatedElement extends TTranslatedElement {
* Gets the temporary variable generated by this element with tag `tag`.
*/
final IRTempVariable getTempVariable(TempVariableTag tag) {
result.getAST() = getAST() and
result.getTag() = tag and
hasTempVariable(tag, _)
exists(Locatable ast |
result.getAST() = ast and
result.getTag() = tag and
hasTempVariableAndAST(tag, ast)
)
}
pragma[noinline]
private predicate hasTempVariableAndAST(TempVariableTag tag, Locatable ast) {
hasTempVariable(tag, _) and
ast = getAST()
}
/**