[PATCH] D118102: [LoopInterchange] Prevent interchange with unsafe control-flow divergence inside inner loops (PR48057)

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 24 22:01:47 PST 2022


congzhe created this revision.
congzhe added reviewers: Whitney, bmahjour, Meinersbur, LoopOptWG.
congzhe added a project: LoopOptWG.
Herald added a subscriber: hiraditya.
congzhe requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is bugfix to pr48057 (https://bugs.llvm.org/show_bug.cgi?id=48057). The source code in pr48057 is added as test cases in this patch.

If there is control-flow divergence in the inner loop with loop-variant
conditions and if there are memory accesses in one of the diverged branches, do not interchange since the value stored to memory will be different after interchange and it escapes the loop, causing incorrect results.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118102

Files:
  llvm/lib/Transforms/Scalar/LoopInterchange.cpp
  llvm/test/Transforms/LoopInterchange/pr48057.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118102.402761.patch
Type: text/x-patch
Size: 16456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220125/6a2942cc/attachment.bin>


More information about the llvm-commits mailing list