SuccessChanges

Summary

  1. [MS] Apply `inreg` to AArch64 sret parms on instance methods (details)
  2. [CGBuiltin] Respect asm labels and redefine_extname for builtins with specialized emitting (details)
  3. Add missing 'override' (details)
  4. [mlir][vector] Add unrolling patterns for Transfer read/write (details)
  5. [GlobalISel] Remove scalar src from non-sequential fadd/fmul reductions. (details)
  6. [AArch64][GlobalISel] NFC: Refactor emitIntegerCompare (details)
  7. [PM/CC1] Add -f[no-]split-cold-code CC1 option to toggle splitting (details)
  8. [mlir] RewriterGen NativeCodeCall matcher with ConstantOp matcher (details)
  9. Switch the default of VerifyIntegerConstantExpression from constant (details)
  10. [MLIR] Fix gcc5 in D89161 (details)
  11. [llvm-cov] don't include all source files when provided source files are filtered out (details)
Commit 5fbab4025eb57b12f2842ab188ff07a110708e1d by rnk
[MS] Apply `inreg` to AArch64 sret parms on instance methods

The documentation rules indicate that instance methods should return
large, trivially copyable aggregates via X1/X0 and not X8 as is normally
done when returning such structs from free functions:
https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=vs-2019#return-values

Fixes PR47836, a bug in the initial implementation of these rules.

I tried to simplify the logic a bit as well while I'm here.

Differential Revision: https://reviews.llvm.org/D89362
The file was modifiedclang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
The file was modifiedclang/lib/CodeGen/MicrosoftCXXABI.cpp
Commit 5a338599fbaa805587227779bde0a9986cb4646d by i
[CGBuiltin] Respect asm labels and redefine_extname for builtins with specialized emitting

rL131311 added `asm()` support for builtin functions, but `asm()` for builtins with
specialized emitting (e.g. memcpy, various math functions) still do not work.

This patch makes these functions work for `asm()` and `#pragma redefine_extname`.
glibc uses `asm()` to redirect internal libc function calls to hidden aliases.

Limitation: such a function is a builtin in clang, but will not be recognized as
a libcall in optimization passes because Clang does not annotate the renamed
function as a libcall.  In GCC -O1 or above, `abs` can be optimized out but we can't.
Additionally, we cannot redirect `__builtin_sin` to `real_sin` in the following example:

  double sin(double x) asm("real_sin");
  double f(double d) { return __builtin_sin(d); }

---

According to @rsmith, the following three statements cannot be simultaneously true:

(1) The frontend function foo has known, builtin semantics X.
(2) The symbol foo has known, builtin semantics X.
(3) It's not correct to lower a call to the frontend function foo to the symbol foo.

People do want (1) (if it is profitable to expand a memcpy, do it).
This also means that people do not want to add -fno-builtin-memcpy.
People do want (3): that is why they use asm("__GI_memcpy") in the first place.

So unfortunately we make a compromise by not refuting (2) (see the limitation above).
For most libcalls, there is a small loss because compilers don't synthesize them.
For the few glibc cares about, it uses `asm("memcpy = __GI_memcpy");` to make
the assembly level redirection.
(Changing function names (e.g. `__memcpy`) is a hit to ergonomics which is not acceptable).

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D88712
The file was modifiedclang/test/CodeGen/asm-label.c
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp
The file was modifiedclang/test/CodeGen/redefine_extname.c
Commit 4c1c88bbc114dc0abd9c2dc5548378d695124c84 by dblaikie
Add missing 'override'
The file was modifiedmlir/tools/mlir-tblgen/TypeDefGen.cpp
Commit edbdea7466d25c5e4d9f73e3043ac87efe433193 by thomasraoux
[mlir][vector] Add unrolling patterns for Transfer read/write

Adding unroll support for transfer read and transfer write operation. This
allows to pick the ideal size for the memory access for a given target.

Differential Revision: https://reviews.llvm.org/D89289
The file was modifiedmlir/include/mlir/Dialect/Vector/VectorTransforms.h
The file was modifiedmlir/lib/Dialect/Vector/VectorTransforms.cpp
The file was addedmlir/test/Dialect/Vector/vector-transfer-unroll.mlir
The file was modifiedmlir/test/lib/Transforms/TestVectorTransforms.cpp
Commit c2551c1f4058d2c3cc4964b1d1d0ca5946036f6c by Amara Emerson
[GlobalISel] Remove scalar src from non-sequential fadd/fmul reductions.

