SuccessChanges

Summary

  1. [test][NewPM] Pin do-nothing-intrinsic.ll to legacy PM (details)
  2. [NFC][CVP] Add tests for srem with potentially different sigdness domains (details)
  3. [CVP] Enhance SRem -> URem fold to work not just on non-negative operands (details)
  4. [ConstantRange] binaryXor(): special-case binary complement case - the result is precise (details)
  5. [ConstantRange] Introduce getActiveBits() method (details)
  6. [NFC][CVP] processUDivOrURem(): refactor to use ConstantRange::getActiveBits() (details)
  7. [NFC][APInt] Refactor getMinSignedBits() in terms of getNumSignBits() (details)
  8. [ConstantRange] Introduce getMinSignedBits() method (details)
  9. [NFC][CVP] Give a better name STATISTIC() counting udiv i16 -> udiv i8 xforms (details)
  10. [NFC][CVP] Add tests for SDiv/SRem narrowing (details)
  11. [CVP] Narrow SDiv/SRem to the smallest power-of-2 that's sufficient to contain its operands (details)
  12. Implement a new kind of Pass: dynamic pass pipeline (details)
  13. Revert "[lldb] XFAIL TestMemoryHistory on Linux" (details)
  14. [flang][msvc] Add explicit function template argument to applyFunction. NFC. (details)
  15. [flang][msvc] Add explicit function template argument to applyLamda. NFC. (details)
  16. [flang][msvc] Explicitly reference "this" inside closure. NFC. (details)
  17. Revert "The wrong placement of add pass with optimizations led to -funique-internal-linkage-names being disabled." (details)
  18. Two patches to fix the broken build. (details)
  19. [lldb][test] Remove accidental import pdb in 783dc7dc7ed7487d0782c2feb8854df949b98e69 (details)
  20. [compiler-rt][AIX] Add CMake support for 32-bit Power builds (details)
  21. [ThinLTO] Option to bypass function importing. (details)
  22. [AArch64] Avoid pairing loads with same result reg (details)
  23. [LoopInfo] empty() -> isInnermost(), add isOutermost() (details)
  24. Revert "[CodeGen] emit CG profile for COFF object file" (details)
  25. Small fixes for "[LoopInfo] empty() -> isInnermost(), add isOutermost()" (details)
  26. Change LoopInfo::empty to isInnermost after D82895 (details)
Commit e16d10b7535ab2224e5bdc533860b7eadf596164 by aeubanks
[test][NewPM] Pin do-nothing-intrinsic.ll to legacy PM

It tests CallGraph infra around the legacy PM which isn't relevant in NPM.
The file was modifiedllvm/test/Analysis/CallGraph/do-nothing-intrinsic.ll
Commit 36ea18b06430e0a1094f9b0994e4abb5cc2175c9 by lebedev.ri
[NFC][CVP] Add tests for srem with potentially different sigdness domains
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/srem.ll
Commit 4eeeb356fc41babf46797b062f74f978b818622b by lebedev.ri
[CVP] Enhance SRem -> URem fold to work not just on non-negative operands

This is a continuation of 8d487668d09fb0e4e54f36207f07c1480ffabbfd,
the logic is pretty much identical for SRem:

Name: pos pos
Pre: C0 >= 0 && C1 >= 0
%r = srem i8 C0, C1
  =>
%r = urem i8 C0, C1

Name: pos neg
Pre: C0 >= 0 && C1 <= 0
%r = srem i8 C0, C1
  =>
%r = urem i8 C0, -C1

Name: neg pos
Pre: C0 <= 0 && C1 >= 0
%r = srem i8 C0, C1
  =>
%t0 = urem i8 -C0, C1
%r = sub i8 0, %t0

Name: neg neg
Pre: C0 <= 0 && C1 <= 0
%r = srem i8 C0, C1
  =>
%t0 = urem i8 -C0, -C1
%r = sub i8 0, %t0

https://rise4fun.com/Alive/Vd6

