SuccessChanges

Summary

  1. [NFC][regalloc] Simplify/conform to style guide indvars in Greedy (details)
  2. Version 0.5 of the new "TableGen Backend Developer's Guide." (details)
  3. [Analyzer][WebKit] UncountedLocalVarsChecker (details)
  4. [gn build] Port 848d66fafd2 (details)
  5. [gn build] Port 8a64689e264 (details)
  6. [clang] Fix a typo-correction crash (details)
  7. [test][MC] Rehabilitate llvm/test/MC/COFF/bigobj.py (details)
  8. [NFC] Replace tabs with spaces in PPCInstrPrefix.td (details)
  9. [InstCombine] For pow(x, +/-0.5), stop falling into pow(x, 1.5), etc. case (details)
  10. [lldb] Skip test_common_completion_process_pid_and_name with reproducers (details)
  11. [lldb] Skip TestMiniDumpUUID with reproducers (details)
  12. [LoopInfo][NewPM] Fix tests in Analysis/LoopInfo under NPM (details)
  13. [test][NewPM] Pin do-nothing-intrinsic.ll to legacy PM (details)
  14. [NFC][CVP] Add tests for srem with potentially different sigdness domains (details)
  15. [CVP] Enhance SRem -> URem fold to work not just on non-negative operands (details)
  16. [ConstantRange] binaryXor(): special-case binary complement case - the result is precise (details)
  17. [ConstantRange] Introduce getActiveBits() method (details)
  18. [NFC][CVP] processUDivOrURem(): refactor to use ConstantRange::getActiveBits() (details)
  19. [NFC][APInt] Refactor getMinSignedBits() in terms of getNumSignBits() (details)
  20. [ConstantRange] Introduce getMinSignedBits() method (details)
  21. [NFC][CVP] Give a better name STATISTIC() counting udiv i16 -> udiv i8 xforms (details)
  22. [NFC][CVP] Add tests for SDiv/SRem narrowing (details)
  23. [CVP] Narrow SDiv/SRem to the smallest power-of-2 that's sufficient to contain its operands (details)
  24. Implement a new kind of Pass: dynamic pass pipeline (details)
  25. Revert "[lldb] XFAIL TestMemoryHistory on Linux" (details)
  26. [flang][msvc] Add explicit function template argument to applyFunction. NFC. (details)
  27. [flang][msvc] Add explicit function template argument to applyLamda. NFC. (details)
  28. [flang][msvc] Explicitly reference "this" inside closure. NFC. (details)
Commit d1e0f9f3cf13e071d788149bde810c46cd14c74b by mtrofin
[NFC][regalloc] Simplify/conform to style guide indvars in Greedy

Differential Revision: https://reviews.llvm.org/D88055
The file was modifiedllvm/lib/CodeGen/RegAllocGreedy.cpp
Commit 848d66fafd2ee4c15292fa5dd25ca752a3f65537 by paul
Version 0.5 of the new "TableGen Backend Developer's Guide."
Files modified to take comments into account.
MLIR documentation updated for new TableGen documentation files.
The file was modifiedmlir/docs/Tutorials/QuickstartRewrites.md
The file was modifiedmlir/docs/OpDefinitions.md
The file was modifiedllvm/docs/TableGen/ProgRef.rst
The file was addedllvm/lib/TableGen/TableGenBackendSkeleton.cpp
The file was modifiedllvm/lib/TableGen/CMakeLists.txt
The file was addedllvm/docs/TableGen/BackGuide.rst
The file was modifiedllvm/docs/TableGen/BackEnds.rst
Commit 8a64689e264ce039e4fb0a09c3e136a1c8451838 by Jan Korous
[Analyzer][WebKit] UncountedLocalVarsChecker

Differential Review: https://reviews.llvm.org/D83259
The file was modifiedclang/include/clang/StaticAnalyzer/Checkers/Checkers.td
The file was modifiedclang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
The file was addedclang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp
The file was modifiedclang/docs/analyzer/checkers.rst
The file was addedclang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
Commit a75f75415aaeee4159c1771d946bb4ae957d7a74 by llvmgnsyncbot
[gn build] Port 848d66fafd2
The file was modifiedllvm/utils/gn/secondary/llvm/lib/TableGen/BUILD.gn
Commit 5ae94047bff1e2c92f9507443bf97ff39ee8243b by llvmgnsyncbot
[gn build] Port 8a64689e264
The file was modifiedllvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
Commit 16ca711803300bd966acf8759876a1ccd478c616 by hokein.wu
[clang] Fix a typo-correction crash

