platform/upstream/llvm.git
2 years ago[BOLT] Testcase to repro R_X86_64_REX_GOTPCRELX bug
Rafael Auler [Thu, 17 Feb 2022 01:01:19 +0000 (17:01 -0800)]
[BOLT] Testcase to repro R_X86_64_REX_GOTPCRELX bug

Add a new testcase that reproduces a bug when BOLTing current
trunk LLD bootstrapped with trunk clang. This makes it official
that we do not support this transformation but are working on
it. When the support is ready, XFAIL should be removed.

Reviewed By: maksfb, Amir, yota9

Differential Revision: https://reviews.llvm.org/D125843

2 years ago[SPIRV] Add simple tests to improve test coverage
Andrey Tretyakov [Fri, 13 May 2022 10:48:23 +0000 (13:48 +0300)]
[SPIRV] Add simple tests to improve test coverage

Differential Revision: https://reviews.llvm.org/D125404

2 years ago[Analysis] Avoid virtual dtor. NFC.
Michael Kruse [Wed, 18 May 2022 22:03:03 +0000 (17:03 -0500)]
[Analysis] Avoid virtual dtor. NFC.

Replace virtual destructor by a protected non-virtual one. Additionally also making derived structs as virtual avoids the warning from reappearing.

Also see the mailing list discussion: https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20220516/1038290.html

Reviewed By: dblaikie, YangKeao

Differential Revision: https://reviews.llvm.org/D125830

2 years ago[Debuginfod] Fix shared libs build break after eafa0530417e
Nemanja Ivanovic [Wed, 18 May 2022 22:31:38 +0000 (17:31 -0500)]
[Debuginfod] Fix shared libs build break after eafa0530417e

The commit added a dependency on LLVMSymbolize but the
CMakeLists.txt file wasn't updated. This doesn't cause
issues for static libraries builds but breaks the shared
libraries build. This just adds the missing dependency.

2 years ago[RISCV] Add a test case where mutation still violates strict asserts in InsertVSETVLI
Philip Reames [Wed, 18 May 2022 21:45:38 +0000 (14:45 -0700)]
[RISCV] Add a test case where mutation still violates strict asserts in InsertVSETVLI

This is the test which triggered my disabling of the assert in d4545e6.  The
issue it reveals is basically the same as from cc0283a6, but in the cross
block case.

We visit block1, mutate the setvli (correctly), and then visit block two and
ask whether the vadd is compatible with the block state.  Before mutation, it
wasn't.  After mutation, it is.  And thus, we have our phase 1 vs 3 difference.

2 years ago[Sanitizers][Darwin] Rename Apple macro SANITIZER_MAC -> SANITIZER_APPLE
Mariusz Borsa [Mon, 9 May 2022 18:34:22 +0000 (11:34 -0700)]
[Sanitizers][Darwin] Rename Apple macro  SANITIZER_MAC -> SANITIZER_APPLE

Initial introduction of the new macro before obsoleting the old one - the old name was really confusing.
Also moved SANITIZER_WATCHOS and SANITIZER_TVOS definitions under common #if defined(__APPLE__) block

Differential Revision: https://reviews.llvm.org/D125816

2 years ago[Analyzer] Remove extra space from NSErrorChecker message.
Usama Hameed [Wed, 18 May 2022 21:26:40 +0000 (14:26 -0700)]
[Analyzer] Remove extra space from NSErrorChecker message.

Differential Revision: https://reviews.llvm.org/D125840

2 years ago[libc][windows] fix strlcpy tests
Michael Jones [Wed, 18 May 2022 18:42:07 +0000 (11:42 -0700)]
[libc][windows] fix strlcpy tests

Generally, size_t is an alias for unsigned long long. In the strlcpy
tests, the return value of strlcpy (a size_t) is compared to an unsigned
long. On Linux unsigned long and unsigned long long are both 64 bits,
but on windows unsigned long is 32 bits. Since the macros require
identical types for both sides, this caused a build failure on windows.
This patch changes the constants to be explicit size_t values.

Differential Revision: https://reviews.llvm.org/D125917

2 years ago[NFCI] clang-format gwp-asan files.
Mitch Phillips [Wed, 18 May 2022 21:10:12 +0000 (14:10 -0700)]
[NFCI] clang-format gwp-asan files.

2 years ago[mlir] Fix the error message for missing explicit TypeID
Mogball [Wed, 18 May 2022 21:06:47 +0000 (21:06 +0000)]
[mlir] Fix the error message for missing explicit TypeID

Summary:

The error message was incorrect

Reviewers: rriddle

Subscribers:

2 years ago[NFCI] clang-format scudo standalone
Mitch Phillips [Wed, 18 May 2022 21:04:04 +0000 (14:04 -0700)]
[NFCI] clang-format scudo standalone

2 years agoReland "[dwarf] Emit a DIGlobalVariable for constant strings."
Mitch Phillips [Wed, 18 May 2022 20:39:59 +0000 (13:39 -0700)]
Reland "[dwarf] Emit a DIGlobalVariable for constant strings."

An upcoming patch will extend llvm-symbolizer to provide the source line
information for global variables. The goal is to move AddressSanitizer
off of internal debug info for symbolization onto the DWARF standard
(and doing a clean-up in the process). Currently, ASan reports the line
information for constant strings if a memory safety bug happens around
them. We want to keep this behaviour, so we need to emit debuginfo for
these variables as well.

Reviewed By: dblaikie, rnk, aprantl

Differential Revision: https://reviews.llvm.org/D123534

2 years ago[SLP]Improve reductions vectorization.
Alexey Bataev [Tue, 5 Oct 2021 12:55:48 +0000 (05:55 -0700)]
[SLP]Improve reductions vectorization.

The pattern matching and vectgorization for reductions was not very
effective. Some of of the possible reduction values were marked as
external arguments, SLP could not find some reduction patterns because
of too early attempt to vectorize pair of binops arguments, the cost of
consts reductions was not correct. Patch addresses these issues and
improves the analysis/cost estimation and vectorization of the
reductions.

The most significant changes in SLP.NumVectorInstructions:

Metric: SLP.NumVectorInstructions                                                                                                                                                                                                 [140/14396]