Now, this new logic does not result in any new catches
as of vanilla llvm test-suite + RawSpeed.
but it should be virtually compile-time free,
and it may be important to be consistent in their handling,
because if we had a pair of sdiv-srem, and only converted one of them,
-divrempairs will no longer see them as a pair,
and thus not "merge" them.
The file was modifiedllvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/srem.ll
Commit b38d897e802664034c7e6e4654328256ed370a61 by lebedev.ri
[ConstantRange] binaryXor(): special-case binary complement case - the result is precise

Use the fact that `~X` is equivalent to `-1 - X`, which gives us
fully-precise answer, and we only need to special-handle the wrapped case.

This fires ~16k times for vanilla llvm test-suite + RawSpeed.
The file was modifiedllvm/unittests/IR/ConstantRangeTest.cpp
The file was modifiedllvm/include/llvm/IR/ConstantRange.h
The file was modifiedllvm/lib/IR/ConstantRange.cpp
Commit 2ed9c4c70bbb36fa12d48a73abc2d89c0af80060 by lebedev.ri
[ConstantRange] Introduce getActiveBits() method

Much like APInt::getActiveBits(), computes how many bits are needed
to be able to represent every value in this constant range,
treating the values as unsigned.
The file was modifiedllvm/lib/IR/ConstantRange.cpp
The file was modifiedllvm/unittests/IR/ConstantRangeTest.cpp
The file was modifiedllvm/include/llvm/IR/ConstantRange.h
Commit ba5afe5588ded61052c8727dbcb0407b5de4410c by lebedev.ri
[NFC][CVP] processUDivOrURem(): refactor to use ConstantRange::getActiveBits()

As an exhaustive test shows, this logic is fully identical to the old
implementation, with exception of the case where both of the operands
had empty ranges:

```
TEST_F(ConstantRangeTest, CVP_UDiv) {
  unsigned Bits = 4;
  EnumerateConstantRanges(Bits, [&](const ConstantRange &CR0) {
    if(CR0.isEmptySet())
      return;
    EnumerateConstantRanges(Bits, [&](const ConstantRange &CR1) {
      if(CR0.isEmptySet())
        return;

      unsigned MaxActiveBits = 0;
      for (const ConstantRange &CR : {CR0, CR1})
        MaxActiveBits = std::max(MaxActiveBits, CR.getActiveBits());

      ConstantRange OperandRange(Bits, /*isFullSet=*/false);
      for (const ConstantRange &CR : {CR0, CR1})
        OperandRange = OperandRange.unionWith(CR);
      unsigned NewWidth = OperandRange.getUnsignedMax().getActiveBits();

      EXPECT_EQ(MaxActiveBits, NewWidth) << CR0 << " " << CR1;
    });
  });
}
```
The file was modifiedllvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
Commit b85395f309890bac5f2d3296ce08dc46c24ef77f by lebedev.ri
[NFC][APInt] Refactor getMinSignedBits() in terms of getNumSignBits()

This is fully identical to the old implementation, just easier to read.
The file was modifiedllvm/include/llvm/ADT/APInt.h
Commit 7465da2077c2b8def7440094e15ac1199226bc25 by lebedev.ri
[ConstantRange] Introduce getMinSignedBits() method

Similar to the ConstantRange::getActiveBits(), and to similarly-named
methods in APInt, returns the bitwidth needed to represent
the given signed constant range
The file was modifiedllvm/include/llvm/IR/ConstantRange.h
The file was modifiedllvm/unittests/IR/ConstantRangeTest.cpp
The file was modifiedllvm/lib/IR/ConstantRange.cpp
Commit 4977eadee56f81377049fb8763350a66cfd2d078 by lebedev.ri
[NFC][CVP] Give a better name STATISTIC() counting udiv i16 -> udiv i8 xforms
The file was modifiedllvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
Commit cb10d5d714e9ae83cfd392dd127e13c51f4d299d by lebedev.ri
[NFC][CVP] Add tests for SDiv/SRem narrowing
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/srem.ll
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/sdiv.ll
Commit b289dc530632613edb3eb067895c1981cb77ccd0 by lebedev.ri
[CVP] Narrow SDiv/SRem to the smallest power-of-2 that's sufficient to contain its operands

