1. Reland [SCEV] Fix and validate ValueExprMap/ExprValueMap consistency (details)
  2. [NVPTX][AsmPrinter] Avoid removing globals before calling AsmPrinter::doFinalization() (details)
  3. [DSE] Optimize defining access of defs while walking upwards. (details)
  4. [ARM] Extra testing for v2i1 types. NFC (details)
Commit 2b160e95c89f28a30e2481e6131073659d866a8c by nikita.ppv
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


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

Differential Revision:
The file was addedllvm/test/Transforms/LoopStrengthReduce/X86/nested-ptr-addrec.ll
The file was modifiedllvm/include/llvm/Analysis/ScalarEvolution.h
The file was addedllvm/test/Analysis/ScalarEvolution/becount-invalidation.ll
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
The file was modifiedllvm/test/CodeGen/PowerPC/more-dq-form-prepare.ll
Commit 9f374a74c2aabed998a731ac9f14bd8baa4208ba by kbessonova
[NVPTX][AsmPrinter] Avoid removing globals before calling AsmPrinter::doFinalization()

Instead of removing globals from a module, we, it seems, can just override
AsmPrinter::emitGlobalVariable() to do nothing as NVPTXAsmPrinter already
emitted globals by this time and we don't want to do it twice.

Reviewed By: tra

Differential Revision:
The file was modifiedllvm/lib/Target/NVPTX/NVPTXAsmPrinter.h
The file was modifiedllvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Commit 25dad1064bf14b9a24c6e33ef4a9e7f8e951c1e3 by flo
[DSE] Optimize defining access of defs while walking upwards.

This patch extends the code that walks memory defs upwards to find
clobbering accesses to also try to optimize the clobbering defining

We should be able to find set the optimized access of our starting def
(KillingDef), if the following holds:

1. It is the first call of getDomMemoryDef for KillingDef (so Current
    ==  KillingDef->getDefiningAccess().
2. No potentially aliasing defs are skipped.

Then if a (partly) aliasing def is encountered, it can be used as
optimized access for KillingDef. No further optimizations can be
applied to KillingDef.

I'd appreciate a careful look, as the existing documentation is not too
clear on what is expected for optimized accesses.

The motivation for this patch is to use the optimized accesses to cover
more cases of redundant stores as follow-up to D111727.

Reviewed By: nikic

Differential Revision:
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Commit 1b2d58ba90cd72a8dfe1535b5fbecbefacc30016 by
[ARM] Extra testing for v2i1 types. NFC

This adds extra tests for various operations from making the v2i1 type
The file was modifiedllvm/test/CodeGen/Thumb2/mve-pred-shuffle.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-pred-spill.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-pred-ext.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-vcmp.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-vmovimm.ll
The file was modifiedllvm/test/CodeGen/Thumb2/active_lane_mask.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-vpsel.ll