Program                                                                                        results  results0 diff
               test-suite :: SingleSource/Benchmarks/Adobe-C++/loop_unroll.test   920.00  3548.00 285.7%
                test-suite :: SingleSource/Benchmarks/BenchmarkGame/n-body.test    66.00   122.00  84.8%
      test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C/miniGMG/miniGMG.test   100.00   128.00  28.0%
 test-suite :: MultiSource/Benchmarks/Prolangs-C/TimberWolfMC/timberwolfmc.test   664.00   810.00  22.0%
                 test-suite :: MultiSource/Benchmarks/mafft/pairlocalalign.test   592.00   687.00  16.0%
  test-suite :: MultiSource/Benchmarks/MiBench/consumer-lame/consumer-lame.test   402.00   426.00   6.0%
                   test-suite :: MultiSource/Applications/JM/lencod/lencod.test  1665.00  1745.00   4.8%
  test-suite :: External/SPEC/CINT2017rate/500.perlbench_r/500.perlbench_r.test   135.00   139.00   3.0%
 test-suite :: External/SPEC/CINT2017speed/600.perlbench_s/600.perlbench_s.test   135.00   139.00   3.0%
                  test-suite :: MultiSource/Benchmarks/7zip/7zip-benchmark.test   388.00   397.00   2.3%
                   test-suite :: MultiSource/Applications/JM/ldecod/ldecod.test   895.00   914.00   2.1%
    test-suite :: MultiSource/Benchmarks/MiBench/telecomm-gsm/telecomm-gsm.test   240.00   244.00   1.7%
           test-suite :: MultiSource/Benchmarks/mediabench/gsm/toast/toast.test   240.00   244.00   1.7%
             test-suite :: External/SPEC/CINT2017speed/602.gcc_s/602.gcc_s.test   820.00   832.00   1.5%
              test-suite :: External/SPEC/CINT2017rate/502.gcc_r/502.gcc_r.test   820.00   832.00   1.5%
       test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 14804.00 14914.00   0.7%
                        test-suite :: MultiSource/Benchmarks/Bullet/bullet.test  8125.00  8183.00   0.7%
           test-suite :: External/SPEC/CINT2017speed/625.x264_s/625.x264_s.test  1330.00  1338.00   0.6%
            test-suite :: External/SPEC/CINT2017rate/525.x264_r/525.x264_r.test  1330.00  1338.00   0.6%
         test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test  9832.00  9880.00   0.5%
         test-suite :: External/SPEC/CFP2017rate/511.povray_r/511.povray_r.test  5267.00  5291.00   0.5%
       test-suite :: External/SPEC/CFP2017rate/538.imagick_r/538.imagick_r.test  4018.00  4024.00   0.1%
      test-suite :: External/SPEC/CFP2017speed/638.imagick_s/638.imagick_s.test  4018.00  4024.00   0.1%
              test-suite :: External/SPEC/CFP2017speed/644.nab_s/644.nab_s.test   426.00   424.00  -0.5%
               test-suite :: External/SPEC/CFP2017rate/544.nab_r/544.nab_r.test   426.00   424.00  -0.5%
          test-suite :: External/SPEC/CINT2017rate/541.leela_r/541.leela_r.test   201.00   192.00  -4.5%
         test-suite :: External/SPEC/CINT2017speed/641.leela_s/641.leela_s.test   201.00   192.00  -4.5%

644.nab_s and 544.nab_r - reduced number of shuffles but increased number
of useful vectorized instructions.

641.leela_s and 541.leela_r - the function
`@_ZN9FastBoard25get_pattern3_augment_specEiib` is not inlined anymore
but its body gets vectorized successfully. Before, the function was
inlined twice and vectorized just after inlining, currently it is not
required. The vector code looks pretty similar, just like as it was before.

Differential Revision: https://reviews.llvm.org/D111574

2 years ago[SystemZ][z/OS] Add missing include to llvm/include/llvm/BinaryFormat/GOFF.h
Yusra Syeda [Wed, 18 May 2022 19:57:05 +0000 (15:57 -0400)]
[SystemZ][z/OS] Add missing include to llvm/include/llvm/BinaryFormat/GOFF.h
Differential Revision: https://reviews.llvm.org/D125921

2 years ago[clang-tidy] Fix readability-simplify-boolean-expr when Ifs have an init statement...
Nathan James [Wed, 18 May 2022 19:47:36 +0000 (20:47 +0100)]
[clang-tidy] Fix readability-simplify-boolean-expr when Ifs have an init statement or condition variable

Fixes https://github.com/llvm/llvm-project/issues/55553.

Reviewed By: LegalizeAdulthood

Differential Revision: https://reviews.llvm.org/D125874

2 years ago[libc++][CI] fixed a return curr_symbol() for Russian in the libcxx/test/support...
zhijian [Wed, 18 May 2022 19:46:52 +0000 (15:46 -0400)]
[libc++][CI] fixed a return curr_symbol() for Russian in the libcxx/test/support/locale_helpers.h for AIX

Summary:

fixed a return curr_symbol() for Russian in the libcxx/test/support/locale_helpers.h for AIX

Reviewers:  David Tenty,Mark de Wever
Differential Revision: https://reviews.llvm.org/D125801

2 years agoFix some -Wstrict-prototypes issues in ORC examples
David Blaikie [Wed, 18 May 2022 19:42:07 +0000 (19:42 +0000)]
Fix some -Wstrict-prototypes issues in ORC examples

2 years ago[Driver] Refactor /opt/rh detection
Fangrui Song [Wed, 18 May 2022 19:40:27 +0000 (12:40 -0700)]
[Driver] Refactor /opt/rh detection

Check /opt/rh first to avoid `/opt/rh/*` newfstatat/etc calls on other
distributions.

2 years ago[GISel] Add new combines for G_FMINNUM/MAXNUM and G_FMINIMUM/MAXIMUM
Michael Kitzan [Tue, 17 May 2022 00:22:50 +0000 (17:22 -0700)]
[GISel] Add new combines for G_FMINNUM/MAXNUM and G_FMINIMUM/MAXIMUM

I noticed https://reviews.llvm.org/D87415 added SDAG combines to fold
FMIN/MAX instrs with NaNs.

