summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-05-11 22:56:59 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-05-11 22:56:59 +0000
commitd644ec764735a14943543ca1848c3b9fe77dfa0c (patch)
tree87027c728b8668bf382b8e7deac224e868c6ba41
parent4c27643398e52efb235c52d4ffa640893d6fcec7 (diff)
downloadbcm5719-llvm-d644ec764735a14943543ca1848c3b9fe77dfa0c.tar.gz
bcm5719-llvm-d644ec764735a14943543ca1848c3b9fe77dfa0c.zip
[DeLICM] Use input access heuristic for mapped PHI WRITEs.
As with the scalar operand of the initial StoreInst, also use input accesses when searching for new opportunities after mapping a PHI write. The same rational applies here: After LICM has been applied, the promoted value will either be an instruction in the same statement (in which case we fall back to try every scalar access of the statement), or in another statement such that there will be such an input access. In the latter case other scalars cannot have originated from the same register promotion, at least not by LICM. This mostly helps to decrease compilation time and makes debugging easier by not pursuing unpromising routes. In some circumstances, it may change the compiler's output. llvm-svn: 302839
-rw-r--r--polly/lib/Transform/DeLICM.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp
index 7bcb0726632..a6ef8cdfbbb 100644
--- a/polly/lib/Transform/DeLICM.cpp
+++ b/polly/lib/Transform/DeLICM.cpp
@@ -1996,9 +1996,24 @@ private:
if (SAI->isPHIKind()) {
if (!tryMapPHI(SAI, EltTarget))
continue;
- // Add inputs of all incoming statements to the worklist.
- for (auto *PHIWrite : DefUse.getPHIIncomings(SAI))
- ProcessAllIncoming(PHIWrite->getStatement());
+ // Add inputs of all incoming statements to the worklist. Prefer the
+ // input accesses of the incoming blocks.
+ for (auto *PHIWrite : DefUse.getPHIIncomings(SAI)) {
+ auto *PHIWriteStmt = PHIWrite->getStatement();
+ bool FoundAny = false;
+ for (auto Incoming : PHIWrite->getIncoming()) {
+ auto *IncomingInputMA =
+ PHIWriteStmt->lookupInputAccessOf(Incoming.second);
+ if (!IncomingInputMA)
+ continue;
+
+ Worklist.push_back(IncomingInputMA);
+ FoundAny = true;
+ }
+
+ if (!FoundAny)
+ ProcessAllIncoming(PHIWrite->getStatement());
+ }
AnyMapped = true;
continue;
OpenPOWER on IntegriCloud