C++: Fix join order in definitionHasPhiNode

This commit is contained in:
Mathias Vorreiter Pedersen
2020-11-26 10:07:44 +01:00
parent f70072a2db
commit 5f4ad3ad7d
3 changed files with 51 additions and 18 deletions

View File

@@ -403,16 +403,27 @@ private import PhiInsertion
* instruction for the virtual variable as a whole.
*/
private module PhiInsertion {
/**
* Holds if `phiBlock` is a block in the dominance frontier of a block that has a definition of the
* memory location `defLocation`.
*/
pragma[noinline]
private predicate dominanceFrontierOfDefinition(
Alias::MemoryLocation defLocation, OldBlock phiBlock
) {
exists(OldBlock defBlock |
phiBlock = Dominance::getDominanceFrontier(defBlock) and
definitionHasDefinitionInBlock(defLocation, defBlock)
)
}
/**
* Holds if a `Phi` instruction needs to be inserted for location `defLocation` at the beginning of block `phiBlock`.
*/
predicate definitionHasPhiNode(Alias::MemoryLocation defLocation, OldBlock phiBlock) {
exists(OldBlock defBlock |
phiBlock = Dominance::getDominanceFrontier(defBlock) and
definitionHasDefinitionInBlock(defLocation, defBlock) and
/* We can also eliminate those nodes where the definition is not live on any incoming edge */
definitionLiveOnEntryToBlock(defLocation, phiBlock)
)
dominanceFrontierOfDefinition(defLocation, phiBlock) and
/* We can also eliminate those nodes where the definition is not live on any incoming edge */
definitionLiveOnEntryToBlock(defLocation, phiBlock)
}
/**

View File

@@ -403,16 +403,27 @@ private import PhiInsertion
* instruction for the virtual variable as a whole.
*/
private module PhiInsertion {
/**
* Holds if `phiBlock` is a block in the dominance frontier of a block that has a definition of the
* memory location `defLocation`.
*/
pragma[noinline]
private predicate dominanceFrontierOfDefinition(
Alias::MemoryLocation defLocation, OldBlock phiBlock
) {
exists(OldBlock defBlock |
phiBlock = Dominance::getDominanceFrontier(defBlock) and
definitionHasDefinitionInBlock(defLocation, defBlock)
)
}
/**
* Holds if a `Phi` instruction needs to be inserted for location `defLocation` at the beginning of block `phiBlock`.
*/
predicate definitionHasPhiNode(Alias::MemoryLocation defLocation, OldBlock phiBlock) {
exists(OldBlock defBlock |
phiBlock = Dominance::getDominanceFrontier(defBlock) and
definitionHasDefinitionInBlock(defLocation, defBlock) and
/* We can also eliminate those nodes where the definition is not live on any incoming edge */
definitionLiveOnEntryToBlock(defLocation, phiBlock)
)
dominanceFrontierOfDefinition(defLocation, phiBlock) and
/* We can also eliminate those nodes where the definition is not live on any incoming edge */
definitionLiveOnEntryToBlock(defLocation, phiBlock)
}
/**