The patch implements the same NaN combines for GISel GMIR FMIN/MAX opcodes:
G_FMINNUM(X, NaN) -> X
G_FMAXNUM(X, NaN) -> X
G_FMINIMUM(X, NaN) -> NaN
G_FMAXIMUM(X, NaN) -> NaN

The patch adds AArch64 tests for these combines as well.

Reviewed by: arsenm

Differential revision: https://reviews.llvm.org/D125819

2 years ago[InstCombine] allow variable shift amount in bswap + shift fold
Sanjay Patel [Wed, 18 May 2022 18:34:48 +0000 (14:34 -0400)]
[InstCombine] allow variable shift amount in bswap + shift fold

When shifting by a byte-multiple:
bswap (shl X, Y) --> lshr (bswap X), Y
bswap (lshr X, Y) --> shl (bswap X), Y

This was limited to constants as a first step in D122010 / 60820e53ec9d3be02 ,
but issue #55327 shows a source example (and there's a test based on that here)
where a variable shift amount is used in this pattern.

2 years ago[InstCombine] add tests for bswap with shift op; NFC
Sanjay Patel [Wed, 18 May 2022 17:35:48 +0000 (13:35 -0400)]
[InstCombine] add tests for bswap with shift op; NFC

issue #55327

2 years ago[llvm-readobj] Improve printing of Windows ARM packed unwind info
Martin Storsjö [Mon, 22 Nov 2021 12:13:01 +0000 (14:13 +0200)]
[llvm-readobj] Improve printing of Windows ARM packed unwind info

Fix a couple minor details in the existing logic for calculating
saved registers and stack adjustment.

Synthesize the corresponding prologues and epilogues and print them.
(This supersedes the previous printout of one single list of stored
registers; as there's lots of minor nuance differences in how
registers are pushed/popped in various corner cases, it's better to
print the full prologue/epilogue instead of trying to condense it
into one single list.)

Print the raw values of the fields Reg, R, L (LinkRegister) and C
(Chaining) instead of only printing the derived values.

Differential Revision: https://reviews.llvm.org/D125644

2 years ago[gn build] Port 4d8268fbf4cd
LLVM GN Syncbot [Wed, 18 May 2022 18:23:14 +0000 (18:23 +0000)]
[gn build] Port 4d8268fbf4cd

2 years ago[libc] fix missing semicolon in bsd_ext.td
Michael Jones [Wed, 18 May 2022 18:17:11 +0000 (11:17 -0700)]
[libc] fix missing semicolon in bsd_ext.td

Fix typo in previous commit

Differential Revision: https://reviews.llvm.org/D125913

2 years ago[CMake][Fuchsia] Build runtimes as universal libraries on OS X
Petr Hosek [Wed, 18 May 2022 17:09:23 +0000 (17:09 +0000)]
[CMake][Fuchsia] Build runtimes as universal libraries on OS X

We want to build libunwind, libc++abi and libc++ as universal libraries
supporting both x86_64 and arm64 architectures.

Differential Revision: https://reviews.llvm.org/D125908

2 years ago[libc++][format][5/6] Improve format_to_n.
Mark de Wever [Sun, 26 Sep 2021 15:04:53 +0000 (17:04 +0200)]
[libc++][format][5/6] Improve format_to_n.

Use a specialized buffer wrapper to limit the number of insertions in the
buffer. After the limit has been reached the buffer only needs to count
the number of insertions to return the buffer size required to store the
entire output.

Depends on D110498

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D110499

2 years ago[SystemZ][z/OS] Add the PPA1 to SystemZAsmPrinter
Yusra Syeda [Wed, 18 May 2022 17:05:11 +0000 (13:05 -0400)]
[SystemZ][z/OS] Add the PPA1 to SystemZAsmPrinter

Differential Revision: https://reviews.llvm.org/D125725

2 years ago[libc++][format] Improve format-arg-store.
Mark de Wever [Sun, 3 Oct 2021 11:11:53 +0000 (13:11 +0200)]
[libc++][format] Improve format-arg-store.

This optimizes the __format_arg_store type to allow a more efficient
storage of the basic_format_args.

It stores the data in two arrays:
- A struct with the tag of the exposition only variant's type and the
  offset of the element in the data array. Since this array only depends
  on the type information it's calculated at compile time and can be
  shared by different instances of this class.
- The arguments converted to the types used in the exposition only
  variant of basic_format_arg. This means the packed data can be
  directly copied to an element of this variant.

The new code uses rvalue reference arguments in preparation for P2418.
The handle class also has some changes to prepare for P2418. The real
changed for P2418 will be done separately, but these parts make it
easier to implement that paper.

Some parts of existing test code are removed since they were no longer
valid after the changes, but new tests have been added.

Implements parts of:
- P2418 Add support for std::generator-like types to std::format

Completes:
- LWG3473 Normative encouragement in non-normative note

Depends on D121138

Reviewed By: #libc, vitaut, Mordante

Differential Revision: https://reviews.llvm.org/D121514

2 years ago[libc++][format] Adds formatter<charT[N], charT>.
Mark de Wever [Sat, 29 Jan 2022 19:15:11 +0000 (20:15 +0100)]
[libc++][format] Adds formatter<charT[N], charT>.

This formatter isn't in the list of required formatters in

[format.formatter.spec]/2.2
  For each charT, the string type specializations
   template<> struct formatter<charT*, charT>;
  template<> struct formatter<const charT*, charT>;
  template<size_t N> struct formatter<const charT[N], charT>;
  template<class traits, class Allocator>
    struct formatter<basic_string<charT, traits, Allocator>, charT>;
  template<class traits>
    struct formatter<basic_string_view<charT, traits>, charT>;

Since remove_cvref_t<const charT[N]> is charT[N] the formatter is
required by

[format.functions]/25
  Preconditions: formatter<remove_cvref_t<Ti>, charT> meets the
  BasicFormatter requirements ([formatter.requirements]) for each Ti in
  Args.

Depends on D120921

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D121138

2 years ago[gn build] Port 15c809e8e780
LLVM GN Syncbot [Wed, 18 May 2022 18:05:17 +0000 (18:05 +0000)]
[gn build] Port 15c809e8e780

