SuccessChanges

Summary

  1. Allow empty value list in propagateMetadata(Inst, ArrayOf...) (details)
  2. [unittest] Fix -Wunused-variable after D94717 (details)
  3. [WebAssembly] Use functions instead of macros for const SIMD intrinsics (details)
  4. [SCEV] By more careful when traversing phis in isImpliedViaMerge. (details)
  5. Revert "[DebugInfo] Fix updateDbgUsersToReg to support DBG_VALUE_LIST" (details)
  6. [mlir][docs] remove stale statement about index type in vectors (details)
  7. [mlir] Add a pattern to bufferize linalg.tensor_reshape. (details)
  8. [mlir] Add a pattern to bufferize std.index_cast. (details)
  9. An attempt to abandon omptarget out-of-tree builds. (details)
  10. [RISCV] Consider scalar types for required extensions. (details)
  11. [BareMetal] Ensure that sysroot always comes after library paths (details)
  12. [flang] Implement NORM2 in the runtime (details)
  13. [LV] Rename Region to TargetRegion, similar to SinkRegion (NFC). (details)
  14. [LV] Assert if trying to sink replicate region into another region (NFC) (details)
  15. [SEH] Fix regression with SEH in noexpect functions (details)
  16. [MCA][RegisterFile] Fix register class check for move elimination (PR50265) (details)
  17. [LV] Remove reference of PHI from comment, they are not recorded (NFC). (details)
  18. Revert "[BareMetal] Ensure that sysroot always comes after library paths" (details)
  19. [mlir][vector] Extend pattern to trim lead unit dimension to Splat Op (details)
  20. [mlir] Missed clang-format (details)
  21. [lld/mac] Write every weak symbol only once in the output (details)
  22. [BareMetal] Ensure that sysroot always comes after library paths (details)
  23. Fix the module-enabled build by removing a redundant type definition. (details)
  24. [AArch64][GlobalISel] Legalize narrow type G_CTPOPs (details)
  25. [NewPM] Move analysis invalidation/clearing logging to instrumentation (details)
Commit 50cf0a1d1ae48bd0397b41a400e01c62975b6706 by kparzysz
Allow empty value list in propagateMetadata(Inst, ArrayOf...)

This will allow writing
  propagateMetadata(Inst, collectInterestingValues(...))
without concern about empty lists. In case of an empty list,
Inst is returned without any changes.
The file was modifiedllvm/lib/Analysis/VectorUtils.cpp
Commit 724604901a104d8ba9e48ca0330e164a66c1c7ac by i
[unittest] Fix -Wunused-variable after D94717
The file was modifiedllvm/unittests/Analysis/LoopInfoTest.cpp
Commit 1e9c39a3f982fe2f50cd19c74be8b64dfba4baad by tlively
[WebAssembly] Use functions instead of macros for const SIMD intrinsics

To improve hygiene, consistency, and usability, it would be good to replace all
the macro intrinsics in wasm_simd128.h with functions. The reason for using
macros in the first place was to enforce the use of constants for some arguments
using `_Static_assert` with `__builtin_constant_p`. This commit switches to
using functions and uses the `__diagnose_if__` attribute rather than
`_Static_assert` to enforce constantness.

The remaining macro intrinsics cannot be made into functions until the builtin
functions they are implemented with can be replaced with normal code patterns
because the builtin functions themselves require that their arguments are
constants.

This commit also fixes a bug with the const_splat intrinsics in which the f32x4
and f64x2 variants were incorrectly producing integer vectors.

Differential Revision: https://reviews.llvm.org/D102018
The file was modifiedclang/lib/Headers/wasm_simd128.h
The file was modifiedclang/test/Headers/wasm.c
Commit 6c99e631201aaea0a75708749cbaf2ba08a493f9 by flo
[SCEV] By more careful when traversing phis in isImpliedViaMerge.

I think currently isImpliedViaMerge can incorrectly return true for phis
in a loop/cycle, if the found condition involves the previous value of

Consider the case in exit_cond_depends_on_inner_loop.

At some point, we call (modulo simplifications)
isImpliedViaMerge(<=, %x.lcssa, -1, %call, -1).

The existing code tries to prove IncV <= -1 for all incoming values
InvV using the found condition (%call <= -1). At the moment this succeeds,
but only because it does not compare the same runtime value. The found
condition checks the value of the last iteration, but the incoming value
is from the *previous* iteration.

Hence we incorrectly determine that the *previous* value was <= -1,
which may not be true.

I think we need to be more careful when looking at the incoming values
here. In particular, we need to rule out that a found condition refers to
any value that may refer to one of the previous iterations. I'm not sure
there's a reliable way to do so (that also works of irreducible control
flow).

