llvm-project/polly/lib/Analysis
Michael Kruse 87baae85cd [ScopBuilder] Skip getting leader when merging statements to close holes.
Function joinOrderedInstructions merges instructions when a leader is encountered twice.
It also notices that leaders in SeenLeaders may lose their leadership in previous merging,
and tries to handle the case using following code:

    Instruction *PrevLeader = UnionFind.getLeaderValue(SeenLeaders.back());

However, this is wrong because it always gets leader for the last element of SeenLeaders,
and I believe it's wrong even we get leader for Prev here.  As a result, Statements in cases
like the one in patch aren't merged as expected.  After investigation, I believe it's
unnecessary to get leader instruction at all.  This is based on fact: Although leaders in
SeenLeaders could lose leadership, they only lose to others in SeenLeaders, in other words,
one existing leader will be chosen as new leader of merged equivalent statements.  We can
take advantage of this and simply check if current leader equals to Prev and break merging
if it does.

The patch also adds a new test.

Patch by bin.narwal <bin.narwal@gmail.com>

Differential Revision: https://reviews.llvm.org/D67007

llvm-svn: 371801
2019-09-13 01:04:38 +00:00
..
DependenceInfo.cpp [DependenceInfo] Compute WAR dependence info using ISL kills. NFC. 2019-08-29 18:55:55 +00:00
PolyhedralInfo.cpp Apply include-what-you-use #include removal suggestions. NFC. 2019-03-28 20:19:49 +00:00
PruneUnprofitable.cpp Apply include-what-you-use #include removal suggestions. NFC. 2019-03-28 20:19:49 +00:00
ScopBuilder.cpp [ScopBuilder] Skip getting leader when merging statements to close holes. 2019-09-13 01:04:38 +00:00
ScopDetection.cpp OpaquePtr: Update polly's calls to Loads.h API 2019-07-09 12:13:31 +00:00
ScopDetectionDiagnostic.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScopGraphPrinter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScopInfo.cpp [NFC][ScopBuilder] Move buildDomains and its callees to ScopBuilder. 2019-08-06 21:51:18 +00:00
ScopPass.cpp Apply include-what-you-use #include removal suggestions. NFC. 2019-03-28 20:19:49 +00:00