[all-commits] [llvm/llvm-project] 80e802: [LV] Workaround PR49900 (a crash due to analyzing ...

Philip Reames via All-commits all-commits at lists.llvm.org
Wed May 5 10:00:07 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 80e8025083982f4eca8ca8200eafecf4a5c3ae6e
      https://github.com/llvm/llvm-project/commit/80e8025083982f4eca8ca8200eafecf4a5c3ae6e
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    A llvm/test/Transforms/LoopVectorize/scev-during-mutation.ll

  Log Message:
  -----------
  [LV] Workaround PR49900 (a crash due to analyzing partially mutated IR)

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.

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




More information about the All-commits mailing list