1. Reapply [LVI] Normalize pointer behavior (details)
  2. [LVI] Remove unnecessary lambda capture (NFC) (details)
  3. [LV] Check opt-for-size before expanding runtime checks. (details)
  4. [InstSimplify] Protect against more poison in SimplifyWithOpReplaced (PR47322) (details)
  5. [InstSimplify] Reduce code duplication in simplifySelectWithICmpCond (NFC) (details)
  6. [Attributor] Fix AANoUndef identification (details)
  7. [libc++] Add from-scratch configuration files for the test suite (details)
  8. [libc++] Move the default site config template alongside other config files (details)
Commit 6d88f6efd44852b995de3a1620ea67b6381c1ad9 by nikita.ppv
Reapply [LVI] Normalize pointer behavior

This got reverted because a dependency was reverted. It has since
been reapplied, so reapply this as well.


Related to D69686. As noted there, LVI currently behaves differently
for integer and pointer values: For integers, the block value is always
valid inside the basic block, while for pointers it is only valid at
the end of the basic block. I believe the integer behavior is the
correct one, and CVP relies on it via its getConstantRange() uses.

The reason for the special pointer behavior is that LVI checks whether
a pointer is dereferenced in a given basic block and marks it as
non-null in that case. Of course, this information is valid only after
the dereferencing instruction, or in conservative approximation,
at the end of the block.

This patch changes the treatment of dereferencability: Instead of
including it inside the block value, we instead treat it as something
similar to an assume (it essentially is a non-nullness assume) and
incorporate this information in intersectAssumeOrGuardBlockValueConstantRange()
if the context instruction is the terminator of the basic block.
This happens either when determining an edge-value internally in LVI,
or when a terminator was explicitly passed to getValueAt(). The latter
case makes this more powerful than the previous implementation as
a side-effect, and this does actually seem benefitial in practice.

Of course, we do not want to recompute dereferencability on each
intersectAssume call, so we need a new cache for this. The
dereferencability analysis requires walking the entire basic block
and computing underlying objects of all memory operands. This was
previously done separately for each queried pointer value. In the
new implementation (both because this makes the caching simpler,
and because it is faster), I instead only walk the full BB once and
cache all the dereferenced pointers. So the traversal is now performed
only once per BB, instead of once per queried pointer value.

I think the overall model now makes more sense than before, and there
will be no more pitfalls due to differing integer/pointer behavior.

Differential Revision:
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/non-null.ll
The file was modifiedllvm/lib/Analysis/LazyValueInfo.cpp
Commit a400a617217db7da1957cf1e102062aff98716e8 by nikita.ppv
[LVI] Remove unnecessary lambda capture (NFC)
The file was modifiedllvm/lib/Analysis/LazyValueInfo.cpp
Commit 5067f4b6261c07d5df94bf18407235d83ce33861 by flo
[LV] Check opt-for-size before expanding runtime checks.

Move bail out when optimizing for size before runtime check generation.
In that case, we do not use the result of the expansion, the expanded
instruction will be dead and cleaned up later.

By doing the check before expanding the runtime-checks, we can save a
bit of unnecessary work.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit a5be86fde5de2c253aa19704bf4e4854f1936f8c by nikita.ppv
[InstSimplify] Protect against more poison in SimplifyWithOpReplaced (PR47322)

Replace the check for poison-producing instructions in
SimplifyWithOpReplaced() with the generic helper canCreatePoison()
that properly handles poisonous shifts and thus avoids the problem
from PR47322.

This additionally fixes a bug in IIQ.UseInstrInfo=false mode, which
previously could have caused this code to ignore poison flags.
Setting UseInstrInfo=false should reduce the possible optimizations,
not increase them.

This is not a full solution to the problem, as poison could be
introduced more indirectly. This is just a minimal, easy to backport

Differential Revision:
The file was modifiedllvm/test/Transforms/InstSimplify/select.ll
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
Commit 88b310f64b3d3fa31ab64b11e67ea211e1b71f66 by nikita.ppv
[InstSimplify] Reduce code duplication in simplifySelectWithICmpCond (NFC)

Canonicalize icmp ne to icmp eq and implement all the folds only once.
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
Commit 7a15dfd0565c3266164b65667eb476975e8c2c02 by okuraofvegetable
[Attributor] Fix AANoUndef identification

Even though `noundef` IR attribute might be attached to non-void type values, AANoUndef is mistakenly identified for pointer type values only.
This patch fixes that.

Reviewed By: jdoerfert

Differential Revision:
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll
The file was modifiedllvm/test/Transforms/Attributor/nonnull.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll
The file was modifiedllvm/test/Transforms/Attributor/dereferenceable-1.ll
The file was modifiedllvm/test/Transforms/Attributor/range.ll
The file was modifiedllvm/test/Transforms/Attributor/returned.ll
The file was modifiedllvm/test/Transforms/Attributor/callbacks.ll
The file was modifiedllvm/test/Transforms/OpenMP/parallel_deletion.ll
The file was modifiedllvm/test/Transforms/Attributor/willreturn.ll
The file was modifiedllvm/test/Transforms/Attributor/heap_to_stack.ll
The file was modifiedllvm/test/Transforms/Attributor/liveness.ll
The file was modifiedllvm/test/Transforms/Attributor/nocapture-1.ll
The file was modifiedllvm/test/Transforms/Attributor/internalize.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
The file was modifiedllvm/lib/Transforms/IPO/Attributor.cpp
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll
The file was modifiedllvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/arg-count-mismatch.ll
The file was modifiedllvm/test/Transforms/Attributor/memory_locations.ll
The file was modifiedllvm/test/Transforms/Attributor/noalias.ll
The file was modifiedllvm/test/Transforms/Attributor/potential.ll
The file was modifiedllvm/test/Transforms/Attributor/value-simplify.ll
The file was modifiedllvm/test/Transforms/Attributor/norecurse.ll
The file was modifiedllvm/test/Transforms/Attributor/readattrs.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/dbg.ll
The file was modifiedllvm/test/Transforms/Attributor/nosync.ll
The file was modifiedllvm/test/Transforms/Attributor/ArgumentPromotion/variadic.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll
The file was modifiedllvm/test/Transforms/Attributor/nofree.ll
The file was modifiedllvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll
Commit a711b5eeb0e578c8af200860e31919aaecabca6d by Louis Dionne
[libc++] Add from-scratch configuration files for the test suite

This commit adds the first from-scratch configuration files for running
the libc++ test suite without using the old configuration:

   Runs the test suite against a trunk libc++ shared library.
   Runs the test suite against a trunk libc++ static library.

Differential Revision:
The file was addedlibcxx/test/configs/
The file was addedlibcxx/test/configs/
Commit f9ca2057b95e680d8a62dda8b303a085d69e13cd by Louis Dionne
[libc++] Move the default site config template alongside other config files
The file was addedlibcxx/test/configs/
The file was removedlibcxx/test/
The file was modifiedlibcxx/CMakeLists.txt
The file was modifiedlibcxx/docs/TestingLibcxx.rst