SuccessChanges

Summary

  1. GlobalISel: Fix a failing combiner test (details)
  2. [CGSCC][NewPM] Fix adding mutually recursive new functions (details)
  3. [AArch64][GlobalISel] Refactor + improve CMN, ADDS, and ADD emit functions (details)
  4. [LICM] Make Loop ICM profile aware again (details)
  5. SVML support for log10, sqrt (details)
  6. [LowerSwitch][NewPM] Port lowerswitch to NPM (details)
  7. [NewPM] Port strip* passes to NPM (details)
  8. [Hexagon] Replace incorrect pattern for vpackl HWI32 -> HVi8 (details)
Commit 79378b1b757d5c981e60320f5a735f3e356557a0 by vkeles
GlobalISel: Fix a failing combiner test

test/CodeGen/AArch64/GlobalISel/combine-trunc.mir was failing
due to the different order for evaluating function arguments.
This patch updates the related code to fix the issue.
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
Commit 91332c4dbb033f7d1ffa1a9632012d88b08661c4 by aeubanks
[CGSCC][NewPM] Fix adding mutually recursive new functions

When adding a new function via addNewFunctionIntoRefSCC(), it creates a
new node and immediately populates the edges. Since populateSlow() calls
G->get() on all referenced functions, it will create a node (but not
populate it) for functions that haven't yet been added. If we add two
mutually recursive functions, the assert that the node should never have
been created will fire when the second function is added. So here we
remove that assert since the node may have already been created (but not
yet populated).

createNode() is only called from addNewFunctionInto{,Ref}SCC().

https://bugs.llvm.org/show_bug.cgi?id=47502

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D87623
The file was modifiedllvm/lib/Analysis/LazyCallGraph.cpp
The file was modifiedllvm/unittests/Analysis/CGSCCPassManagerTest.cpp
Commit ffe9986de4297fdeddcd0b0b9bac2a28c45f661b by Jessica Paquette
[AArch64][GlobalISel] Refactor + improve CMN, ADDS, and ADD emit functions

These functions were extremely similar:

- `emitADD`
- `emitADDS`
- `emitCMN`

Refactor them a little, introducing a more generic `emitInstr` function to
do most of the work.

Also add support for the immediate + shifted register addressing modes in each
of them.

Update select-uaddo.mir to show that selecing ADDS now supports folding
immediates + shifts. (I don't think this can impact CMN, because the CMN checks
require a G_SUB with a non-constant on the RHS.)

This is around a 0.02% code size improvement on CTMark at -O3.

Differential Revision: https://reviews.llvm.org/D87529
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/select-uaddo.mir
Commit 2c391a5a14aeb34e970aba85c5aa540656fe47ca by aktoon
[LICM] Make Loop ICM profile aware again

D65060 was reverted because it introduced non-determinism by using BFI counts from already freed blocks. The parent of this revision fixes that by using a VH callback on blocks to prevent this from happening and makes sure BFI data is passed correctly in LoopStandardAnalysisResults.

This re-introduces the previous optimization of using BFI data to prevent LICM from hoisting/sinking if the instruction will end up moving to a colder block.

Internally at Facebook this change results in a ~7% win in a CPU related metric in one of our big services by preventing hoisting cold code into a hot pre-header like the added test case demonstrates.

Testing:
ninja check

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87551
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
The file was modifiedllvm/test/Transforms/LICM/sink.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/LoopUtils.h
The file was addedllvm/test/Transforms/LICM/no-hoist-prof.ll
The file was addedllvm/test/Transforms/LICM/Inputs/no-hoist-prof.prof
The file was modifiedllvm/lib/Transforms/Scalar/LICM.cpp
Commit 056534dc2b15ed1d276bead76f054cc7ac9d2bf1 by aktoon
SVML support for log10, sqrt

Although LLVM supports vectorization of loops containing log10/sqrt, it did not support using SVML implementation of it. Added support so that when clang is invoked with -fveclib=SVML now an appropriate SVML library log2 implementation will be invoked.

Follow up on: https://reviews.llvm.org/D77114

Tests:
Added unit tests to svml-calls.ll, svml-calls-finite.ll. Can be run with llvm-lint.
Created a simple c++ file that tests log10/sqrt, and used clang+ to build it, and output final assembly.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D87169
The file was modifiedllvm/test/Transforms/LoopVectorize/X86/svml-calls.ll
The file was modifiedllvm/test/Transforms/Util/add-TLI-mappings.ll
The file was modifiedllvm/test/Transforms/LoopVectorize/X86/svml-calls-finite.ll
The file was modifiedllvm/include/llvm/Analysis/VecFuncs.def
Commit f7aa1563eb5ff00416fba373073ba19832b6fc34 by aeubanks
[LowerSwitch][NewPM] Port lowerswitch to NPM

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D87726
The file was modifiedllvm/lib/Transforms/Utils/UnifyLoopExits.cpp
The file was modifiedllvm/lib/Transforms/Utils/LowerSwitch.cpp
The file was addedllvm/include/llvm/Transforms/Utils/LowerSwitch.h
The file was modifiedllvm/lib/Transforms/Utils/Utils.cpp
The file was modifiedllvm/lib/Transforms/Scalar/StructurizeCFG.cpp
The file was modifiedllvm/lib/Transforms/Utils/FixIrreducible.cpp
The file was modifiedllvm/test/Transforms/LowerSwitch/feature.ll
The file was modifiedllvm/include/llvm/InitializePasses.h
The file was modifiedllvm/lib/Passes/PassRegistry.def
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
Commit ba12e77ec16b38a4498610c6b8cdeb1a7e8a6aae by aeubanks
[NewPM] Port strip* passes to NPM

strip-nondebug and strip-debug-declare have no existing associated tests

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D87639
The file was addedllvm/include/llvm/Transforms/IPO/StripSymbols.h
The file was modifiedllvm/test/Transforms/StripSymbols/2007-01-15-llvm.used.ll
The file was modifiedllvm/lib/Transforms/IPO/StripSymbols.cpp
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
The file was modifiedllvm/lib/Passes/PassRegistry.def
The file was modifiedllvm/test/Transforms/StripSymbols/strip-dead-debug-info.ll
Commit 5f4abb7fab1c6a87f059ed8732fd12b237f4805d by kparzysz
[Hexagon] Replace incorrect pattern for vpackl HWI32 -> HVi8

V6_vdealb4w is not correct for pairs, use V6_vpackeh/V6_vpackeb instead.
The file was modifiedllvm/test/CodeGen/Hexagon/autohvx/isel-widen-truncate-pair.ll
The file was modifiedllvm/lib/Target/Hexagon/HexagonPatternsHVX.td
The file was modifiedllvm/test/CodeGen/Hexagon/autohvx/widen-trunc.ll