We leave a dangling TypoExpr when typo-correction is performed
successfully in `checkArgsForPlaceholders`, which leads a crash in the
later TypoCorrection.

This code was added in https://github.com/llvm/llvm-project/commit/1586782767938df3a20f7abc4d8335c48b100bc4,
and it didn't seem to have enough test coverage.
The fix is to remove this part, and no failuer tests.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D87815
The file was modifiedclang/test/SemaCXX/typo-correction-crash.cpp
The file was modifiedclang/lib/Sema/SemaExpr.cpp
Commit a6f8aeb51c731ce01b995725cbda3f9be9059ab0 by hubert.reinterpretcast
[test][MC] Rehabilitate llvm/test/MC/COFF/bigobj.py

The subject test was not actually running. This patch adds the
relevant suffix to the list of lit case filename extensions for the
enclosing directory.

Minor adjustments are also made to deal with bit rot.

Reviewed By: daltenty

Differential Revision: https://reviews.llvm.org/D87122
The file was modifiedllvm/test/MC/COFF/bigobj.py
The file was modifiedllvm/test/MC/COFF/lit.local.cfg
Commit b0f58aa116a1ac2c2fa6b1667017bb29b3418411 by hubert.reinterpretcast
[NFC] Replace tabs with spaces in PPCInstrPrefix.td
The file was modifiedllvm/lib/Target/PowerPC/PPCInstrPrefix.td
Commit 6801950192ff4f6d60c822fc721354f34e609e7a by hubert.reinterpretcast
[InstCombine] For pow(x, +/-0.5), stop falling into pow(x, 1.5), etc. case

The current code for handling pow(x, y) where y is an integer plus 0.5
is not explicitly guarded against attempting to transform the case where
abs(y) is exactly 0.5.

The latter case is meant to be handled by `replacePowWithSqrt`. Indeed,
if the pow(x, integer+0.5) case proceeds past a certain point, it will
hit an assertion by attempting to form pow(x, 0) using `getPow`.

This patch adds an explicit check to prevent attempting the
pow(x, integer+0.5) transformation on pow(x, +/-0.5) as suggested during
the review of D87877. This has the effect of retaining the shrinking of
`pow` to `powf` when the `sqrt` libcall cannot be formed.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D88066
The file was modifiedllvm/test/Transforms/InstCombine/pow-4.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
Commit 8457ae0d9359590b2db1e8e090531197be4d62c6 by Jonas Devlieghere
[lldb] Skip test_common_completion_process_pid_and_name with reproducers

This test launches a subprocess which will have a different PID during
capture and replay.
The file was modifiedlldb/test/API/functionalities/completion/TestCompletion.py
Commit 783dc7dc7ed7487d0782c2feb8854df949b98e69 by Jonas Devlieghere
[lldb] Skip TestMiniDumpUUID with reproducers

The modules not getting orphaned is wreaking havoc when the UUIDs match
between tests.
The file was modifiedlldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
Commit a5141b83f1f1b94886d17c9091f09d4c63568dd2 by aeubanks
[LoopInfo][NewPM] Fix tests in Analysis/LoopInfo under NPM
The file was modifiedllvm/test/Analysis/LoopInfo/annotated-parallel-simple.ll
The file was modifiedllvm/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll
The file was modifiedllvm/test/Analysis/LoopInfo/annotated-parallel-complex.ll
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/lib/IR/ConstantRange.cpp
The file was modifiedllvm/include/llvm/IR/ConstantRange.h
The file was modifiedllvm/unittests/IR/ConstantRangeTest.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/lib/IR/ConstantRange.cpp
The file was modifiedllvm/unittests/IR/ConstantRangeTest.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/srem.ll
The file was modifiedllvm/test/Transforms/CorrelatedValuePropagation/sdiv.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/lib/Pass/Pass.cpp
The file was modifiedmlir/include/mlir/Pass/PassManager.h
The file was modifiedmlir/include/mlir/Pass/Pass.h
The file was addedmlir/test/Pass/dynamic-pipeline.mlir
The file was addedmlir/test/Pass/dynamic-pipeline-nested.mlir
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 addedmlir/test/lib/Transforms/TestDynamicPipeline.cpp
The file was modifiedmlir/test/lib/Transforms/CMakeLists.txt
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