[all-commits] [llvm/llvm-project] 2b160e: Reland [SCEV] Fix and validate ValueExprMap/ExprVa...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sat Nov 27 03:37:41 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b160e95c89f28a30e2481e6131073659d866a8c
      https://github.com/llvm/llvm-project/commit/2b160e95c89f28a30e2481e6131073659d866a8c
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-11-27 (Sat, 27 Nov 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Analysis/ScalarEvolution.cpp
    A llvm/test/Analysis/ScalarEvolution/becount-invalidation.ll
    M llvm/test/CodeGen/PowerPC/more-dq-form-prepare.ll
    A llvm/test/Transforms/LoopStrengthReduce/X86/nested-ptr-addrec.ll

  Log Message:
  -----------
  Reland [SCEV] Fix and validate ValueExprMap/ExprValueMap consistency

Relative to the previous landing attempt, this introduces an additional
flag on forgetMemoizedResults() to not remove SCEVUnknown phis from
the value map. The invalidation after BECount calculation wants to
leave these alone and skips them in its own use-def walk, but we can
still end up invalidating them via forgetMemoizedResults() if there
is another IR value with the same SCEV. This is intended as a temporary
workaround only, and the need for this should go away once the
getBackedgeTakenInfo() invalidation is refactored in the spirit of
D114263.

-----

This adds validation for consistency of ValueExprMap and
ExprValueMap, and fixes identified issues:

* Addrec construction directly wrote to ValueExprMap in a few places,
  without updating ExprValueMap. Add a helper to ensures they stay
  consistent. The adjustment in forgetSymbolicName() explicitly
  drops the old value from the map, so that we don't rely on it
  being overwritten.
* forgetMemoizedResultsImpl() was dropping the SCEV from
  ExprValueMap, but not dropping the corresponding entries from
  ValueExprMap.

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




More information about the All-commits mailing list