Sergey Kachkov [Fri, 13 Jan 2023 08:21:55 +0000 (11:21 +0300)]
[GVN][NFC] Refactor GVN::AnalyzeLoadAvailability method
Simplify AnalyzeLoadAvailability code:
1. Use std::optional for return value
2. Use range-based loop for non-local dependencies
Differential Revision: https://reviews.llvm.org/D141664
Tobias Gysi [Fri, 13 Jan 2023 09:14:21 +0000 (10:14 +0100)]
Reland "[mlir][llvm] Add an explicit void type debug info attribute."
Previously, the DISubroutineType attribute used an optional result
parameter and an optional argument types array to model the subroutine
signature. LLVM IR debug metadata, on the other hand, has one types
list whose first entry maps to the result type. That entry may be
null to model a void result type. The type list may also be entirely
empty not specifying any type information. The latter is problematic
since the current DISubroutineType attribute cannot express it.
The revision changes DISubroutineTypeAttr to closely follow the
LLVM metadata design. In particular, it uses a single types parameter
array to model the subroutine signature and introduces an explicit
DIVoidResultTypeAttr to model the null entries.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D141261
This reverts commit 81f57b6
and relands commit a960547
Fixes flang build and drop_begin on an empty array ref.
Ben Shi [Thu, 12 Jan 2023 11:58:53 +0000 (19:58 +0800)]
[clang] Redefine some AVR specific macros
Fixes https://github.com/llvm/llvm-project/issues/58855
Reviewed By: aykevl, Miss_Grape
Differential Revision: https://reviews.llvm.org/D141598
Rainer Orth [Fri, 13 Jan 2023 09:08:33 +0000 (10:08 +0100)]
[Driver] Add crtfastmath.o on Solaris if appropriate
`Flang :: Driver/fast_math.f90` `FAIL`s on Solaris because `crtfastmath.o`
is missing from the link line.
This patch adds it as appropriate.
Tested on `amd64-pc-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D141596
Diana Picus [Mon, 9 Jan 2023 08:21:41 +0000 (09:21 +0100)]
MachineIRBuilder: Add buildMergeValues. NFC
Add a `buildMergeValues` method that unconditionally builds a
G_MERGE_VALUES instruction, as opposed to `buildMergeLikeInstr` which
may decide on a different opcode based on the input types.
I haven't audited all the uses of `buildMergeLikeInstr` to see if they
can be replaced with `buildMergeValues`, but I did find a couple of
obvious ones where we check that we're merging scalars right before
calling `buildMerge`.
This is a follow-up suggested in https://reviews.llvm.org/D140964
Differential Revision: https://reviews.llvm.org/D141373
Diana Picus [Mon, 9 Jan 2023 10:59:00 +0000 (11:59 +0100)]
MachineIRBuilder: Rename buildMerge. NFC
`buildMerge` may build a G_MERGE_VALUES, G_BUILD_VECTOR or
G_CONCAT_VECTORS. Rename it to `buildMergeLikeInstr`.
This is a follow-up suggested in https://reviews.llvm.org/D140964
Differential Revision: https://reviews.llvm.org/D141372
Diana Picus [Thu, 12 Jan 2023 10:01:54 +0000 (11:01 +0100)]
GlobalISel: s/Op/Instr in some places. NFC
This patch replaces `GMergeLikeOp` with `GMergeLikeInstr` and
`MachineIRBuilder::buildAssertOp` with `buildAssertInstr` in order to
remove ambiguity. Discussed in: https://reviews.llvm.org/D141372
Jean Perier [Fri, 13 Jan 2023 08:15:52 +0000 (09:15 +0100)]
[flang] Lower elemental intrinsics to hlfir.elemental
- Move the core code generating hlfir.elemental for user calls from
genUserElementalCall into a new ElementalCallBuilder class and use
C++ CRTP (curiously recursive template pattern) to implement the
parts specific to user and intrinsic call into ElementalUserCallBuilder
and ElementalIntrinsicCallBuilder. This allows sharing the core logic
to lower elemental procedures for both user defined and intrinsics
procedures.
- To allow using ElementalCallBuilder, split the intrinsic lowering code
into two parts: first lower the arguments to hlfir::Entity regardless
of the interface of the intrinsics, and then, in a different function
(genIntrinsicProcRefCore), prepare the hlfir::Entity according to the
interface. This allows using the same core logic to prepare "normal"
arguments for non-elemental intrinsics, and to prepare the elements of
array arguments inside elemental call (ElementalIntrinsicCallBuilder
calls genIntrinsicProcRefCore once it has computed the scalar actual
arguments).
To allow this split, genExprBox/genExprAddr/genExprValue logic had to
be split in ConvertExprToHlfir.[cpp/h].
- Add missing statement context pushScope/finalizeAndPop around the
code generation inside the hlfir.elemental so that any temps created
while lowering the call at the element level is correctly cleaned-up.
- One piece of code in hlfir::Entity::hasNonDefaultLowerBounds() was wrong for assumed shape arrays (returned true when an assumed shaped array had no explicit lower bounds). This caused the added test to hit a bogus TODO, so fix it.
Elemental intrinsics returning are still TODO (e.g., adjustl). I will implement this in a next patch, this one is big enough.
Differential Revision: https://reviews.llvm.org/D141612
Siva Chandra Reddy [Fri, 13 Jan 2023 07:42:49 +0000 (07:42 +0000)]
[libc][NFC] Use C headers in host CPU sniffing code.
Yingchi Long [Fri, 16 Sep 2022 14:13:54 +0000 (22:13 +0800)]
[C2x] reject type definitions in offsetof
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very
clear that it is an UB having type definitions with in offsetof. After
this patch clang will reject any type definitions in __builtin_offsetof.
Fixes https://github.com/llvm/llvm-project/issues/57065
```
local/offsetof.c:10:38: error: 'struct S' cannot be defined in '__builtin_offsetof'
return __builtin_offsetof(struct S{ int a, b;}, a);
^
```
Reviewed By: aaron.ballman, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D133574
chenglin.bi [Fri, 13 Jan 2023 07:31:19 +0000 (15:31 +0800)]
[Instcombine] Add precommit tests for pattern xor(and, or); NFC
Carlos Galvez [Thu, 12 Jan 2023 10:10:48 +0000 (10:10 +0000)]
[clang-tidy][doc] Deprecate the AnalyzeTemporaryDtors option
It's not used anywhere, and we should not keep it
for eternity. Document it as deprecated and announce
its removal 2 releases later, so people have time
to update their .clang-tidy files.
Differential Revision: https://reviews.llvm.org/D141583
Yingchi Long [Fri, 9 Dec 2022 13:05:37 +0000 (21:05 +0800)]
[RISCV][VP] expand vp intrinsics if no +zve32x feature
If the subtarget does not support VInstructions, expand vp intrinscs to scalar instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D139706
Ben Shi [Thu, 12 Jan 2023 09:21:55 +0000 (17:21 +0800)]
[AVR] Fix a bug in AsmPrinter when printing inline-asm operands
Fixes https://github.com/llvm/llvm-project/issues/58878
Reviewed By: aykevl, Miss_Grape
Differential Revision: https://reviews.llvm.org/D141589
Vitaly Buka [Fri, 13 Jan 2023 05:46:51 +0000 (21:46 -0800)]
[X86] Remove unused variable after D140087
Joshua Cao [Fri, 6 Jan 2023 04:48:13 +0000 (20:48 -0800)]
[LoopReroll] Allow for multiple loop control only induction vars
Before this, LoopReroll would fail an assertion, falsely assuming that
there can only possibly a single loop control only induction variable.
For example:
```
%a = phi i16 [ %dec2, %for.body ], [ 0, %entry ]
%b = phi i16 [ %dec1, %for.body ], [ 0, %entry ]
%a.next = add nsw i16 %1, -1
%b.next = add nsw i16 %0, -1
%add = add nsw i16 %a, %b
; ... rerollable code
%cmp.not = icmp eq i16 -10, %add
br i1 %cmp.not, label %exit, label %loop
```
Both %a and %b are valid loop control only induction vars
Additionally, some NFC changes to remove unnecessary isa<PHINode> check
Updated complex_reroll checks
Differential Revision: https://reviews.llvm.org/D141109
Noah Goldstein [Fri, 13 Jan 2023 02:30:00 +0000 (18:30 -0800)]
[X86] Improve mul x, 2^N +/- 2 pattern by making the +/- 2x compute independently to x << N
Previous pattern was omitting ops in sequence which just increases the
latency (to 3c, same as imul!) i.e:
`(add/sub (add/sub (shl x, N), x), x)`
Better is to compute 2x indepedently so x << N for better ULP i.e:
`(add/sub (shl x, N), (add x, x))`
Reviewed By: pengfei, RKSimon
Differential Revision: https://reviews.llvm.org/D141113
Noah Goldstein [Fri, 13 Jan 2023 02:24:43 +0000 (18:24 -0800)]
[X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift count
Shift count is masked by hardware so these peepholes just extend
common patterns for NOT to the lower bits of shift count.
As well (32/64 ^ X) is masked off by the shift so can be safely
ignored.
Reviewed By: pengfei, lebedev.ri
Differential Revision: https://reviews.llvm.org/D140087
Matt Arsenault [Fri, 30 Dec 2022 14:21:49 +0000 (09:21 -0500)]
AMDGPU/GlobalISel: Make regbankselect of implicit_def consistent with constants
LiDongjin [Fri, 13 Jan 2023 03:48:22 +0000 (11:48 +0800)]
[RISCV] Change the return type of getStreamer() to support the use of overloading and other functions in RISCVELFStreamer
Move the declaration of RISCVELFStreamer from RISCVELFStreamer.cpp to RISCVELFStreamer.h.
Change the return type of getStreamer() to support the use of overloading and other functions in RISCVELFStreamer.
Differential Revision: https://reviews.llvm.org/D138500
Med Ismail Bennani [Wed, 11 Jan 2023 00:28:25 +0000 (16:28 -0800)]
[lldb/test] Fix data racing issue in TestStackCoreScriptedProcess
This patch should fix an nondeterministic error in TestStackCoreScriptedProcess.
In order to test both the multithreading capability and shared library
loading in Scripted Processes, the test would create multiple threads
that would take the same variable as a reference.
The first thread would alter the value and the second thread would
monitor the value until it gets altered. This assumed a certain ordering
regarding the `std::thread` spawning, however the ordering was not
always guaranteed at runtime.
To fix that, the test now makes use of a `std::condition_variable`
shared between the each thread. On the former, it will notify the other
thread when the variable gets initialized or updated and on the latter,
it will wait until the variable it receives a new notification.
This should fix the data racing issue while preserving the testing
coverage.
rdar://
98678134
Differential Revision: https://reviews.llvm.org/D139484
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:30:24 +0000 (15:30 -0800)]
[lldb] Update custom commands to always be overrriden
This is a follow-up patch to
6f7835f309b9.
As explained previously, when running from an IDE, it can happen that
the IDE imports some lldb scripts by itself. If the user also tries to
import these commands, lldb will show the following message:
```
error: cannot add command: user command exists and force replace not set
```
This message is confusing to the user, because it suggests that the
command import failed and that the execution should stop. However, in
this case, lldb will continue the execution with the command added
previously by the user.
To prevent that, this patch updates every first-party lldb-packaged
custom commands to override commands that were pre-imported in lldb.
Differential Revision: https://reviews.llvm.org/D140293
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:29:19 +0000 (15:29 -0800)]
[lldb] Force override when adding crashlog command
When using interactive crashlog from an IDE, it can happen that the user
already have the `command script import lldb.macosx.crashlog` command on
their `lldbinit` file.
That leads to showing some message:
```
error: cannot add command: user command exists and force replace not set
error: cannot add command: user command exists and force replace not set
```
This leads to confusion because the crashlog symbolication continues and
succeeds even after these errors.
To address that, the crashlog commands get overridden everytime the
script get re-imported.
rdar://
103403943
Differential Revision: https://reviews.llvm.org/D140113
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:27:45 +0000 (15:27 -0800)]
[lldb/Process] Populate queues in Scripted Process
This patch enhances queue support in Scripted Processes.
Scripted Threads could already report their queue name if they had one,
but this information was only surfaced when getting the process and
thread status.
However, no queue was create and added to the scripted process queue
list. This patch improves that by creating a queue from the scripted
thread queue name. For now, it uses an invalid queue id, since the
scripted thread doesn't expose this capability yet, but this could
easily be supported if the queue id information is available.
rdar://
98844004
Differential Revision: https://reviews.llvm.org/D139853
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 23:26:49 +0000 (15:26 -0800)]
[lldb/crashlog] Refactor CrashLogParser into a Factory pattern
This patch should fix an undefined behaviour that's happening when
parsing a crash report from an IDE. In the previous implementation, the
CrashLogParser base class would use the `__new__` static class method to
create the right parser instance depending on the crash report type.
For some reasons, the derived parser initializer wouldn't be called when
running the command from an IDE, so this patch refactors the
CrashLogParser code to replace the use of the `__new__` method with a
factory `create` static method.
rdar://
100527640
Differential Revision: https://reviews.llvm.org/D139951
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Owen Anderson [Thu, 12 Jan 2023 04:53:30 +0000 (21:53 -0700)]
Remove a workaround for libstdc++4.8
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D141564
Nico Weber [Fri, 13 Jan 2023 03:04:20 +0000 (22:04 -0500)]
[gn] Reformat all build files
Ran:
git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
Joseph Huber [Fri, 13 Jan 2023 02:35:51 +0000 (20:35 -0600)]
[LinkerWrapper] Adjust test after a previous change in temp file names
Summary:
This patch adjusts the test to correctly search for the temp files
created after a previous patch changed the name. This wasn't caught
because it still technically worked.
v1nh1shungry [Fri, 13 Jan 2023 02:15:13 +0000 (03:15 +0100)]
[clangd] support expanding `decltype(expr)`
Enable the existing tweak `ExpandAutoType` to expand
`decltype(expr)`, e.g.
```
decltype(0) i;
```
will expand to
```
int i;
```
Therefore, rename the tweak `ExpandAutoType` to `ExpandDeducedType`.
This patch also fixes some nits,
* avoid replacing reference to a function
* avoid replacing array types and reference to an array
Fixes https://github.com/clangd/clangd/issues/1456
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D141226
Hui Li [Fri, 13 Jan 2023 02:17:48 +0000 (10:17 +0800)]
[LLDB][LoongArch] Add unittests for EmulateInstructionLoongArch
Add unit tests For EmulateInstructionLoongArch existing branch instruction.
Add 19 test cases in total.
Without this patch:
```
$ ninja check-lldb-unit
[0/1] Running lldb unit test suite
Testing Time: 10.55s
Passed: 1025
```
With this patch:
```
$ ninja check-lldb-unit
[0/1] Running lldb unit test suite
Testing Time: 10.45s
Passed: 1044
```
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D140386
Hui Li [Fri, 13 Jan 2023 02:16:29 +0000 (10:16 +0800)]
[LLDB][LoongArch] ObjectFile: add a case for `EM_LOONGARCH`
This adds the jump slot mapping for LoongArch. This is a simple
change that ensures lldb running properly.
Note that this problem was found only when CMake variables
"DLLVM_ENABLE_ASSERTIONS=ON" is selected.
Without this patch,
```
$ build/bin/lldb test
../ELFHeader::GetRelocationJumpSlotType() const: Assertion `false && "architecture not supported"' fail
```
With this patch
```
$ build/bin/lldb test
(lldb) target create "test"
Current executable set to '../test' (loongarch64).
```
Reviewed By: SixWeining, DavidSpickett
Differential Revision: https://reviews.llvm.org/D141245
Vitaly Buka [Fri, 13 Jan 2023 02:09:15 +0000 (18:09 -0800)]
Revert "[MergeICmps] Adapt to non-eq comparisons"
Breaks ubsan build, details in D141188.
This reverts commit
3ac2b3a4f9effc9f79822e770f209fd70ff66362.
Tony Tye [Thu, 5 Jan 2023 00:34:02 +0000 (00:34 +0000)]
[AMDGPU][NFC] Heterogeneous DWARF extensions update
- Clarify CFI rules in heterogeneous DWARF extensions
- Added DWARF source language memory spaces.
- Added DWARF architecture address spaces.
- Other minor corrections.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D141548
Ben Shi [Fri, 13 Jan 2023 01:25:42 +0000 (09:25 +0800)]
[clang][test] Remove unnecessary 'REQUIRES'
The test 'Preprocessor/predefined-arch-macros.c' contains many
target tests than 'amdgpu'. If clang is built without 'amdgpu',
then failures in other target tests will not be reported.
Reviewed By: aaron.ballman, MaskRay
Differential Revision: https://reviews.llvm.org/D141647
Kirill Stoimenov [Thu, 12 Jan 2023 21:31:49 +0000 (13:31 -0800)]
[LSAN] More LSAN interface tweaking.
Main goal is to remove thread registry dependency from the interface because HWASAN is using its own code to manage threads.
Reviewed By: vitalybuka, kstoimenov
Differential Revision: https://reviews.llvm.org/D140039
Joseph Huber [Fri, 13 Jan 2023 01:56:24 +0000 (19:56 -0600)]
[LinkerWrapper] Fix test on Windows
Summary:
`clang` is called `clang.exe` on windows, we need to glob the text
inbetween.
Richard Smith [Fri, 13 Jan 2023 01:21:45 +0000 (17:21 -0800)]
Remove a bogus assertion.
The result of recomputing the type of an LValue may be different from
the type we find serialized with that LValue, either due to differing
type sugar in a redeclaration, or more significantly due to a later
declaration of a variable having an array bound that a prior declaration
did not have. Therefore this assertion was attempting to verify a
property that isn't necessarily true.
Nico Weber [Sun, 20 Nov 2022 16:59:16 +0000 (11:59 -0500)]
[lld/mac] Add support for distributed ThinLTO
Adds support for the following flags:
* --thinlto-index-only, --thinlto-index-only=
* --thinlto-emit-imports-files
* --thinlto-emit-index-files
* --thinlto-object-suffix-replace=
* --thinlto-prefix-replace=
See https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html
for some words on --thinlto-index-only.
I don't really need the other flags, but they were in the vicinity
and _someone_ might need them, so I figured I'd add them too.
`-object_path_lto` now sets `c.AlwaysEmitRegularLTOObj` as in the other ports,
which means it can now only point to a filename for non-thin LTO.
I think that was the intent of D129705 anyways, so update
test/MachO/lto-object-path.ll to use a non-thin bitcode file for that test.
Differential Revision: https://reviews.llvm.org/D138451
Teresa Johnson [Thu, 12 Jan 2023 01:16:03 +0000 (17:16 -0800)]
[MemProf] Collect access density statistics during profiling
Track min/max/avg access density (accesses per byte and accesses per
byte per lifetime second) metrics directly during profiling. This allows
more accurate use of these metrics in profile analysis and use, instead
of trying to compute them from already aggregated data in the profile.
This required regenerating some of the raw profile and executable inputs
for a few tests. While here, make the llvm-profdata memprof tests more
resilient to differences in things like memory mapping, timestamps and
cpu ids to make future test updates easier.
Differential Revision: https://reviews.llvm.org/D141558
Yeting Kuo [Thu, 12 Jan 2023 10:14:24 +0000 (18:14 +0800)]
[RISCV] Custom lower vector ISD::CTLZ to the minimum of ISD::CTLZ_ZERO_UNDEF and element size.
D111904 made RISC-V customized lower ISD::CTLZ_ZERO_UNDEF by converting to float
and using the float result. The expected value of CTLZ with zero input is the
element size of input type. Since the result of above method with zero input
must be greater than the element size, for ISD::CTLZ, we could use the minimum
of element size and the result of CTLZ_ZERO_UNDER with same input.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D141585
Vitaly Buka [Fri, 13 Jan 2023 01:30:26 +0000 (17:30 -0800)]
Revert "[LSAN] More LSAN interface tweaking."
Breaks bots.
Also it's missing changes we discussed on review.
This reverts commit
f001e50f955c3cdf2deb79e38a9fd19c9a781882.
This reverts commit
2924189233fdb724453ead4b94595107b1ce9cfa.
eopXD [Tue, 27 Dec 2022 09:12:51 +0000 (01:12 -0800)]
[Clang][RISCV] Update operand order for vmerge and vcompress
From:
vint32m1_t vmerge_vvm_i32m1 (vbool32_t mask, vint32m1_t op1, vint32m1_t op2, size_t vl);
vint32m1_t vcompress_vm_i32m1 (vbool32_t mask, vint32m1_t src, size_t vl);
To:
vint32m1_t vmerge_vvm_i32m1 (vint32m1_t op1, vint32m1_t op2, vbool32_t selector, size_t vl);
vint32m1_t vcompress_vm_i32m1 (vint32m1_t src, vbool32_t selector, size_t vl);
Address issues:
riscv-non-isa/rvv-intrinsic-doc#140
riscv-non-isa/rvv-intrinsic-doc#167
Pull request:
riscv-non-isa/rvv-intrinsic-doc#185
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140686
Nico Weber [Fri, 13 Jan 2023 01:07:55 +0000 (20:07 -0500)]
[gn] port
3432f4bf86e7 (//llvm/lib/Testing/Annotations)
v1nh1shungry [Thu, 12 Jan 2023 23:40:05 +0000 (23:40 +0000)]
[clang-tidy] don't warn when returning the result for bugprone-standalone-empty
Relevant issue: https://github.com/llvm/llvm-project/issues/59517
Currently this check will warn when the result is used in a `return`
statement, e.g.
```
bool foobar() {
std::vector<int> v;
return v.empty();
// will get a warning here, which makes no sense IMO
}
```
Reviewed By: cjdb, denik
Differential Revision: https://reviews.llvm.org/D141107
Keith Smiley [Thu, 12 Jan 2023 22:43:12 +0000 (14:43 -0800)]
[lld-macho] Downgrade missing fat arch to warning
This mirrors ld64's behavior. In many cases this likely still leads to a
link failure but if you didn't actually use anything from the library
it can be ignored. If you care about these invalid cases -fatal_warnings
still upgrades it back to an error.
Example: https://github.com/keith/ld64.lld/issues/3
Differential Revision: https://reviews.llvm.org/D141638
Alex Brachet [Fri, 13 Jan 2023 00:47:46 +0000 (00:47 +0000)]
[lsan] Fix build for Fuchsia after D140039
Xiang1 Zhang [Wed, 11 Jan 2023 08:54:07 +0000 (16:54 +0800)]
Add -disable-check-noreturn-call for stack protect
Differential Revision: https://reviews.llvm.org/D141556
Reviewed By: lanza
Matt Arsenault [Thu, 12 Jan 2023 01:34:00 +0000 (20:34 -0500)]
OpenMP: Use inbounds in EmitOMPAggregateAssign
This looked like a plausibly correct out of tree patch.
The changed testcases with the pragmas stripped out only use
inbounds GEPs so I assume this is correct.
Mitch Phillips [Thu, 12 Jan 2023 23:58:36 +0000 (15:58 -0800)]
Revert "[GWP-ASan] Add recoverable mode."
This reverts commit
90a9beb7cc9755791caa23dfc4e36bc544e98ed3.
Reason: Broke an internal build.
Mitch Phillips [Thu, 12 Jan 2023 23:58:10 +0000 (15:58 -0800)]
Revert "[GWP-ASan] Fix test to work with Fuchsia's zxtest"
This reverts commit
64138725e4cf0ab5e3f9c0dba38e11ce3d3b4017.
Parent change https://reviews.llvm.org/D140173 broke an internal build.
I'll land this bit as part of the re-land for
https://reviews.llvm.org/D140173.
Mitch Phillips [Thu, 12 Jan 2023 23:57:27 +0000 (15:57 -0800)]
Revert "[GWP-ASan] Fix 6413872"
This reverts commit
df87e62cbd4b5090b5349247d29457706d2ac4e8.
Parent change https://reviews.llvm.org/D140173 broke an internal build.
I'll integrate this patch into the re-land for
https://reviews.llvm.org/D140173.
Kirill Stoimenov [Thu, 12 Jan 2023 00:03:41 +0000 (00:03 +0000)]
[LSAN] More LSAN interface tweaking.
Main goal is to remove thread registry dependency from the interface because HWASAN is using its own code to manage threads.
Reviewed By: vitalybuka, kstoimenov
Differential Revision: https://reviews.llvm.org/D140039
Johannes Doerfert [Thu, 12 Jan 2023 23:29:55 +0000 (15:29 -0800)]
[OpenMP][FIX] The thread limit is the block, not grid size
Artem Belevich [Thu, 12 Jan 2023 01:09:21 +0000 (17:09 -0800)]
[CUDA] added cmath wrappers to unbreak CUDA compilation after D79555
libc++ introduced a handful of internal functions that may or may not be
constexpr, depending on C++ version. For pre-constexpr variants we must declare
__device__ counterparts. Otherwise the code fails to compile on the GPU side.
See https://reviews.llvm.org/D79555
Differential Revision: https://reviews.llvm.org/D141555
Diego Caballero [Thu, 12 Jan 2023 23:11:45 +0000 (23:11 +0000)]
[mlir][linalg] Fix incorrect reduction detection in Vectorizer
When detecting reductions, make sure the block argument is from the linalg generic op.
This fixes https://github.com/iree-org/iree/issues/11779.
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D141413
bixia1 [Thu, 12 Jan 2023 00:25:50 +0000 (16:25 -0800)]
[mlir][sparse] Minor code clean up (NFC).
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D141554
Johannes Doerfert [Thu, 12 Jan 2023 23:19:35 +0000 (15:19 -0800)]
[Attributor][FIX] Consistently use the access/remote instruction
We use the actual access (=remote) instruction when reasoning about
accesses, except for one leftover use case of the local instruction.
This caused us to potentially ignore the dominating write if the read
and write were in a different function than the (stack) allocation.
Reported by @ye-luo
Nikolas Klauser [Mon, 9 Jan 2023 00:39:58 +0000 (01:39 +0100)]
[libc++] Add clang-tidy to the list of possible substitutions for %{clang-tidy}
Most people don't have a versioned clang-tidy locally. This allows them to still run the clang-tidy test if they have a suitable version.
Reviewed By: ldionne, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D141241
River Riddle [Thu, 12 Jan 2023 22:43:32 +0000 (14:43 -0800)]
[mlir][NFC] Use explicit ArrayRef construction in OptionalArrayRefParameter
GCC was barfing on template deduction for ArrayRef parameters in
some situations.
River Riddle [Thu, 12 Jan 2023 22:20:00 +0000 (14:20 -0800)]
[mlir][AttrType] Emit unbalanced character errors using the last punctuation used
This gives a better diagnostic in general, because it indicates that the user didn't
close out the last open puncutation range. For example:
```
foo.op {
some.op -> !blah.pointer<
}
```
We want the error to hint about the unclosed `<`, not the `}` (which isn't really in the context of the type).
Differential Revision: https://reviews.llvm.org/D141635
Florian Mayer [Thu, 12 Jan 2023 22:47:03 +0000 (14:47 -0800)]
[NFC] [scudo] avoid casting in a circle
Eric Li [Thu, 12 Jan 2023 22:10:39 +0000 (17:10 -0500)]
[libTooling] Add `getFileRange` as an alternative to `getRangeForEdit`
Add a `getFileRange` function alongside the existing `getRangeForEdit`
as a way to get a contiguous range within a single file (similar to
`getRangeForEdit`) but without the restriction that it cannot be in a
system header.
This can be used where a tool may want to use the range to extract the
source text. In such cases, we don't want to restrict this from
pulling from system headers.
Differential Revision: https://reviews.llvm.org/D141634
Joseph Huber [Thu, 12 Jan 2023 22:42:30 +0000 (16:42 -0600)]
[LinkerWrapper] Improve -save-temps behaviour
Summary:
This patch changes around some of the names for the temp files we
generate. This also emits the `postlink` and `postopt` temp files. We
don't use the built-in save temps from LTO right now because it doesn't
give the ASM properly. We may be able to fix that in the future.
Florian Hahn [Thu, 12 Jan 2023 22:38:39 +0000 (22:38 +0000)]
[AArch64] Add IfConv test with loads with invariant ops as conditions.
Add EarlyIfConversion tests for AArch64 where the condition is a load
with invariant operands. A follow-up patch will propose a heuristic to
consider such conditions predictable.
Peiming Liu [Tue, 27 Dec 2022 22:10:37 +0000 (22:10 +0000)]
[mlir][sparse] support parsing slices in sparse tensor encoding attribute
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D140712
Siva Chandra Reddy [Thu, 12 Jan 2023 22:33:38 +0000 (22:33 +0000)]
[libc][obvious] Add a missing dep.
Roman Lebedev [Thu, 12 Jan 2023 22:12:07 +0000 (01:12 +0300)]
Revert "[SimplifyCFG] When eliminating `unreachable` landing pads, mark `call`s as `nounwind`"
The bool is in the wrong place and might get implicitly converted from
the previous second argument - a pointer. Thinking about it more,
it's not really the best place for that functionality anyways,
only a single caller needs that.
This reverts commit
3c5b1f2d94d021005ce3769a4402d4a4ae843989.
Jeff Niu [Thu, 12 Jan 2023 22:17:32 +0000 (14:17 -0800)]
[mlir][python] fix python build
Med Ismail Bennani [Thu, 12 Jan 2023 22:10:48 +0000 (14:10 -0800)]
[lldb/test] Disable TestScriptedProcess.py on linux while investigating the issue
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Roman Lebedev [Thu, 12 Jan 2023 21:05:19 +0000 (00:05 +0300)]
[SimplifyCFG] When eliminating `unreachable` landing pads, mark `call`s as `nounwind`
We really can't recover that knowledge, and `nounwind` knowledge,
(and not just a lack of the unwind edge, aka `call` instead of `invoke`),
is e.g. part of the reasoning in e.g. `mayHaveSideEffects()`.
Note that this is call-site-specific knowledge,
just because some callsite had an `unreachable`
unwind edge, does not mean that all will.
Roman Lebedev [Thu, 12 Jan 2023 20:43:38 +0000 (23:43 +0300)]
[NFC][SimplifyCFG] Autogenerate checklines in some tests that eliminate unwind edges
Jordan Rupprecht [Thu, 12 Jan 2023 21:40:47 +0000 (13:40 -0800)]
[test] Split out Annotations from `TestingSupport`
The Annotations helper class does not have a gtest or gmock dependency, but because it's bundled with the rest of TestingSupport, it gets one. By splitting it out, a target can use it without being forced to use LLVM's copy of gtest.
Reviewed By: GMNGeoffrey, sammccall, gribozavr2
Differential Revision: https://reviews.llvm.org/D141175
Lang Hames [Thu, 12 Jan 2023 16:32:58 +0000 (08:32 -0800)]
[ORC] Tidy up MachOPlatform's references to ORC runtime registration functions.
Use an private struct, RuntimeFunction, to to keep the name and address of each
registration function together, and rename the member variables with their purpose
rather than the full name of the function in the runtime.
Jeff Niu [Sun, 8 Jan 2023 20:46:52 +0000 (12:46 -0800)]
[mlir][ods] Generate inferReturnTypes for ops with TypesMatchWith
Ops that use TypesMatchWith to constrain result types for verification
and to infer result types during parser generation should also be able
to have the `inferReturnTypes` method auto generated. This patch
upgrades the logic for generating `inferReturnTypes` to handle the
TypesMatchWith trait by building a type inference graph where each edge
corresponds to "type of A can be inferred from type of B", supporting
transformers other than `"$_self"`.
Reviewed By: lattner, rriddle
Differential Revision: https://reviews.llvm.org/D141231
Maksim Panchenko [Tue, 10 Jan 2023 03:14:38 +0000 (19:14 -0800)]
[BOLT] Minor refactoring for -print-sorted-by option
Only display used values for -print-sorted-by option when printing help.
Differential Revision: https://reviews.llvm.org/D141209
Jeff Niu [Sun, 8 Jan 2023 22:15:07 +0000 (14:15 -0800)]
[mlir] Add operations to BlockAndValueMapping and rename it to IRMapping
The patch adds operations to `BlockAndValueMapping` and renames it to `IRMapping`. When operations are cloned, old operations are mapped to the cloned operations. This allows mapping from an operation to a cloned operation. Example:
```
Operation *opWithRegion = ...
Operation *opInsideRegion = &opWithRegion->front().front();
IRMapping map
Operation *newOpWithRegion = opWithRegion->clone(map);
Operation *newOpInsideRegion = map.lookupOrNull(opInsideRegion);
```
Migration instructions:
All includes to `mlir/IR/BlockAndValueMapping.h` should be replaced with `mlir/IR/IRMapping.h`. All uses of `BlockAndValueMapping` need to be renamed to `IRMapping`.
Reviewed By: rriddle, mehdi_amini
Differential Revision: https://reviews.llvm.org/D139665
Luke Nicholson [Thu, 12 Jan 2023 21:05:30 +0000 (13:05 -0800)]
[scudo] Fix RingBuffer initialization.
Several map implementations require that map calls provide a page
aligned size.
Reviewed By: fmayer
Differential Revision: https://reviews.llvm.org/D141630
Fangrui Song [Thu, 12 Jan 2023 21:08:06 +0000 (13:08 -0800)]
[bazel] Fix --features=layering_check issues and enable layering_check for lld
Med Ismail Bennani [Thu, 12 Jan 2023 07:27:39 +0000 (23:27 -0800)]
[lldb/Interpreter] Introduce ScriptedPlatform{,Python}Interface
This patch introduces both the ScriptedPlatformInterface and the
ScriptedPlatformPythonInterface. As the name suggests, these calls will
be used to call into the Scripted Platform python implementation from
the C++ Scripted Platform plugin instance.
Differential Revision: https://reviews.llvm.org/D139251
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 12 Jan 2023 07:04:24 +0000 (23:04 -0800)]
[lldb] Add ScriptedPlatform python implementation
This patch introduces both the Scripted Platform python base
implementation and an example for it.
The base implementation is embedded in lldb python module under
`lldb.plugins.scripted_platform`.
This patch also refactor the various SWIG methods to create scripted
objects into a single method, that is now shared between the Scripted
Platform, Process and Thread. It also replaces the target argument by a
execution context object.
Differential Revision: https://reviews.llvm.org/D139250
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 10 Jan 2023 04:26:19 +0000 (20:26 -0800)]
[lldb] Add Debugger & ScriptedMetadata reference to Platform::CreateInstance
This patch is preparatory work for Scripted Platform support and does
multiple things:
First, it introduces new options for the `platform select` command and
`SBPlatform::Create` API, to hold a reference to the debugger object,
the name of the python script managing the Scripted Platform and a
structured data dictionary that the user can use to pass arbitrary data.
Then, it updates the various `Create` and `GetOrCreate` methods for
the `Platform` and `PlatformList` classes to pass down the new parameter
to the `Platform::CreateInstance` callbacks.
Finally, it updates every callback to reflect these changes.
Differential Revision: https://reviews.llvm.org/D139249
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 16 Dec 2022 14:26:55 +0000 (06:26 -0800)]
[lldb/Interpreter] Improve ScriptedPythonInterface::GetStatusFromMethod
This patch makes `ScriptedPythonInterface::GetStatusFromMethod` take a
parameter pack as an argument. That will allow it to pass arbitrary
arguments to the python method.
Differential Revision: https://reviews.llvm.org/D139248
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Mon, 5 Dec 2022 21:54:21 +0000 (13:54 -0800)]
[lldb/Interpreter] Make ScriptedProcessInfo more generic
This patch moves the ScriptedProcessInfo class out of the
ScriptedProcess and hoist it as a standalone interpreter class, so it can be
reused with the Scripted Platform.
Differential Revision: https://reviews.llvm.org/D139247
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Nawrin Sultana [Mon, 5 Dec 2022 23:17:20 +0000 (17:17 -0600)]
[OpenMP] Fix dynamic schedule assertion failure on AArch64
This patch fixes assertion failure in dynamic schedule with 8 byte induction
variable. It uses acquire load instead of relaxed to ensure that steal_lock
pointer is not NULL.
Differential Revision: https://reviews.llvm.org/D139373
Joseph Huber [Thu, 12 Jan 2023 20:37:11 +0000 (14:37 -0600)]
[Clang] Explicitly move returned values converted to expected
Summary:
These can cause failures on GCC-7 it seems. We should explicitly move
them to prevent this from causing build failures.
Yitzhak Mandelbaum [Thu, 15 Dec 2022 15:11:21 +0000 (15:11 +0000)]
[clang][dataflow] In optional model, implement `widen` and make `compare` sound.
This patch includes two related changes:
1. Rewrite `compare` operation to be sound. Current version checks for equality
of `isNonEmptyOptional` on both values, judging the values `Same` when the
results are equal. While that works when both are true, it is problematic when
they are both false, because there are four cases in which that's can occur:
both empty, one empty and one unknown (which is two cases), and both unknown. In
the latter three cases, it is unsound to judge them `Same`. This patch changes
`compare` to explicitly check for case of `both empty` and then judge any other
case `Different`.
2. With the change to `compare`, a number of common cases will no longer
terminate. So, we also implement widening to properly handle those cases and
recover termination.
Drive-by: improve performance of `merge` operation.
Of the new tests, the code before the patch fails
* ReassignValueInLoopToSetUnsafe, and
* ReassignValueInLoopToUnknownUnsafe.
Differential Revision: https://reviews.llvm.org/D140344
Matt Arsenault [Thu, 12 Jan 2023 20:22:18 +0000 (15:22 -0500)]
clang/AMDGPU: Update clang test for llvm change
Matt Arsenault [Sun, 8 Jan 2023 13:15:30 +0000 (08:15 -0500)]
Partially reapply "AMDGPU: Invert handling of enqueued block detection"
This mostly reverts commit
270e96f435596449002fc89962595497481c8770.
Keep the attributor related changes around, but functionally restore
the old behavior as a workaround. Device enqueue goes back to not
working at -O0 with this version.
Nathan James [Thu, 12 Jan 2023 19:20:53 +0000 (19:20 +0000)]
[clang-tidy][NFC] Make CheckFactories::CreateChecks* const
There's no reason for these methods to be non-const.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D138566
Johannes Doerfert [Thu, 12 Jan 2023 19:07:33 +0000 (11:07 -0800)]
[Attributor] Enable tests and ensure all call sites are updated
This reverts commit
9e08b083a09ef4e02fb0a4de2c0d3ddc0eccadde and ensures
signature rewriting also updates dead call sites to avoid the call graph
assertion.
Alexander Yermolovich [Thu, 12 Jan 2023 19:17:55 +0000 (11:17 -0800)]
[fix] Change formatting to use llvm::formatv Summary:
Missed one formating that was reversed.
Reviewed By: hoy, zhuhan0
Differential Revision: https://reviews.llvm.org/D141624
LLVM GN Syncbot [Thu, 12 Jan 2023 19:05:33 +0000 (19:05 +0000)]
[gn build] Port
944f4b280585
Emilia Dreamer [Thu, 12 Jan 2023 19:00:10 +0000 (21:00 +0200)]
[clang-format][docs] Add ability to link to specific config options
This allows for the creation of permalinks to specific clang-format
options, for better sharing of a specific option and its options.
(I'm adding the usual clang-format reviewers on this patch because
I don't know any other reviewers that well, perhaps someone with
docs experience should be added instead...)
Note that I wanted to make minimal changes to make this happen and thus
landed on an unideal setup, but to me, it seems like the best out of
worse ones.
I could have made every style option a subheading, which would add
automatically the logic for permalinks and the little paragraph icon for
sharing.
However, this meant that the links themselves would be suboptimal, as
they'd include the whole text of the heading, including the type and
versionbadge, which is needless noise and could change, breaking the
concept of a "permalink". The format of the page could be changed to
put the option names on their own in a heading, and the other info below
it in a paragraph.
As Sphinx seems unwilling to fix https://github.com/sphinx-doc/sphinx/issues/1961,
there isn't a succinct way to change the "id" html field used for
sections
I could have used an add-on (https://github.com/GeeTransit/sphinx-better-subsection),
or made one myself, but I wanted to avoid extra dependencies for no
reason. (plus, I don't know how to make one myself.)
I could have used raw HTML for each heading, but that would immensely
pollute the rst file, which, while it is generated, is currently still
human-readable and it'd be nice for it to stay that way.
Also note that sphinx treats references as case-insensitive, which means
that they will all be lowercased in the resulting HTML. I envisioned
the ability to simply add #OptionName after the URL to get placed right
at the desired config option, which isn't possible without things such
as inline `raw` HTML.
To reconcile that, I added the ¶ paragraph buttons that can be used to
generate the link to the desired section, but since headings are not
actually used, they are faked and literally just a link following each
option, which means they stylistically don't match all other headings.
Also note that this sort-of assumes HTML output. I know Sphinx can
output other formats but I do not know if they are used. A non-html
output could embed unusable ¶ signs everywhere.
I'm okay with this patch being rejected in its current solution, or if
any of the above listed alternatives are better, they could be pursued
instead. In case the downsides of this solution are too much, I will
just create a feature request issue for this and maybe let someone more
experienced with Sphinx handle it, since this is still a feature I would
like to have. (and I do not want to deal with Sphinx at all after
battling with it for a whole day to produce a mediocre result.)
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay, aaron.ballman
Differential Revision: https://reviews.llvm.org/D138446
Alexander Yermolovich [Thu, 12 Jan 2023 18:43:08 +0000 (10:43 -0800)]
[DWARFLibrary] Add support to re-construct cu-index
According to DWARF5 specification and gnu specification for DWARF4 the offset
entry in the CU/TU Index is 32 bits. This presents a problem when
.debug_info.dwo in DWP file grows beyond 4GB. The CU Index becomes partially
corrupted.
This diff adds manual parsing of .debug_info.dwo/.debug_abbrev.dwo to
reconstruct CU index in general, and TU index for DWARF5. This is a work around
until DWARF6 spec is finalized.
Next patch will change internal CU/TU struct to 64 bit, and change uses as
necessary. The plan is to land all the patches in one go after all are approved.
This patch originates from the discussion in: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D137882
Joseph Huber [Wed, 11 Jan 2023 20:57:39 +0000 (14:57 -0600)]
[LinkerWrapper] Emit assembly files from LTO with `save-temps`
Currently in LTO mode we don't emit any `.s` files for non-NVPTX targets
during LTO. This makes it diffcult to investigate any failures in the
assembly. This patch makes the save-temps mode output an assembly file
and then assembles it separately. I decided to simply invoke `clang` for
this as it would be a lot of effort to invoke the `MCStramer` interface
directly.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D141543
Tim Northover [Wed, 11 Jan 2023 13:52:45 +0000 (13:52 +0000)]
LoopIdiom: avoid patterned memset if constant is not relocatable.
The pattern we're using for the memset_pattern* call gets put into a static
global variable initialized, which means it has to be representable with
relocations on the target. Most `ConstantExpr` instances do not satisfy this
constraint, so avoid all of them for now.
Jonas Devlieghere [Thu, 12 Jan 2023 18:47:14 +0000 (10:47 -0800)]
[lldb] Fix compile error in Lua typemap
Fix error "non-const lvalue reference to type 'lldb::FileSP' cannot
bind to a value of unrelated type" in Lua typemap.
Xiang Li [Thu, 12 Jan 2023 16:56:18 +0000 (11:56 -0500)]
[DirectX backend] add support ConstantBuffer to DXILResource.h
class ConstantBuffer is added to save information for cbuffer.
Also add CBufferDataLayout to calculate the size for cbuffer.
Now always use legacy cbuffer layout.
https://reviews.llvm.org/D134998 will add control to disable legacy cbuffer layout.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D136031
Matt Arsenault [Thu, 12 Jan 2023 14:28:51 +0000 (09:28 -0500)]
clang/OpenCL: Check calling convention in test
update_cc_test_checks misses this, so make sure at least one block
enqueue test manually checks the calling convention for the kernel.
Louis Dionne [Thu, 12 Jan 2023 18:37:49 +0000 (13:37 -0500)]
[libc++] Add missing includes in move_iterator.h