It's probably better to split these into separate G_FADD/G_FMUL + G_VECREDUCE
operations in the translator rather than carrying the scalar around. The
majority of the time it'll get simplified away as the scalars are probably
identity values.

Differential Revision: https://reviews.llvm.org/D89150
The file was modifiedllvm/include/llvm/Target/GenericOpcodes.td
The file was modifiedllvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
The file was modifiedllvm/lib/CodeGen/MachineVerifier.cpp
The file was modifiedllvm/test/MachineVerifier/test_vector_reductions.mir
Commit 609d765cd3b1a4f9558b654dbb1bc7c973f3408b by Jessica Paquette
[AArch64][GlobalISel] NFC: Refactor emitIntegerCompare

Simplify emitIntegerCompare and improve comments + asserts.

Mostly making the code a little easier to follow.

Also, this code is only used for G_ICMP. The legalizer ensures that the LHS/RHS
for every G_ICMP is either a s32 or s64. So, there's no need to handle anything
else. This lets us remove a bunch of checks for whether or not we successfully
emitted the compare.

Differential Revision: https://reviews.llvm.org/D89433
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
Commit 273c299d5d649a0222fbde03c9a41e41913751b4 by Saleem Abdulrasool
[PM/CC1] Add -f[no-]split-cold-code CC1 option to toggle splitting

This patch adds -f[no-]split-cold-code CC1 options to clang. This allows
the splitting pass to be toggled on/off. The current method of passing
`-mllvm -hot-cold-split=true` to clang isn't ideal as it may not compose
correctly (say, with `-O0` or `-Oz`).

To implement the -fsplit-cold-code option, an attribute is applied to
functions to indicate that they may be considered for splitting. This
removes some complexity from the old/new PM pipeline builders, and
behaves as expected when LTO is enabled.

Co-authored by: Saleem Abdulrasool <compnerd@compnerd.org>
Differential Revision: https://reviews.llvm.org/D57265
Reviewed By: Aditya Kumar, Vedant Kumar
Reviewers: Teresa Johnson, Aditya Kumar, Fedor Sergeev, Philip Pfaffe, Vedant Kumar
The file was modifiedllvm/test/Transforms/HotColdSplit/section-splitting-custom.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/apply-successor-penalty.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/addr-taken.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/duplicate-phi-preds-crash.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/outline-cold-asm.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/minsize.ll
The file was modifiedclang/include/clang/Basic/CodeGenOptions.def
The file was modifiedllvm/test/Transforms/HotColdSplit/outline-disjoint-diamonds.ll
The file was modifiedllvm/test/Transforms/CodeExtractor/extract-assume.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/transfer-debug-info.ll
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedllvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.expected
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedllvm/test/Transforms/HotColdSplit/resume.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/stale-assume-in-original-func.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/succ-block-with-self-edge.ll
The file was modifiedclang/include/clang/Basic/DiagnosticFrontendKinds.td
The file was modifiedllvm/test/Transforms/HotColdSplit/retain-section.ll
The file was modifiedllvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.expected
The file was modifiedllvm/test/Other/new-pm-lto-defaults.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/apply-noreturn-bonus.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/update-split-loop-metadata.ll
The file was modifiedllvm/test/Other/opt-hot-cold-split.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/region-overlap.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/split-phis-in-exit-blocks.ll
The file was modifiedllvm/test/Other/opt-O3-pipeline-enable-matrix.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/unwind.ll
The file was modifiedllvm/test/Other/opt-Os-pipeline.ll
The file was modifiedllvm/test/Other/new-pm-defaults.ll
The file was modifiedllvm/test/Other/pass-pipelines.ll
The file was modifiedllvm/include/llvm/Transforms/IPO/HotColdSplitting.h
The file was addedclang/test/Frontend/split-cold-code.c
The file was modifiedllvm/test/Other/opt-O2-pipeline.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
The file was modifiedllvm/test/Other/X86/lto-hot-cold-split.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/eh-typeid-for.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/coldentrycount.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/outline-if-then-else.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/section-splitting-default.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/noreturn.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/opt-pipeline.ll
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp
The file was addedclang/test/CodeGen/split-cold-code.c
The file was modifiedllvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/delete-use-without-def-dbg-val.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/split-out-dbg-label.ll
The file was modifiedllvm/test/Other/new-pm-thinlto-defaults.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/mark-the-whole-func-cold.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/multiple-exits.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
The file was modifiedllvm/test/Other/opt-O3-pipeline.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/X86/do-not-split.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll
The file was modifiedllvm/test/Other/new-pm-pgo.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-1.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/split-out-dbg-val-of-arg.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/swifterror.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/eh-pads.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/outline-multiple-entry-region.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/outline-while-loop.ll
The file was modifiedllvm/test/Transforms/HotColdSplit/split-cold-2.ll
The file was modifiedllvm/lib/Transforms/IPO/PassManagerBuilder.cpp
The file was modifiedllvm/test/Transforms/HotColdSplit/apply-penalty-for-outputs.ll
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
The file was modifiedllvm/lib/Transforms/IPO/HotColdSplitting.cpp
The file was modifiedllvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
The file was modifiedllvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll
Commit 2bf423b0218c9583e3a372950a34facbf93e63d3 by rob.suderman
[mlir] RewriterGen NativeCodeCall matcher with ConstantOp matcher

