Jonas Paulsson [Wed, 10 May 2023 09:02:07 +0000 (11:02 +0200)]
[SystemZ] Bugfix in expansion of memmem operations.
Since NC, OC, and XC clobber CC, the EXRL_Pseudo targeting these must also be
marked to do so.
Original patch by uweigand.
Reviewed by: uweigand
Differential Revision: https://reviews.llvm.org/D150251
Fixes: https://github.com/llvm/llvm-project/issues/62572
Guillaume Chatelet [Wed, 10 May 2023 08:34:05 +0000 (08:34 +0000)]
[libc] Add optimized memcpy for RISCV
This patch adds two versions of memcpy optimized for architectures where unaligned accesses are either illegal or extremely slow.
It is currently enabled for RISCV 64 and RISCV 32 but it could be used for ARM 32 architectures as well.
Here is the before / after output of `libc.benchmarks.memory_functions.opt_host --benchmark_filter=BM_Memcpy` on a quad core Linux starfive RISCV 64 board running at 1.5GHz.
Before:
```
Run on (4 X 1500 MHz CPU s)
CPU Caches:
L1 Instruction 32 KiB (x4)
L1 Data 32 KiB (x4)
L2 Unified 2048 KiB (x1)
------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------
BM_Memcpy/0/0 474 ns 474 ns 1483776 bytes_per_cycle=0.243492/s bytes_per_second=348.318M/s items_per_second=2.11097M/s __llvm_libc::memcpy,memcpy Google A
BM_Memcpy/1/0 210 ns 209 ns 3649536 bytes_per_cycle=0.233819/s bytes_per_second=334.481M/s items_per_second=4.77519M/s __llvm_libc::memcpy,memcpy Google B
BM_Memcpy/2/0 1814 ns 1814 ns 396288 bytes_per_cycle=0.247899/s bytes_per_second=354.622M/s items_per_second=551.402k/s __llvm_libc::memcpy,memcpy Google D
BM_Memcpy/3/0 89.3 ns 89.2 ns 7459840 bytes_per_cycle=0.217415/s bytes_per_second=311.014M/s items_per_second=11.2071M/s __llvm_libc::memcpy,memcpy Google L
BM_Memcpy/4/0 134 ns 134 ns 3815424 bytes_per_cycle=0.226584/s bytes_per_second=324.131M/s items_per_second=7.44567M/s __llvm_libc::memcpy,memcpy Google M
BM_Memcpy/5/0 52.8 ns 52.6 ns
11001856 bytes_per_cycle=0.194893/s bytes_per_second=278.797M/s items_per_second=19.0284M/s __llvm_libc::memcpy,memcpy Google Q
BM_Memcpy/6/0 180 ns 180 ns 4101120 bytes_per_cycle=0.231884/s bytes_per_second=331.713M/s items_per_second=5.55957M/s __llvm_libc::memcpy,memcpy Google S
BM_Memcpy/7/0 195 ns 195 ns 3906560 bytes_per_cycle=0.232951/s bytes_per_second=333.239M/s items_per_second=5.1217M/s __llvm_libc::memcpy,memcpy Google U
BM_Memcpy/8/0 152 ns 152 ns 4789248 bytes_per_cycle=0.227507/s bytes_per_second=325.452M/s items_per_second=6.58187M/s __llvm_libc::memcpy,memcpy Google W
BM_Memcpy/9/0 6036 ns 6033 ns 118784 bytes_per_cycle=0.249158/s bytes_per_second=356.423M/s items_per_second=165.75k/s __llvm_libc::memcpy,uniform 384 to 4096
```
After:
```
BM_Memcpy/0/0 126 ns 126 ns 5770240 bytes_per_cycle=1.04707/s bytes_per_second=1.46273G/s items_per_second=7.9385M/s __llvm_libc::memcpy,memcpy Google A
BM_Memcpy/1/0 75.1 ns 75.0 ns
10204160 bytes_per_cycle=0.691143/s bytes_per_second=988.687M/s items_per_second=13.3289M/s __llvm_libc::memcpy,memcpy Google B
BM_Memcpy/2/0 333 ns 333 ns 2174976 bytes_per_cycle=1.39297/s bytes_per_second=1.94596G/s items_per_second=3.00002M/s __llvm_libc::memcpy,memcpy Google D
BM_Memcpy/3/0 49.6 ns 49.5 ns
16092160 bytes_per_cycle=0.710161/s bytes_per_second=1015.89M/s items_per_second=20.1844M/s __llvm_libc::memcpy,memcpy Google L
BM_Memcpy/4/0 57.7 ns 57.7 ns
11213824 bytes_per_cycle=0.561557/s bytes_per_second=803.314M/s items_per_second=17.3228M/s __llvm_libc::memcpy,memcpy Google M
BM_Memcpy/5/0 48.0 ns 47.9 ns
16437248 bytes_per_cycle=0.346708/s bytes_per_second=495.97M/s items_per_second=20.8571M/s __llvm_libc::memcpy,memcpy Google Q
BM_Memcpy/6/0 67.5 ns 67.5 ns
10616832 bytes_per_cycle=0.614173/s bytes_per_second=878.582M/s items_per_second=14.8142M/s __llvm_libc::memcpy,memcpy Google S
BM_Memcpy/7/0 84.7 ns 84.6 ns
10480640 bytes_per_cycle=0.819077/s bytes_per_second=1.14424G/s items_per_second=11.8174M/s __llvm_libc::memcpy,memcpy Google U
BM_Memcpy/8/0 61.7 ns 61.6 ns
11191296 bytes_per_cycle=0.550078/s bytes_per_second=786.893M/s items_per_second=16.2279M/s __llvm_libc::memcpy,memcpy Google W
BM_Memcpy/9/0 981 ns 981 ns 703488 bytes_per_cycle=1.52333/s bytes_per_second=2.12807G/s items_per_second=1019.81k/s __llvm_libc::memcpy,uniform 384 to 4096
```
It is not as good as glibc for now so there's room for improvement. I suspect a path pumping 16 bytes at once given the doubled numbers for large copies.
```
BM_Memcpy/0/1 146 ns 82.5 ns 8576000 bytes_per_cycle=1.35236/s bytes_per_second=1.88922G/s items_per_second=12.1169M/s glibc memcpy,memcpy Google A
BM_Memcpy/1/1 112 ns 63.7 ns
10634240 bytes_per_cycle=0.628018/s bytes_per_second=898.387M/s items_per_second=15.702M/s glibc memcpy,memcpy Google B
BM_Memcpy/2/1 315 ns 180 ns 4079616 bytes_per_cycle=2.65229/s bytes_per_second=3.7052G/s items_per_second=5.54764M/s glibc memcpy,memcpy Google D
BM_Memcpy/3/1 85.3 ns 43.1 ns
15854592 bytes_per_cycle=0.774164/s bytes_per_second=1107.45M/s items_per_second=23.2249M/s glibc memcpy,memcpy Google L
BM_Memcpy/4/1 105 ns 54.3 ns
13427712 bytes_per_cycle=0.7793/s bytes_per_second=1114.8M/s items_per_second=18.4109M/s glibc memcpy,memcpy Google M
BM_Memcpy/5/1 77.1 ns 43.2 ns
16476160 bytes_per_cycle=0.279808/s bytes_per_second=400.269M/s items_per_second=23.1428M/s glibc memcpy,memcpy Google Q
BM_Memcpy/6/1 112 ns 62.7 ns
11236352 bytes_per_cycle=0.676078/s bytes_per_second=967.137M/s items_per_second=15.9387M/s glibc memcpy,memcpy Google S
BM_Memcpy/7/1 131 ns 65.5 ns
11751424 bytes_per_cycle=0.965616/s bytes_per_second=1.34895G/s items_per_second=15.2762M/s glibc memcpy,memcpy Google U
BM_Memcpy/8/1 104 ns 55.0 ns
12314624 bytes_per_cycle=0.583336/s bytes_per_second=834.468M/s items_per_second=18.1937M/s glibc memcpy,memcpy Google W
BM_Memcpy/9/1 932 ns 466 ns 1480704 bytes_per_cycle=3.17342/s bytes_per_second=4.43321G/s items_per_second=2.14679M/s glibc memcpy,uniform 384 to 4096
```
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D150202
Chuanqi Xu [Wed, 10 May 2023 03:54:04 +0000 (11:54 +0800)]
[NFC] [C++20] [Modules] Refactor Sema::isModuleUnitOfCurrentTU into
Decl::isInCurrentModuleUnit
Refactor `Sema::isModuleUnitOfCurrentTU` to `Decl::isInCurrentModuleUnit`
to make code simpler a little bit. Note that although this patch
introduces a FIXME, this is an existing issue and this patch just tries
to describe it explicitly.
Qiu Chaofan [Wed, 10 May 2023 07:42:03 +0000 (15:42 +0800)]
Reland "[PowerPC] Add target feature requirement to builtins"
This relands D143467 after fixing build failure with GCC.
Joshua Cao [Sat, 15 Apr 2023 23:04:58 +0000 (16:04 -0700)]
[SimpleLoopUnswitch] unswitch selects
The old LoopUnswitch pass unswitched selects, but the changes were never
ported to the new SimpleLoopUnswitch.
We unswitch by turning:
```
S = select %cond, %a, %b
```
into:
```
head:
br %cond, label %then, label %tail
then:
br label %tail
tail:
S = phi [ %a, %then ], [ %b, %head ]
```
Unswitch selects are always nontrivial, since the successors do not exit
the loop and the loop body always needs to be cloned.
Unswitch selects always need to freeze the conditional if the
conditional could be poison or undef. Selects don't propagate
poison/undef, and branches on poison/undef causes UB.
Reviewed By: nikic, kachkov98, vitalybuka
Differential Revision: https://reviews.llvm.org/D138526
Fangrui Song [Wed, 10 May 2023 07:19:46 +0000 (00:19 -0700)]
[test] Clean up Driver/check-time-trace*
Rename check-time-trace* to ftime-trace*.
Avoid deprecated %T.
Mikael Holmen [Wed, 10 May 2023 07:00:39 +0000 (09:00 +0200)]
[CombinerHelper] Fix gcc warning [NFC]
Without the fix gcc complains with
../lib/CodeGen/GlobalISel/CombinerHelper.cpp:1652:52: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
1652 | SrcDef->getOpcode() == TargetOpcode::G_OR && "Unexpected op");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
Matt Arsenault [Sat, 6 May 2023 00:17:53 +0000 (01:17 +0100)]
AMDGPU: Add baseline tests for fmed3 shrinking combine
Matt Arsenault [Mon, 8 May 2023 13:34:03 +0000 (14:34 +0100)]
GlobalISel: Fold out G_FPTRUNC(G_FPEXT)
Matt Arsenault [Mon, 8 May 2023 12:02:38 +0000 (13:02 +0100)]
TableGen: Fix missing C++ mode comments
luxufan [Wed, 10 May 2023 06:05:57 +0000 (14:05 +0800)]
Revert "Revert "[ValutTracking] Use isGuaranteedNotToBePoison in impliesPoison""
This reverts commit
706e8110573c83f140a63b40803d6370c86c1414.
Lang Hames [Wed, 10 May 2023 06:31:11 +0000 (23:31 -0700)]
[lli] Honor -mtriple option in -jit-kind=orc mode.
Useful for lli debugging / experiments. See, for example, discussion at
https://reviews.llvm.org/D149996.
Craig Topper [Wed, 10 May 2023 06:16:27 +0000 (23:16 -0700)]
[LegalizeTypes] Simplify code for UndefinedBooleanContent in PromoteIntOp_VECREDUCE.
We can treat UndefinedBooleanContent the same as ZeroOrOneBooleanContent.
There's no reason to consider sign extending.
Lang Hames [Tue, 9 May 2023 06:25:30 +0000 (23:25 -0700)]
[lli] Improve support for MinGW by implementing __main as a no-op.
Without this function lli will error out on MinGW with a missing symbol error
for __main.
Cygwin and MinGW insert calls from the main function to the runtime function
__main. The __main function is responsible for setting up main's environment
(e.g. running static constructors), however this is not needed when running
under lli: the executor process will have run non-JIT ctors, and ORC will take
care of running JIT'd ctors. To avoid a missing symbol error we just implement
__main as a no-op.
Craig Topper [Wed, 10 May 2023 05:43:14 +0000 (22:43 -0700)]
[LegalizeTypes] Use ISD::isTrueWhenEqual to simplify code. NFC
Mahesh Ravishankar [Tue, 9 May 2023 06:20:53 +0000 (06:20 +0000)]
[mlir][Linalg] Avoid collapsing dimensions of linalg op that arent foldable.
The collapsing dimensions transformation is limited to only those
cases where the sequence of dimensions are contiguous in all the
ranges of the indexing maps of the operation. Add this check before
applying the transformation.
Differential Revision: https://reviews.llvm.org/D150176
Serguei Katkov [Wed, 10 May 2023 04:53:41 +0000 (11:53 +0700)]
[X86] Add test cases for fminimum/fmaximum with vector zero operands.
Daniel Garvey [Wed, 10 May 2023 04:26:37 +0000 (21:26 -0700)]
[spirv][math] Fix sign propagation for math.powf conversion
For `x^y`, the result's sign should consider whether `y` is
an integer and whether it's odd or even.
This still does not cover all corner cases regarding `x^y`
but it's an improvement over the current implementation.
Reviewed By: antiagainst, qedawkins
Differential Revision: https://reviews.llvm.org/D150234
Chen Zheng [Wed, 10 May 2023 03:02:20 +0000 (03:02 +0000)]
fix bot failure https://lab.llvm.org/buildbot/#/builders/38/builds/11709
Some generic cases have empty prologue on some platforms like hexagon,
but non empty prologue on some other platform like PPC.
Remove the checks for the optimized lines hit by D147506.
Chuanqi Xu [Wed, 10 May 2023 01:59:48 +0000 (09:59 +0800)]
[docs] [C++20] [Modules] Remove the section 'Source content consistency'
Since the C++20 named modules won't check source files consistency after
5b388f8, it would be better to remove this section in the document.
Jianjian GUAN [Sat, 6 May 2023 02:01:22 +0000 (10:01 +0800)]
[RISCV] Make Zvfh depend on Zfhmin.
According to the v spec, the Zvfh extension depends on the Zve32f and Zfhmin extensions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150016
Enna1 [Wed, 10 May 2023 01:23:49 +0000 (09:23 +0800)]
[NFC][HWASAN] replace redundant calls to IRBuilder::get*Ty() with saved types
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D149628
Chen Zheng [Thu, 4 May 2023 04:19:28 +0000 (04:19 +0000)]
[DebugLine] save one debug line entry for empty prologue
Reland D147506 after fixing the failure in bot
https://lab.llvm.org/buildbot/#/builders/247/builds/4125
Some debuggers like DBX on AIX assume the address in debug line
entries is always incremental. But clang generates two entries (entry
for file scope line and entry for prologue end) with same address if
prologue is empty
And if the prologue is empty, seems the first debug line entry for the
function is unnecessary(i.e. removing the first entry won't impact the
behavior in GDB on Linux), so I implement this for all debuggers.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D147506
Chen Zheng [Tue, 4 Apr 2023 06:35:34 +0000 (06:35 +0000)]
[DebugInfo] add test case for D147506, NFC
[DebugLine] save one debug line entry for empty prologue
Alexey Vishnyakov [Wed, 10 May 2023 01:06:10 +0000 (18:06 -0700)]
[TableGen] Fix null pointer dereferences in TreePattern::ParseTreePattern()
Bugs were found by Svace static analysis tool. Null pointers are
dereferenced right after error checking that does not return from
function.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D147706
Douglas Yung [Wed, 10 May 2023 00:42:28 +0000 (17:42 -0700)]
Revert "[test] [llvm-config] Assume unix style lib names on mingw targets"
This reverts commit
38db3795e706b212a34140a395d642195b9d150e.
This change was causing a test failure on the PS5 Windows bot:
https://lab.llvm.org/buildbot/#/builders/216/builds/20982
Mehdi Amini [Fri, 21 Apr 2023 06:51:14 +0000 (00:51 -0600)]
Adopt Properties to store operations inherent Attributes in the NVGPU dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148895
Mehdi Amini [Fri, 21 Apr 2023 06:50:13 +0000 (00:50 -0600)]
Adopt Properties to store operations inherent Attributes in the MLProgram dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148894
Mehdi Amini [Fri, 21 Apr 2023 06:45:52 +0000 (00:45 -0600)]
Adopt Properties to store operations inherent Attributes in the Memref dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148893
Mehdi Amini [Fri, 21 Apr 2023 06:44:38 +0000 (00:44 -0600)]
Adopt Properties to store operations inherent Attributes in the Math dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148892
Mehdi Amini [Fri, 21 Apr 2023 06:42:58 +0000 (00:42 -0600)]
Adopt Properties to store operations inherent Attributes in the IRDL dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148891
Mehdi Amini [Fri, 21 Apr 2023 06:29:34 +0000 (00:29 -0600)]
Adopt Properties to store operations inherent Attributes in the Index dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148890
Younan Zhang [Wed, 10 May 2023 00:23:18 +0000 (08:23 +0800)]
[clangd] Fix a build failure. NFC
This is caused by
7385cc389aba.
Noah Goldstein [Tue, 9 May 2023 23:04:41 +0000 (18:04 -0500)]
Re-revert "[ValueTracking] Use knownbits interface for determining if `div`/`rem` are safe to speculate"
Seems to be causing a bug in CorrelatedValuePropegation. Reverting
while the issue is investigated.
This reverts commit
6c667abf3294d61e4fbe1238e1755c79f7547f1b.
Jason Molenda [Tue, 9 May 2023 23:56:08 +0000 (16:56 -0700)]
[nfc] Remove dead code from ObjectFileMachO
The old way of lldb reading the on-disk shared cache is still in
the sources, but we use dyld SPI to inspect this binary now. This
code is no longer called.
Fangrui Song [Tue, 9 May 2023 23:44:15 +0000 (16:44 -0700)]
[Driver][test] Exclude `-o /dev/null` test for Windows
lit changes /dev/null to a special filename, and `"-dumpdir" "/dev/null-"` will fail.
Sami Tolvanen [Tue, 9 May 2023 23:13:35 +0000 (23:13 +0000)]
[KCFI] Expand the KCFI term in comments (NFC)
Jie Fu [Tue, 9 May 2023 22:54:22 +0000 (06:54 +0800)]
[mlir] Remove unused variable 'kCopyFlag' in OpenACCToLLVMIRTranslation.cpp (NFC)
/data/llvm-project/mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp:41:27: error: unused variable 'kCopyFlag' [-Werror,-Wunused-const-variable]
static constexpr uint64_t kCopyFlag = kDeviceCopyinFlag | kHostCopyoutFlag;
^
1 error generated.
Nathan Sidwell [Fri, 5 May 2023 15:58:54 +0000 (11:58 -0400)]
[NFC] Refactor loop metadata movement
* Use 'if (T v = expr)' idiom
* llvm.loop is a fixed metadata ID
Differential Revision: https://reviews.llvm.org/D150109
Reviewed By: kazu
Christopher Ferris [Tue, 9 May 2023 02:12:32 +0000 (19:12 -0700)]
[scudo] Change secondary StatsAllocated update
In the secondary allocation routine, the StatsAllocated stat is
increased by BlockSize. However, in the deallocate routine, the
stat subtract uses CommitSize. CommitSize can be bigger than BlockSize
so this can lead to a negative calculated stat. Since the stats
are not guaranteed to be completely accurate, just add CommitSize
during allocation.
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D150169
Ivan Butygin [Tue, 25 Apr 2023 20:11:23 +0000 (22:11 +0200)]
[mlir][gpu] Reduction ops canonicalizatios
Make group ops uniform if `gpu.launch` is their direct parent.
Differential Revision: https://reviews.llvm.org/D149183
Rahul Kayaith [Tue, 9 May 2023 22:01:44 +0000 (18:01 -0400)]
Revert "[mlir][python] Allow specifying block arg locations"
This reverts commit
4d0d295b618edfc937d5bf247f0853df5c70cb96.
This caused a buildbot failure: https://lab.llvm.org/buildbot/#/builders/61/builds/43479
Martin Storsjö [Fri, 5 May 2023 11:08:32 +0000 (11:08 +0000)]
[clang-tidy] [test] Narrow down a special case to MSVC mode
For MinGW targets, size_t isn't a compiler defined type, just like
for unix targets.
Differential Revision: https://reviews.llvm.org/D149999
Martin Storsjö [Fri, 5 May 2023 10:58:47 +0000 (10:58 +0000)]
[clang] [test] Narrow down MSVC specific behaviours from "any windows" to only MSVC/clang-cl
This fixes running tests with a toolchain that defaults to a MinGW
target.
Differential Revision: https://reviews.llvm.org/D149997
Martin Storsjö [Fri, 5 May 2023 11:05:26 +0000 (11:05 +0000)]
[test] [llvm-config] Assume unix style lib names on mingw targets
Assume the MSVC style naming only for "windows-msvc" targets.
Differential Revision: https://reviews.llvm.org/D149998
Valentin Clement [Tue, 9 May 2023 21:57:23 +0000 (14:57 -0700)]
[mlir][openacc] Cleanup acc.parallel from old data clause operands
Remove old clause operands from acc.parallel operation since
the new dataOperands is now in place.
private, firstprivate and reductions will receive some redesign but are
not part of the new dataOperands.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150207
Arthur Eubanks [Tue, 9 May 2023 21:45:49 +0000 (14:45 -0700)]
[gn build] Manually port
e9569748de
Fangrui Song [Tue, 9 May 2023 21:43:46 +0000 (14:43 -0700)]
[Driver] Add -dumpdir and change -gsplit-dwarf .dwo names for linking
When the final phase is linking, Clang currently places `.dwo` files in the
current directory (like the `-c` behavior for multiple inputs).
Strangely, -fdebug-compilation-dir=/-ffile-compilation-dir= is considered, which
is untested.
GCC has a more useful behavior that derives auxiliary filenames from the final
output (-o).
```
gcc -c -g -gsplit-dwarf d/a.c d/b.c # a.dwo b.dwo
gcc -g -gsplit-dwarf d/a.c d/b.c -o e/x # e/x-a.dwo e/x-b.dwo
gcc -g -gsplit-dwarf d/a.c d/b.c # a-a.dwo a-b.dwo
```
Port a useful subset of GCC behaviors that are easy to describe to Clang.
* Add a driver and cc1 option -dumpdir
* When the final phase is link, add a default -dumpdir if not specified by the user
* Forward -dumpdir to -cc1 command lines
* tools::SplitDebugName prefers -dumpdir when constructing the .dwo filename
GCC provides -dumpbase. If we use just one of -dumpdir and -dumpbase,
-dumpbase isn't very useful as it appends a dash.
```
gcc -g -gsplit-dwarf -dumpdir e d/a.c # ea.dwo
gcc -g -gsplit-dwarf -dumpdir e/ d/a.c # e/a.dwo
gcc -g -gsplit-dwarf -dumpbase e d/a.c # e-a.dwo
gcc -g -gsplit-dwarf -dumpbase e/ d/a.c # e/-a.dwo
```
If we specify both `-dumpdir` and `-dumpbase`, we can avoid the influence of the
source filename when there is one input file.
```
gcc -g -gsplit-dwarf -dumpdir f/ -dumpbase x d/a.c # f/x.dwo
gcc -g -gsplit-dwarf -dumpdir f/ -dumpbase x d/a.c d/b.c # f/x-a.dwo f/x-b.dwo
```
Given the above examples, I think -dumpbase is not useful.
GCC -save-temps has interesting interaction with -dumpdir as -save-temps
generated files are considered auxiliary files like .dwo files.
For Clang, with this patch, -save-temps and -dumpdir are orthogonal, which is
easier to explain.
```
gcc -g -gsplit-dwarf d/a.c -o e/x -dumpdir f/ -save-temps=obj # e/a.{i,s,o,dwo}
gcc -g -gsplit-dwarf d/a.c -o e/x -save-temps=obj -dumpdir f/ # f/a.{i,s,o,dwo}
clang -g -gsplit-dwarf d/a.c -o e/x -save-temps=obj -dumpdir f/ # e/a.{i,s,o} f/a.dwo
```
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D149193
Florian Hahn [Tue, 9 May 2023 21:43:03 +0000 (22:43 +0100)]
[VPlan] Add printing test with fast-math flags.
Add missing test coverage for D150029.
Owen Pan [Tue, 9 May 2023 21:32:21 +0000 (14:32 -0700)]
[clang-format] Put a "trailing" space back in a unit test
Put an intentional "trailing" space back in
FormatTestComments.SplitCommentIntroducers. It was removed in
a4c87f8ccacc by mistake.
Alexey Vishnyakov [Tue, 9 May 2023 21:40:43 +0000 (14:40 -0700)]
[ARM] ARMMachObjectWriter::recordRelocation: reduce strength on a condition
Reviewed By: MaskRay, dmgreen
Differential Revision: https://reviews.llvm.org/D147931
Valentin Clement [Tue, 9 May 2023 21:27:08 +0000 (14:27 -0700)]
[flang][openacc] Fix lowerbound when there is no subscripts
The lowerbound was not correctly normalized to 0 when the bound
are generated for an array without subscripts.
```
integer :: a(11:20)
!$acc enter data create(a)
```
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150208
Zhenkai Weng [Fri, 5 May 2023 22:43:58 +0000 (15:43 -0700)]
[FuzzMutate] Module size heuristics
IRMutation::mutateModule() currently requires the bitcode size of the module.
To compute the bitcode size, one way is to write the module to a buffer using
BitcodeWriter and calculating the buffer size. This would be fine for a single
mutation, but infeasible for repeated mutations due to the large overhead. It
turns out that the only IR strategy weight calculation method that depends on
the current module size is InstDeleterStrategy, which deletes instructions more
frequently as the module size approaches a given max size. However, there is no
real need for the size to be in bytes of bitcode, so we can use a different
metric. One alternative is to let the size be the number of objects in the
Module, including instructions, basic blocks, globals, and aliases. Although
getting the number of instructions is still O(n), it should have significantly
less overhead than BitcodeWriter. This suggestion would cause a change to the
IRMutator API, since IRMutator::mutateModule() can calculate the Module size
itself.
Reviewed By: Peter
Differential Revision: https://reviews.llvm.org/D149989
Alex Langford [Tue, 9 May 2023 19:51:10 +0000 (12:51 -0700)]
[lldb][NFCI] Remove custom dwarf LEB128 types
The LEB128 type defined by the DWARF standard is explicitly a variable-length
encoding of an integer. LLDB had defined `uleb128` and `sleb128` types
to be 32-bit but in many places in both LLVM and LLDB we treat the maximum
width of LEB128 types to be 64, so let's remove these types and be
consistent.
Differential Revision: https://reviews.llvm.org/D150222
Slava Zakharin [Tue, 9 May 2023 15:41:03 +0000 (08:41 -0700)]
[flang] Added missing type cast for the implied-do index.
The implied-do index value has 'index' type, and it has to be
converted to the original ac-do-variable's data type.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150150
Slava Zakharin [Tue, 9 May 2023 02:34:21 +0000 (19:34 -0700)]
[flang][hlfir] Allow passing null() to dummy class argument.
Fangrui Song [Tue, 9 May 2023 20:23:58 +0000 (13:23 -0700)]
PrologEpilogInserter: Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds
Valentin Clement [Tue, 9 May 2023 20:21:16 +0000 (13:21 -0700)]
[mlir][openacc] Cleanup acc.data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.data in D149673, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150155
Aaron Ballman [Tue, 9 May 2023 20:16:07 +0000 (16:16 -0400)]
Further amend
945f6e65be0d20b3446e7c1537c64151de618af4
This addresses the ARM issue found by:
https://lab.llvm.org/buildbot/#/builders/109/builds/63726
(This test wouldn't run for me locally, hence missing it in the last fix.)
Aaron Ballman [Tue, 9 May 2023 20:08:41 +0000 (16:08 -0400)]
Fix test failure from
945f6e65be0d20b3446e7c1537c64151de618af4
It seems we were testing the behavior of the debug messages!
Ben Langmuir [Mon, 8 May 2023 22:59:51 +0000 (15:59 -0700)]
[clang] Prevent creation of new submodules in ASTWriter
Avoid inferring new submodules for headers in ASTWriter's collection of
affecting modulemap files, since we don't want to pick up dependencies
that didn't actually exist during parsing.
rdar://
109112624
Differential Revision: https://reviews.llvm.org/D150151
Valentin Clement [Tue, 9 May 2023 19:59:14 +0000 (12:59 -0700)]
Revert "[flang][openacc] Fix lowerbound when there is no subscripts"
This reverts commit
626aa8518d873c5760cd033fe49b1809c9de3494.
Aaron Ballman [Tue, 9 May 2023 19:53:24 +0000 (15:53 -0400)]
Wrap debug code with the LLVM_DEBUG macro; NFC
While investigating a bug in Clang, I noticed that -Wframe-larger-than
was emitting extra debug information along with the diagnostic. It
turns out that
2e1e2f52f357768186ecfcc5ac53d5fa53d1b094 fixed an issue
with the diagnostic, but accidentally left in some debug code that was
exposed in all builds.
So now we no longer emit things like:
8/
4294967304 (0.00%) spills,
4294967296/
4294967304 (100.00%) variables
along with the diagnostic
Aaron Ballman [Tue, 9 May 2023 19:28:02 +0000 (15:28 -0400)]
Fix LLVM sphinx build
This addresses the issues found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/34937
Valentin Clement [Tue, 9 May 2023 19:21:44 +0000 (12:21 -0700)]
[flang][openacc] Fix lowerbound when there is no subscripts
The lowerbound was not correctly normalized to 0 when the bound
are generated for an array without subscripts.
```
integer :: a(11:20)
!$acc enter data create(a)
```
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150208
Sami Tolvanen [Tue, 9 May 2023 16:51:52 +0000 (16:51 +0000)]
[CodeGen][KCFI] Move cfi-type lowering to TargetLowering
KCFI machine function passes transform indirect calls with a
cfi-type attribute into architecture-specific type checks bundled
together with the calls. Instead of having a separate pass for each
architecture, add a generic machine function pass for KCFI and
move the architecture-specific code that emits the actual check to
TargetLowering. This avoids unnecessary duplication and makes it
easier to add KCFI support to other architectures.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D149915
Alexander Yermolovich [Tue, 9 May 2023 18:37:13 +0000 (11:37 -0700)]
[BOLT][DWARF][NFC] Fixed an assertion check
Spotted this one while working on new DWARF Rewriter. We were using wrong check
in assertion.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D150167
Valentin Clement [Tue, 9 May 2023 18:36:28 +0000 (11:36 -0700)]
[mlir][openacc] Cleanup acc.exit_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.exit_data in D149601, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150145
Alexander Shaposhnikov [Tue, 9 May 2023 18:14:39 +0000 (18:14 +0000)]
[Clang][Sema] Fix comparison of constraint expressions
This diff switches the approach to comparison of constraint expressions
to the new one based on template args substitution.
It continues the effort to fix our handling of out-of-line definitions
of constrained templates.
This is a recommit of
3a54022934.
Differential revision: https://reviews.llvm.org/D146178
Casey Smalley [Tue, 9 May 2023 18:10:54 +0000 (20:10 +0200)]
Do not link asan_rtl_x86_64.S for non x86_64 platforms.
Do not link asan_rtl_x86_64.S for non x86_64 platforms.
Prior to this CL asan_rtl_x86_64.S would be always be linked when
building compiler-rt for non x86_64 platforms, this normally isn't an
issue since at that link time is an empty file anyway.
When attempting to link a Aarch64 program with branch protection enabled
with the address sanitizer.
E.g.
```
clang --target=aarch64 \
-fsanitize=address \
-mbranch-protection=standard \
-Wl,-z,force-bti
-o test \
test.cc
```
Results in the linking error from the sections generated from the empty
asan_rtl_x86_64.S owed to missing a .note.gnu.property
Also see [[ https://bugs.chromium.org/p/chromium/issues/detail?id=1427165 | https://bugs.chromium.org/p/chromium/issues/detail?id=1427165 ]]
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D149957
Min-Yih Hsu [Tue, 9 May 2023 17:54:57 +0000 (10:54 -0700)]
[M68k] Register MIR Passes with the PassRegistry
In order to use the -stop-before/after infrastructure. Also remove the
creator function for M68kConvertMOVToMOVMPass, which has never been
created.
NFC.
Dave Lee [Mon, 8 May 2023 23:51:01 +0000 (16:51 -0700)]
[lldb] Simplify Log::PutString (NFC)
* As no format string is involved, avoid unecessary call into `Printf`
* Eliminate creation of a `std::string` to print a `StringRef`
Differential Revision: https://reviews.llvm.org/D150160
Jordan Rupprecht [Tue, 9 May 2023 17:38:46 +0000 (10:38 -0700)]
Revert "[AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP-indices Differential Revision: https://reviews.llvm.org/D146622 Fixes https://github.com/llvm/llvm-project/issues/61615"
This reverts commit
0574a4be879e07b48ba9be8d63eebba49a04dfe8. It causes a compiler crash due to a div by zero.
Craig Topper [Tue, 9 May 2023 17:37:20 +0000 (10:37 -0700)]
[AArch64] Remove global constructors from AArch64Disassembler.cpp.
Instead of using SmallVectors of SmallVectors, use a plain array.
Reviewed By: c-rhodes
Differential Revision: https://reviews.llvm.org/D150077
Valentin Clement [Tue, 9 May 2023 17:29:41 +0000 (10:29 -0700)]
[flang][openacc] Lower self clause on acc update as host clause
Self clause is the same same as the host clause. Lower it
in a simmilar way.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150174
Alan Zhao [Fri, 5 May 2023 21:50:36 +0000 (14:50 -0700)]
[clang] Fix initializer_list matching failures with modules
Previously, if a class with a defined public virtual destructor is
declared before including <initializer_list> and initializer_list is
provided via a Clang module, then overload resolution would fail for
std::initializer_list. This is because when Clang sees the virtual
destructor, Clang creates an implicit NamespaceDecl for std to
implicitly declare a std::bad_alloc. That NamespaceDecl is not added to
the translation unit's lookup table, so when the module containing
std::initializer_list is imported later, that module's std NamespaceDecl
can't find the previous std NamespaceDecl during redeclaration lookup,
causing overload resolution to fail.
To fix this, implicitly created std NamespaceDecls are now added to the
lookup map. At the same time, their IdentifierNamespace members are
cleared to prevent regular name lookups from finding it.
Fixes 60929
Reviewed By: ChuanqiXu, #clang-language-wg, inclyc
Differential Revision: https://reviews.llvm.org/D150001
Ben Langmuir [Thu, 4 May 2023 16:12:52 +0000 (09:12 -0700)]
[clang][deps] Teach dep directive scanner about _Pragma
While we cannot handle `_Pragma` used inside macros, we can handle
this at the top level, and it some projects use the `_Pragma("once")`
spelling like that, which was causing spurious failures in the scanner.
Limitations
* Cannot handle #define ONCE _Pragma("once"), same issue as using
@import in a macro -- ideally we should diagnose this in obvious cases
* Our LangOpts are currently fixed, so we are not handling u"" strings
or R"()" strings that require C11/C++11.
rdar://
108629982
Differential Revision: https://reviews.llvm.org/D149884
Alex Langford [Tue, 9 May 2023 01:29:38 +0000 (18:29 -0700)]
[lldb] Simplify predicates of find_if in BroadcastManager
We had some custom classes that were used as the predicate for
`std::find_if`. It would be a lot simpler if we used lambdas instead.
Differential Revision: https://reviews.llvm.org/D150168
Kevin Sala [Tue, 9 May 2023 14:03:21 +0000 (16:03 +0200)]
[OpenMP][libomptarget] Init device when printing device info
This patch fixes the printing of device information. Devices are initialized
before printing its information. Fixes #61392
Differential Revision: https://reviews.llvm.org/D146081
Carlos Galvez [Sun, 7 May 2023 17:08:33 +0000 (17:08 +0000)]
[clang-tidy] Fix bugprone-assert-side-effect to actually give warnings
Some time ago a patch was merged to disable all clang-tidy warnings
from system macros. This led to bugprone-assert-side-effect
silently no longer working, since the warnings came from a system
macro. The problem was not detected because the fake assert functions
were implemented in the same file as the test, instead of being a
system include like it's done in the real world.
Move the assert to a proper system header, and fix the code to
warn at the correct location.
This patch is breakdown from https://reviews.llvm.org/D147081
by PiotrZSL.
Fixes https://github.com/llvm/llvm-project/issues/62314
Differential Revision: https://reviews.llvm.org/D150071
Rahul Kayaith [Mon, 8 May 2023 03:56:04 +0000 (23:56 -0400)]
[mlir][python] Allow specifying block arg locations
Currently blocks are always created with UnknownLoc's for their arguments. This
adds an `arg_locs` argument to all block creation APIs, which takes an optional
sequence of locations to use, one per block argument. If no locations are
supplied, the current Location context is used.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150084
Jean Perier [Tue, 9 May 2023 16:22:55 +0000 (18:22 +0200)]
[flang] Ensure pointer components are always established
Follow up of https://reviews.llvm.org/D149979 for lowering.
In Fortran, it is possible to assign a pointer to another pointer
with an undefined association status.
When using the runtime do to none trivial pointer association, if the
descriptor are garbage, the runtime cannot safely detect that it has
a garbage descriptor, and it cannot safely know the descriptor size
leading to undefined behavior.
Another reason to initialize descriptor of pointers is to record any
non deferred length parameter value.
Hence, although this is not required by Fortran, f18 always initialize
pointers to NULL().
This was already done in lowering for whole pointer object, but not for
pointer components.
This patch uses the related semantics patch that updated
derivedTypeSpe::HasDefaultInitialization to ensure pointer components
of local and global object are always initialized.
It adds tests to ensure that allocation of such derived type uses the
runtime to ensure the storage is initialized, and that structure
constructors are setting the descriptor component to NULL() if no
initial target is given.
Differential Revision: https://reviews.llvm.org/D150180
Valentin Clement [Tue, 9 May 2023 16:00:36 +0000 (09:00 -0700)]
[mlir][openacc] Cleanup acc.enter_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.enter_data in D148721, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150132
Valentin Clement [Tue, 9 May 2023 15:58:59 +0000 (08:58 -0700)]
[flang][openacc] Lower if_present clause correctly on acc update
The `if_present` clause is modeled as an attribute on the
acc.update operation. The lowering was not adding correctly the attribute
when the clause was present. This patch update the lowering to add
the attribute when needed.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150171
Kévin Petit [Tue, 9 May 2023 15:52:13 +0000 (16:52 +0100)]
libclc: clspv: fix fma, add vstore and fix inlining issues
https://reviews.llvm.org/D147773
Patch by Romaric Jodin <rjodin@google.com>
Cordell Bloor [Tue, 9 May 2023 13:46:48 +0000 (09:46 -0400)]
[HIP] Detect HIP for Ubuntu, Mint, Gentoo, etc.
HIP may be installed into /usr or /usr/local on a variety of Linux
operating systems. It may become unwieldy to list them all.
Reviewed by: Siu Chi Chan, Yaxun Liu
Differential Revision: https://reviews.llvm.org/D149110
Thomas Symalla [Tue, 9 May 2023 15:24:00 +0000 (17:24 +0200)]
[NFC][AMDGPU] Add option to test.
Zain Jaffal [Tue, 9 May 2023 14:15:13 +0000 (17:15 +0300)]
[IRGen] Change annotation metadata to support inserting tuple of strings into annotation metadata array.
Annotation metadata supports adding singular annotation strings to annotation block. This patch adds the ability to insert a tuple of strings into the metadata array.
The idea here is that each tuple of strings represents a piece of information that can be all related. It makes it easier to parse through related metadata information given it will be contained in one tuple.
For example in remarks any pass that implements annotation remarks can have different type of remarks and pass additional information for each.
The original behaviour of annotation remarks is preserved here and we can mix tuple annotations and single annotations for the same instruction.
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D148328
khei4 [Fri, 24 Mar 2023 09:48:30 +0000 (18:48 +0900)]
[AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP-indices Differential Revision: https://reviews.llvm.org/D146622 Fixes https://github.com/llvm/llvm-project/issues/61615
Florian Hahn [Tue, 9 May 2023 14:17:20 +0000 (15:17 +0100)]
[VPlan] Address missed suggestions from D149082.
This address 2 comments missed from D149082. It sets inbounds directly
when creating the GEP and fixes the order in the enum.
Théo Degioanni [Tue, 9 May 2023 14:01:31 +0000 (14:01 +0000)]
[mlir][mem2reg] Add mem2reg rewrite pattern.
This revision introduces the ability to invoke mem2reg as a rewrite pattern. This also modified the canonical mem2reg pass to use the rewrite pattern approach.
Depends on D149825
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D149958
Mehdi Amini [Fri, 21 Apr 2023 06:28:39 +0000 (00:28 -0600)]
Adopt Properties to store operations inherent Attributes in the GPU dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148889
Mehdi Amini [Fri, 21 Apr 2023 06:27:39 +0000 (00:27 -0600)]
Adopt Properties to store operations inherent Attributes in the EmitC dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148888
Mehdi Amini [Fri, 21 Apr 2023 06:26:54 +0000 (00:26 -0600)]
Adopt Properties to store operations inherent Attributes in the DLTI dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148887
Mehdi Amini [Fri, 21 Apr 2023 06:26:00 +0000 (00:26 -0600)]
Adopt Properties to store operations inherent Attributes in the ControlFlow dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148886
Mehdi Amini [Fri, 21 Apr 2023 06:24:10 +0000 (00:24 -0600)]
Adopt Properties to store operations inherent Attributes in the Complex dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148885
Mehdi Amini [Fri, 21 Apr 2023 06:23:18 +0000 (00:23 -0600)]
Adopt Properties to store operations inherent Attributes in the Bufferization dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148884
Kevin Sala [Wed, 12 Apr 2023 20:02:23 +0000 (22:02 +0200)]
[OpenMP][libomptarget] Improve device info printing in NextGen plugins
This patch improves the device info printing in the NextGen plugins. The device
info properties are composed of keys, values and units (if necessary). These
properties are pushed into a queue by each vendor-specifc plugin, and later,
these properties are printed processed and printed by the common Plugin
Interface. The printing format is common across the different plugins.
Differential Revision: https://reviews.llvm.org/D148178
Louis Dionne [Tue, 28 Mar 2023 17:10:25 +0000 (13:10 -0400)]
[libc++] Add assertions for potential OOB reads in std::sort
We introduced an optimization to std::sort in
4eddbf9f10a6. However,
that optimization led to issues where users that were passing invalid
comparators to std::sort could start seeing OOB reads. This led to
the revert of the std::sort optimization from the LLVM 16 release
(see https://llvm.org/D146421).
This patch introduces _LIBCPP_ASSERTs to the places in the algorithm
where we make an assumption that the comparator will be consistent and
hence avoid a bounds check based on that. If the comparator happens not
to be consistent with itself, these are the places where we would
incorrectly go out of bounds. This allows users that enable libc++
assertions to catch such misuse at the cost of basically a bounds
check. For users that do not enable libc++ assertions (which is 99.9%
of users since assertions are off by default), this is basically a
no-op, and in fact the assertion will turn into a __builtin_assume,
making it explicit to the compiler that it can rely on the fact that
we're not going out of bounds.
I think this patch strikes the right balance. Folks that want absolute
performance will get what they want, since it is a precondition for the
comparator to be consistent, so the bounds checks are technically not
mandatory. Folks who want more safety *already* need to be enabling
libc++ assertions to catch other types of bugs (like operator[] OOB),
so this solution should also work for them.
I do think we have a lot of work towards popularizing the use of libc++
assertions and integrating it better so that users don't have to know
about the obscure _LIBCPP_ENABLE_ASSERTIONS macro to enable them, but
that's a separate concern.
rdar://
106897934
Differential Revision: https://reviews.llvm.org/D147089
Joseph Huber [Tue, 9 May 2023 12:56:33 +0000 (07:56 -0500)]
[clangd][NFX][FIX] Fix conflicting symbol name `Expr`
Summary:
This class has a member named `Expr` which conflicts with the clang type
of the same name due to the namespace. If we want to do this we need to
explicitly scope the variable. This was preventing me from building.
This was introduced in https://reviews.llvm.org/D148457