So for now this patch adds an additional requirement that the incoming
value must properly dominate the phi block. This should ensure the
values do not change in a cycle. I am not entirely sure if will catch
all cases and I appreciate a through second look in that regard.

Alternatively we could also unconditionally bail out in this case,
instead of checking the incoming values

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D101829
The file was modifiedllvm/test/Transforms/IndVarSimplify/eliminate-exit.ll
The file was modifiedllvm/test/Transforms/IRCE/decrementing-loop.ll
The file was modifiedllvm/lib/Analysis/ScalarEvolution.cpp
Commit 7ca26c5fa2df253878cab22e1e2f0d6f1b481218 by aeubanks
Revert "[DebugInfo] Fix updateDbgUsersToReg to support DBG_VALUE_LIST"

This reverts commit 0791f968fee259e5c34523167bd58179b8b081c2.

Causing crashes: https://crbug.com/1206764
The file was removedllvm/test/DebugInfo/ARM/machine-cp-updates-dbg-reg.mir
The file was modifiedllvm/include/llvm/CodeGen/MachineRegisterInfo.h
The file was modifiedllvm/lib/CodeGen/MachineCopyPropagation.cpp
Commit 21db1e3b01402678994a291930eadf82187750c4 by gysit
[mlir][docs] remove stale statement about index type in vectors

b614ada0e8 ("[mlir] add support for index type in vectors.") removed
this limitation.

Differential Revision: https://reviews.llvm.org/D102081
The file was modifiedmlir/include/mlir/IR/BuiltinTypes.td
Commit a3f22d020b2709b2b4897ae3450c33834e646329 by pifon
[mlir] Add a pattern to bufferize linalg.tensor_reshape.

Differential Revision: https://reviews.llvm.org/D102089
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
The file was modifiedmlir/test/Dialect/Linalg/bufferize.mlir
Commit 3444996b4c45f6efdd731100e8ca6c6105407045 by pifon
[mlir] Add a pattern to bufferize std.index_cast.

Differential Revision: https://reviews.llvm.org/D102088
The file was modifiedmlir/lib/Dialect/StandardOps/Transforms/Bufferize.cpp
The file was modifiedmlir/test/Dialect/Standard/bufferize.mlir
Commit f2f88f3e7a110b2d4d9da446e45f0dba040e62b2 by vyacheslav.p.zakharin
An attempt to abandon omptarget out-of-tree builds.

I want to start using LLVM component libraries in libomptarget
to stop duplicating implementations already available in LLVM
(e.g. LLVMObject, LLVMSupport, etc.). Without relying on LLVM
in all libomptarget builds one has to provide fallback implementation
for each used LLVM feature.

This is an attempt to stop supporting out-of-llvm-tree builds of libomptarget.

I understand that I may need to revert this,
if this affects downstream projects in a bad way.

Differential Revision: https://reviews.llvm.org/D101509
The file was modifiedopenmp/README.rst
The file was modifiedopenmp/libomptarget/src/CMakeLists.txt
The file was modifiedopenmp/CMakeLists.txt
The file was modifiedopenmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
The file was modifiedopenmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
Commit c04c66d705b4f6e95a6325ef6d6c647ebc622165 by kai.wang
[RISCV] Consider scalar types for required extensions.

We have vector operations on double vector and float scalar. For
example, vfwadd.wf is such a instruction.

vfloat64m1_t vfwadd_wf(vfloat64m1_t op0, float op1, size_t op2);

We should specify F and D extensions for it.

Differential Revision: https://reviews.llvm.org/D102051
The file was modifiedclang/utils/TableGen/RISCVVEmitter.cpp
Commit 6b00b34b8a05896f79b18a1963811299b83d5b21 by phosek
[BareMetal] Ensure that sysroot always comes after library paths

This addresses an issue introduced in D91559. We would invoke the
compiler with -Lpath/to/lib --sysroot=path/to/sysroot where both
locations contain libraries with the same name, but we expect linker
to pick up the library in path/to/lib since that version is more
specialized. This was the case before D91559 where the sysroot path
would be ignored, but after that change linker would now pick up the
library from the sysroot which resulted in unexpected behavior.

The sysroot path should always come after any user provided library
paths, followed by compiler runtime paths. We want for libraries in user
provided library paths to always take precedence over sysroot libraries.
This matches the behavior of other toolchains used with other targets.

Differential Revision: https://reviews.llvm.org/D102049
The file was modifiedclang/test/Driver/baremetal-sysroot.cpp
The file was modifiedclang/lib/Driver/ToolChains/BareMetal.cpp
Commit 01c78a0b0764e5c254c745a21c35f7950b6c8816 by pklausler
[flang] Implement NORM2 in the runtime

Implement the reduction transformational intrinsic function NORM2 in
the runtime, using infrastructure already in place for MAXVAL & al.