Added an underlying matcher for generic constant ops. This
included a rewriter of RewriterGen to make variable use more
clear.

Differential Revision: https://reviews.llvm.org/D89161
The file was modifiedmlir/lib/TableGen/Pattern.cpp
The file was modifiedmlir/test/lib/Dialect/Test/TestOps.td
The file was modifiedmlir/include/mlir/IR/OpBase.td
The file was modifiedmlir/include/mlir/TableGen/Pattern.h
The file was addedmlir/test/mlir-tblgen/rewriter-errors.td
The file was modifiedmlir/test/lib/Dialect/Test/TestDialect.cpp
The file was modifiedmlir/test/lib/Dialect/Test/TestPatterns.cpp
The file was modifiedmlir/test/mlir-tblgen/pattern.mlir
The file was modifiedmlir/tools/mlir-tblgen/RewriterGen.cpp
Commit fc031d29bea856f2b91a250fd81c5f9fb79dbe07 by richard
Switch the default of VerifyIntegerConstantExpression from constant
folding to not constant folding.

Constant folding of ICEs is done as a GCC compatibility measure, but new
code was picking it up, presumably by accident, due to the bad default.

While here, also switch the flag from a bool to an enum to make it more
obvious what it means at call sites. This highlighted a couple of places
where our behavior is different between C++11 and C++14 due to switching
from checking for an ICE to checking for a converted constant
expression (where there is no 'fold' codepath).
The file was modifiedclang/lib/Sema/SemaDeclAttr.cpp
The file was modifiedclang/lib/Sema/SemaDecl.cpp
The file was modifiedclang/lib/Sema/SemaOpenMP.cpp
The file was modifiedclang/test/SemaCXX/new-delete.cpp
The file was modifiedclang/lib/Sema/SemaExpr.cpp
The file was modifiedclang/test/SemaCXX/enum.cpp
The file was modifiedclang/lib/Sema/SemaStmt.cpp
The file was modifiedclang/lib/Sema/SemaTemplate.cpp
The file was modifiedclang/lib/Sema/SemaDeclCXX.cpp
The file was modifiedclang/lib/Sema/SemaType.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
The file was modifiedclang/lib/Sema/SemaInit.cpp
The file was modifiedclang/lib/Sema/SemaExceptionSpec.cpp
Commit ad1fe3963f30d0e7ef6796ad90bd4ddb6f7b117b by rob.suderman
[MLIR] Fix gcc5 in D89161

Missing .str() makes gcc5 unable to infer the template to use.

Differential Revision: https://reviews.llvm.org/D89516
The file was modifiedmlir/lib/TableGen/Pattern.cpp
Commit cd3090819c4eac750339496c8b8d3c92f8a3950c by zequanwu
[llvm-cov] don't include all source files when provided source files are filtered out

When all provided source files are filtered out either due to `--ignore-filename-regex` or not part of binary, don't generate coverage reults for all source files. Because if users want to generate coverage results for all source files, they don't even need to provid selected source files or `--ignore-filename-regex`.

Differential Revision: https://reviews.llvm.org/D89359
The file was modifiedllvm/test/tools/llvm-cov/sources-specified.test
The file was modifiedllvm/test/tools/llvm-cov/universal_bin_wrapping_archives.test
The file was modifiedllvm/tools/llvm-cov/CodeCoverage.cpp