[PATCH] D68941: [ScopBuilder]Fix bug 38358 by preserve correct order of ScopStmts

bin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 05:19:59 PDT 2019


bin.narwal created this revision.
bin.narwal added reviewers: Meinersbur, bollu.
bin.narwal added projects: Polly, LLVM.

Hi,
ScopBuilder::buildEqivClassBlockStmts creates ScopStmts for instruction groups in basic block and inserts these ScopStmts into Scop::StmtMap, however, as described in https://bugs.llvm.org/show_bug.cgi?id=38358, comment #5, StmtScops are inserted into vector ScopStmt[BB] in wrong order.  As a result, ScopBuilder::buildSchedule creates wrong order sequence node.

Looking closer to code, it's clear there is no equivalent classes with interleaving isOrderedInstruction(memory access) instructions after joinOrderedInstructions.  Afterwards, ScopStmts need to be created and inserted in the original order of memory access instructions, however, at the moment ScopStmts are inserted in the order of leader instructions which are probably not memory access instructions.

The fix is simple with a standalone loop scanning isOrderedInstruction(memory access) instructions in basic block and inserting elements into LeaderToInstList one by one.  The patch also removes double reversing operations which are now unnecessary.

New test preserve-equiv-class-order-in-basic_block.ll is also added.  Comments?

Thanks,
bin


Repository:
  rPLO Polly

https://reviews.llvm.org/D68941

Files:
  lib/Analysis/ScopBuilder.cpp
  test/ScopInfo/preserve-equiv-class-order-in-basic_block.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68941.224832.patch
Type: text/x-patch
Size: 8042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191014/8006fc9e/attachment.bin>


More information about the llvm-commits mailing list