This is practically identical to what we already do for UDiv/URem:
  https://rise4fun.com/Alive/04K

Name: narrow udiv
Pre: C0 u<= 255 && C1 u<= 255
%r = udiv i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = udiv i8 %t0, %t1
%r = zext i8 %t2 to i16

Name: narrow exact udiv
Pre: C0 u<= 255 && C1 u<= 255
%r = udiv exact i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = udiv exact i8 %t0, %t1
%r = zext i8 %t2 to i16

Name: narrow urem
Pre: C0 u<= 255 && C1 u<= 255
%r = urem i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = urem i8 %t0, %t1
%r = zext i8 %t2 to i16

... only here we need to look for 'min signed bits', not 'active bits',
and there's an UB to be aware of:
  https://rise4fun.com/Alive/KG86
  https://rise4fun.com/Alive/LwR

Name: narrow sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128
%r = sdiv i16 C0, C1
  =>
%t0 = trunc i16 C0 to i9
%t1 = trunc i16 C1 to i9
%t2 = sdiv i9 %t0, %t1
%r = sext i9 %t2 to i16

Name: narrow exact sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128
%r = sdiv exact i16 C0, C1
  =>
%t0 = trunc i16 C0 to i9
%t1 = trunc i16 C1 to i9
%t2 = sdiv exact i9 %t0, %t1
%r = sext i9 %t2 to i16

Name: narrow srem
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128
%r = srem i16 C0, C1
  =>
%t0 = trunc i16 C0 to i9
%t1 = trunc i16 C1 to i9
%t2 = srem i9 %t0, %t1
%r = sext i9 %t2 to i16


Name: narrow sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128 && !(C0 == -128 && C1 == -1)
%r = sdiv i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = sdiv i8 %t0, %t1
%r = sext i8 %t2 to i16

Name: narrow exact sdiv
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128 && !(C0 == -128 && C1 == -1)
%r = sdiv exact i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = sdiv exact i8 %t0, %t1
%r = sext i8 %t2 to i16

Name: narrow srem
Pre: C0 <= 127 && C1 <= 127 && C0 >= -128 && C1 >= -128 && !(C0 == -128 && C1 == -1)
%r = srem i16 C0, C1
  =>
%t0 = trunc i16 C0 to i8
%t1 = trunc i16 C1 to i8
%t2 = srem i8 %t0, %t1
%r = sext i8 %t2 to i16


The ConstantRangeTest.losslessSignedTruncationSignext test sanity-checks
the logic, that we can losslessly truncate ConstantRange to
`getMinSignedBits()` and signext it back, and it will be identical
to the original CR.

On vanilla llvm test-suite + RawSpeed, this fires 1262 times,
while the same fold for UDiv/URem only fires 384 times. Sic!

Additionally, this causes +606.18% (+1079) extra cases of
aggressive-instcombine.NumDAGsReduced, and +473.14% (+1145)
of aggressive-instcombine.NumInstrsReduced folds.
The file was modifiedllvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/sdiv.ll
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/srem.ll
Commit fb1de7ed921c3c1531c0cb28b9603af22ecd0529 by joker.eph
Implement a new kind of Pass: dynamic pass pipeline

Instead of performing a transformation, such pass yields a new pass pipeline
to run on the currently visited operation.
This feature can be used for example to implement a sub-pipeline that
would run only on an operation with specific attributes. Another example
would be to compute a cost model and dynamic schedule a pipeline based
on the result of this analysis.

Discussion: https://llvm.discourse.group/t/rfc-dynamic-pass-pipeline/1637

