Changes

Summary

  1. [RISCV] Use llvm::stable_sort instead of std::stable_sort. NFC (details)
  2. [indvars] Canonicalize exit conditions to unsigned using range info (details)
  3. Extend transform introduced in D111896 to multiple exits (details)
  4. [SCEV] Avoid compile time explosion in ScalarEvolution::isImpliedCond (details)
  5. Revert "Reland [clang] Pass -clear-ast-before-backend in Clang::ConstructJob()" (details)
  6. [SCEV] Fix formatting error introduced by D112080 (details)
  7. [lldb] improve the help strings for gdb-remote and kdp-remote (details)
Commit dc8a5f9419f5cc35fc3c9e8698ba3ebb6a3f974f by craig.topper
[RISCV] Use llvm::stable_sort instead of std::stable_sort. NFC
The file was modifiedclang/utils/TableGen/RISCVVEmitter.cpp
Commit fca0218875f5117110d38b9cd7503bc2789693d3 by listmail
[indvars] Canonicalize exit conditions to unsigned using range info

This patch duplicates a bit of logic we apply to comparisons encountered during the IV users walk to conditions which feed exit conditions. Why? simplifyAndExtend has a very limited list of users it walks. In particular, in the examples is stops at the zext and never visits the icmp. (Because we can't fold the zext to an addrec yet in SCEV.) Being willing to visit when we haven't simplified regresses multiple tests (seemingly because of less optimal results when computing trip counts).

Note that this can be trivially extended to multiple exiting blocks. I'm leaving that to a future patch (solely to cut down on the number of versions of the same code in review at once.)

Differential Revision: https://reviews.llvm.org/D111896
The file was modifiedllvm/test/Transforms/IndVarSimplify/finite-exit-comparisons.ll
The file was modifiedllvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Commit 0836a1059dcf8e4fbf408248bf5eed13dfd93f7b by listmail
Extend transform introduced in D111896 to multiple exits

This is trivial.  It was left out of the original review only because we had multiple copies of the same code in review at the same time, and keeping them in sync was easiest if the structure was kept in sync.
The file was modifiedllvm/lib/Transforms/Scalar/IndVarSimplify.cpp
The file was modifiedllvm/test/Transforms/IndVarSimplify/finite-exit-comparisons.ll
Commit 08619006a0c0694477f143dc1552eab35701e50b by bjorn.a.pettersson
[SCEV] Avoid compile time explosion in ScalarEvolution::isImpliedCond

As seen in PR51869 the ScalarEvolution::isImpliedCond function might
end up spending lots of time when doing the isKnownPredicate checks.

Calling isKnownPredicate for example result in isKnownViaInduction
being called, which might result in isLoopBackedgeGuardedByCond being
called, and then we might get one or more new calls to isImpliedCond.
Even if the scenario described here isn't an infinite loop, using
some random generated C programs as input indicates that those
isKnownPredicate checks quite often returns true. On the other hand,
the third condition that needs to be fulfilled in order to "prove
implications via truncation", i.e. the isImpliedCondBalancedTypes
check, is rarely fulfilled.
I also made some similar experiments to look at how often we would
get the same result when using isKnownViaNonRecursiveReasoning instead
of isKnownPredicate. So far I haven't seen a single case when codegen
is negatively impacted by using isKnownViaNonRecursiveReasoning. On
the other hand, it seems like we get rid of the compile time explosion
seen in PR51869 that way. Hence this patch.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D112080
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
The file was addedllvm/test/Analysis/ScalarEvolution/pr51869-scalar-evolution-prove-implications-via-truncation.ll
Commit 57553ce43281a7c379e375161320cc09d8236839 by zequanwu
Revert "Reland [clang] Pass -clear-ast-before-backend in Clang::ConstructJob()"

This reverts commit 1fb24fe85a19ae71b00875ff6c96ef1831dcf7e3.

This causes clang crash on chromium. See repro at https://bugs.chromium.org/p/chromium/issues/detail?id=1261551#c1.
The file was modifiedclang/lib/Interpreter/Interpreter.cpp
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
Commit 9c44a0996c8cf87607807751be2315020c582c66 by bjorn.a.pettersson
[SCEV] Fix formatting error introduced by D112080

Accidentally pushed D112080 without this clang-format cleanup.
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
Commit 8ac5a6641fa4d742fb4599b485c40700e773f01f by Lawrence D'Anna
[lldb] improve the help strings for gdb-remote and kdp-remote

The help string can be more helpful by explaining these are
aliases for 'process connect'

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D111965
The file was modifiedlldb/source/Interpreter/CommandInterpreter.cpp