Liming Liu [Fri, 6 Jan 2023 13:56:25 +0000 (05:56 -0800)]
[C++20] Determine the dependency of unevaluated lambdas more accurately
During template instantiation, the instantiator will enter constant
evaluated
context before instantiate a template argument originated from an
expression,
and this impedes the instantiator from creating lambdas with independent
types.
This patch solves the problem via widening the condition that the
instantiator
marks lambdas as never dependent, and fixes the issue #57960
Differential Revision: https://reviews.llvm.org/D140554
Jay Foad [Fri, 6 Jan 2023 11:09:36 +0000 (11:09 +0000)]
[AMDGPU] Add a feature for VALUTransUseHazard
NFCI. This just allows us to experiment with enabling/disabling the
workaround on different subtargets.
Differential Revision: https://reviews.llvm.org/D141121
Guillaume Chatelet [Fri, 6 Jan 2023 13:24:44 +0000 (13:24 +0000)]
[llvm-exegesis][NFC] Update benchmark phase naming to match documentation
Matthias Springer [Fri, 6 Jan 2023 13:24:30 +0000 (14:24 +0100)]
[mlir][memref] Add runtime verification for memref::CastOp
Verify unranked -> ranked casts and casts of dynamic sizes/offset/strides to static ones.
Differential Revision: https://reviews.llvm.org/D138671
Sanjay Patel [Thu, 5 Jan 2023 20:35:24 +0000 (15:35 -0500)]
[AArch64] add tests for x*y == 0; NFC
Sanjay Patel [Thu, 5 Jan 2023 19:58:56 +0000 (14:58 -0500)]
[x86] add tests for x*y == 0; NFC
Alex Richardson [Fri, 6 Jan 2023 13:23:10 +0000 (13:23 +0000)]
[UpdateTestChecks] Do not add --force-update to UTC_ARGS
Persisting this flag only introduces test churn.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D141124
Alex Richardson [Fri, 6 Jan 2023 13:20:11 +0000 (13:20 +0000)]
Make switch-to-lookup-large-types.ll more reliable
When larger integer types are natively supported simplifycfg will use an
inline constant instead of a global variable for this transform. I noticed
this while trying to automatically infer the datalayout from the target
triple in opt if it is not explicitly specified. Since the x86_64
datalayout includes "n8:16:32:64", this test started failing.
While touching this file also change i128 to i64 in the first test since
this was intended behaviour in the original commit.
Reviewed By: spatel, fhahn
Differential Revision: https://reviews.llvm.org/D141055
Nikita Popov [Fri, 6 Jan 2023 13:34:41 +0000 (14:34 +0100)]
[CallSiteSplitting] Convert test to opaque pointers (NFC)
Keeping the bitcasts here because this is in part testing the
(legal) bitcast after a musttail call, even though it's no longer
really relevant.
LLVM GN Syncbot [Fri, 6 Jan 2023 13:20:13 +0000 (13:20 +0000)]
[gn build] Port
4670d5ece57d
Guillaume Chatelet [Sat, 17 Dec 2022 17:48:36 +0000 (17:48 +0000)]
[NFC] Vastly simplifies TypeSize
Simplifies the implementation of `TypeSize` while retaining its interface.
There is no need for abstract concepts like `LinearPolyBase`, `UnivariateLinearPolyBase` or `LinearPolySize`.
Differential Revision: https://reviews.llvm.org/D140263
Luke Lau [Tue, 3 Jan 2023 19:37:16 +0000 (19:37 +0000)]
[WebAssembly] Explicitly add {z,s}ext so extends are selected
During DAG legalization, {u,s}itofp instructions on v2i8, v2i16, v4i8
and v4i16 types ended up being legalized into scalar instructions, when
they could just be extended to v2i32/v4i32 instead.
Fixes https://github.com/llvm/llvm-project/issues/57182
Differential Revision: https://reviews.llvm.org/D140916
Alex Zinenko [Tue, 3 Jan 2023 16:01:07 +0000 (16:01 +0000)]
[mlir] adapt TransformEachOpTrait to parameter values
Adapt the implementation of TransformEachOpTrait to the existence of
parameter values recently introduced into the transform dialect. In
particular, allow `applyToOne` hooks to return a list containing a mix
of `Operation *` that will be associated with handles and `Attribute`
that will be associated with parameter values by the trait
implementation of the transform interface's `apply` method.
Disentangle the "transposition" of the list of per-payload op partial
results to decrease its overall complexity and detemplatize the code
that doesn't really need templates. This removes the poorly documented
special handling for single-result ops with TransformEachOpTrait that
could have assigned null pointer values to handles.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D140979
Alex Zinenko [Mon, 2 Jan 2023 17:11:40 +0000 (17:11 +0000)]
[mlir] NFC: move DiagnosedSilenceableFailure to Utils in Transform dialect
It was originally placed in TransformInterfaces for convenience, but it
is really a generic utility. It may also create an include cycle between
TransformTypes and TransformInterfaces if the latter needs to include
the former because the former uses the failure util.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D140978
Alex Zinenko [Mon, 2 Jan 2023 13:58:53 +0000 (13:58 +0000)]
[mlir] NFC: rename TransformTypeInterface to TransformHandleTypeInterface
This makes it more consistent with the recently added
TransformParamTypeInterface.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D140977
Alex Zinenko [Mon, 2 Jan 2023 13:07:02 +0000 (13:07 +0000)]
[mlir] introduce parameters into the transofrm dialect
Introduce a new kind of values into the transform dialect -- parameter
values. These values have a type implementing the new
`TransformParamTypeInterface` and are associated with lists of
attributes rather than lists of payload operations. This mechanism
allows one to wrap numeric calculations, typically heuristics, into
transform operations separate from those at actually applying the
transformation. For example, tile size computation can be now separated
from tiling itself, and not hardcoded in the transform dialect. This
further improves the separation of concerns between transform choice and
implementation.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D140976
Benjamin Kramer [Fri, 6 Jan 2023 11:51:01 +0000 (12:51 +0100)]
[bazel] Add missing :Support dependency after
1b8224537070
Matthias Springer [Fri, 6 Jan 2023 10:59:30 +0000 (11:59 +0100)]
[mlir][tensor] Support parallel_insert_slice in MergeConsecutiveInsertExtractSlicePatterns.cpp
Differential Revision: https://reviews.llvm.org/D141116
Matthias Springer [Fri, 6 Jan 2023 10:59:41 +0000 (11:59 +0100)]
[mlir][linalg] Swap extract_slice(fill(x)) ops
This pattern is similar to `FoldFillWithTensorReshape`, which performs the same swapping with reshapes.
Fill the smaller extracted tensor slice instead of `x`. This allows for additional simplifications in case `x` is the result of another extract_slice.
Differential Revision: https://reviews.llvm.org/D141117
Balázs Kéri [Fri, 6 Jan 2023 10:21:41 +0000 (11:21 +0100)]
[clang][analyzer] Extend StreamChecker with some new functions.
The stream handling functions `ftell`, `rewind`, `fgetpos`, `fsetpos`
are evaluated in the checker more exactly than before.
New tests are added to test behavior of the checker together with
StdLibraryFunctionsChecker. The option ModelPOSIX of that checker
affects if (most of) the stream functions are recognized, and checker
StdLibraryFunctionArgs generates warnings if constraints for arguments
are not satisfied. The state of `errno` is set by StdLibraryFunctionsChecker
too for every case in the stream functions.
StreamChecker works with the stream state only, does not set the errno state,
and is not dependent on other checkers.
Reviewed By: Szelethus
Differential Revision: https://reviews.llvm.org/D140395
Nikita Popov [Fri, 6 Jan 2023 11:09:52 +0000 (12:09 +0100)]
[Transforms] Convert some tests to opaque pointers (NFC)
Ties Stuij [Fri, 6 Jan 2023 10:09:46 +0000 (10:09 +0000)]
[AArch64] add GlobalIsel support for scalar CNT instruction
When feature CSSC is available we should use instruction CNT for s32, s64 and
s128 types in GlobalIsel's G_CTPOP.
spec:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/CNT--Count-bits-
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D139417
Nikita Popov [Fri, 6 Jan 2023 11:07:06 +0000 (12:07 +0100)]
[GlobalSplit] Convert test to opaque pointers (NFC)
Nikita Popov [Fri, 6 Jan 2023 11:02:52 +0000 (12:02 +0100)]
[ConstantFold] Don't drop zero index gep with inrange attribute
This may cause GlobalSplit to fail if opaque pointers are used.
inrange really needs a new representation, but for now restore the
pre-opaque pointers status.
OCHyams [Fri, 6 Jan 2023 10:58:12 +0000 (10:58 +0000)]
NFC Address review comment for D140905
Florian Hahn [Fri, 6 Jan 2023 10:56:17 +0000 (10:56 +0000)]
[LV] Disable runtime unrolling for vectorized loops.
This patch adds metadata to disable runtime unrolling to the vectorized
loop. If runtime unrolling/interleaving is considered profitable, LV
will interleave the loop directly. There should be no need to perform
runtime unrolling at a later stage.
Note that we already add metadata to disable runtime unrolling to the
scalar loop after vectorization.
The additional unrolling unnecessarily increases code size and compile
time. In addition to that we have several bug reports of unncessary
runtime unrolling for vectorized loops, e.g. PR40961
Compile-time improvements:
NewPM-O3: -1.04%
NewPM-ReleaseThinLTO: -0.59%
NewPM-ReleaseLTO-g: -0.97%
https://llvm-compile-time-tracker.com/compare.php?from=
ce1be13a868d0f8afa367975558c1a6175cce33a&to=
78bc2e67f22e9e10e61cdb6cdac4bb857d95eb1b&stat=instructions:u
Fixes #40306.
Reviewed By: lebedev.ri, nikic
Differential Revision: https://reviews.llvm.org/D115261
OCHyams [Fri, 6 Jan 2023 10:49:13 +0000 (10:49 +0000)]
[DebugInfo] Replace UndefValue with PoisonValue in setKillLocation
This helps towards the effort to remove UndefValue from LLVM.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: nlopes
Differential Revision: https://reviews.llvm.org/D140905
Nikita Popov [Fri, 6 Jan 2023 10:47:32 +0000 (11:47 +0100)]
[LoopUnroll] Convert test to opaque pointers (NFC)
Nikita Popov [Fri, 6 Jan 2023 10:46:59 +0000 (11:46 +0100)]
[LoopUnroll] Name instructions in test (NFC)
Mehdi Amini [Thu, 5 Jan 2023 19:28:48 +0000 (19:28 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in SparseTensorCodegen.cpp (NFC)
Nikita Popov [Fri, 6 Jan 2023 10:19:48 +0000 (11:19 +0100)]
[LoopIdiom] Convert tests to opaque pointers (NFC)
The differences here are due to SCEVExpander producing GEPs with
explicit offset calculation, a known difference with opaque pointers.
Luke Lau [Thu, 5 Jan 2023 17:46:22 +0000 (17:46 +0000)]
[cmake] Add llvm-debuginfod as test dependency
llvm-debuginfod is used by llvm-lit as of
36f01909a0e29c1014301ed6835687a84bf0e9fa, so adding this dependency
fixes a "note: Did not find llvm-debuginfod" warning from showing up
when running tests.
Differential Revision: https://reviews.llvm.org/D141071
OCHyams [Fri, 6 Jan 2023 09:16:50 +0000 (09:16 +0000)]
[DebugInfo] Prefer setKillLocation rather than replacing operands with undef
NFC-ish. There is a functional change but the outputs are semantically
identical. Where we might've before replaced one operand with undef (which
means "this is a kill location marker") the use of `setKillLocation` will
replace all location operands with `undef` (which also means "this is a kill
location marker").
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140904
Nikita Popov [Fri, 6 Jan 2023 10:07:42 +0000 (11:07 +0100)]
[LoopIdiom] Name instructions in test (NFC)
Balázs Kéri [Fri, 6 Jan 2023 08:57:37 +0000 (09:57 +0100)]
[clang][analyzer] Add stream related functions to StdLibraryFunctionsChecker.
Additional stream handling functions are added.
These are partially evaluated by StreamChecker, result of the addition is
check for more preconditions and construction of success and failure branches
with specific errno handling.
Reviewed By: Szelethus
Differential Revision: https://reviews.llvm.org/D140387
Noah Goldstein [Fri, 6 Jan 2023 07:24:15 +0000 (15:24 +0800)]
[X86] Add tests for atomic bittest with register/memory operands
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D140938
Guillaume Chatelet [Thu, 5 Jan 2023 13:35:09 +0000 (13:35 +0000)]
[libc] Add a section about supported compilers in the documentation
Context https://github.com/llvm/llvm-project/issues/59368
Differential Revision: https://reviews.llvm.org/D141045
OCHyams [Fri, 6 Jan 2023 08:42:18 +0000 (08:42 +0000)]
[DebugInfo][NFC] Rename is/setUndef to is/setKilllocation
These names better reflect the semantics and also the implementation, since
it's not just "undef" operands that are sentinels used to signal that the debug
intrinsic terminates dominating locations definitions.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140903
Markus Böck [Fri, 6 Jan 2023 08:54:55 +0000 (09:54 +0100)]
[lldb] Allow configuring on Windows with python interpreter within a junction
The current implementation nicely takes into account when the python interpreter is symlinked (or transitively within a symlinked directory). Sadly, `os.path.islink` returns `false` on Windows if instead of Windows symlinks, junctions are used. This has caused me issues after I started using `scoop` as my package manager on Windows, which creates junctions instead of symlinks.
The fix proposed in this patch is to check whether `realpath` returns a different path to `exe`, and if it does, to simply try again with that path.
The code could also be simplified since `sys.executable` is guaranteed to be absolute, and `os.readlink`, which can return a relative path, is no longer used.
Tested on Windows 11 with Python 3.11 as interpreter and Ubuntu 18.04 with Python 3.6
Differential Revision: https://reviews.llvm.org/D141042
Jean Perier [Fri, 6 Jan 2023 08:57:08 +0000 (09:57 +0100)]
[flang] add hlfir.null to implement NULL()
In HLFIR, the address of a Fortran entity in lowering must be defined
by an operation that has the FortranVariableOpInterface (it is a sanity
requirement to ensure that the mlir::Value propagated in certain places
of lowering can be reasoned about).
fir.zero_bits does not have this interface and it makes little sense to
add it since it can "zero initialize" more types than just addresses.
Creating an hlfir.declare for null addresses is a bit too much (what
would be the name), and it would be noisy in the IR.
Instead add a small hlfir.null operation whose codegen is simply a
replacement by fir.zero_bits.
It may also later help dealing with the NULL(MOLD) cases in a nicer
way (the current lowering of this uses special handling it).
Differential Revision: https://reviews.llvm.org/D141040
Juan Manuel MARTINEZ CAAMAÑO [Fri, 6 Jan 2023 08:45:36 +0000 (09:45 +0100)]
[CodeGen][AMDGPU] EXTRACT_VECTOR_ELT: input vector element type can differ from output type
In function SITargetLowering::performExtractVectorElt,
the output type was not considered which could lead to type mismatches
later.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D139943
Nikita Popov [Fri, 6 Jan 2023 08:44:27 +0000 (09:44 +0100)]
Revert "CodingStandards: restrict CamelCase variable names guideline to llvm/clang/clang-tools-extra/polly/bolt"
This reverts commit
ee9ccb11036ac46ff9b9f3fa2d459d9d2bce5509.
See https://reviews.llvm.org/D140585#4019417 and following.
Multiple people requested a revert of this change pending further
discussion.
Nikita Popov [Fri, 6 Jan 2023 08:37:45 +0000 (09:37 +0100)]
Revert "[X86] Revert -fno-plt __tls_get_addr workaround for old GNU ld"
This reverts commit
2679e8bba3e166e3174971d040b9457ec7b7d768.
This change is a significant backwards-compatibility break, which
does in fact break the entire Rust ecosystem, which uses an
-fno-plt -mrelax-relocations=0 default.
Please go through pre-commit review for this change in order to
gain broader consensus.
Chuanqi Xu [Fri, 6 Jan 2023 08:34:48 +0000 (16:34 +0800)]
[NFC] [Coroutines] Move collectFrameAlloca to decrease the times to iterate the function
Previously in collectFrameAllocas, we will iterate every instruction in
the Function and we will iterate the function again later. It is
redundnt.
Pierre van Houtryve [Tue, 13 Dec 2022 08:50:41 +0000 (03:50 -0500)]
[Sema] Fix crash when evaluating nested call with value-dependent arg
Fix an edge case `ExprConstant.cpp`'s `EvaluateWithSubstitution` when called by `CheckEnableIf`
The assertion in `CallStackFrame::getTemporary`
could fail during evaluation of nested calls to a function
using `enable_if` when the second argument was a
value-dependent expression.
This caused a temporary to be created for the second
argument with a given version during the
evaluation of the inner call, but we bailed out
when evaluating the second argument of the
outer call due to the expression being value-dependent.
After bailing out, we tried to clean up the argument's value slot but it
caused an assertion to trigger in `getTemporary` as
a temporary for the second argument existed, but only for the inner call and not the outer call.
See the test case for a more complete description of the issue.
Reviewed By: ahatanak
Differential Revision: https://reviews.llvm.org/D139713
Benjamin Chetioui [Fri, 6 Jan 2023 07:25:44 +0000 (07:25 +0000)]
[NFC] Test commit.
Yeting Kuo [Thu, 5 Jan 2023 07:01:16 +0000 (15:01 +0800)]
[VP][RISCV] Add vp.abs and RISC-V support.
RISC-V uses ISD::ABS lower method (abs x) -> (smax_vl x (sub_vl 0, x)) for ISD::VP_ABS.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D141033
Akira Hatanaka [Fri, 6 Jan 2023 06:06:50 +0000 (22:06 -0800)]
Save the result of getenv() to a string
The result has to be saved to a string as the result might be
overwritten by subsequent calls to getenv.
https://pubs.opengroup.org/onlinepubs/
009696899/functions/getenv.html
See the discussion here: https://reviews.llvm.org/D137996#4029305
Noah Goldstein [Fri, 6 Jan 2023 06:08:25 +0000 (14:08 +0800)]
[X86] Add additional tests to no-shift.ll
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D141076
Fangrui Song [Fri, 6 Jan 2023 06:21:13 +0000 (22:21 -0800)]
[Driver] Simplify -fsanitize-memory-track-origins handling. NFC
ziqingluo-90 [Fri, 6 Jan 2023 06:02:43 +0000 (22:02 -0800)]
Revert "[Fix]"[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations""
This reverts commit
ef47a0a711f12add401394f7af07a0b4d1635b56.
Revert "[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations"
This reverts commit
b2ac5fd724c44cf662caed84bd8f84af574b981d.
This patch is causing failure in some Sanitizer tests
(https://lab.llvm.org/buildbot/#/builders/5/builds/30522/steps/13/logs/stdio). Reverting the patch and its' fix.
Josh Stone [Wed, 4 Jan 2023 00:04:45 +0000 (16:04 -0800)]
[RegAllocFast] Handle new debug values for spills
These new debug values get inserted after the place where the spill
happens, which means they won't be reached by the reverse traversal of
basic block instructions. This would crash or fail assertions if they
contained any virtual registers to be replaced. We can manually handle
the new debug values right away to resolve this.
Fixes https://github.com/llvm/llvm-project/issues/59172
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D139590
Akira Hatanaka [Fri, 6 Jan 2023 04:09:56 +0000 (20:09 -0800)]
[Sema] Fix a bug where clang doesn't detect uses of unavailable decls
in C++ base or member initializers
Differential Revision: https://reviews.llvm.org/D127442
Akira Hatanaka [Fri, 6 Jan 2023 03:48:25 +0000 (19:48 -0800)]
[CodeGen][ObjC] Fix a memory leak that occurs when a non-trivial C
struct property is set using dot notation
Make sure the destructor is called if needed.
Differential Revision: https://reviews.llvm.org/D136639
Xiaodong Liu [Fri, 6 Jan 2023 01:32:20 +0000 (09:32 +0800)]
[LoongArch] Add intrinsics for CACOP instruction
The CACOP instruction is mainly used for cache initialization
and cache-consistency maintenance.
Depends on D140872
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D140527
Jie Fu [Fri, 6 Jan 2023 03:36:13 +0000 (19:36 -0800)]
[mlir] Fix build error due to -Wsign-compare after revision D140871
This patch fixes build failure due to -Wsign-compare in sparse2SparseRewrite(...) after https://reviews.llvm.org/D140871.
```
llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp:842:32: error: comparison of integers of different signs: 'uint64_t' (aka 'unsigned long') and 'int64_t' (aka 'long') [-Werror,-Wsign-compare]
for (uint64_t i = 0; i < rank; i++) {
~ ^ ~~~~
1 error generated.
```
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D141104
Emilia Dreamer [Fri, 6 Jan 2023 03:18:19 +0000 (05:18 +0200)]
[clang-format] Disallow decltype in the middle of constraints
If a function with a `requires` clause as a constraint has a decltype
return type, such as `decltype(auto)`, the decltype was seen to be part
of the constraint clause, rather than as part of the function
declaration, causing it to be placed on the wrong line.
This patch disallows decltype to be a part of these clauses
Fixes https://github.com/llvm/llvm-project/issues/59578
Depends on D140339
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D140312
Emilia Dreamer [Fri, 6 Jan 2023 03:13:58 +0000 (05:13 +0200)]
[clang-format] Remove special logic for parsing concept definitions.
Previously, clang-format relied on a special method to parse concept
definitions, `UnwrappedLineParser::parseConcept()`, which deferred to
`UnwrappedLineParser::parseConstraintExpression()`. This is problematic,
because the C++ grammar treats concepts and requires clauses
differently, causing issues such as https://github.com/llvm/llvm-project/issues/55898 and https://github.com/llvm/llvm-project/issues/58130.
This patch removes `parseConcept`, letting the formatter parse concept
definitions as more like what they actually are, fancy bool definitions.
NOTE that because of this, some long concept definitions change in their
formatting, as can be seen in the changed tests. This is because of a
change in split penalties, caused by a change in MightBeFunctionDecl on
the concept definition line, which was previously `true` but with this
patch is now `false`.
One might argue that `false` is a more "correct" value for concept
definitions, but I'd be fine with setting it to `true` again to maintain
compatibility with previous versions.
Fixes https://github.com/llvm/llvm-project/issues/58130
Depends on D140330
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D140339
Emilia Dreamer [Fri, 6 Jan 2023 03:03:29 +0000 (05:03 +0200)]
[clang-format] Require space before noexcept qualifier
This brings the noexcept qualifier more visually in line with the other
keyword qualifiers, such as "final" and "override".
Originally reported as https://github.com/llvm/llvm-project/issues/44542,
it was closed as "working by design" and reinforcing tests were added
as part of
a218706cba90248be0c60bd6a8f10dbcf0270955. The exact spacing
depended on the `PointerAlignment` option, where the default value of
`Right` would leave no space.
This patch seeks to change this behaviour, regardless of the configured
`PointerAlignment` option (matching the previous behaviour of the `Left`
option).
Closes https://github.com/llvm/llvm-project/issues/59729
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D140767
Brad Smith [Fri, 6 Jan 2023 02:24:36 +0000 (21:24 -0500)]
Fix for tests on Windows buildbot
Chen Zheng [Fri, 6 Jan 2023 02:22:18 +0000 (21:22 -0500)]
[PowerPC] remove the ctr clobbers check related to TLS access
Dynamic tls access model will be lowered to MI which clobbers CTR in
the loop in ISEL(ADDItlsgdLADDR) and post-isel CTR loop pass will revert
the loop to a normal compare + branch form.
So no need to add this clobber check in hardware loop insertion pass now.
Reviewed By: nemanjai
Differential revision: https://reviews.llvm.org/D140367
Brad Smith [Fri, 6 Jan 2023 02:18:12 +0000 (21:18 -0500)]
[Driver] move Fuchsia header search path management to the driver
Fuchsia already implements AddClangSystemIncludeArgs(). So it looks like we
just have to switch over to using it.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D141073
Chen Zheng [Fri, 6 Jan 2023 01:46:52 +0000 (20:46 -0500)]
[PowerPC][NFC] add an option to keep the test point
Passes before hardware loop insertion change the loop to a form which
is not a hardware loop candidate (return early before checking the ctr clobbers).
And the PHI in the loop exit block is also optimized away. This breaks the
previous test point when the case was committed. Fixing this by running this
case just before hardware loop insertion pass.
Reviewed By: nemanjai
Differential revision: https://reviews.llvm.org/D140366
Xiaodong Liu [Fri, 6 Jan 2023 01:18:11 +0000 (09:18 +0800)]
[LoongArch] Add "32bit" target feature
There are a few intrinsics or instructions on LoongArch
that are only appropriate for loongarch32 target. So the
feature "32bit" is added to implement it.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D140872
Brad Smith [Fri, 6 Jan 2023 01:18:59 +0000 (20:18 -0500)]
[LoongArch] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros
Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros
Reviewed By: SixWeining, MaskRay
Differential Revision: https://reviews.llvm.org/D141070
Jakub Kuderski [Fri, 6 Jan 2023 01:11:46 +0000 (20:11 -0500)]
[mlir][spirv] Add smul_extended expansion for WebGPU
We need this because WGSL does not support extended multiplication ops.
Fixes: https://github.com/llvm/llvm-project/issues/59563
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D141096
Yitzhak Mandelbaum [Fri, 6 Jan 2023 01:07:28 +0000 (01:07 +0000)]
Revert "[clang][dataflow] Only model struct fields that are used in the function being analyzed."
This reverts commit
5e8f597c2fedc740b71f07dfdb1ef3c2d348b193. It caused msan and ubsan breakages.
Craig Topper [Fri, 6 Jan 2023 00:35:59 +0000 (16:35 -0800)]
[RISCV] Rename SDT_RISCVVecCvtX2FOp_VL->SDT_RISCVVecCvtF2XOp_VL. NFC
The instruction name is x.f with the destination type first. The
template name was intended as "convert F to X". So the F comes first.
Kirill Stoimenov [Fri, 6 Jan 2023 00:08:59 +0000 (00:08 +0000)]
[LSAN][NFC] Removed FinishThreadLocked from the LSAN interface.
It is only used in the LSAN specific part.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D140109
Jeffrey Byrnes [Fri, 6 Jan 2023 00:22:04 +0000 (16:22 -0800)]
[AMDGPU] Switch to autogenerated checks
Murali Vijayaraghavan [Thu, 5 Jan 2023 23:50:05 +0000 (23:50 +0000)]
[NFC][MLIR] Adding better names to lit test for pooling vectorization
Differential Revision: https://reviews.llvm.org/D141097
bixia1 [Thu, 5 Jan 2023 17:39:23 +0000 (09:39 -0800)]
[mlir][sparse] Replace sparse_tensor.sort with sparse_tensor.sort_coo for sorting COO tensors.
Add codegen pattern for sparse_tensor.indices_buffer.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D140871
Jakub Kuderski [Thu, 5 Jan 2023 23:37:49 +0000 (18:37 -0500)]
[mlir][spirv] Fix extended umul expansion for WebGPU
Fix an off-by-one error in extended umul extension for WebGPU.
Revert to the long multiplication algorithm originally added to wide
integer emulation, which was deleted in D139776. It is much easier
to see why it is correct.
Add runtime tests based on the mlir-vulkan-runner. These run both with
and without umul extension.
Issue: https://github.com/llvm/llvm-project/issues/59563
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D141085
Owen Pan [Thu, 5 Jan 2023 07:55:10 +0000 (23:55 -0800)]
[clang-format] Add an option to insert a newline at EOF if missing
Closes #38042.
Differential Revision: https://reviews.llvm.org/D141035
Murali Vijayaraghavan [Thu, 5 Jan 2023 23:08:11 +0000 (23:08 +0000)]
[mlir][linalg] Vectorize 1D convolution
Differential Revision: https://reviews.llvm.org/D140188
Keno Fischer [Wed, 4 Jan 2023 01:49:17 +0000 (01:49 +0000)]
[LVI] Look through negations when evaluating conditions
This teaches LVI (and thus CVP) to extract range information
from branches whose condition is negated using (`xor %c, true`).
On the implementation side, we switch the cache to additionally
track whether we're looking for the inverted value or not and
otherwise using the existing support for computing inverted
conditions.
I think the biggest question here is why this negation shows up
here at all. After all, it should always be possible for some
other pass to fold such a negation into a branch, comparison or
some other logical operation. Indeed, instcombine does just that.
However, these negations can be otherwise fairly persistent, e.g.
instsimplify is not able to exchange branch conditions from
negations. In addition, jumpthreading, which sits at the same
point in default pass pipeline also handles this pattern, which
adds further evidence that we might expect these negations to
not have been canonicalized away yet at this point in the pass
pipeline.
In the particular case I was looking at there was a bit of a
circular dependency where flags computed by cvp were needed
by instcombine, and incstombine's folding of the negation was
needed for cvp. Adding a second instombine pass would have
worked of course, but instcombine can be somewhat expensive,
so it appeared desirable to not require it to have run
before cvp (as is the case in the default pass pipeline).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D140933
Fangrui Song [Thu, 5 Jan 2023 22:36:36 +0000 (14:36 -0800)]
[C] Make (c ? e1 : e2) noreturn only if both e1 and e2 are noreturn
In C mode, if e1 has __attribute__((noreturn)) but e2 doesn't, `(c ? e1 : e2)`
is incorrectly noreturn and Clang codegen produces `unreachable`
which may lead to miscompiles (see [1] `gawk/support/dfa.c`).
This problem has been known since
8c6b56f39d967347f28dd9c93f1cffddf6d7e4cd (2010) or earlier.
Fix this by making the result type noreturn only if both e1 and e2 are
noreturn, matching GCC.
`_Noreturn` and `[[noreturn]]` do not have the aforementioned problem.
Fix https://github.com/llvm/llvm-project/issues/59792 [1]
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D140868
Peter Rong [Thu, 29 Dec 2022 00:51:07 +0000 (16:51 -0800)]
[Transform] Rewrite LowerSwitch using APInt
This rewrite fixes https://github.com/llvm/llvm-project/issues/59316.
Previously LowerSwitch uses int64_t, which will crash on case branches using integers with more than 64 bits.
Using APInt fixes this problem. This patch also includes a test
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D140747
Aaron Ballman [Thu, 5 Jan 2023 22:08:57 +0000 (17:08 -0500)]
Add isInAnonymousNamespace() to the dynamic AST matchers
This was added to the static matchers in
125ccd3751472a0c709498f83671577ffed394a6, but the dynamic matcher was
missed. This adds the dynamic matcher to the list.
Zibi Sarbinowski [Thu, 5 Jan 2023 21:55:21 +0000 (15:55 -0600)]
Disable a part of the unit test CommandLineTest/BadResponseFile for z/OS.
[Support] Do not run test on z/OS
A part of the unit test CommandLineTest/BadResponseFile, added in
the commit
fd3d7a9f8cbb need to be disable for z/OS as it was already done for AIX platform.
Reviewed By: fanbo-meng
Differential Revision: https://reviews.llvm.org/D141084
Joshua Cranmer [Thu, 5 Jan 2023 21:53:29 +0000 (16:53 -0500)]
[NFC][IR] Avoid string leak with target extension types.
Reviewed By: nikic, hctim
Differential Revision: https://reviews.llvm.org/D141083
Yitzhak Mandelbaum [Tue, 27 Dec 2022 14:21:29 +0000 (14:21 +0000)]
[clang][dataflow] Only model struct fields that are used in the function being analyzed.
Previously, the model for structs modeled all fields in a struct when
`createValue` was called for that type. This patch adds a prepass on the
function under analysis to discover the fields referenced in the scope and then
limits modeling to only those fields. This reduces wasted memory usage
(modeling unused fields) which can be important for programss that use large
structs.
Note: This patch obviates the need for https://reviews.llvm.org/D123032.
Differential Revision: https://reviews.llvm.org/D140694
Adrian Prantl [Thu, 5 Jan 2023 21:41:33 +0000 (13:41 -0800)]
Revert an unintentional API ABI break
lldb::LanguageType is used as a parameter in
SBExpressionOptions::SetLanguage(), which actually makes this type API
too. Commit
6eaedbb52f2a616e644e5acc7279c8b07c4cfe82 added a
`: uint16_t` to it, which broke binary compatibility for the SBAPI. This
patch reverts to the original enum.
I tried moving the entire enum into include/API, but that created a
cyclic module dependency between API and Utility. To keep things
simple, this just reverts to the original code and adds a warning.
rdar://
103415402
Differential Revision: https://reviews.llvm.org/D141087
Matt Arsenault [Mon, 28 Nov 2022 22:55:17 +0000 (17:55 -0500)]
clang/AMDGPU: Remove flat-address-space from feature map
This was only used for checking if is_shared/is_private were legal,
which we're not bothering to do anymore.
This is apparently visible to more than the target attribute (which
seems to silently ignore unrecognized features), so this has the
potential to break something (i.e. see the OpenMP test change)
Xiang Li [Thu, 5 Jan 2023 21:29:09 +0000 (16:29 -0500)]
[NFC] [Doc] Fix example for AnnotateTypeDocs
Change clang::annotate into clang::annotate_type.
The example will get error like
error: 'annotate' attribute cannot be applied to types
int* [[clang::annotate("category1", "foo", 1)]] f(int[[clang::annotate("category2")]] *);
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D139935
Vang Thao [Thu, 5 Jan 2023 20:40:12 +0000 (20:40 +0000)]
[AMDGPU] Add .uniform_work_group_size metadata to v5
Amdgpu kernel with function attribute "uniform-work-group-size"="true" requires
uniform work group size (i.e. each dimension of global size is a multiple of
corresponding dimension of work group size). hipExtModuleLaunchKernel allows to
launch HIP kernel with non-uniform workgroup size, which makes it necessary for
runtime to check and enforce uniform workgroup size if kernel requires it. To
let runtime be able to enforce that, this metadata is needed to indicate that
the kernel requires uniform workgroup size.
Reviewed By: kzhuravl, arsenm
Differential Revision: https://reviews.llvm.org/D141012
Fangrui Song [Thu, 5 Jan 2023 21:28:48 +0000 (13:28 -0800)]
[CodeGen] Default TargetOptions::RelaxELFRelocations to true
MC and lld/ELF defaults were flipped in 2016. For Clang: CMake
ENABLE_X86_RELAX_RELOCATIONS defaults to on in 2020. It makes sense for
the TargetOptions default to be true now.
R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX require GNU ld newer than 2015-10
(subsumed by the current requirement of -fbinutils-version=).
This should fix `rustc -Z plt=no` PIC relocatable files with GNU ld.
(See https://github.com/rust-lang/rust/pull/106380)
Owen Pan [Mon, 2 Jan 2023 00:02:35 +0000 (16:02 -0800)]
[clang-format] Improve UnwrappedLineParser::mightFitOnOneLine()
Account for an r_brace that precedes an "else if" statement when
calculating whether the line might fit on one line if the r_brace
is removed.
Fixes #59778.
Differential Revision: https://reviews.llvm.org/D140835
Saleem Abdulrasool [Thu, 22 Dec 2022 15:46:34 +0000 (15:46 +0000)]
Parse: handle another case of invalid handling for attributes
clang would improperly disallow GNU attributes before C++ standard
attributes when a declaration had a linkage specifier. Handle this
similarly to the previous case of invalid parsing. We now better match
the parsing rules from GCC.
Differential Revision: https://reviews.llvm.org/D140507
Reviewed By: aaron.ballman
Alexander Timofeev [Wed, 7 Dec 2022 17:36:11 +0000 (18:36 +0100)]
[AMDGPU] MachineScheduler: schedule execution metric added for the UnclusteredHighRPStage
Since the divergence-driven ISel was fully enabled we have more VGPRs available.
MachineScheduler trying to take advantage of that bumps up the occupancy sacrificing
the hiding of memory access latency. This really spoils the initially good schedule.
A new metric that reflects the latency hiding quality of the schedule has been created
to make it to balance between occupancy and latency. The metric is based on the latency
model which computes the bubble to working cycles ratio. Then we use this ratio to decide
if the higher occupancy schedule is profitable as follows:
Profit = NewOccupancy/OldOccupancy * OldMetric/NewMetric
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D139710
ziqingluo-90 [Thu, 5 Jan 2023 19:48:02 +0000 (11:48 -0800)]
[Fix]"[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations"
The original patch in commit
b2ac5fd724c44cf662caed84bd8f84af574b981d
causes compilation errors which can be reproduced by the
`-fdelayed-template-parsing` flag. This commit fixes the problem.
Related differential revision: https://reviews.llvm.org/D138329
ziqingluo-90 [Thu, 5 Jan 2023 19:45:25 +0000 (11:45 -0800)]
Revert "Revert "[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations""
This reverts commit
f58b025354ee2d3bcd7ab2399a11429ec940c1e0.
The previous revert reverts a patch that causes compilation problem on
windows which can be reproduced using `-fdelayed-template-parsing`.
I'm now to revert the patch back and commit a fix next.
Matt Arsenault [Thu, 24 Nov 2022 21:58:49 +0000 (16:58 -0500)]
Verifier: Disallow uses of intrinsic global variables
appendToGlobalCtors implicitly assumes this is the case, since it
deletes and recreates without trying to update any uses.
This ran into an interesting problem in a few linker tests. During the
link, ConstantExpr casts were speculatively created to replace any
uses that might need them for replacement. These unused ConstantExprs
would hang around and still appear on the use list. It seems like a
bug that those stick around, but I'm not sure where those are supposed
to be cleaned up. Avoid this by not creating the casts for appending
linkage.
Delete one of the casts entirely as it breaks no tests. The verifier
has enforced a specific type for these since 2011, so I don't see why
we would need to handle linking modules with a wrong types. One test
does fail without the second cast (Linker/appending-global-proto.ll,
added by D95126). This test looks contrived; it's using appending
linkage with a regular variable. The LangRef suggests this is illegal
(and suggests another missing verifier check).
Aaron Ballman [Thu, 5 Jan 2023 19:47:11 +0000 (14:47 -0500)]
Remove documentation about the Go bindings
We removed the Go bindings in https://reviews.llvm.org/D135436 but
missed documentation that talks about the bindings.
Craig Topper [Thu, 5 Jan 2023 19:18:26 +0000 (11:18 -0800)]
[RISCV] Prevent constant hoisting for or/and/xor that can use bseti/bclri/binvi.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D140928
Fangrui Song [Thu, 5 Jan 2023 19:18:17 +0000 (11:18 -0800)]
[test] Test __attribute__((noreturn)), _Noreturn, and [[return]] with conditional operator
Jez Ng [Thu, 5 Jan 2023 19:14:11 +0000 (14:14 -0500)]
[lld-macho] Don't support relocations in cstring sections
We can technically handle them, but since they shouldn't come up in any
real-world programs (since ld64 dedups strings unconditionally), there's
no reason to support them.
It's a thoroughly untested code path too -- as evidenced by the fact
that the only test this change breaks is one that verifies that we
reject relocations when dedup'ing. There is no test that covers the case
where we handle relocations in cstring sections when dedup is disabled.
Reviewed By: #lld-macho, oontvoo, keith, thakis
Differential Revision: https://reviews.llvm.org/D141025
Florian Hahn [Thu, 5 Jan 2023 19:03:33 +0000 (19:03 +0000)]
[profile] Update test to make condition non-redundant.
The tests contain a redundant condition in the else if branch that can
be simplified with
fb13dcf3431c.
Update the condition used to prevent it from getting removed.
Alive2 proof for check removal:
https://alive2.llvm.org/ce/z/iFBnsy
Luke Drummond [Thu, 5 Jan 2023 18:34:55 +0000 (18:34 +0000)]
Fix typos
I found one typo of "implemnt", then some more.
s/implemnt/implement/g
Matt Arsenault [Thu, 22 Dec 2022 16:49:00 +0000 (11:49 -0500)]
AMDGPU: Fix broken opaque pointer handling in printf pass
This was directly considering the pointee type, and also applying
special semantics to constant address space.