2 years ago[libc++][format] Adds a formattable concept.
Mark de Wever [Sun, 30 Jan 2022 15:08:19 +0000 (16:08 +0100)]
[libc++][format] Adds a formattable concept.

The concept is based on P2286R2 Formatting Ranges. It will be used to
optimise the storage of __format_arg_store as required by LWG-3473.

Depends on D120916

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D120921

2 years ago[libc] Add String to bsd headers
Alex Brachet [Wed, 18 May 2022 18:01:02 +0000 (18:01 +0000)]
[libc] Add String to bsd headers

2 years ago[libc] Add strlcpy
Alex Brachet [Wed, 18 May 2022 17:45:05 +0000 (17:45 +0000)]
[libc] Add strlcpy

Differential Revision: https://reviews.llvm.org/D125806

2 years ago[MC] [Win64EH] Don't produce packed ARM64 unwind info with homed parameters
Martin Storsjö [Wed, 18 May 2022 09:36:59 +0000 (12:36 +0300)]
[MC] [Win64EH] Don't produce packed ARM64 unwind info with homed parameters

There's an inconsistency regarding the epilogs of packed ARM64
unwind info with homed parameters; according to the documentation
(and according to common sense), the epilog wouldn't have a series
of nop instructions matching the stp x0-x7 in the prolog - however
in practice, RtlVirtualUnwind still seems to behave as if the epilog
does have the mirrored nops from the prolog.

In practice, MSVC doesn't seem to produce packed unwind info with
homed parameters, which might be why this inconsistency hasn't
been noticed.

Thus, to play it safe, avoid creating such packed unwind info with
homed parameters. (LLVM's current behaviour matches the current
runtime behaviour of RtlVirtualUnwind, but if it later is bug fixed
to match the documentation, such unwind information would be
incorrect.)

See https://github.com/llvm/llvm-project/issues/54879 for further
discussion on the matter.

Differential Revision: https://reviews.llvm.org/D125876

2 years ago[MC] [Win64EH] Remove an unused parameter to ARM64EmitUnwindCode. NFC.
Martin Storsjö [Wed, 18 May 2022 11:05:08 +0000 (14:05 +0300)]
[MC] [Win64EH] Remove an unused parameter to ARM64EmitUnwindCode. NFC.

Differential Revision: https://reviews.llvm.org/D125878

2 years ago[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows
Martin Storsjö [Sat, 9 Apr 2022 20:40:07 +0000 (23:40 +0300)]
[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows

(In the case of libunwind, the cmake option is called
LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as
LIBCXX_HERMETIC_STATIC_LIBRARY and
LIBCXXABI_HERMETIC_STATIC_LIBRARY.)

Previously, the same issue was dealt with by setting a project wide
define (_LIBUNWIND_HIDE_SYMBOLS,
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static
library.  If building both static and shared at the same time, this
wasn't set, and the static library would contain dllexport directives.

The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake
options only apply the defines to the static library in the build,
even if building both static and shared at the same time.

(This could only be done use after the object libraries were
enabled, as a shared libcxx needs libcxxabi object files built
with dllexports included.)

This allows removing inelegant code for deciding how to build the
libcxxabi static library and a TODO comment that suggested that
users should need to start setting an option, which they shouldn't
need to. Finally, this gets rid of two XFAILs in tests.

Differential Revision: https://reviews.llvm.org/D125715

2 years ago[RISCV] Use selectShiftMaskXLen ComplexPattern for isel of rotates.
Craig Topper [Wed, 18 May 2022 16:58:28 +0000 (09:58 -0700)]
[RISCV] Use selectShiftMaskXLen ComplexPattern for isel of rotates.

This will remove masks on the shift amount. We usually get this with
SimplifyDemandedBits in DAGCombine, but that's restricted to cases
where the AND has a single use. selectShiftMaskXLen does not have
that restriction.

2 years ago[RISCV] Add test cases showing failure to remove mask on rotate amounts.
Craig Topper [Wed, 18 May 2022 16:54:37 +0000 (09:54 -0700)]
[RISCV] Add test cases showing failure to remove mask on rotate amounts.

If the masking AND has multiple users we fail to remove it.

2 years ago[mlir][ods] Simplify useDefaultType/AttributePrinterParser
Mogball [Tue, 17 May 2022 18:26:00 +0000 (18:26 +0000)]
[mlir][ods] Simplify useDefaultType/AttributePrinterParser

The current behaviour of `useDefaultTypePrinterParser` and `useDefaultAttributePrinterParser` is that they are set by default, but the dialect generator only generates the declarations for the parsing and printing hooks if it sees dialect types and attributes. Same goes for the definitions generated by the AttrOrTypeDef generator.

This can lead to confusing and undesirable behaviour if the dialect generator doesn't see the definitions of the attributes and types, for example, if they are sensibly separated into different files: `Dialect.td`, `Ops.td`, `Attributes.td`, and `Types.td`.

Now, these bits are unset by default. Setting them will always result in the dialect generator emitting the declarations for the parsing hooks. And if the AttrOrTypeDef generator sees it set, it will generate the default implementations.

Reviewed By: rriddle, stellaraccident

Differential Revision: https://reviews.llvm.org/D125809

2 years ago[gn build] port 6694491affa18
Nico Weber [Wed, 18 May 2022 17:16:21 +0000 (13:16 -0400)]
[gn build] port 6694491affa18

Needed to link llvm-debuginfod-find after eafa0530417e.

2 years agoAdd a darwin platform setting to specify which exceptions debugserver
Jim Ingham [Wed, 11 May 2022 22:10:16 +0000 (15:10 -0700)]
Add a darwin platform setting to specify which exceptions debugserver
should not receive as exceptions (some will get converted to BSD
signals instead).  This is really the only stable way to ensure that
a Mach exception gets converted to it's equivalent BSD signal.  For
programs that rely on BSD signal handlers, this has to happen or you
can't even get the program to invoke the signal handler when under
the debugger.

This builds on a previous solution to this problem which required you
start debugserver with the -U flag.  This was not very discoverable
and required lldb be the one to launch debugserver, which is not always
the case.

Differential Revision: https://reviews.llvm.org/D125434

2 years agoPartially revert "[CMake] Passthrough OSX CMake options to builtins and runtimes"
Petr Hosek [Wed, 18 May 2022 17:00:18 +0000 (17:00 +0000)]
Partially revert "[CMake] Passthrough OSX CMake options to builtins and runtimes"

This partially reverts commit 9cddfe3085c4c500e64350b56c37ae2ed1cbe3f6,
specifically passthrough for CMAKE_OSX_* since this can lead to build
passing through internal variables when it's not intended.

2 years ago[Debuginfod] Add --debug-file-directory to llvm-debuginfod-find.
Daniel Thornburgh [Tue, 17 May 2022 14:29:27 +0000 (14:29 +0000)]
[Debuginfod] Add --debug-file-directory to llvm-debuginfod-find.

This allows llvm-debuginfod-find to locate binaries in local build ID
directories configured via --debug-file-directory, the same flag used
for this purpose by llvm-symbolizer. This provides a consistent lookup
semantics between the two tools when configured the same way, in
particular when debug binaries may be located either locally or
remotely.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D125864

2 years agoCorrect the diagnostic behavior for unreachable _Generic associations in C++
Aaron Ballman [Wed, 18 May 2022 16:44:24 +0000 (12:44 -0400)]
Correct the diagnostic behavior for unreachable _Generic associations in C++

New diagnostics were added for unreachable generic selection expression
associations in ca75ac5f04f269def97e6844c2f5c9596b29c84c, but it did
not account for a difference in behavior between C and C++ regarding
lvalue to rvalue conversions. So we would issue diagnostics about a
selection being unreachable and then reach it. This corrects the
diagnostic behavior in that case.

Differential Revision: https://reviews.llvm.org/D125882

2 years ago[ObjCopy][NFC] Remove unneeded zero initialization
Fangrui Song [Wed, 18 May 2022 16:42:31 +0000 (09:42 -0700)]
[ObjCopy][NFC] Remove unneeded zero initialization

getNewMemBuffer has called memset.

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D125833

2 years ago[clang-tidy] Fix readability-simplify-boolean-expr crash with implicit cast in return.
Nathan James [Wed, 18 May 2022 16:38:42 +0000 (17:38 +0100)]
[clang-tidy] Fix readability-simplify-boolean-expr crash with implicit cast in return.

Fixes https://github.com/llvm/llvm-project/issues/55557

Reviewed By: LegalizeAdulthood

Differential Revision: https://reviews.llvm.org/D125877

2 years ago[DAGCombiner] Fix bug in MatchBSwapHWordLow.
Craig Topper [Wed, 18 May 2022 16:23:17 +0000 (09:23 -0700)]
[DAGCombiner] Fix bug in MatchBSwapHWordLow.

This function tries to match (a >> 8) | (a << 8) as (bswap a) >> 16.

If the SRL isn't masked and the high bits aren't demanded, we still
need to ensure that bits 23:16 are zero. After the right shift they
will be in bits 15:8 which is where the important bits from the SHL
end up. It's only a bswap if the OR on bits 15:8 only takes the bits
from the SHL.

Fixes PR55484.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D125641

2 years agoApply clang-tidy fixes for llvm-else-after-return in OpenMPDialect.cpp (NFC)
Mehdi Amini [Mon, 16 May 2022 10:04:49 +0000 (10:04 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in OpenMPDialect.cpp (NFC)

2 years agoApply clang-tidy fixes for performance-for-range-copy in LinalgOps.cpp (NFC)
Mehdi Amini [Mon, 16 May 2022 09:51:26 +0000 (09:51 +0000)]
Apply clang-tidy fixes for performance-for-range-copy in LinalgOps.cpp (NFC)

2 years ago[libunwind][AArch64] Add support for DWARF expression for RA_SIGN_STATE.
Daniel Kiss [Fri, 13 May 2022 07:12:07 +0000 (09:12 +0200)]
[libunwind][AArch64] Add support for DWARF expression for RA_SIGN_STATE.

Program may set the RA_SIGN_STATE pseudo register by expressions.
Libunwind expected only the DW_CFA_AARCH64_negate_ra_state could change the value
of the register which leads to runtime errors on PAC enabled systems.
In the recent version of the aadwarf64[1] a limitation is added[2] to forbid the mixing the
DW_CFA_AARCH64_negate_ra_state with other DWARF Register Rule Instructions.

[1] https://github.com/ARM-software/abi-aa/releases/tag/2022Q1
[2] https://github.com/ARM-software/abi-aa/pull/129

Reviewed By: #libunwind, MaskRay

Differential Revision: https://reviews.llvm.org/D123692
Reland: test moved because it depends on exceptions.

2 years ago[mlir][sparse] Add support for complex.im and complex.re to the sparse compiler.
Bixia Zheng [Tue, 17 May 2022 20:16:07 +0000 (20:16 +0000)]
[mlir][sparse] Add support for complex.im and complex.re to the sparse compiler.

Add a test.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D125834

2 years ago[gn build] Port 29e556fc2ba9
LLVM GN Syncbot [Wed, 18 May 2022 15:49:22 +0000 (15:49 +0000)]
[gn build] Port 29e556fc2ba9

2 years ago[lldb] Change implementation of memory read --show-tags option
David Spickett [Thu, 14 Apr 2022 10:56:44 +0000 (11:56 +0100)]
[lldb] Change implementation of memory read --show-tags option

This does 2 things:
* Moves it after the short options. Which makes sense given it's
  a niche, default off option.
  (if 2 files for one option seems a bit much, I am going to reuse
  them for "memory find" later)
* Fixes the use of repeated commands. For example:
    memory read buf --show-tags
    <shows tags>
    memory read
    <shows tags>

Added tests for the repetition and updated existing help tests.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D125089

2 years ago[gn build] Port 77533ea443ac
LLVM GN Syncbot [Wed, 18 May 2022 15:43:23 +0000 (15:43 +0000)]
[gn build] Port 77533ea443ac

2 years ago[AArch64] Add tests showing reassoc breaks (s|u)ml(a|s)l selection.
Florian Hahn [Wed, 18 May 2022 15:40:27 +0000 (16:40 +0100)]
[AArch64] Add tests showing reassoc breaks (s|u)ml(a|s)l selection.

2 years agoRevert "Reland(2) "[clangd] Indexing of standard library""
Sam McCall [Wed, 18 May 2022 15:35:50 +0000 (17:35 +0200)]
Revert "Reland(2) "[clangd] Indexing of standard library""

This reverts commit ca875539f788c8063e243ce9ceb877a0d2ad9115.

2 years ago[LoopUnroll] Regenerate test checks (NFC)
Nikita Popov [Wed, 18 May 2022 15:19:53 +0000 (17:19 +0200)]
[LoopUnroll] Regenerate test checks (NFC)

2 years ago[tests] Add test coverage for issue causing revert f7988d0
Philip Reames [Wed, 18 May 2022 15:05:59 +0000 (08:05 -0700)]
[tests] Add test coverage for issue causing revert f7988d0

As theorized, it does look like opnew is not getting inferred inaccessiblemmemonly.

2 years ago[RISCV][NFC] Rename variable in RISCVVEmitter.cpp
Kito Cheng [Wed, 18 May 2022 15:14:18 +0000 (23:14 +0800)]
[RISCV][NFC] Rename variable in RISCVVEmitter.cpp

- Use `Overloaded` rather than `Mangled`.
- Use `Prototype` or `Desc` rather than `Seq`, it's not just a string sequence.
  - `Prototype` for those PrototypeDescriptor will used to evaluate as argument type.
  - `Desc` for those PrototypeDescriptor will used to evaluate as part of function name.

Reviewed By: khchen

Differential Revision: https://reviews.llvm.org/D125886

2 years ago[ARM] Clean up a test check from D125604. NFC
David Green [Wed, 18 May 2022 15:12:08 +0000 (16:12 +0100)]
[ARM] Clean up a test check from D125604. NFC

The Arm test had a incorrect check line with the wrong offset. From the
look of the code it should be -400*4 = 0xFFFFF9C0 = 4294965696

2 years ago[OpenMP] libomp: honor passive wait policy requested with tasking
AndreyChurbanov [Wed, 18 May 2022 15:01:18 +0000 (10:01 -0500)]
[OpenMP] libomp: honor passive wait policy requested with tasking

Currently the library ignores requested wait policy in the presence
of tasking. Threads always actively spin. The patch fixes this problem
making the wait policy passive if this explicitly requested by user.

Differential Revision: https://reviews.llvm.org/D123044

2 years agoclang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp
Nico Weber [Wed, 18 May 2022 13:45:06 +0000 (09:45 -0400)]
clang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp

Since we already have a dedicated file for testing the /Zc: flags,
let's be consistent about putting /Zc: tests there.

No behavior change.

Differential Revision: https://reviews.llvm.org/D125889

2 years agoRevert "[BasicAA] Remove unneeded special case for malloc/calloc"
Philip Reames [Wed, 18 May 2022 14:33:39 +0000 (07:33 -0700)]
Revert "[BasicAA] Remove unneeded special case for malloc/calloc"

This reverts commit 9b1e00738c5ddba681e17e5cb7c260d9afc4c3a7.

Nikic reported in commit thread that I had forgotten history here, and that a) we'd tried this before, and b) had to revert due to an unexpected codegen impact.  Current measurements confirm the same issue still exists.

2 years ago[SystemZ] Bugfix in SystemZTargetLowering::combineINT_TO_FP()
Jonas Paulsson [Wed, 18 May 2022 12:20:30 +0000 (14:20 +0200)]
[SystemZ] Bugfix in SystemZTargetLowering::combineINT_TO_FP()

Make sure to also handle extended value types to avoid crashing.

Resulting integers greater than 64 bits are not optimized (i128 is not a
legal type), and vectorizing seems to result in libcalls instead of just
scalarization.

Other extended vector types like <10 x float> are however now handled and
should result in vectorized conversions.

Reviewed By: Ulrich Weigand

Differential Revision: https://reviews.llvm.org/D125881

2 years ago[SCEV] Part 1, Serialize function calls in function arguments.
NAKAMURA Takumi [Sun, 8 May 2022 00:54:53 +0000 (00:54 +0000)]
[SCEV] Part 1, Serialize function calls in function arguments.

Evaluation odering in function call arguments is implementation-dependent.
In fact, gcc evaluates bottom-top and clang does top-bottom.

Fixes #55283 partially.

Part of https://reviews.llvm.org/D125627

2 years ago[NFC] correcting a code comment.
Chris Bieneman [Wed, 18 May 2022 13:51:44 +0000 (08:51 -0500)]
[NFC] correcting a code comment.

2 years ago[gn build] Port ca875539f788
LLVM GN Syncbot [Wed, 18 May 2022 13:39:15 +0000 (13:39 +0000)]
[gn build] Port ca875539f788

2 years agoAssert on polymorphic pointer intrinsic param
Thomas Preud'homme [Tue, 17 May 2022 10:47:43 +0000 (11:47 +0100)]
Assert on polymorphic pointer intrinsic param

Opaque pointers cannot be polymorphic on the pointed type given their
lack thereof. However they are currently accepted by tablegen but the
intrinsic signature verifier trips when verifying any further
polymorphic type because the opaque pointer codepath for pointers will
not push the pointed type in ArgTys.

This commit adds an assert to easily catch such cases instead of having
the generic signature match failure.

Reviewed By: #opaque-pointers, nikic

Differential Revision: https://reviews.llvm.org/D125764

2 years ago[CGP] Regenerate test checks (NFC)
Nikita Popov [Wed, 18 May 2022 13:35:00 +0000 (15:35 +0200)]
[CGP] Regenerate test checks (NFC)

2 years ago[lit] pass LLVM_SYMBOLIZER_PATH through to tests.
Sam McCall [Wed, 18 May 2022 13:28:43 +0000 (15:28 +0200)]
[lit] pass LLVM_SYMBOLIZER_PATH through to tests.

Currently several buildbots give unsymbolized traces on crash.
I suspect these are configuring the symbolizer in this way and regressed in
D122251 or thereabouts.

Trying this coupled with a reland of patch that failed on a couple of bots with
no useful stacktrace...

2 years agoReland(2) "[clangd] Indexing of standard library"
Sam McCall [Wed, 18 May 2022 12:23:02 +0000 (14:23 +0200)]
Reland(2) "[clangd] Indexing of standard library"

This reverts commit 6aabf60f2fb7589430c0ecc8fe95913c973fa248.

2 years ago[InstCombine] avoid crash on fold of icmp with cast operand
Sanjay Patel [Wed, 18 May 2022 13:07:07 +0000 (09:07 -0400)]
[InstCombine] avoid crash on fold of icmp with cast operand

We could do better by inserting a bitcast from scalar int
to vector int or using an insertelement (the alternate test
does not crash because there's an independent fold like that).

But this doesn't seem like a likely pattern, so just bail out
for now.

Fixes issue #55516.

2 years ago[InstCombine] reduce code duplication for checking types; NFC
Sanjay Patel [Wed, 18 May 2022 12:34:45 +0000 (08:34 -0400)]
[InstCombine] reduce code duplication for checking types; NFC

2 years ago[lldb][AArch64] Fix corefile memory reads when there are non-address bits
David Spickett [Mon, 4 Apr 2022 13:42:24 +0000 (14:42 +0100)]
[lldb][AArch64] Fix corefile memory reads when there are non-address bits

Previously if you read a code/data mask before there was a valid thread
you would get the top byte mask. This meant the value was "valid" as in,
don't read it again.

When using a corefile we ask for the data mask very early on and this
meant that later once you did have a thread it wouldn't read the
register to get the rest of the mask.

This fixes that and adds a corefile test generated from the same program
as in my previous change on this theme.

Depends on D118794

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D122411

2 years ago[InstCombine] Remove disable-verify tests (NFC)
Nikita Popov [Wed, 18 May 2022 12:47:38 +0000 (14:47 +0200)]
[InstCombine] Remove disable-verify tests (NFC)

InstCombine is not required to do anything sensible if it receives
invalid IR.

These tests seem to be testing self-referential instructions that
may occur in unreachable code -- but InstCombine actually goes out
of the way to remove such instructions ahead of time so it doesn't
need to deal with them.

2 years ago[AMDGPU][MC][GFX940] Correct tied operand decoding for smfmac opcodes
Dmitry Preobrazhensky [Wed, 18 May 2022 12:37:30 +0000 (15:37 +0300)]
[AMDGPU][MC][GFX940] Correct tied operand decoding for smfmac opcodes

Differential Revision: https://reviews.llvm.org/D125790

2 years ago[libcxx] [test] Include header for strverscmp
Jonathan Wakely [Wed, 18 May 2022 12:36:20 +0000 (14:36 +0200)]
[libcxx] [test] Include header for strverscmp

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D122570

2 years ago[libcxx] [test] Add missing header for std::numeric_limits
Jonathan Wakely [Wed, 18 May 2022 12:35:57 +0000 (14:35 +0200)]
[libcxx] [test] Add missing header for std::numeric_limits

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D122571

2 years ago[X86] addcarry.ll - add nounwind to prevent cfi noise on tests
Simon Pilgrim [Wed, 18 May 2022 12:30:43 +0000 (13:30 +0100)]
[X86] addcarry.ll - add nounwind to prevent cfi noise on tests

2 years ago[AArch64] neon-vmull-high-p64.ll - fix name/check mismatch identified in D125604
Simon Pilgrim [Wed, 18 May 2022 12:24:20 +0000 (13:24 +0100)]
[AArch64] neon-vmull-high-p64.ll - fix name/check mismatch identified in D125604

Typos meant that we weren't actually checking the function name, which wasn't accounting for mangling

2 years ago[Security Group] Update representative for Rust.
Pietro Albini [Wed, 18 May 2022 12:16:39 +0000 (14:16 +0200)]
[Security Group] Update representative for Rust.

Steve Klabnik recently left the Rust project. Josh Stone (the other member of
the Rust Security Response WG) replaces him as one of the vendor contacts for
Rust.

Differential Revision: https://reviews.llvm.org/D119137

2 years ago[AMDGPU][MC][GFX7] Disable cache policy modifiers with SMRD
Dmitry Preobrazhensky [Wed, 18 May 2022 12:12:01 +0000 (15:12 +0300)]
[AMDGPU][MC][GFX7] Disable cache policy modifiers with SMRD

Differential Revision: https://reviews.llvm.org/D125799

2 years ago[ARM] Don't Enable AES Pass for Generic Cores
Archibald Elliott [Wed, 18 May 2022 12:10:22 +0000 (13:10 +0100)]
[ARM] Don't Enable AES Pass for Generic Cores

This brings clang/llvm into line with GCC. The Pass is still enabled for
the affected cores, but is now opt-in when using `-march=`.

I also took the opportunity to add release notes for this change.

Reviewed By: john.brawn

Differential Revision: https://reviews.llvm.org/D125775

2 years ago[mlir][complex] Add pow/sqrt/tanh ops and lowering to libm
Benjamin Kramer [Fri, 13 May 2022 15:12:11 +0000 (17:12 +0200)]
[mlir][complex] Add pow/sqrt/tanh ops and lowering to libm

Lowering through libm gives us a baseline version, even though it's not
going to be particularly fast. This is similar to what we do for some
math dialect ops.

Differential Revision: https://reviews.llvm.org/D125550

2 years ago[OpenCL] Add cl_khr_subgroup_rotate builtins
Sven van Haastregt [Wed, 18 May 2022 12:02:17 +0000 (13:02 +0100)]
[OpenCL] Add cl_khr_subgroup_rotate builtins

Differential Revision: https://reviews.llvm.org/D124256

2 years ago[AMDGPU][MC][NFC] MUBUF code cleanup
Dmitry Preobrazhensky [Wed, 18 May 2022 11:58:45 +0000 (14:58 +0300)]
[AMDGPU][MC][NFC] MUBUF code cleanup

Removed code that is no longer used after https://reviews.llvm.org/D124485.

Differential Revision: https://reviews.llvm.org/D125811

2 years ago[lldb] Remove non-address bits from read/write addresses in lldb
David Spickett [Fri, 28 Jan 2022 13:47:30 +0000 (13:47 +0000)]
[lldb] Remove non-address bits from read/write addresses in lldb

Non-address bits are not part of the virtual address in a pointer.
So they must be removed before passing to interfaces like ptrace.

Some of them we get way with not removing, like AArch64's top byte.
However this is only because of a hardware feature that ignores them.

This change updates all the Process/Target Read/Write memory methods
to remove non-address bits before using addresses.

Doing it in this way keeps lldb-server simple and also fixes the
memory caching when differently tagged pointers for the same location
are read.

Removing the bits is done at the ReadMemory level not DoReadMemory
because particualrly for process, many subclasses override DoReadMemory.

Tests have been added for read/write at the command and API level,
for process and target. This includes variants like
Read<sometype>FromMemory. Commands are tested to make sure we remove
at the command and API level.

"memory find" is not included because:
* There is no API for it.
* It already has its own address handling tests.

Software breakpoints do use these methods but they are not tested
here because there are bigger issues to fix with those. This will
happen in another change.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D118794

2 years agoRevert "[lldb] Add --all option to "memory region""
David Spickett [Wed, 18 May 2022 11:57:20 +0000 (11:57 +0000)]
Revert "[lldb] Add --all option to "memory region""

This reverts commit 8e648f195c3d57e573fdd8023edcfd80e0516c61
due to test failures on Windows:
https://lab.llvm.org/buildbot/#/builders/83/builds/19094

2 years ago[AArch64] fp16-v8-instructions.ll - remove some old defunct CHECKS identified in...
Simon Pilgrim [Wed, 18 May 2022 11:49:05 +0000 (12:49 +0100)]
[AArch64] fp16-v8-instructions.ll - remove some old defunct CHECKS identified in D125604

Typos meant that the update script never removed them

2 years ago[DebugInfo][X86] debug-info-template-parameter.ll - fix broken DW_AT_default_value...
Simon Pilgrim [Wed, 18 May 2022 11:39:02 +0000 (12:39 +0100)]
[DebugInfo][X86] debug-info-template-parameter.ll - fix broken DW_AT_default_value checks identified in D125604

2 years ago[X86] statepoint-vreg-details.ll - fix CHECK-VREG-LABEL typo identified in D125604
Simon Pilgrim [Wed, 18 May 2022 11:33:53 +0000 (12:33 +0100)]
[X86] statepoint-vreg-details.ll - fix CHECK-VREG-LABEL typo identified in D125604

2 years ago[X86] lvi-hardening-indirectbr.ll - fix X64-NOT typo identified in D125604
Simon Pilgrim [Wed, 18 May 2022 11:33:27 +0000 (12:33 +0100)]
[X86] lvi-hardening-indirectbr.ll - fix X64-NOT typo identified in D125604

2 years ago[X86] copy-propagation.ll - fix CHECK-NEXT typo identified in D125604
Simon Pilgrim [Wed, 18 May 2022 11:32:31 +0000 (12:32 +0100)]
[X86] copy-propagation.ll - fix CHECK-NEXT typo identified in D125604

2 years ago[X86] coalesce-dead-lanes.mir - fix CHECK-LABEL typo identified in D125604
Simon Pilgrim [Wed, 18 May 2022 11:31:42 +0000 (12:31 +0100)]
[X86] coalesce-dead-lanes.mir - fix CHECK-LABEL typo identified in D125604

2 years ago[X86] Regenerate select-ext.ll test for D125604
Simon Pilgrim [Wed, 18 May 2022 11:25:35 +0000 (12:25 +0100)]
[X86] Regenerate select-ext.ll test for D125604

GlobalISel tests are barely supported on X86, so just regenerate for now to avoid a blocker

2 years agoAArch64: fall back to DWARF instead of crashing on weird .cfi directives
Tim Northover [Wed, 18 May 2022 10:40:46 +0000 (11:40 +0100)]
AArch64: fall back to DWARF instead of crashing on weird .cfi directives

CodeGen will only produce fixed formwat prologues, but hand-written assembly
can have .cfi directives in any combination they want. This should cause a
fallback to DWARF rather than an assertion failure (or an incorrect compact
unwind if assertions are disabled).

2 years ago[lldb] Add --all option to "memory region"
David Spickett [Wed, 18 May 2022 10:30:14 +0000 (10:30 +0000)]
[lldb] Add --all option to "memory region"

This adds an option to the memory region command
to print all regions at once. Like you can do by
starting at address 0 and repeating the command
manually.

memory region [-a] [<address-expression>]

(lldb) memory region --all
[0x0000000000000000-0x0000000000400000) ---
[0x0000000000400000-0x0000000000401000) r-x <...>/a.out PT_LOAD[0]
<...>
[0x0000fffffffdf000-0x0001000000000000) rw- [stack]
[0x0001000000000000-0xffffffffffffffff) ---

The output matches exactly what you'd get from
repeating the command. Including that it shows
unmapped areas between the mapped regions.

(this is why Process GetMemoryRegions is not
used, that skips unmapped areas)

Help text has been updated to show that you can have
an address or --all but not both.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D111791

2 years ago[AMDGPU][MC][GFX10] Add missing s_scratch_load tests.
Ivan Kosarev [Wed, 18 May 2022 09:47:24 +0000 (10:47 +0100)]
[AMDGPU][MC][GFX10] Add missing s_scratch_load tests.

Completes
https://reviews.llvm.org/D125117

Reviewed By: dp, arsenm

Differential Revision: https://reviews.llvm.org/D125753

2 years ago[JumpThreading] Look through freeze in getPredicateAt() fold
Nikita Popov [Wed, 18 May 2022 09:26:56 +0000 (11:26 +0200)]
[JumpThreading] Look through freeze in getPredicateAt() fold

This code is valid for any icmp, so we can safely look through a
freeze when trying to find one.

A caveat here is that replaceFoldableUses() may not end up replacing
any uses in this case. It might make sense to use the freeze as the
context instruction (rather than the terminator) if there is a
freeze, to ensure that it always gets folded. This would require
some changes to how replaceFoldedUses() works though, as it
currently assumes that the value is valid at the end of the block.

2 years ago[AMDGPU] Aggressively fold immediates in SIShrinkInstructions
Jay Foad [Mon, 16 May 2022 14:53:03 +0000 (15:53 +0100)]
[AMDGPU] Aggressively fold immediates in SIShrinkInstructions

Fold immediates regardless of how many uses they have. This is expected
to increase overall code size, but decrease register usage.

Differential Revision: https://reviews.llvm.org/D114644