Differential Revision: https://reviews.llvm.org/D102024
The file was modifiedflang/unittests/RuntimeGTest/Reduction.cpp
The file was modifiedflang/runtime/reduction.h
The file was modifiedflang/runtime/extrema.cpp
The file was modifiedflang/runtime/reduction.cpp
Commit 01c26d4e048cf9812e7675cb704c2a4461b68e4c by flo
[LV] Rename Region to TargetRegion, similar to SinkRegion (NFC).

Adjust the name to make it clearer this is the region containing the
target recipe, similar to SinkRegion below.

Suggested post-commit for ccebf7a1096a.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit 337d7652823f59f4613552cebdf81292bf8f393d by flo
[LV] Assert if trying to sink replicate region into another region (NFC)

Currently sinking a replicate region into another replicate region is
not supported. Add an assert, to make the problem more obvious, should
it occur.

Discussed post-commit for ccebf7a1096a.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit c4adc49a1c988e6ea8a340b6245525ef5599812c by rnk
[SEH] Fix regression with SEH in noexpect functions

Commit 5baea0560160a693b19022c5d0ba637b6b46b2d8 set the CurCodeDecl
because it was needed to pass the assert in CodeGenFunction::EmitLValueForLambdaField,
But this was not right to do as CodeGenFunction::FinishFunction passes it to EmitEndEHSpec
and cause corruption of the EHStack.

Revert the part of the commit that changes the CurCodeDecl, and instead
adjust the assert to check for a null CurCodeDecl.

Differential Revision: https://reviews.llvm.org/D102027
The file was modifiedclang/lib/CodeGen/CGException.cpp
The file was modifiedclang/test/CodeGenCXX/exceptions-seh.cpp
The file was modifiedclang/lib/CodeGen/CGExpr.cpp
Commit 3822ac909ead8f41ebc81e382bb01908bf04f407 by andrea.dibiagio
[MCA][RegisterFile] Fix register class check for move elimination (PR50265)

The register file should always check if the destination register is from a
register class that allows move elimination.

Before this change, the check on the register class was only performed in a few
very specific cases. However, it should have always been performed.
This patch fixes the issue.

Note that none of the upstream scheduling models is currently affected by this
bug, so there is no test for it. The issue was found by Roman while working on
the znver3 model. I was able to reproduce the issue locally by tweaking the
btver2 model. I then verified that this patch fixes the issue.
The file was modifiedllvm/lib/MCA/HardwareUnits/RegisterFile.cpp
Commit 75b9997760c69968863740ded6c89d4faf29ca7f by flo
[LV] Remove reference of PHI from comment, they are not recorded (NFC).

The comment incorrectly states that the PHI is recorded. That's not
accurate, only the recipe for the incoming value is recorded.

Suggested post-commit for 4ba8720f8844.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit f97ada27aaf64207a2ffad937ce3ccf009e81bd8 by phosek
Revert "[BareMetal] Ensure that sysroot always comes after library paths"

This reverts commit 6b00b34b8a05896f79b18a1963811299b83d5b21.
The file was modifiedclang/test/Driver/baremetal-sysroot.cpp
The file was modifiedclang/lib/Driver/ToolChains/BareMetal.cpp
Commit d0453a8933a14c9441b2d89e6f934bd1bc243200 by thomasraoux
[mlir][vector] Extend pattern to trim lead unit dimension to Splat Op

Differential Revision: https://reviews.llvm.org/D102091
The file was modifiedmlir/lib/Dialect/Vector/VectorTransforms.cpp
The file was modifiedmlir/test/Dialect/Vector/vector-transforms.mlir
Commit b90b66bcbe3ec909d386d3d546cd116099619641 by thomasraoux
[mlir] Missed clang-format
The file was modifiedmlir/lib/Dialect/Vector/VectorTransforms.cpp
Commit d5a70db1938c06380bdab033b7d47a7437914f4c by thakis
[lld/mac] Write every weak symbol only once in the output

Before this, if an inline function was defined in several input files,
lld would write each copy of the inline function the output. With this
patch, it only writes one copy.