Recommit after fixing an ASAN issue: the callback lambda needs to be
allocated to a temporary to have its lifetime extended to the end of the
current block instead of just the current call expression.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D86392
The file was modifiedmlir/tools/mlir-opt/mlir-opt.cpp
The file was addedmlir/test/Pass/dynamic-pipeline-fail-on-parent.mlir
The file was modifiedmlir/include/mlir/Pass/Pass.h
The file was addedmlir/test/lib/Transforms/TestDynamicPipeline.cpp
The file was modifiedmlir/lib/Pass/Pass.cpp
The file was modifiedmlir/test/lib/Transforms/CMakeLists.txt
The file was modifiedmlir/include/mlir/Pass/PassManager.h
The file was addedmlir/test/Pass/dynamic-pipeline.mlir
The file was addedmlir/test/Pass/dynamic-pipeline-nested.mlir
Commit ef7d22a98683ce98b6a2c4d0818d2d9978d42861 by Raphael Isemann
Revert "[lldb] XFAIL TestMemoryHistory on Linux"

This reverts commit 7518006d75accd21325747430d6bced66b2c5ada.

This test apparently works on the Swift CI ubuntu bot, so it shouldn't be
XFAIL'd on Linux.
The file was modifiedlldb/test/API/functionalities/asan/TestMemoryHistory.py
Commit 2bc589bbb8d7d00f5939e9cd33cbe57e47d61f7e by llvm-project
[flang][msvc] Add explicit function template argument to applyFunction. NFC.

Msvc has difficulties deducing the template argument here. The error message is:
```
basic-parsers.h(790,12): error C2672: 'applyFunction': no matching overloaded function found
```
Explicitly pass the first template argument to help it.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D87961
The file was modifiedflang/lib/Parser/basic-parsers.h
Commit 97ca41e1ddfbb6812e2042dcbd2db6e0e7d0bc33 by llvm-project
[flang][msvc] Add explicit function template argument to applyLamda. NFC.

Like in D87961, msvc has difficulties deducing the template argument. The error message is:
```
expr-parsers.cpp(383): error C2672: 'applyLambda': no matching overloaded function found
```
Explicitly pass the first template argument to help it.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D88001
The file was modifiedflang/lib/Parser/expr-parsers.cpp
Commit 62afc3129dc28638d950c17117347b4e001a613d by llvm-project
[flang][msvc] Explicitly reference "this" inside closure. NFC.

The Microsoft compiler seems to have difficulties to decide between a const/non-const method of a captured object context in a closure. The error message is:
```
symbol.cpp(261): error C2668: 'Fortran::semantics::Symbol::detailsIf': ambiguous call to overloaded function
symbol.h(535): note: could be 'const D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void) const'
symbol.h(534): note: or       'D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void)'
symbol.cpp(261): note: while trying to match the argument list '()'
```
Explicitly using the this-pointer resolves this problem.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.

Reviewed By: DavidTruby

Differential Revision: https://reviews.llvm.org/D88052
The file was modifiedflang/lib/Semantics/symbol.cpp
Commit b89059a31347dd09b55a96b99b3dbe38d7749908 by tmsriram
Revert "The wrong placement of add pass with optimizations led to -funique-internal-linkage-names being disabled."

This reverts commit 6950db36d33d85d18e3241ab6c87494c05ebe0fb.
The file was modifiedclang/test/CodeGen/unique-internal-linkage-names.cpp
The file was modifiedclang/lib/CodeGen/BackendUtil.cpp
Commit 21f5f509c8a066a9647a3f5b86f6931db40b7fc7 by paul
Two patches to fix the broken build.
One to fix a C++ compiler warning.
One to allow Sphinx to find a new document.
The file was modifiedllvm/lib/TableGen/TableGenBackendSkeleton.cpp
The file was modifiedllvm/docs/TableGen/index.rst
Commit f21212215031e5871c389999daf3b06b1a6250fd by i
[lldb][test] Remove accidental import pdb in 783dc7dc7ed7487d0782c2feb8854df949b98e69
The file was modifiedlldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
Commit c45596147938191b0ffde91ee8d506e315bf4c8f by daltenty
[compiler-rt][AIX] Add CMake support for 32-bit Power builds

