SuccessChanges

Summary

  1. [SCEVExpander] Avoid re-using existing casts if it means updating users. (details)
  2. [VectorCombine] try to create vector loads from scalar loads (details)
  3. [Diagnostics] Handle string concat pattern and avoid false positives (details)
Commit c70f0b9d4a063df396bb63378963cedbaa357bb8 by flo
[SCEVExpander] Avoid re-using existing casts if it means updating users.

Currently the SCEVExpander tries to re-use existing casts, even if they
are not exactly at the insertion point it was asked to create the cast.
To do so in some case, it creates a new cast at the insertion point and
updates all users to use the new cast.

This behavior is problematic, because it changes the IR outside of the
instructions created during the expansion. Therefore we cannot
completely undo all changes made during expansion.

This re-use should be only an extra optimization, so only using the new
cast in the expanded instructions should not be a correctness issue.
There are many cases equivalent instructions are created during
expansion.

This patch also adjusts findInsertPointAfter to skip instructions
inserted during expansion. This enables re-using existing casts without
the renaming any uses, by picking a better insertion point.

Reviewed By: efriedma, lebedev.ri

Differential Revision: https://reviews.llvm.org/D84399
The file was modifiedllvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
The file was modifiedllvm/test/Transforms/LoopIdiom/reuse-cast.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
The file was modifiedllvm/test/Transforms/LoopDistribute/bounds-expansion-bug.ll
The file was modifiedllvm/test/Transforms/LoopStrengthReduce/pr27056.ll
Commit 43bdac290663f4424f9fb3920c47c7288a2aabb4 by spatel
[VectorCombine] try to create vector loads from scalar loads

This patch was adjusted to match the most basic pattern that starts with an insertelement
(so there's no extract created here). Hopefully, that removes any concern about
interfering with other passes. Ie, the transform should almost always be profitable.

We could make an argument that this could be part of canonicalization, but we
conservatively try not to create vector ops from scalar ops in passes like instcombine.

If the transform is not profitable, the backend should be able to re-scalarize the load.

Differential Revision: https://reviews.llvm.org/D81766
The file was modifiedllvm/test/Transforms/VectorCombine/X86/load.ll
The file was modifiedllvm/lib/Transforms/Vectorize/VectorCombine.cpp
Commit 975467e4aa7ce1b8fcf4af0e25cdf053cfa8669e by Dávid Bolvanský
[Diagnostics] Handle string concat pattern and avoid false positives
The file was modifiedclang/test/Sema/string-concat.c
The file was modifiedclang/lib/Sema/SemaExpr.cpp