[PATCH] D101487: [LV] Workaround PR49900

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 14:12:27 PDT 2021


reames created this revision.
reames added a reviewer: fhahn.
Herald added subscribers: javed.absar, hiraditya, mcrosier.
Herald added a reviewer: bollu.
reames requested review of this revision.
Herald added a project: LLVM.

LoopVectorize has a fairly deeply baked in design problem where it will try to query analysis (primarily SCEV, but also ValueTracking) in the midst of mutating IR.  In particular, the intermediate IR state does not represent the semantics of the original (or final) program.

Fixing this for real is hard, but all of the cases seen so far share a common symptom.  In cases seen to date, the analysis being queried is the computation of the original loop's trip count.  We can fix this particular instance of the issue by simply computing the trip count early, and caching it.

I want to be really clear that this is nothing but a workaround.  It does nothing to fix the root issue, and at best, delays the time until we have to fix this for real.  Florian and I have discussed an eventual solution in the review comments for https://reviews.llvm.org/D100663, but it's a lot of work.

Test taken from https://reviews.llvm.org/D100663.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101487

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/scev-during-mutation.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101487.341312.patch
Type: text/x-patch
Size: 3371 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210428/2cf3c81a/attachment.bin>


More information about the llvm-commits mailing list