This patch enables support for building compiler-rt builtins for 32-bit
Power arch on AIX. For now, we leave out the specialized ppc builtin
implementations for 128-bit long double and friends since those will
need some special handling for AIX.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D87383
The file was modifiedcompiler-rt/cmake/base-config-ix.cmake
The file was modifiedcompiler-rt/lib/builtins/CMakeLists.txt
The file was modifiedcompiler-rt/cmake/builtin-config-ix.cmake
The file was modifiedcompiler-rt/cmake/Modules/CompilerRTUtils.cmake
Commit cf112382ddd0d717edf0b8a3e5b061de925258e9 by mtrofin
[ThinLTO] Option to bypass function importing.

This completes the circle, complementing -lto-embed-bitcode
(specifically, post-merge-pre-opt). Using -thinlto-assume-merged skips
function importing. The index file is still needed for the other data it
contains.

Differential Revision: https://reviews.llvm.org/D87949
The file was modifiedclang/test/CodeGen/thinlto_embed_bitcode.ll
The file was modifiedllvm/lib/LTO/LTOBackend.cpp
The file was modifiedclang/lib/CodeGen/CodeGenAction.cpp
The file was modifiedclang/include/clang/CodeGen/BackendUtil.h
The file was modifiedclang/lib/CodeGen/BackendUtil.cpp
The file was modifiedllvm/include/llvm/LTO/LTOBackend.h
Commit 4edb3d3646c46f15ca93bf19ed96a9169143ed6d by dancgr
[AArch64] Avoid pairing loads with same result reg

When pairing ldr instructions to an ldp instruction, we cannot pair two ldr
destination registers where one is a sub or super register of the other.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D86906
The file was modifiedllvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
The file was addedllvm/test/CodeGen/AArch64/aarch64-ldst-subsuperReg-no-ldp.mir
Commit 89c1e35f3c5060c23f9eed409f89c2c9908b87ed by sdi1600105
[LoopInfo] empty() -> isInnermost(), add isOutermost()

Differential Revision: https://reviews.llvm.org/D82895
The file was modifiedllvm/lib/Analysis/LoopInfo.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopDistribute.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopInterchange.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
The file was modifiedllvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
The file was modifiedllvm/lib/Analysis/LoopAccessAnalysis.cpp
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LICM.cpp
The file was modifiedllvm/lib/Analysis/LoopPass.cpp
The file was modifiedllvm/lib/Analysis/LoopCacheAnalysis.cpp
The file was modifiedllvm/lib/Transforms/Utils/LoopPeel.cpp
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopFuse.cpp
The file was modifiedllvm/include/llvm/Analysis/LoopInfoImpl.h
The file was modifiedllvm/lib/Analysis/LoopNestAnalysis.cpp
The file was modifiedllvm/lib/Transforms/Utils/LoopVersioning.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
The file was modifiedllvm/lib/CodeGen/HardwareLoops.cpp
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
The file was modifiedllvm/include/llvm/Analysis/LoopInfo.h
The file was modifiedllvm/lib/Target/Hexagon/HexagonHardwareLoops.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
The file was modifiedllvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
The file was modifiedllvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
Commit 90242caca2074dab5a9b76e5bc36d9fafd2179a7 by rnk
Revert "[CodeGen] emit CG profile for COFF object file"

This reverts commit 91aed9bf975f1e4346cc8f4bdefc98436386ced2, it is
causing link errors.
The file was modifiedllvm/lib/Target/TargetLoweringObjectFile.cpp
The file was modifiedllvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
The file was removedllvm/test/MC/COFF/cgprofile.ll
The file was modifiedllvm/include/llvm/Target/TargetLoweringObjectFile.h
The file was modifiedllvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
Commit a7873e5abc65125087f2ce7ab3a720a113d8ffa5 by sdi1600105
Small fixes for "[LoopInfo] empty() -> isInnermost(), add isOutermost()"
The file was modifiedllvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
The file was modifiedllvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64FalkorHWPFFix.cpp
The file was modifiedllvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
Commit 49f2744931762323dfa5ef96e1baa12bb79d5b9a by i
Change LoopInfo::empty to isInnermost after D82895
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp