platform/upstream/llvm.git
2 years ago[X86] Introduce more common modern tunings into `generic`
Phoebe Wang [Sat, 5 Feb 2022 01:49:54 +0000 (09:49 +0800)]
[X86] Introduce more common modern tunings into `generic`

GCC has updated its generic `-mtune` to haswell. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81616
Update it to match with GCC.

Reviewed By: spatel

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

2 years ago[ELF] Avoid wrapping unreferenced lazy symbols
Shoaib Meenai [Wed, 2 Feb 2022 07:59:50 +0000 (23:59 -0800)]
[ELF] Avoid wrapping unreferenced lazy symbols

There's a couple of motivations here:
* LLD 12 (which I was originally testing with) was adding an undefined
  symbol to the symbol table if you attempted to wrap an unreferenced
  lazy symbol, which would later break `--no-allow-shlib-undefined`. LLD
  on main actually produces a weak undefined symbol, so this doesn't
  break anyway, but it's cleaner to not have the weak undefined symbol
  as well. The new behavior also matches bfd and gold.
* PROVIDE in a linker script referencing a wrapped symbol would think
  that an otherwise-unreferenced lazy symbol which was wrapped was
  actually referenced, and therefore proceed with the definition, which
  goes against expectations. The new behavior also matches bfd and gold.

Reviewed By: MaskRay

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

2 years ago[test] Remove unnecessary require<> in LoopAccessAnalysis tests
Arthur Eubanks [Sat, 5 Feb 2022 02:02:48 +0000 (18:02 -0800)]
[test] Remove unnecessary require<> in LoopAccessAnalysis tests

These function analyses are always available in loop passes.

2 years ago[BOLT] Add nfc-check-setup script
Amir Ayupov [Sat, 5 Feb 2022 02:02:50 +0000 (18:02 -0800)]
[BOLT] Add nfc-check-setup script

Add the script to set up llvm-bolt-wrapper. The intended use is to run NFC
checks manually and automatically on a buildbot.

Reviewed By: rafauler

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

2 years ago[flang] Debugging of ACCESS='STREAM' I/O (take 2)
Peter Klausler [Fri, 28 Jan 2022 23:34:28 +0000 (15:34 -0800)]
[flang] Debugging of ACCESS='STREAM' I/O (take 2)

Corrects the runtime implementation of I/O on files with
the access mode ACCESS='STREAM'.  This is a collection
of edge-case tweaks to ensure that the distinctions between
stream and direct/sequential files, unformatted or formatted,
are respected where appropriate.

Moves NextInField() from io-stmt.h to io-stmt.cpp --
it was getting too big to keep in a header.

This patch exposed a problem with the I/O runtime
on Windows and it was reverted.  This version also
fixes that problem; files are now opened on Windows
in binary mode to prevent inadvertent insertions of
carriage returns before line feeds, and those line
endings (CR+LF) are now explicitly generated.

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

2 years ago[BOLT-UnitTests] Fix shared libraries build
Amir Ayupov [Fri, 4 Feb 2022 23:04:01 +0000 (15:04 -0800)]
[BOLT-UnitTests] Fix shared libraries build

Fix build with `-DBUILD_SHARED_LIBS=ON` (add explicit deps).

Reviewed By: yota9

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

2 years ago[gn build] Port 679f8a885b65
LLVM GN Syncbot [Sat, 5 Feb 2022 01:52:05 +0000 (01:52 +0000)]
[gn build] Port 679f8a885b65

2 years ago[OpenMP] Change amdgcn to amdgpu in device library handling
Joseph Huber [Sat, 5 Feb 2022 01:44:06 +0000 (20:44 -0500)]
[OpenMP] Change amdgcn to amdgpu in device library handling

Summary:
The name of the AMDGPU device library was changes. Previously it was
called 'libomptarget-amdgcn'. This patch changes fixes the tests to use
the new name of the library and adds a new flag with the same name.

2 years ago[Debuginfod][test] Fix debuginfod.test to use %python instead of python after D112759
Fangrui Song [Sat, 5 Feb 2022 01:32:00 +0000 (17:32 -0800)]
[Debuginfod][test] Fix debuginfod.test to use %python instead of python after D112759

2 years ago[Debuginfod] Fix curl_easy_init in -DLLVM_ENABLE_ASSERTIONS=off build after D112753
Fangrui Song [Sat, 5 Feb 2022 01:29:19 +0000 (17:29 -0800)]
[Debuginfod] Fix curl_easy_init in -DLLVM_ENABLE_ASSERTIONS=off build after D112753

2 years ago[RISCV] Remove exclusions for zext.h/zext.w from our (and (srl X, C1), C2) selection...
Craig Topper [Sat, 5 Feb 2022 01:10:43 +0000 (17:10 -0800)]
[RISCV] Remove exclusions for zext.h/zext.w from our (and (srl X, C1), C2) selection code.

This code tries to replace the pattern with a pair of shifts, but
we were excluding if the And could be a zext.h or zext.w. The SLLI/SRL
pair is more compressible and doesn't come with much down side.

We do regress one test case in rv64i-exhaustive-w-insts.ll but we
can probably add a narrower exclusion for that case.

2 years agoReland [SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d...
Roman Lebedev [Fri, 4 Feb 2022 23:39:22 +0000 (02:39 +0300)]
Reland [SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable`

As per LangRef's definition of `noreturn` attribute:
```
noreturn
  This function attribute indicates that the function never returns
  normally, hence through a return instruction.
  This produces undefined behavior at runtime if the function
  ever does dynamically return. nnotated functions may still
  raise an exception, i.a., nounwind is not implied.
```

So if we `invoke` a `noreturn` function, and the normal destination
of an invoke is not an `unreachable`, point it at the new `unreachable`
block.

The change/fix from the original commit is that we now actually create
the new block, and don't just repurpose the original block,
because said normal destination block could have other users.

This reverts commit db1176ce66cf276b45ac3b90ea6b5ce62de56be7,
relanding commit 598833c987593ce192fa827f162cae8c867c9d43.

2 years ago[NFC][SimplifyCFG] Add test w/ shared normal dest of a `noreturn` `invoke`d function
Roman Lebedev [Fri, 4 Feb 2022 23:38:48 +0000 (02:38 +0300)]
[NFC][SimplifyCFG] Add test w/ shared normal dest of a `noreturn` `invoke`d function

2 years ago[BOLT][NFC] Fix compiler warnings
Amir Ayupov [Tue, 1 Feb 2022 06:07:46 +0000 (22:07 -0800)]
[BOLT][NFC] Fix compiler warnings

Summary:
- variable 'TotalSize' set but not used
- variable 'TotalCallsTopN' set but not used
- use of bitwise '|' with boolean operands

Reviewed By: maksfb

FBD33911129

2 years ago[mlir][NFC] Fully qualify call to `mlir::success` in auto generated C++
Markus Böck [Fri, 4 Feb 2022 23:40:04 +0000 (00:40 +0100)]
[mlir][NFC] Fully qualify call to `mlir::success` in auto generated C++

2 years agoRevert "[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke...
Roman Lebedev [Fri, 4 Feb 2022 23:29:28 +0000 (02:29 +0300)]
Revert "[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable`"

The normal destination may have other uses.

This reverts commit 598833c987593ce192fa827f162cae8c867c9d43.

2 years ago[mlir] Add canonicalizer to merge shape.assuming_all ops
Eugene Zhulenev [Fri, 4 Feb 2022 19:31:59 +0000 (11:31 -0800)]
[mlir] Add canonicalizer to merge shape.assuming_all ops

Depends On D119021

Reviewed By: frgossen

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

2 years ago[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn...
Roman Lebedev [Fri, 4 Feb 2022 22:28:24 +0000 (01:28 +0300)]
[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable`

As per LangRef's definition of `noreturn` attribute:
```
noreturn
  This function attribute indicates that the function never returns
  normally, hence through a return instruction.
  This produces undefined behavior at runtime if the function
  ever does dynamically return. nnotated functions may still
  raise an exception, i.a., nounwind is not implied.
```

2 years ago[NFC][SimplifyCFG] Add test showing failure to drop normal dest of noreturn invoke
Roman Lebedev [Fri, 4 Feb 2022 22:27:05 +0000 (01:27 +0300)]
[NFC][SimplifyCFG] Add test showing failure to drop normal dest of noreturn invoke

2 years ago[NFC][InstCombine] `visitCallInst()`: make comment more understandable
Roman Lebedev [Fri, 4 Feb 2022 22:03:39 +0000 (01:03 +0300)]
[NFC][InstCombine] `visitCallInst()`: make comment more understandable

2 years ago[NFC][SimplifyCFG] 'merge compatible invokes': tests for non-`unreachable` normal...
Roman Lebedev [Fri, 4 Feb 2022 21:26:01 +0000 (00:26 +0300)]
[NFC][SimplifyCFG] 'merge compatible invokes': tests for non-`unreachable` normal destination

2 years ago[ELF] Support R_PPC_NONE/R_PPC64_NONE in getImplicitAddend
Fangrui Song [Fri, 4 Feb 2022 23:13:37 +0000 (15:13 -0800)]
[ELF] Support R_PPC_NONE/R_PPC64_NONE in getImplicitAddend

Similar to f457863ae345d2635026501f5383e0e625869639

2 years ago[yaml2obj] Support R_PPC_* relocation types
Fangrui Song [Fri, 4 Feb 2022 23:11:50 +0000 (15:11 -0800)]
[yaml2obj] Support R_PPC_* relocation types

2 years agoRevert "[clangd] Properly compute framework-style include spelling"
David Goldman [Fri, 4 Feb 2022 22:57:11 +0000 (17:57 -0500)]
Revert "[clangd] Properly compute framework-style include spelling"

This reverts commit 4dfd11324eb05d167392958c0f0f273cae6386c6
due to the failures on Linux CI:
https://lab.llvm.org/buildbot/#/builders/188/builds/9296

2 years ago[GlobalISel] Don't combine instructions which are fed by memory instructions using...
Róbert Ágoston [Fri, 4 Feb 2022 22:46:27 +0000 (14:46 -0800)]
[GlobalISel] Don't combine instructions which are fed by memory instructions using different size

Memory instructions like extending loads from the same address are not equal if
their size is not equal.

This fixes https://github.com/llvm/llvm-project/issues/53524.

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

2 years ago[OpenMP] Emit remark on the captured call instead of the variable
Joseph Huber [Fri, 4 Feb 2022 21:54:59 +0000 (16:54 -0500)]
[OpenMP] Emit remark on the captured call instead of the variable

Changes the remark to emit on the function call that captures the globalized
variable instead of the globalized variable itself. The user should be able to
see which variable it was in the argument list of the function.

Reviewed By: jdoerfert

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

2 years agoAttempt forward fix after 4dfd113
David Goldman [Fri, 4 Feb 2022 22:47:38 +0000 (17:47 -0500)]
Attempt forward fix after 4dfd113

If this doesn't work will just revert the change,
can't seem to repro on macOS.

2 years ago[mlir:NFC] Move BaseOpWithOffsetSizesAndStrides out of OpBase.td
River Riddle [Fri, 4 Feb 2022 20:57:28 +0000 (12:57 -0800)]
[mlir:NFC] Move BaseOpWithOffsetSizesAndStrides out of OpBase.td

This is not a general construct, and shouldn't have been defined in OpBase.
This moves a copy to both MemRefOps+TensorOps, which are the only
users.

2 years agoAMDGPU/GlobalISel: Fix assertions on invalid addrspacecasts
Matt Arsenault [Thu, 27 Jan 2022 01:20:29 +0000 (20:20 -0500)]
AMDGPU/GlobalISel: Fix assertions on invalid addrspacecasts

Fixes some assert on invalid situations and starts directly emitting
the error.

2 years ago[libc++][Docker] Don't actually start using a newer compiler in the CI
Louis Dionne [Fri, 4 Feb 2022 22:12:38 +0000 (17:12 -0500)]
[libc++][Docker] Don't actually start using a newer compiler in the CI

To ensure a smooth transition without breaking CI, we should use explicitly
versioned Clangs in the CI jobs definition instead, since that's a change
we can actually test in the CI.

So instead of bumping the compiler version from the Docker image, use
the same version as before by default, and we can bump it from the CI
job definition once all the nodes are running the new image.

2 years ago[libc++] Replace includes of <utility> with specific detail headers
Arthur O'Dwyer [Fri, 4 Feb 2022 18:09:30 +0000 (13:09 -0500)]
[libc++] Replace includes of <utility> with specific detail headers

Basically a rebase of D104980; most of that patch had already happened
via gradual drive-by changes, but this finishes it up.
Don't touch the inclusions from `<__functional_base>`, `<__hash_table>`,
or `<__locale>`; those could be removed if we propagated the
inclusions up to the includers of those files, but there are lots
of those includers.

`<algorithm>`, `<functional>`, and `<memory>` already include `<utility>`
at the top level. `<iterator>` did not, so I've added it there.

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

2 years ago[libc++] Bump the version of Clang we use in the CI
Louis Dionne [Wed, 2 Feb 2022 18:19:27 +0000 (13:19 -0500)]
[libc++] Bump the version of Clang we use in the CI

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

2 years ago[mlir][vector] Add constant folder for vector.shuffle ops
Lei Zhang [Fri, 4 Feb 2022 21:32:42 +0000 (16:32 -0500)]
[mlir][vector] Add constant folder for vector.shuffle ops

Reviewed By: ThomasRaoux

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

2 years ago[ELF][test] Test getImplicitAddend for R_ARM_NONE/R_RISCV_NONE/R_386_NONE/R_X86_64_NONE
Fangrui Song [Fri, 4 Feb 2022 21:59:18 +0000 (13:59 -0800)]
[ELF][test] Test getImplicitAddend for R_ARM_NONE/R_RISCV_NONE/R_386_NONE/R_X86_64_NONE

Similar to f457863ae345d2635026501f5383e0e625869639

2 years ago[OpenMP] Fix mismatched device runtime name
Joseph Huber [Fri, 4 Feb 2022 21:53:11 +0000 (16:53 -0500)]
[OpenMP] Fix mismatched device runtime name

Summary:
The new runtime was deleted. AMD's old runtime used the triple name
`amdgcn` while the new runtime used `amdgpu`. This was not updated when
the old runtime was removed causing the library to not be found on
AMDGPU.

2 years agoAMDGPU: Fix failing test
Matt Arsenault [Fri, 4 Feb 2022 21:53:55 +0000 (16:53 -0500)]
AMDGPU: Fix failing test

2 years ago[mlir][spirv] Fix missing dependencies in BUILD.bazel
Lei Zhang [Fri, 4 Feb 2022 21:51:05 +0000 (16:51 -0500)]
[mlir][spirv] Fix missing dependencies in BUILD.bazel

2 years ago[clangd] Properly compute framework-style include spelling
David Goldman [Thu, 20 Jan 2022 20:31:01 +0000 (15:31 -0500)]
[clangd] Properly compute framework-style include spelling

With this change, clangd now computes framework-style includes
for framework headers at indexing time.

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

2 years ago[lld][macho] Add more skip platform check for libSystem re-exports
Byoungchan Lee [Fri, 4 Feb 2022 19:03:11 +0000 (14:03 -0500)]
[lld][macho] Add more skip platform check for libSystem re-exports

Xcode 13 comes with a mismatched platform in libcompiler_rt.dylib,
so this creates a linker error on mac catalyst.
Fix it by adding it to the skip list.

Reviewed By: MaskRay, #lld-macho, int3

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

2 years ago[mlir][spirv] Add support for converting vector.shuffle
Lei Zhang [Fri, 4 Feb 2022 21:30:44 +0000 (16:30 -0500)]
[mlir][spirv] Add support for converting vector.shuffle

Reviewed By: ThomasRaoux

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

2 years ago[PowerPC] Option controling scalar MASS convertion
Masoud Ataei [Fri, 4 Feb 2022 21:24:22 +0000 (13:24 -0800)]
[PowerPC] Option controling scalar MASS convertion

differential: https://reviews.llvm.org/D119035

reviewer: bmahjour

2 years ago[ELF] Support REL-format R_AARCH64_NONE relocation
Fangrui Song [Fri, 4 Feb 2022 21:20:49 +0000 (13:20 -0800)]
[ELF] Support REL-format R_AARCH64_NONE relocation

-fprofile-use=/-fprofile-sample-use= compiles may produce REL-format
.rel.llvm.call-graph-profile even if the prevailing format is RELA on AArch64.
Add R_AARCH64_NONE to getImplicitAddend to fix this linker error:

```
ld.lld: error: internal linker error: cannot read addend for relocation R_AARCH64_NONE
PLEASE submit a bug report to https://crbug.com and run tools/clang/scripts/process_crashreports.py (only works inside Google) which will upload a report and include the crash backtrace.
```

2 years ago[bazel] Port dbed14d215fe
Benjamin Kramer [Fri, 4 Feb 2022 21:14:45 +0000 (22:14 +0100)]
[bazel] Port dbed14d215fe

2 years ago[libc++] No longer support ranges::begin(x) when x is an array of incomplete type.
Arthur O'Dwyer [Fri, 4 Feb 2022 02:41:30 +0000 (21:41 -0500)]
[libc++] No longer support ranges::begin(x) when x is an array of incomplete type.

var-const points out that `ranges::begin` is (non-normatively
but explicitly) always supposed to return a `std::input_or_output_iterator`,
and `Incomplete*` is not a `std::input_or_output_iterator` because it
has no `operator++`. Therefore, we should never return `Incomplete*`
from `ranges::begin(x)`, even when `x` is `Incomplete(&)[]`. Instead,
just SFINAE away.

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

2 years ago[WebAssembly] Refactor and fix emission of external IR global decls
Paulo Matos [Fri, 4 Feb 2022 21:01:41 +0000 (22:01 +0100)]
[WebAssembly] Refactor and fix emission of external IR global decls

Reland of 00bf4755.

This patches fixes the visibility and linkage information of symbols
referring to IR globals.

Emission of external declarations is now done in the first execution
of emitConstantPool rather than in emitLinkage (and a few other
places). This is the point where we have already gathered information
about used symbols (by running the MC Lower PrePass) and not yet
started emitting any functions so that any declarations that need to
be emitted are done so at the top of the file before any functions.

This changes the order of a few directives in the final asm file which
required an update to a few tests.

Reviewed By: sbc100

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

2 years agoRename this file to fix the typo in its name; NFC
Aaron Ballman [Fri, 4 Feb 2022 20:59:28 +0000 (15:59 -0500)]
Rename this file to fix the typo in its name; NFC

2 years agoAMDGPU: Convert AMDGPUResourceUsageAnalysis to a Module pass
Matt Arsenault [Mon, 17 Jan 2022 15:55:36 +0000 (10:55 -0500)]
AMDGPU: Convert AMDGPUResourceUsageAnalysis to a Module pass

This is more precise in the face of indirect calls and aliases, still
assuming the call target is defined somewhere in the current module.

This sometimes changes the order the functions are printed, and also
changes the point where context errors are printed relative to
stdout. This also likely has negative consequences for compile time
and memory usage.

2 years agoAMDGPU: Use module level register maximums for unknown callees
Matt Arsenault [Fri, 14 Jan 2022 01:13:29 +0000 (20:13 -0500)]
AMDGPU: Use module level register maximums for unknown callees

Compute the theoretical register budget based on the IR function
signature/attributes, and use the global maximum register budgets for
unknown callees.

This should fix the kernel reported register usage in the presence of
indirect calls. The previous fix in
2b08f6af62afbf32e89a6a392dbafa92c62f7bdf was incorrect becauset it was
only taking the maximum in the known call graph, and missing something
that was either outside of it or codegened later.

This fixes a second case I discovered where calls to aliases also did
not work as expected. CallGraphAnalysis misses these, so functions
called through aliases were not codegened ahead of callers as
expected. CallGraphAnalysis should probably be fixed to understand
this case, and there's likely a bug with IPRA here. This fixes
numerous failures in the conformance test at -O0.

2 years ago[libc++] Move fpos into its own header
Nikolas Klauser [Fri, 4 Feb 2022 12:04:33 +0000 (13:04 +0100)]
[libc++] Move fpos into its own header

For some reason `<string>` defines `std::fpos`, which should be defined in `<ios>`.

Reviewed By: Quuxplusone, Mordante, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[gn build] Port dbed14d
Arthur Eubanks [Fri, 4 Feb 2022 20:51:53 +0000 (12:51 -0800)]
[gn build] Port dbed14d

2 years ago[libc++] Remove unused code paths for non-existent builtins
Louis Dionne [Thu, 3 Feb 2022 17:29:35 +0000 (12:29 -0500)]
[libc++] Remove unused code paths for non-existent builtins

It looks like we added some checks to try and use builtin type traits
in https://reviews.llvm.org/D67900, but some of those type traits are
never implemented as builtins, so this is essentially dead code.

Fixes llvm-project#53569

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

2 years agoClean up a test case.
minglotus-6 [Wed, 2 Feb 2022 21:30:22 +0000 (13:30 -0800)]
Clean up a test case.

The test case is added to demonstrate diff before and after patch D114832.

The solution is

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

2 years ago[APInt] Update APInt::isShiftedMask() description. NFC.
Simon Pilgrim [Fri, 4 Feb 2022 20:38:52 +0000 (20:38 +0000)]
[APInt] Update APInt::isShiftedMask() description. NFC.

Make it clear that it matches a non-empty sequence of ones, matches the descriptions for isShiftedMask_32/64 as suggested on D119019

2 years ago[IntrospectionTest] Replace "return" with "GTEST_SKIP"
Paul Robinson [Fri, 4 Feb 2022 20:33:21 +0000 (12:33 -0800)]
[IntrospectionTest] Replace "return" with "GTEST_SKIP"

If a test simply returns, it gets mis-reported as a pass; being
reported as SKIPPED is correct.

Found by the Rotten Green Tests project.

2 years ago[mte] [nfc] do not keep Tag in AllocaInfo
Florian Mayer [Fri, 4 Feb 2022 01:10:28 +0000 (17:10 -0800)]
[mte] [nfc] do not keep Tag in AllocaInfo

this is to get the implementation closer to HWASan

Reviewed By: eugenis

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

2 years ago[OpenMP] Completely remove old device runtime
Joseph Huber [Thu, 3 Feb 2022 19:43:40 +0000 (14:43 -0500)]
[OpenMP] Completely remove old device runtime

This patch completely removes the old OpenMP device runtime. Previously,
the old runtime had the prefix `libomptarget-new-` and the old runtime
was simply called `libomptarget-`. This patch makes the formerly new
runtime the only runtime available. The entire project has been deleted,
and all references to the `libomptarget-new` runtime has been replaced
with `libomptarget-`.

Reviewed By: JonChesterfield

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

2 years ago[SLP] Strengthen internal asserts about scheduled node state [NFC]
Philip Reames [Fri, 4 Feb 2022 20:21:53 +0000 (12:21 -0800)]
[SLP] Strengthen internal asserts about scheduled node state [NFC]

All members of a scheduled bundle must have valid dependencies, with no unscheduled ones, and only the lead element gets marked scheduled.

2 years agoUse functions with prototypes when appropriate; NFC
Aaron Ballman [Fri, 4 Feb 2022 20:19:56 +0000 (15:19 -0500)]
Use functions with prototypes when appropriate; NFC

A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the second batch of tests being updated (there are a significant
number of other tests left to be updated).

2 years ago[OpenMP] Add -Bsymbolic to arguments for GNU linker
Joseph Huber [Fri, 4 Feb 2022 17:51:10 +0000 (12:51 -0500)]
[OpenMP] Add -Bsymbolic to arguments for GNU linker

This patch adds the '-Bsymbolic' flag when we perform linking for the
offloading device. We already pass '-fvisibility=protected' but this is
not properly handled when using the bfd linker as is described in
https://maskray.me/blog/2021-05-16-elf-interposition-and-bsymbolic.
Previously this caused linker errors when creating the shared library.

Reviewed By: JonChesterfield

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

2 years ago[Clang][Sema][OpenMP] Fix uninitialized variable Op
Shilei Tian [Fri, 4 Feb 2022 20:00:36 +0000 (15:00 -0500)]
[Clang][Sema][OpenMP] Fix uninitialized variable Op

This can fix the case atomic_messages

2 years ago[libc++][ranges][NFC] On the Ranges status page, fix some broken links.
Konstantin Varlamov [Fri, 4 Feb 2022 19:58:35 +0000 (11:58 -0800)]
[libc++][ranges][NFC] On the Ranges status page, fix some broken links.

2 years ago[mlir][sparse] Updating sparse-compiler pipeline for python usage
wren romano [Tue, 1 Feb 2022 22:19:11 +0000 (14:19 -0800)]
[mlir][sparse] Updating sparse-compiler pipeline for python usage

Explicitly nests passes for FuncOp, adds more options to the sparse-compiler pipeline, and updates python integration tests.  This should be sufficient to close https://github.com/llvm/llvm-project/issues/51751

Reviewed By: aartbik

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

2 years ago[clang-format][NFC] Fix a bug in setting type FunctionLBrace
Owen Pan [Fri, 4 Feb 2022 05:23:41 +0000 (21:23 -0800)]
[clang-format][NFC] Fix a bug in setting type FunctionLBrace

The l_brace token in a macro definition should not be set to
TT_FunctionLBrace.

This patch could have fixed #42087.

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

2 years ago[mlir] Use SetVector to deduplicate shape ops operands
Eugene Zhulenev [Fri, 4 Feb 2022 18:20:12 +0000 (10:20 -0800)]
[mlir] Use SetVector to deduplicate shape ops operands

Do not use quadratic complexity algorithm to find unique operands

Reviewed By: jpienaar

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

2 years ago[mlir][linalg] Let tile and fuse fail for tile sizes zero.
gysit [Fri, 4 Feb 2022 19:13:28 +0000 (19:13 +0000)]
[mlir][linalg] Let tile and fuse fail for tile sizes zero.

Adapt `tileConsumerAndFuseProducers` to return failure if the generated tile loop nest is empty since all tile sizes are zero. Additionally, fix `LinalgTileAndFuseTensorOpsPattern` to return success if the pattern applied successfully.

Reviewed By: mravishankar

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

2 years ago[clang] roll-forward "[clang] Mark `trivial_abi` types as "trivially relocatable"".
Devin Jeanpierre [Fri, 4 Feb 2022 18:54:35 +0000 (19:54 +0100)]
[clang] roll-forward "[clang] Mark `trivial_abi` types as "trivially relocatable"".

This reverts commit 852afed5e0200b70047c28ccf4424a17089d17b0.

Changes since D114732:

On PS4, we reverse the expectation that classes whose constructor is deleted are not trivially relocatable. Because, at the moment, only classes which are passed in registers are trivially relocatable, and PS4 allows passing in registers if the copy constructor is deleted, the original assertions were broken on PS4.

(This is kinda similar to DR1734.)

Reviewed By: gribozavr2

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

2 years ago[x86] enable fast sqrtss/sqrtps tuning for AMD Zen cores
Sanjay Patel [Fri, 4 Feb 2022 18:13:01 +0000 (13:13 -0500)]
[x86] enable fast sqrtss/sqrtps tuning for AMD Zen cores

As discussed in D118534, all of the recent AMD CPUs have
relatively fast (<14 cycle latency) "sqrtss" and "sqrtps"
instructions:
https://uops.info/table.html?search=sqrtps&cb_lat=on&cb_tp=on&cb_SNB=on&cb_SKL=on&cb_ZENp=on&cb_ZEN2=on&cb_ZEN3=on&cb_measurements=on&cb_avx=on&cb_sse=on

So we should set this tuning flag to alter codegen of plain
"sqrt(X)" expansion (as opposed to reciprocal-sqrt - there
is other test coverage for that pattern). The expansion is
both slower and less accurate than the hardware instruction.

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

2 years ago[llvm-libtool-darwin] Fix crash with bitcode asm module
Keith Smiley [Sun, 30 Jan 2022 21:38:03 +0000 (13:38 -0800)]
[llvm-libtool-darwin] Fix crash with bitcode asm module

When using llvm-libtool-darwin with LTO building llvm itself, it crashed
on a file with an asm module in the bitcode. This fixes that by
correctly registering the targets for this.

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

2 years ago[gn build] Port 1d8bbe3d255f
LLVM GN Syncbot [Fri, 4 Feb 2022 18:44:32 +0000 (18:44 +0000)]
[gn build] Port 1d8bbe3d255f

2 years ago[RISCV] Implement a basic version of AArch64RedundantCopyElimination pass.
Craig Topper [Fri, 4 Feb 2022 17:45:02 +0000 (09:45 -0800)]
[RISCV] Implement a basic version of AArch64RedundantCopyElimination pass.

Using AArch64's original implementation for reference, this patch
implements a pass to remove unneeded copies of X0. This pass runs
after register allocation and looks to see if a register is implied
to be 0 by a branch in the predecessor basic block.

Reviewed By: asb

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

2 years ago[lldb] Rename DemangleWithRichManglingInfo to GetRichManglingInfo (NFC)
Jonas Devlieghere [Fri, 4 Feb 2022 18:32:34 +0000 (10:32 -0800)]
[lldb] Rename DemangleWithRichManglingInfo to GetRichManglingInfo (NFC)

This addresses Pavel's comment from D118814.

2 years ago[Libomptarget] Remove AMDGPU XFAIL from test
Joseph Huber [Fri, 4 Feb 2022 18:38:57 +0000 (13:38 -0500)]
[Libomptarget] Remove AMDGPU XFAIL from test

Summary;
This test should pass now with AMDGPU. Previously the symbols were
hidden and would fail when read.

2 years ago[mte] fix runOnFunction return value falsely suggesting function was modified.
Florian Mayer [Fri, 4 Feb 2022 02:18:39 +0000 (18:18 -0800)]
[mte] fix runOnFunction return value falsely suggesting function was modified.

If NumInterestingAllocas == 0 we do not add any instrumentation or
padding in the previous loop.

Reviewed By: eugenis

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

2 years ago[HeaderSearch] Track framework name in LookupFile
David Goldman [Thu, 20 Jan 2022 18:41:56 +0000 (13:41 -0500)]
[HeaderSearch] Track framework name in LookupFile

Previously, the Framework name was only set if the file
came from a header mapped framework; now we'll always
set the framework name if the file is in a framework.

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

2 years ago[Clang][Sema][OpenMP] Remove unused variables. NFC.
Benjamin Kramer [Fri, 4 Feb 2022 18:27:59 +0000 (19:27 +0100)]
[Clang][Sema][OpenMP] Remove unused variables. NFC.

2 years ago[lldb] Don't construct the demangled strings while indexing the symbol table
Jonas Devlieghere [Thu, 3 Feb 2022 18:48:16 +0000 (10:48 -0800)]
[lldb] Don't construct the demangled strings while indexing the symbol table

The symbol table needs to demangle all symbol names when building its
index. However, this doesn't require the full mangled name: we only need
the base name and the function declaration context. Currently, we always
construct the demangled string during indexing and cache it in the
string pool as a way to speed up future lookups.

Constructing the demangled string is by far the most expensive step of
the demangling process, because the output string can be exponentially
larger than the input and unless you're dumping the symbol table, many
of those demangled names will not be needed again.

This patch avoids constructing the full demangled string when we can
partially demangle. This speeds up indexing and reduces memory usage.

I gathered some numbers by attaching to Slack:

Before
------

  Memory usage: 280MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.829 s ±  0.518 s    [User: 4.012 s, System: 0.208 s]
    Range (min … max):    4.624 s …  6.294 s    10 runs

After
-----

  Memory usage: 189MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.182 s ±  0.025 s    [User: 3.536 s, System: 0.192 s]
    Range (min … max):    4.152 s …  4.233 s    10 runs

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

2 years ago[lldb] Improve RichManglingContext ergonomics (NFC)
Jonas Devlieghere [Fri, 4 Feb 2022 01:26:19 +0000 (17:26 -0800)]
[lldb] Improve RichManglingContext ergonomics (NFC)

Have the different ::Parse.* methods return the demangled string
directly instead of having to go through ::GetBufferRef.

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

2 years ago[msan] Guard FP_XSTATE_MAGIC1 usage with SANITIZER_GLIBC
Fangrui Song [Fri, 4 Feb 2022 18:15:11 +0000 (10:15 -0800)]
[msan] Guard FP_XSTATE_MAGIC1 usage with SANITIZER_GLIBC

Fix build for Linux musl.

Reviewed By: #sanitizers, dvyukov

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

2 years ago[SLP] Remove ScheduleData::UnscheduledDepsInBundle field [NFC-ish]
Philip Reames [Fri, 4 Feb 2022 18:09:38 +0000 (10:09 -0800)]
[SLP] Remove ScheduleData::UnscheduledDepsInBundle field [NFC-ish]

We can simply compute the value of this field on demand.  Doing so clarifies the behavior when one of the instructions within a bundle doesn't have valid dependencies.  I vaguely thing this could change behavior slightly, but none of the test cases are affected, and my attempts to write one by hand have failed.

This also minorly reduces memory usage, but that's a secondary value at best.

2 years agoRevert "[MLIR][Presburger] Use `SmallVector` instead of `std::vector` in `getLocalRepr`"
Prashant Kumar [Fri, 4 Feb 2022 15:57:01 +0000 (21:27 +0530)]
Revert "[MLIR][Presburger] Use `SmallVector` instead of `std::vector` in `getLocalRepr`"

This reverts commit 3cc544772848682bc77ff63db659a5aa4b3d4e6b.
SmallVector inside SmallVector are not optimized.

Reviewed By: arjunp

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

2 years ago[BOLT][TEST] Add section flags for .gcc_except_table
Amir Ayupov [Fri, 4 Feb 2022 17:33:22 +0000 (09:33 -0800)]
[BOLT][TEST] Add section flags for .gcc_except_table

clang-10 complains about changed section flags in two tests:
- X86/shrinkwrapping.test
- X86/exceptions-args.test

Fix that by adding the missing flags.

Reviewed By: yota9

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

2 years ago[gn build] Port 4a02562275d4
LLVM GN Syncbot [Fri, 4 Feb 2022 17:43:11 +0000 (17:43 +0000)]
[gn build] Port 4a02562275d4

2 years ago[gn build] Port 44cdca37c01a
LLVM GN Syncbot [Fri, 4 Feb 2022 17:43:10 +0000 (17:43 +0000)]
[gn build] Port 44cdca37c01a

2 years ago[AMDGPU] Lazily init pal metadata on first function
Sebastian Neubauer [Fri, 4 Feb 2022 17:39:35 +0000 (18:39 +0100)]
[AMDGPU] Lazily init pal metadata on first function

Delay reading global metadata until the first function or the end of
the file is emitted. That way, earlier module passes can set metadata
that is emitted in the ELF.

`emitStartOfAsmFile` gets called when the passes are initialized,
which prevented earlier passes from changing the metadata.

This fixes issues encountered after converting
AMDGPUResourceUsageAnalysis to a Module pass in D117504.

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

2 years ago[libc++] Define `namespace views` in its own detail header.
Arthur O'Dwyer [Wed, 2 Feb 2022 17:23:51 +0000 (12:23 -0500)]
[libc++] Define `namespace views` in its own detail header.

Discovered in the comments on D118748: we would like this namespace
to exist anytime Ranges exists, regardless of whether concepts syntax
is supported. Also, we'd like to fully granularize the <ranges> header,
which means not putting any loose declarations at the top level.

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

2 years ago[Clang][Sema][OpenMP] Sema support for `atomic compare`
Shilei Tian [Fri, 4 Feb 2022 17:30:17 +0000 (12:30 -0500)]
[Clang][Sema][OpenMP] Sema support for `atomic compare`

This patch adds the Sema support for `atomic compare`.

Reviewed By: ABataev

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

2 years ago[Driver][Android] Removed obsoleted --warn-shared-textrel
Fangrui Song [Fri, 4 Feb 2022 17:30:11 +0000 (09:30 -0800)]
[Driver][Android] Removed obsoleted --warn-shared-textrel

--warn-shared-textrel is ignored in ld.lld and obsoleted in GNU ld
(https://sourceware.org/bugzilla/show_bug.cgi?id=22909).

Note: binutils can be configured with --enable-textrel-check=[yes|error]
to make GNU ld error for text relocations by default, like ld.lld.

Reviewed By: srhines

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

2 years ago[libc++] Normalize all our '#pragma GCC system_header', and regression-test.
Arthur O'Dwyer [Wed, 2 Feb 2022 01:16:40 +0000 (20:16 -0500)]
[libc++] Normalize all our '#pragma GCC system_header', and regression-test.

Now we'll notice if a header forgets to include this magic phrase.

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

2 years ago[SimplifyCFG] 'merge compatible invokes': allow PHI nodes in landing pads
Roman Lebedev [Fri, 4 Feb 2022 17:16:49 +0000 (20:16 +0300)]
[SimplifyCFG] 'merge compatible invokes': allow PHI nodes in landing pads

... iff the incoming values for the invokes-to-be-merged
are compatible (identical).

2 years ago[NFC][SimplifyCFG] Extract `IncomingValuesAreCompatible()` out of `SafeToMergeTermina...
Roman Lebedev [Fri, 4 Feb 2022 15:43:29 +0000 (18:43 +0300)]
[NFC][SimplifyCFG] Extract `IncomingValuesAreCompatible()` out of `SafeToMergeTerminators()`

2 years ago[NFC][SimplifyCFG] 'merge compatible invokes': tests w/ PHI's in landingpad
Roman Lebedev [Fri, 4 Feb 2022 14:31:24 +0000 (17:31 +0300)]
[NFC][SimplifyCFG] 'merge compatible invokes': tests w/ PHI's in landingpad

2 years ago[AMDGPU] SILoadStoreOptimizer: rewrite checkAndPrepareMerge. NFCI.
Jay Foad [Thu, 27 Jan 2022 14:22:55 +0000 (14:22 +0000)]
[AMDGPU] SILoadStoreOptimizer: rewrite checkAndPrepareMerge. NFCI.

Separate the function clearly into:
- Checks that can be done on CI and Paired before the loop.
- The loop over all instructions between CI and Paired.
- Checks that must be done on InstsToMove after the loop.

Previously these were mostly done inside the loop in a very
confusing way.

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

2 years ago[RISCV] Add more types of shuffles isShuffleMaskLegal.
Craig Topper [Fri, 4 Feb 2022 17:13:12 +0000 (09:13 -0800)]
[RISCV] Add more types of shuffles isShuffleMaskLegal.

Add the vslidedown and interleave patterns that I recently implemented.

Reviewed By: frasercrmck

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

2 years ago[RISCV] Add inline expansion for vector fround.
Craig Topper [Fri, 4 Feb 2022 17:01:07 +0000 (09:01 -0800)]
[RISCV] Add inline expansion for vector fround.

This avoids a crash for scalable vectors and or scalarization for
fixed vectors.

The algorithm is different enough that I don't think it makes sense
to merge with ceil/floor/trunc. Algorithm is adapted from gcc's X86
SSE2 output.

Reviewed By: frasercrmck

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

2 years ago[Support] Add isShiftedMask_32/isShiftedMask_64 unit test coverage
Simon Pilgrim [Fri, 4 Feb 2022 17:06:48 +0000 (17:06 +0000)]
[Support] Add isShiftedMask_32/isShiftedMask_64 unit test coverage

2 years ago[NFC] Move FoldingSetNodeIDRef::ComputeHash and FoldingSetNodeID::ComputeHash definit...
Dawid Jurczak [Fri, 4 Feb 2022 17:03:42 +0000 (18:03 +0100)]
[NFC] Move FoldingSetNodeIDRef::ComputeHash and FoldingSetNodeID::ComputeHash definitions to header

Lack of ComputeHash inlining slows down slightly FoldingSetBase::FindNodeOrInsertPos calls.
Inlining makes it faster which matters in particular for FoldingSet users in ASTContext.

Extracted from: https://reviews.llvm.org/D118385

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

2 years ago[InstCombine] try to fold one-demanded-bit-of-multiply
Sanjay Patel [Fri, 4 Feb 2022 16:24:01 +0000 (11:24 -0500)]
[InstCombine] try to fold one-demanded-bit-of-multiply

This is a generalization of the icmp fold in D118061 (and that can be abandoned).
We're looking for a disguised form of "odd * odd must be odd".
Some Alive2 proofs to show correctness:
https://alive2.llvm.org/ce/z/60Y8hz
https://alive2.llvm.org/ce/z/HfAP6R

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

2 years ago[x86] add test coverage for AMD Ryzen fast sqrt codegen; NFC
Sanjay Patel [Fri, 4 Feb 2022 15:35:17 +0000 (10:35 -0500)]
[x86] add test coverage for AMD Ryzen fast sqrt codegen; NFC

2 years ago[BitstreamReader] Fix incorrect error forwarding
Nikita Popov [Fri, 4 Feb 2022 16:30:48 +0000 (17:30 +0100)]
[BitstreamReader] Fix incorrect error forwarding

This code clearly intended to forward the error, but instead
returned the non-error result.

2 years ago[BitstreamReader] Handle errors more gracefully
Nikita Popov [Fri, 4 Feb 2022 16:23:08 +0000 (17:23 +0100)]
[BitstreamReader] Handle errors more gracefully

Use proper error reporting instead of report_fatal_error().