Reduces the size of Chromium Framework from 378MB to 345MB (compared
to 290MB linked with ld64, which also does dead-stripping, which we
don't do yet), and makes linking it faster:

        N           Min           Max        Median           Avg        Stddev
    x  10     3.9957051     4.3496981     4.1411121      4.156837    0.10092097
    +  10      3.908154      4.169318     3.9712729     3.9846753   0.075773012
    Difference at 95.0% confidence
            -0.172162 +/- 0.083847
            -4.14165% +/- 2.01709%
            (Student's t, pooled s = 0.0892373)

Implementation-wise, when merging two weak symbols, this sets a
"canOmitFromOutput" on the InputSection belonging to the weak symbol not put in
the symbol table. We then don't write InputSections that have this set, as long
as they are not referenced from other symbols. (This happens e.g. for object
files that don't set .subsections_via_symbols or that use .alt_entry.)

Some restrictions:
- not yet done for bitcode inputs
- no "comdat" handling (`kindNoneGroupSubordinate*` in ld64) --
  Frame Descriptor Entries (FDEs), Language Specific Data Areas (LSDAs)
  (that is, catch block unwind information) and Personality Routines
  associated with weak functions still not stripped. This is wasteful,
  but harmless.
- However, this does strip weaks from __unwind_info (which is needed for
  correctness and not just for size)
- This nopes out on InputSections that are referenced form more than
  one symbol (eg from .alt_entry) for now

Things that work based on symbols Just Work:
- map files (change in MapFile.cpp is no-op and not needed; I just
  found it a bit more explicit)
- exports

Things that work with inputSections need to explicitly check if
an inputSection is written (e.g. unwind info).

This patch is useful in itself, but it's also likely also a useful foundation
for dead_strip.

I used to have a "canoncialRepresentative" pointer on InputSection instead of
just the bool, which would be handy for ICF too. But I ended up not needing it
for this patch, so I removed that again for now.

Differential Revision: https://reviews.llvm.org/D102076
The file was modifiedlld/MachO/UnwindInfoSection.cpp
The file was modifiedlld/MachO/Writer.cpp
The file was modifiedlld/MachO/Symbols.h
The file was modifiedlld/MachO/InputSection.h
The file was modifiedlld/MachO/SymbolTable.cpp
The file was modifiedlld/MachO/InputFiles.cpp
The file was addedlld/test/MachO/weak-definition-gc.s
The file was modifiedlld/MachO/InputSection.cpp
The file was modifiedlld/MachO/MapFile.cpp
Commit 167906c10932f5eda97b480ee084b17746c362e7 by phosek
[BareMetal] Ensure that sysroot always comes after library paths

This addresses an issue introduced in D91559. We would invoke the
compiler with -Lpath/to/lib --sysroot=path/to/sysroot where both
locations contain libraries with the same name, but we expect linker
to pick up the library in path/to/lib since that version is more
specialized. This was the case before D91559 where the sysroot path
would be ignored, but after that change linker would now pick up the
library from the sysroot which resulted in unexpected behavior.

The sysroot path should always come after any user provided library
paths, followed by compiler runtime paths. We want for libraries in user
provided library paths to always take precedence over sysroot libraries.
This matches the behavior of other toolchains used with other targets.

Differential Revision: https://reviews.llvm.org/D102049
The file was modifiedclang/test/Driver/baremetal.cpp
The file was modifiedclang/lib/Driver/ToolChains/BareMetal.cpp
Commit c6ddf669dcf379360e97a557e13617435d3c78cc by Adrian Prantl
Fix the module-enabled build by removing a redundant type definition.
The file was modifiedllvm/lib/Transforms/IPO/PassManagerBuilder.cpp
Commit 1312852040b3190a6cb7d7c1f61fe95a5e930d8d by Jessica Paquette
[AArch64][GlobalISel] Legalize narrow type G_CTPOPs

Using `clampScalar` here because we ought to mark s128 as custom eventually.

(Right now, it will just fall back.)

With this legalization, we get the same code as SDAG:
https://godbolt.org/z/TneoPKrKG

Differential Revision: https://reviews.llvm.org/D100908
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/legalize-ctpop.mir
Commit 6f7131002b6a821fc9b245ec5179910f171e3358 by aeubanks
[NewPM] Move analysis invalidation/clearing logging to instrumentation

We're trying to move DebugLogging into instrumentation, rather than
being part of PassManagers/AnalysisManagers.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D102093
The file was modifiedllvm/lib/Passes/StandardInstrumentations.cpp
The file was modifiedllvm/include/llvm/IR/PassManager.h
The file was modifiedllvm/unittests/IR/PassBuilderCallbacksTest.cpp
The file was modifiedllvm/include/llvm/IR/PassManagerImpl.h
The file was modifiedllvm/tools/opt/NewPMDriver.cpp
The file was modifiedllvm/include/llvm/CodeGen/MachinePassManager.h
The file was modifiedllvm/lib/LTO/LTOBackend.cpp
The file was modifiedllvm/unittests/IR/PassManagerTest.cpp
The file was modifiedllvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp
The file was modifiedclang/lib/CodeGen/BackendUtil.cpp
The file was modifiedllvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll
The file was modifiedllvm/unittests/CodeGen/PassManagerTest.cpp
The file was modifiedllvm/unittests/Analysis/CGSCCPassManagerTest.cpp
The file was modifiedllvm/include/llvm/IR/PassInstrumentation.h