Nikita Popov [Tue, 22 Mar 2022 08:52:12 +0000 (09:52 +0100)]
[CodeGen] Remove some uses of deprecated Address constructor
Remove two stray uses in CodeGenModule and CGCUDANV.
serge-sans-paille [Mon, 21 Mar 2022 20:52:58 +0000 (21:52 +0100)]
Cleanup includes: Linker
Preprocessor output diff: -7300 lines
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D122182
Nikita Popov [Fri, 18 Mar 2022 12:06:42 +0000 (13:06 +0100)]
[CodeGen] Avoid deprecated Address ctor in EmitLoadOfPointer()
This requires some adjustment in caller code, because there was
a confusion regarding the meaning of the PtrTy argument: This
argument is the type of the pointer being loaded, not the addresses
being loaded from.
Nikita Popov [Mon, 21 Mar 2022 16:52:40 +0000 (17:52 +0100)]
[CodeGen][OpenMP] Make EmitLoadOfPointer() type consistent
If necessary insert a bitcast beforehand, so the LLVM-level pointer
type and the Clang-level pointer type line up.
Stanislav Gatev [Mon, 21 Mar 2022 12:06:16 +0000 (12:06 +0000)]
[clang][dataflow] Model the behavior of optional and std swap
Differential Revision: https://reviews.llvm.org/D122129
Reviewed-by: ymandel, xazax.hun
Zakk Chen [Sat, 19 Feb 2022 06:19:15 +0000 (22:19 -0800)]
[RISCV] Support mask policy for RVV IR intrinsics.
Add the UsesMaskPolicy flag to indicate the operations result
would be effected by the mask policy. (ex. mask operations).
It means RISCVInsertVSETVLI should decide the mask policy according
by mask policy operand or passthru operand.
If UsesMaskPolicy is false (ex. unmasked, store, and reduction operations),
the mask policy could be either mask undisturbed or agnostic.
Currently, RISCVInsertVSETVLI sets UsesMaskPolicy operations default to
MA, otherwise to MU to keep the current mask policy would not be changed
for unmasked operations.
Add masked-tama, masked-tamu, masked-tuma and masked-tumu test cases.
I didn't add all operations because most of implementations are using
the same pseudo multiclass. Some tests maybe be duplicated in different
tests. (ex. masked vmacc with tumu shows in vmacc-rv32.ll and masked-tumu)
I think having different tests only for policy would make the testing
clear.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D120226
Lian Wang [Tue, 22 Mar 2022 07:32:18 +0000 (07:32 +0000)]
[RISCV][NFC] Add some check prefixes to remove redundant checks in some IR tests
Reviewed By: frasercrmck, jacquesguan
Differential Revision: https://reviews.llvm.org/D122211
Petr Hosek [Fri, 18 Mar 2022 23:07:35 +0000 (16:07 -0700)]
[CMake][Fuchsia] Switch to lld on Apple platforms
lld Mach-O backend supports all our use cases now.
Differential Revision: https://reviews.llvm.org/D122047
Shengchen Kan [Tue, 22 Mar 2022 07:58:52 +0000 (15:58 +0800)]
[X86] Simplify attributes of the generated memory folding table (NFCI)
This reduces the gaps between tables in X86GenFoldTables.inc and X86InstrFoldTables.cpp
gysit [Tue, 22 Mar 2022 06:57:02 +0000 (06:57 +0000)]
[mlir][affine] Add affine.min / affine.max canonicalization.
The revision introduces a affine.min and affine.max canonicalization pattern that orders the result expressions. It flattens the result expressions to arrays of dimension and symbol coefficients plus one constant coefficient and rearranges them in lexicographic order.
Without the pattern, CSE will not eliminate two affine.min / affine.max operation if the results are ordered differently. For example, the operations
```
%1 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
%2 = affine.min affine_map<(d0) -> (-d0 + 27, 8)>(%arg4)
```
doe not CSE. After applying the pattern, the two operations are equivalent
```
%1 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
%2 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
```
which enables CSE.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D121819
Siva Chandra Reddy [Tue, 22 Mar 2022 07:04:21 +0000 (07:04 +0000)]
[libc][Obvious] Remove an unnecessary dep and use inline_memcpy.
An unnecessary dep of the getenv function is removed. From the x86_64
loader, a call to __llvm_libc::memcpy is replaced with call to
__llvm_libc::inline_memcpy.
Chuanqi Xu [Tue, 22 Mar 2022 06:20:38 +0000 (14:20 +0800)]
[NFC] [Coroutines] Remove unnecessary check and constraints on SmallVector
The CoroSplit pass would check the existence of coroutine intrinsic
before starting work. It is not necessary and wasteful since it would
iterate over the Module.
This patch also removes the constraint on the corresponding of the
SmallVector for the possible coroutines in the Modules. The original
value is 4. Given coroutines is used actually in practice. 4 is really
relatively a low threshold.
Yeting Kuo [Wed, 16 Mar 2022 05:09:12 +0000 (13:09 +0800)]
[RISCV] Add basic cost model for vector casting
To perform the cost model of vector casting, the patch consider most vector
casts as their scalar form and consider those vector form of free scalr castings
as 1.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121771
Sheng [Tue, 22 Mar 2022 05:47:18 +0000 (05:47 +0000)]
[TableGen] Fix a misuse of getValueAsBitsInit
`getValueAsBitsInit` will assert when the "SoftFail" isn't presented.
But given the 'if' statement below, we should've allowed this situation.
This patch fix this.
Petr Hosek [Tue, 22 Mar 2022 01:34:59 +0000 (18:34 -0700)]
Revert "[bootstrap] Allow passing options to sub-builds for all targets"
This reverts commit
240e06dfe77feabe38a03cbb1c94875639d0f9ff.
Shraiysh Vaishay [Tue, 22 Mar 2022 04:38:33 +0000 (10:08 +0530)]
[mlir] Printing oilist element
This patch attempts to deduce when the oilist element must be printed
based on the optional arguments to it. This especially helps creating
an operation accurately because with the current implementation, the
inferred unit attributes must be manually added to print the clauses
appropriately.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D121579
jacquesguan [Mon, 21 Mar 2022 09:29:16 +0000 (17:29 +0800)]
[RISCV][NFC] Add common check prefix to reduce duplicate check lines.
Differential Revision: https://reviews.llvm.org/D122120
Ella Ma [Tue, 18 May 2021 06:22:46 +0000 (14:22 +0800)]
[analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file
This error was found when analyzing MySQL with CTU enabled.
When there are space characters in the lookup name, the current
delimiter searching strategy will make the file path wrongly parsed.
And when two lookup names have the same prefix before their first space
characters, a 'multiple definitions' error will be wrongly reported.
e.g. The lookup names for the two lambda exprs in the test case are
`c:@S@G@F@G#@Sa@F@operator int (*)(char)#1` and
`c:@S@G@F@G#@Sa@F@operator bool (*)(char)#1` respectively. And their
prefixes are both `c:@S@G@F@G#@Sa@F@operator` when using the first space
character as the delimiter.
Solving the problem by adding a length for the lookup name, making the
index items in the format of `<USR-Length>:<USR File> <Path>`.
---
In the test case of this patch, we found that it will trigger a "triple
mismatch" warning when using `clang -cc1` to analyze the source file
with CTU using the on-demand-parsing strategy in Darwin systems. And
this problem is also encountered in D75665, which is the patch
introducing the on-demand parsing strategy.
We temporarily bypass this problem by using the loading-ast-file
strategy.
Refer to the [discourse topic](https://discourse.llvm.org/t/60762) for
more details.
Differential Revision: https://reviews.llvm.org/D102669
jacquesguan [Mon, 21 Mar 2022 07:43:40 +0000 (15:43 +0800)]
[mlir][Math] Add more constant folder for Math ops.
This revision add constant folder for abs, copysign, ctlz, cttz and
ctpop.
Differential Revision: https://reviews.llvm.org/D122115
Carl Ritson [Tue, 22 Mar 2022 02:13:13 +0000 (11:13 +0900)]
[MachineSink] Check block prologue interference
Sinking must check for interference between the block prologue
and the instruction being sunk.
Specifically check for clobbering of uses by the prologue, and
overwrites to prologue defined registers by the sunk instruction.
Reviewed By: rampitec, ruiling
Differential Revision: https://reviews.llvm.org/D121277
Louis Dionne [Mon, 21 Mar 2022 21:05:06 +0000 (17:05 -0400)]
[libc++] Re-enable workaround for pre-ranges CTAD in std::span
See https://reviews.llvm.org/D121626 for details -- this re-enables the
CTAD we removed, since it does break some stuff as well (even though it's
not nearly as bad as the removed constructors fixed by D121626).
Differential Revision: https://reviews.llvm.org/D122184
Louis Dionne [Mon, 21 Mar 2022 17:43:02 +0000 (13:43 -0400)]
[cmake] Handle iOS, watchOS and tvOS when finding compiler-rt on Apple
This patch uses CMAKE_OSX_SYSROOT, which should contain the SDK path
that we're building against on Apple platforms, to determine which
platform we are compiling for and set the compiler-rt suffix accordingly.
Differential Revision: https://reviews.llvm.org/D122161
Petr Hosek [Tue, 22 Mar 2022 01:33:50 +0000 (18:33 -0700)]
[Clang] Set -mlinker-version explicitly in the lto test
This test assumes that the driver will set -object_path_lto linker
flag and it requests the platform linker with -fuse-ld=. When lld is
used as the host linker, the host linker version is unset and so
Clang won't set -object_path_lto since that flag is set conditionally
only when linker version is at least 116. We set the linker version
explicitly to make sure that -object_path_lto is set. That approach
is already used elsewhere in the test.
Differential Revision: https://reviews.llvm.org/D122110
Petr Hosek [Tue, 22 Mar 2022 01:32:03 +0000 (18:32 -0700)]
[CMake][Clang] Skip host link version detection for lld on Darwin
When lld is being used as host linker, skip version detection since
lld version cannot be used interchangeably with ld64 version and lld
is already handled specially in Clang driver.
Differential Revision: https://reviews.llvm.org/D122109
Joseph Huber [Mon, 21 Mar 2022 23:53:05 +0000 (19:53 -0400)]
[OpenMP] Manually unroll the argument copy loop
The unroll pragma did not properly work as the loop bound was not known
when we optimize the runtime and we then added a "unroll disable"
metadata which prevented unrolling later when the bounds were known.
For now we manually unroll to make sure up to 16 elements are handled
nicely. This helps optimizations to look through the argument passing.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D109164
Arthur Eubanks [Tue, 22 Mar 2022 00:11:35 +0000 (17:11 -0700)]
Revert "Revert "[OpaquePtr][LLParser] Automatically detect opaque pointers in .ll files""
This reverts commit
9c96a6bbfdde665b5c2389100a15acdeea0f4145.
Issues were already fixed at head.
Arthur Eubanks [Tue, 22 Mar 2022 00:11:14 +0000 (17:11 -0700)]
Revert "Revert "[OpaquePointers][BitcodeReader] Enable -opaque-pointers if we see an opaque pointer type""
This reverts commit
80ec0ebfdc5692a58e0832125f2c6a991df9d63f.
Issues were already fixed at head.
wren romano [Mon, 21 Mar 2022 23:37:11 +0000 (16:37 -0700)]
[mlir][sparse] Marking several things const/static
This is (tangential) work towards fixing: https://github.com/llvm/llvm-project/issues/51652
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D122059
Mitch Phillips [Mon, 21 Mar 2022 23:17:11 +0000 (16:17 -0700)]
Revert "[OpaquePointers][BitcodeReader] Enable -opaque-pointers if we see an opaque pointer type"
This reverts commit
46216aa97729aa994dce79e75cd25707fb4b7874.
Dependency https://reviews.llvm.org/D119482 broke the ASan buildbot.
Mitch Phillips [Mon, 21 Mar 2022 23:03:48 +0000 (16:03 -0700)]
Revert "[OpaquePtr][LLParser] Automatically detect opaque pointers in .ll files"
This reverts commit
295172ef51c6b9a73bc0fdcfd25f8c41ead9034a.
Reason: Broke the ASan buildbot. More details are available on the
original Phab review at https://reviews.llvm.org/D119482.
Walter Erquinigo [Mon, 21 Mar 2022 20:26:57 +0000 (13:26 -0700)]
[trace] clear any existing tracing sessions before relaunching the binary
There's a bug caused when a process is relaunched: the target, which
doesn't change, keeps the Trace object from the previous process, which
is already defunct, and causes segmentation faults when it's attempted
to be used.
A fix is to clean up the Trace object when the target is disposing of
the previous process during relaunches.
A way to reproduce this:
```
lldb a.out
b main
r
process trace start
c
r
process trace start
```
Differential Revision: https://reviews.llvm.org/D122176
Walter Erquinigo [Mon, 21 Mar 2022 22:46:19 +0000 (15:46 -0700)]
[trace] Use vector instead of ArrayRef when reading data
I incorrectly returned an ArrayRef when the underlying object didn't own
the data. Instead, returning a vector<uint8_t> is what we should do.
This fixes an issue when trying to access an intel-pt trace buffer
larger than 16 MB.
repro
```
go to a breakpoint
thread trace start -s
16777216
n
thread trace dump instructions # this doesn't fail anymore
```
Differential Revision: https://reviews.llvm.org/D122192
Mitch Phillips [Mon, 21 Mar 2022 22:58:38 +0000 (15:58 -0700)]
Revert "[memprof] Store callsite metadata with memprof records."
This reverts commit
0d362c90d335509c57c0fbd01ae1829e2b9c3765.
Reason: Causes the MSan buildbot to fail (see comments on
https://reviews.llvm.org/D121179 for more information
Vasileios Porpodas [Fri, 18 Mar 2022 01:28:28 +0000 (18:28 -0700)]
Recommit "[SLP] Fix lookahead operand reordering for splat loads."
Original review: https://reviews.llvm.org/D121354
The original commit
9136145eb019e1d18c966d4d06a3df349b88cc14 broke the build on several targets.
Differential Revision: https://reviews.llvm.org/D121973
Walter Erquinigo [Mon, 21 Mar 2022 22:56:53 +0000 (15:56 -0700)]
[simple] fix formatting in the intel-pt doc
A list needs to be properly formatted.
Jonas Devlieghere [Mon, 21 Mar 2022 22:21:10 +0000 (15:21 -0700)]
[lldb] Fix log & progress report for in-memory binaries
Fix the log and progress report message for in-memory binaries. If
there's no object file, use the name from the Module. With this patch we
correctly show the library name when attaching to a remote process
without an expanded shared cache.
Differential revision: https://reviews.llvm.org/D122177
Nathan James [Mon, 21 Mar 2022 22:29:22 +0000 (22:29 +0000)]
Revert "[ASTMatchers] Output currently processing match and nodes on crash"
This reverts commit
d89f9e963e4979466193dc6a15fe091bf7ca5c47.
Jakob Johnson [Mon, 21 Mar 2022 21:58:06 +0000 (14:58 -0700)]
Fix
e6c84f82b87576a57d1fa1c7e8c289d3d4fa7ab1
Failed buildbot: https://lab.llvm.org/buildbot/#/builders/17/builds/19490
Only run perf event tsc conversion test on x86_64.
Yonghong Song [Sat, 12 Mar 2022 19:05:40 +0000 (11:05 -0800)]
[Clang] Fix an unused-but-set-variable warning with volatile variable
For the following code,
void test() {
volatile int j = 0;
for (int i = 0; i < 1000; i++)
j += 1;
return;
}
If compiled with
clang -g -Wall -Werror -S -emit-llvm test.c
we will see the following error:
test.c:2:6: error: variable 'j' set but not used [-Werror,-Wunused-but-set-variable]
volatile int j = 0;
^
This is not quite right since 'j' is indeed used due to '+=' operator.
gcc doesn't emit error either in this case.
Also if we change 'j += 1' to 'j++', the warning will disappear
with latest clang.
Note that clang will issue the warning if the volatile declaration
involves only simple assignment (var = ...).
To fix the issue, in function MaybeDecrementCount(), if the
operator is a compound assignment (i.e., +=, -=, etc.) and the
variable is volatile, the count for RefsMinusAssignments will be
decremented, similar to 'j++' case.
Differential Revision: https://reviews.llvm.org/D121715
Craig Topper [Mon, 21 Mar 2022 21:55:39 +0000 (14:55 -0700)]
Revert "[RISCV] Special case sign extended scalars when type legalizing nxvXi64 .vx instrinsics on RV32."
This reverts commit
8c4937b33fe9090546f6dc834e174177075b5084.
Committed by mistake.
sstwcw [Mon, 21 Mar 2022 21:47:51 +0000 (21:47 +0000)]
[clang-format] Use an enum for context types. NFC
We currently have all those fields in AnnotatingParser::Context. They
are not inherited from the Context object for the parent scope. They
are exclusive. Now they are replaced with an enum.
`InCpp11AttributeSpecifier` and `InCSharpAttributeSpecifier` are not
handled like the rest in ContextType because they are not exclusive.
Reviewed By: curdeius, MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D121907
Craig Topper [Mon, 21 Mar 2022 21:50:05 +0000 (14:50 -0700)]
[RISCV] Simplify some code. NFC
Craig Topper [Mon, 21 Mar 2022 21:37:52 +0000 (14:37 -0700)]
[RISCV] Remove stray slash from comment. NFC
Craig Topper [Mon, 21 Mar 2022 21:27:09 +0000 (14:27 -0700)]
[RISCV] Special case sign extended scalars when type legalizing nxvXi64 .vx instrinsics on RV32.
On RV32, we need to type legalize i64 scalar arguments to intrinsics.
We usually do this by splatting the value into a vector separately.
If the scalar happens to be sign extended, we can continue using a .vx
intrinsic.
We already special cased sign extended constants, this extends it
to any sign extended value.
I've only added tests for one case of vadd. Most intrinsics go
through the same check. I can add more tests if we're concerned.
Differential Revision: https://reviews.llvm.org/D122186
Mahesh Ravishankar [Fri, 18 Mar 2022 16:36:16 +0000 (16:36 +0000)]
[mlir][MemRef] Add early exit for computing dropped unit-dims.
Computing dropped unit-dims when all the unit dims are dropped, does
not need to check for strides being dropped.
This also enables canonicalization of reduced-rank subviews.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D121766
Jorge Gorbe Moya [Mon, 21 Mar 2022 21:22:15 +0000 (14:22 -0700)]
Revert "[clang-format] Handle attributes before case label."
This reverts commit
596fa2d90044841c33b9a0e6b17406c2a45077a2.
Simon Pilgrim [Mon, 21 Mar 2022 21:37:37 +0000 (21:37 +0000)]
[X86] combineAddOrSubToADCOrSBB - Fold ADD/SUB + (AND(SRL(X,Y),1) -> ADC/SBB+BT(X,Y) (REAPPLIED)
As suggested on PR35908, if we are adding/subtracting an extracted bit, attempt to use BT instead to fold the op and use a ADC/SBB op.
Reapply with extra type legality checks - LowerAndToBT was originally only used during lowering, now that it can occur earlier we might encounter illegal types that we can either promote to i32 or just bail.
Differential Revision: https://reviews.llvm.org/D122084
Jakob Johnson [Mon, 21 Mar 2022 21:19:11 +0000 (14:19 -0700)]
Fix
e6c84f82b87576a57d1fa1c7e8c289d3d4fa7ab1
Failed buildbot: https://lab.llvm.org/buildbot/#/builders/68/builds/29250
Use toString() to consume the Error
Konrad Kleine [Mon, 21 Mar 2022 21:16:35 +0000 (21:16 +0000)]
[format] Use int8_t as the underlying type of all enums in FormatStyle
It was requested here (https://reviews.llvm.org/D120398#3353053) to make
the underlying type of all enums in `FormatStyle` an `int8_t`.
Originally the type was changed in https://reviews.llvm.org/D93758.
Reviewed By: HazardyKnusperkeks, curdeius, owenpan
Differential Revision: https://reviews.llvm.org/D120884
Maksim Panchenko [Tue, 15 Mar 2022 19:48:53 +0000 (12:48 -0700)]
[X86][NFCI] Remove redundant functions
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D121731
Nikita Popov [Mon, 21 Mar 2022 21:12:51 +0000 (22:12 +0100)]
[X86] Regenerate test checks
Update test checks after the revert in
15336828395792bfc818e6fcd3d951cba1b8477b.
Frederic Cambus [Mon, 21 Mar 2022 21:05:58 +0000 (22:05 +0100)]
[compiler-rt] Remove mentions of AuroraUX in code comments and docs.
AuroraUX was an operating system project based on an OpenSolaris kernel
and an Ada userland.
There appear to be no public code or release available online anymore.
The project page on Wikipedia [1] was deleted in January 2012, and a news
item [2] from November 2012 has more details.
[1] https://en.wikipedia.org/w/index.php?title=Special:Log/delete&page=AuroraUX
[2] https://www.phoronix.com/scan.php?page=news_item&px=MTIyMTI
Daniel Grumberg [Thu, 17 Mar 2022 10:50:55 +0000 (10:50 +0000)]
Ensure -extract-api handles multiple headers correctly
clang -extract-api should accept multiple headers and forward them to a
single CC1 instance. This change introduces a new ExtractAPIJobAction.
Currently API Extraction is done during the Precompile phase as this is
the current phase that matches the requirements the most. Adding a new
phase would need to change some logic in how phases are scheduled. If
the headers scheduled for API extraction are of different types the
driver emits a diagnostic.
Differential Revision: https://reviews.llvm.org/D121936
Jakob Johnson [Mon, 21 Mar 2022 20:54:32 +0000 (13:54 -0700)]
Fix
e6c84f82b87576a57d1fa1c7e8c289d3d4fa7ab1
Failed buildbot: https://lab.llvm.org/buildbot/#/builders/17/builds/19480
The fix seems to be simply be adding some type casts to make the compiler happy
Snehasish Kumar [Wed, 2 Mar 2022 22:06:06 +0000 (14:06 -0800)]
[memprof] Store callsite metadata with memprof records.
To ease profile annotation, each of the callsites in a function can be
annotated with profile data - "IR metadata format for MemProf" [1]. This
patch extends the on-disk serialized record format to store the debug
information for allocation callsites incl inline frames. This change is
incompatible with the existing format i.e. indexed profiles must be
regenerated, raw profiles are unaffected.
[1] https://groups.google.com/g/llvm-dev/c/aWHsdMxKAfE/m/WtEmRqyhAgAJ
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D121179
Arthur Eubanks [Mon, 21 Mar 2022 20:54:47 +0000 (13:54 -0700)]
[llvm-stress] Remove global LLVMContext
Can cause initialization order fiasco issues.
Nikita Popov [Mon, 21 Mar 2022 20:50:13 +0000 (21:50 +0100)]
Revert "[X86] combineAddOrSubToADCOrSBB - Fold ADD/SUB + (AND(SRL(X,Y),1) -> ADC/SBB+BT(X,Y)"
This reverts commit
81569f5b6ef531a48023f28133481262ee1509a3.
This causes a segfault when building consumer-typeset in
ReleaseLTO-g configuration:
https://llvm-compile-time-tracker.com/show_error.php?commit=
81569f5b6ef531a48023f28133481262ee1509a3
Mehdi Amini [Mon, 21 Mar 2022 19:57:40 +0000 (19:57 +0000)]
Adjust `llvm_unreachable` macro to account for platforms that don't define LLVM_BUILTIN_UNREACHABLE
Post
892c104fb7, LLVM_BUILTIN_UNREACHABLE may not be defined anymore.
Also when LLVM_UNREACHABLE_OPTIMIZE is OFF, emit LLVM_BUILTIN_UNREACHABLE
after LLVM_BUILTIN_TRAP to ensure that diagnostics are suppressed on
environments where LLVM_BUILTIN_TRAP is not marked as noreturn.
Differential Revision: https://reviews.llvm.org/D122170
Mircea Trofin [Mon, 21 Mar 2022 20:48:04 +0000 (13:48 -0700)]
[mlgo] Fix build breaks introduced by includes cleanups
These were not detected by the build bots because those went quietly
offline, too, due to a misconfiguration (fixed since)
LLVM GN Syncbot [Mon, 21 Mar 2022 20:44:15 +0000 (20:44 +0000)]
[gn build] Port
e6c84f82b875
Markus Böck [Mon, 21 Mar 2022 20:42:13 +0000 (21:42 +0100)]
[mlir] Rename `OpAsmParser::OperandType` to `OpAsmParser::UnresolvedOperand`
I am not sure about the meaning of Type in the name (was it meant be interpreted as Kind?), and given the importance and meaning of Type in the context of MLIR, its probably better to rename it. Given the comment in the source code, the suggestion in the GitHub issue and the final discussions in the review, this patch renames the OperandType to UnresolvedOperand.
Fixes https://github.com/llvm/llvm-project/issues/54446
Differential Revision: https://reviews.llvm.org/D122142
Eric Li [Mon, 21 Mar 2022 20:38:40 +0000 (20:38 +0000)]
[libTooling] Generalize string explanation as templated metadata
Change RewriteRule from holding an `Explanation` to being able to generate
arbitrary metadata. Where TransformerClangTidyCheck was interested in a string
description for the diagnostic, other tools may be interested in richer metadata
at a higher level of abstraction than at the edit level (which is currently
available as ASTEdit::Metadata).
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D120360
Jakob Johnson [Tue, 15 Mar 2022 19:22:17 +0000 (12:22 -0700)]
Add thin wrapper for perf_event_open API
- Add PerfEvent class to handle creating ring buffers and handle the resources associated with a perf_event
- Refactor IntelPT collection code to use this new API
- Add TSC to timestamp conversion logic with unittest
Differential Revision: https://reviews.llvm.org/D121734
Stanislav Mekhanoshin [Mon, 21 Mar 2022 20:12:36 +0000 (13:12 -0700)]
[AMDGPU] Fix AV classes VTs. NFCI.
NFC at this point, but will be used at a later patch.
Differential Revision: https://reviews.llvm.org/D122174
Arthur Eubanks [Mon, 21 Mar 2022 20:33:09 +0000 (13:33 -0700)]
[llvm-libtools-darwin] Don't use global LLVMContext
Fixes some initialization order fiasco issues
https://lab.llvm.org/buildbot#builders/5/builds/20996
Joseph Huber [Mon, 21 Mar 2022 20:32:12 +0000 (16:32 -0400)]
[CUDA] Add getTargetFeatures for the NVPTX toolchain
The NVPTX toolchain uses target features to determine the PTX version to
use. However this isn't exposed externally like most other toolchain
specific target features are. Add this functionaliy in preparation for
using it in for OpenMP offloading.
Reviewed By: jdoerfert, tra
Differential Revision: https://reviews.llvm.org/D122089
Stefan Pintilie [Mon, 21 Mar 2022 19:02:28 +0000 (14:02 -0500)]
[PowerPC][NFC] Add test case for byval argument passing
Add a test case for byval argument passing where the argument size is more than
8 bytes and is not a factor of 8 bytes.
alex-t [Sat, 19 Mar 2022 15:12:00 +0000 (16:12 +0100)]
[AMDGPU] divergence patterns for the BUILD_VECTOR i16, undef expansion.
BUILD_VECTOR of i16 and undef gets expanded to the COPY_TO_REGCLASS.
The latter is further lowererd to the copy instructions.
We need to provide the correct register class for the uniform and divergent BUILD_VECTOR nodes
to avoid VGPR to SGPR copies.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D122068
Peter Klausler [Tue, 15 Mar 2022 19:17:17 +0000 (12:17 -0700)]
[flang] Expose error recovery cases in external I/O
Some I/O error situations are current handled with fatal
runtime asserts, but should be exposed for user program
error recovery.
Differential Revision: https://reviews.llvm.org/D122049
Louis Dionne [Wed, 16 Mar 2022 16:35:35 +0000 (12:35 -0400)]
[bootstrap] Allow passing options to sub-builds for all targets
This patch makes it possible to pass a CMake option to one of the runtimes
for all targets being built. Basically, any option that starts with the
name of a runtime project being built will be forwarded as-is to the
sub-build. This is useful for customizing a sub-build for all targets.
Differential Revision: https://reviews.llvm.org/D121822
Arjun P [Fri, 18 Mar 2022 14:51:00 +0000 (14:51 +0000)]
[MLIR][Presburger] Deduplicate and move getNegatedCoeffs and getComplementIneq into Utils
Craig Topper [Mon, 21 Mar 2022 19:08:56 +0000 (12:08 -0700)]
[SelectionDAG] Make getPreferredExtendForValue take a Instruction * instead of Value *.
This is only called for instructions and the caller is already holding
an Instruction *. This makes the code more explicit and makes it
obvious the code doesn't make decisions about constants.
Nathan James [Mon, 21 Mar 2022 19:13:35 +0000 (19:13 +0000)]
[ASTMatchers] Output currently processing match and nodes on crash
Create a PrettyStackTraceEvent that will dump the current `MatchCallback` id as well as the `BoundNodes` if the 'run' method of a `MatchCallback` results in a crash.
The purpose of this is sometimes clang-tidy checks can crash in the `check` method. And in a large codebase with alot of checks enabled and in a release build, it can be near impossible to figure out which check as well as the source code that caused the crash. Without that information a reproducer is very hard to create.
This is a more generalised version of D118520 which has a nicer integration and should be useful to clients other than clang-tidy.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D120185
Kim Gräsman [Mon, 21 Mar 2022 19:09:02 +0000 (15:09 -0400)]
Yitzhak Mandelbaum [Mon, 21 Mar 2022 19:03:20 +0000 (19:03 +0000)]
Revert "[libTooling] Generalize string explanation as templated metadata"
This reverts commit
18440547d3520b78c9ab929685309419fc1fbe95. Causing failures
in some build modes.
e.g. https://lab.llvm.org/buildbot/#/builders/217/builds/1886
Aaron Ballman [Mon, 21 Mar 2022 19:05:53 +0000 (15:05 -0400)]
Ignore FullExpr when traversing cast sub-expressions
Full-expressions are Sema-generated implicit nodes that cover
constant-expressions and expressions-with-cleanup for temporaries.
Ignore those as part of implicit-ignore, and also remove too-aggressive
IgnoreImplicit (which includes nested ImplicitCastExprs, for example)
on unpacked sub-expressions.
Add some unittests to demonstrate that RecursiveASTVisitor sees through
ConstantExpr nodes correctly.
Adjust cxx2a-consteval test to cover diagnostics for nested consteval
expressions that were previously missed.
Fixes bug #53044.
Kim Gräsman [Mon, 21 Mar 2022 19:01:31 +0000 (15:01 -0400)]
Generalize and harmonize sub-expression traversal
CastExpr::getSubExprAsWritten and getConversionFunction used to have
disparate implementations to traverse the sub-expression chain and skip
so-called "implicit temporaries" (which are really implicit nodes added
by Sema to represent semantic details in the AST).
There's some friction in these algorithms that makes it hard to extend
and change them:
* skipImplicitTemporary is order-dependent; it can skip a
CXXBindTemporaryExpr nested inside a MaterializeTemporaryExpr, but not
vice versa
* skipImplicitTemporary only runs one pass, it does not traverse
multiple nested sequences of MTE/CBTE/MTE/CBTE, for example
Both of these weaknesses are void at this point, because this kind of
out-of-order multi-level nesting does not exist in the current AST.
Adding a new implicit expression to skip exacerbates the problem,
however, since a node X might show up in any and all locations between
the existing.
Thus;
* Harmonize the form of getSubExprAsWritten and getConversionFunction
so they both use a for loop
* Use the IgnoreExprNodes machinery to skip multiple nodes
* Rename skipImplicitTemporary to ignoreImplicitSemaNodes to generalize
* Update ignoreImplicitSemaNodes so it only skips one level per call,
to mirror existing Ignore functions and work better with
IgnoreExprNodes
This is a functional change, but one without visible effect.
Duncan P. N. Exon Smith [Mon, 21 Mar 2022 18:43:00 +0000 (11:43 -0700)]
Compiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE
`llvm_unreachable()` and `LLVM_ASSUME_ALIGNED` use
`defined(LLVM_BUILTIN_UNREACHABLE)` to check whether it has a
definition. Remove the fallback added in
26827337dff26ba3 (as a drive-by
when updating the GCC logic) and add a comment to prevent future
mistakes.
Differential Revision: https://reviews.llvm.org/D122167
Eric Li [Mon, 21 Mar 2022 18:19:17 +0000 (18:19 +0000)]
[libTooling] Generalize string explanation as templated metadata
Change RewriteRule from holding an `Explanation` to being able to generate
arbitrary metadata. Where TransformerClangTidyCheck was interested in a string
description for the diagnostic, other tools may be interested in richer metadata
at a higher level of abstraction than at the edit level (which is currently
available as ASTEdit::Metadata).
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D120360
Zarko Todorovski [Mon, 21 Mar 2022 18:38:29 +0000 (14:38 -0400)]
[libc++][AIX] AIX allows for changing permissions of symlinks
The test fails on AIX due to it expecting an error as on Linux. However, as on
other non-Linux systems symlinks permissions are supported so expect an empty
error code.
Reviewed By: daltenty, #libc, ldionne
Differential Revision: https://reviews.llvm.org/D121140
Arjun P [Fri, 18 Mar 2022 12:38:54 +0000 (12:38 +0000)]
[MLIR][Presburger] simplify removeConstraintsInvolvingRange
Nico Weber [Mon, 21 Mar 2022 18:28:59 +0000 (14:28 -0400)]
[clang] Remove stdint.h include from a test
Tests must not include headers from the host system.
It looks like the include wasn't needed for anything, so just remove it.
This makes check-clang work in a `git bash` launched from a cmd.exe
that isn't an MSVC shell (that is, %INCLUDE% isn't set).
Daniel Thornburgh [Mon, 21 Mar 2022 17:57:36 +0000 (17:57 +0000)]
Fix buildbot failures from
7917b3c6.
Sam McCall [Mon, 21 Mar 2022 17:53:59 +0000 (18:53 +0100)]
[clangd] Fix nullptr crash in AddUsing tweak on catch(...)
Fixes https://github.com/clangd/clangd/issues/1072
Louis Dionne [Mon, 21 Mar 2022 17:50:53 +0000 (13:50 -0400)]
[libc++] Trigger CI when cmake/ is modified
Philip Reames [Sun, 20 Mar 2022 21:38:46 +0000 (14:38 -0700)]
[test] Add regression test from pr54465
The reported crash regression was (presumably) fixed in 79a1823, but without adding coverage.
Nico Weber [Mon, 21 Mar 2022 17:42:28 +0000 (13:42 -0400)]
[gn build] Use lld-link's new /winsysroot: flag
If `clang_base_path` is set, it must now point to a directory that contains
an lld-link built with D118070.
(If this is a problem for anyone, we can guard this behind a
lld_link_understands_winsysroot gn arg, but let's see if we can get away
without that for now.)
With this, it's possible to build everything in a normal cmd.exe Window,
an MSVC shell isn't needed \o/
(Assuming you set `clang_base_path`, and you set `sysroot` to a directory
that contains a win sysroot. If you have MSVC installed,
`python3 llvm\utils\sysroot.py make-fake --out-dir=my-sysroot` and
setting `sysroot = "//my-sysroot"` in args.gn works, for example.)
Differential Revision: https://reviews.llvm.org/D121871
Arthur Eubanks [Mon, 21 Mar 2022 17:37:13 +0000 (10:37 -0700)]
[llvm-lipo] Don't use a global LLVMContext
Fixes initialization order fiasco issue reported by
https://lab.llvm.org/buildbot/#builders/5/builds/20987
Simon Pilgrim [Mon, 21 Mar 2022 17:38:06 +0000 (17:38 +0000)]
[X86][AVX512] lower1BitShuffle - fold broadcast(setcc(x,y)) -> setcc(broadcast(x),broadcast(y)) (PR52500)
AVX512 has excellent broadcast ops for everything but vXi1 bool vectors - so if we're broadcasting a comparison result, see if we can broadcast the comparison operands instead.
Snehasish Kumar [Fri, 18 Mar 2022 20:34:15 +0000 (13:34 -0700)]
[DebugInfo][NFC] Add a comment on the ordering of DILineInfo frames.
Add a comment to getFrame() to mention that frames are stored in
bottom-up, i.e. leaf to root in order of increasing index.
Differential Revision: https://reviews.llvm.org/D122033
Snehasish Kumar [Wed, 16 Mar 2022 17:31:55 +0000 (10:31 -0700)]
[memprof] Update the frame is inline logic and unittests.
Since DI frames are enumerated with the leaf function at index 0, this
patch fixes the logic when IsInlineFrame is set. Also update the
unittests to check that only the last frame is marked as non-inline from
a set of DI Frames for a PC address.
Differential Revision: https://reviews.llvm.org/D121830
Aart Bik [Fri, 18 Mar 2022 20:28:59 +0000 (13:28 -0700)]
[mlir][sparse] implement loop index value vectorization
with CHECK and integration test
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D122040
Tom Honermann [Tue, 15 Mar 2022 21:43:58 +0000 (14:43 -0700)]
[clang] [OpenMP] Diagnose use of 'target_clones' in OpenMP variant declarations.
Previously, OpenMP variant declarations for a function declaration that included
the 'cpu_dispatch', 'cpu_specific', or 'target' attributes was diagnosed, but
one with the 'target_clones' attribute was not. Now fixed.
Reviewed By: erichkeane, jdoerfert
Differential Revision: https://reviews.llvm.org/D121963
Tom Honermann [Tue, 15 Mar 2022 21:36:26 +0000 (14:36 -0700)]
[clang] [OpenMP] Extend OpenMP variant declaration tests.
This change extends the existing diagnostic tests for OpenMP variant
declarations to cover diagnostics for declarations that include
multiversion function attributes. The new tests demonstrate a missing
check for the 'target_clones' attribute.
Reviewed By: erichkeane, jdoerfert
Differential Revision: https://reviews.llvm.org/D121962
Tom Honermann [Wed, 2 Mar 2022 22:10:33 +0000 (14:10 -0800)]
[clang] Produce a "multiversion" annotation in textual AST output.
This change adds a "multiversion" annotation to textual AST output.
For example:
FunctionDecl 0xb6628b0 <t.c:1:1, col:13> col:5 multiversion foo 'int (void)'
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D121961
Tom Honermann [Tue, 1 Mar 2022 17:17:14 +0000 (09:17 -0800)]
[clang] NFC: Rename 'MVType' variables to 'MVKind' for consistency with their type.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D121960
Tom Honermann [Wed, 9 Feb 2022 23:02:13 +0000 (15:02 -0800)]
[clang] Add missing diagnostics for invalid overloads of multiversion functions in C.
Previously, an attempt to declare an overload of a multiversion function
in C was not properly diagnosed. In some cases, diagnostics were simply
missing. In other cases the following assertion failure occured...
```
Assertion `(Previous.empty() || llvm::any_of(Previous, [](const NamedDecl *ND) { return ND->hasAttr(); })) && "Non-redecls shouldn't happen without overloadable present"' failed.
```
... or the following diagnostic was spuriously issued.
```
error: at most one overload for a given name may lack the 'overloadable' attribute
```
The diagnostics issued in some cases could be improved. When the function
type of a redeclaration does not match the prior declaration, it would be
preferable to diagnose the type mismatch before diagnosing mismatched
attributes. Diagnostics are also missing for some cases.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D121959
Tom Honermann [Wed, 23 Feb 2022 17:00:02 +0000 (09:00 -0800)]
[clang] NFC: Remove forced type merging in multiversion function checks.
Checking of multiversion function declarations performed by various functions
in clang/lib/Sema/SemaDecl.cpp previously forced the valus of a passed in
'MergeTypeWithPrevious' reference argument in several scenarios. This was
unnecessary and possibly incorrect in the one case that the value
was forced to 'true' (though seemingly unobservably so).
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D121958
Tom Honermann [Tue, 8 Mar 2022 21:48:26 +0000 (13:48 -0800)]
[clang] NFC: Redundant code removal in SemaDecl.cpp, CheckTargetCausesMultiVersioning().
This change removes redundant code in the definition of
CheckTargetCausesMultiVersioning() in SemaDecl.cpp. The removed code checked
for multiversion function support. The code immediately following the removed
code is a call to CheckMultiVersionAdditionalRules(); that function performs
the same check on entry. In both cases, the consequences of missing multiversion
function support results in the same diagnostic message being issued and the
applicable function declaration being marked as invalid.
Reviewed By: erichkeane, aaron.ballman
Differential Revision: https://reviews.llvm.org/D121957
Tom Honermann [Tue, 22 Feb 2022 15:57:49 +0000 (07:57 -0800)]
[clang] NFC: Dead code removal in SemaDecl.cpp, CheckMultiVersionFunction().
This change removes dead code in the definition of CheckMultiVersionFunction()
in clang/lib/Sema/SemaDecl.cpp. The removed code was made dead by commit
fc53eb69c26cdd7efa6b629c187d04326f0448ca: "Reapply 'Implement target_clones multiversioning'".
See the added code just above the code being deleted; it contains the same
return statement with the previous condition now distributed across an if
statement and a switch statement.
Reviewed By: erichkeane, aaron.ballman
Differential Revision: https://reviews.llvm.org/D121955