platform/upstream/llvm.git
17 months ago[libc++][CI] Installs libomp.
Mark de Wever [Thu, 25 May 2023 19:38:07 +0000 (21:38 +0200)]
[libc++][CI] Installs libomp.

This is needed to build clang-tidy plugins using clang-tidy 17.

Reviewed By: #libc, ldionne

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

17 months ago[clang][analyzer][NFC] Replace dyn_cast with cast in MemRegion::getMemorySpace
Dmitri Gribenko [Tue, 30 May 2023 16:23:11 +0000 (18:23 +0200)]
[clang][analyzer][NFC] Replace dyn_cast with cast in MemRegion::getMemorySpace

MemRegion::getMemorySpace() is annotated with
LLVM_ATTRIBUTE_RETURNS_NONNULL (which triggers instant UB if a null
pointer is returned), and callers indeed don't check the return value
for null. Thus, even though llvm::dyn_cast is called, it can never
return null in this context. Therefore, we can safely call llvm::cast.

Reviewed By: steakhal

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

17 months ago[clang][analyzer][NFC] Move dyn_cast's into if statements for readability
Dmitri Gribenko [Tue, 30 May 2023 16:17:10 +0000 (18:17 +0200)]
[clang][analyzer][NFC] Move dyn_cast's into if statements for readability

Reviewed By: steakhal

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

17 months ago[X86] Regenerate sqrt-fastmath-mir.ll
Simon Pilgrim [Tue, 30 May 2023 16:21:44 +0000 (17:21 +0100)]
[X86] Regenerate sqrt-fastmath-mir.ll

17 months agoMark header as textual
Adrian Prantl [Tue, 30 May 2023 16:21:16 +0000 (09:21 -0700)]
Mark header as textual

17 months ago[CodeGen] Refactor IR generation functions to use IRBuilder in ComplexDeinterleaving...
Igor Kirillov [Wed, 19 Apr 2023 10:11:33 +0000 (10:11 +0000)]
[CodeGen] Refactor IR generation functions to use IRBuilder in ComplexDeinterleaving pass

This patch updates several functions in LLVM's IR generation code to accept
an IRBuilder object as an argument, rather than an Instruction that indicates
the insertion point for new instructions.
This change is necessary to handle sophisticated -Ofast optimization cases
from D148558 where it's unclear which instructions should be used as the
insertion point for new operations.

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

17 months ago[clang][analyzer][NFC] Remove unnecessary FALLTHROUGH markers
Dmitri Gribenko [Tue, 30 May 2023 16:10:58 +0000 (18:10 +0200)]
[clang][analyzer][NFC] Remove unnecessary FALLTHROUGH markers

They are redundant with the [[fallthrough]]; attribute that follows.

Reviewed By: steakhal

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

17 months ago[clang][analyzer][NFC] Remove unnecessary casts around Allocate function calls
Dmitri Gribenko [Tue, 30 May 2023 16:02:10 +0000 (18:02 +0200)]
[clang][analyzer][NFC] Remove unnecessary casts around Allocate function calls

Reviewed By: steakhal

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

17 months ago[mlir] silence msvc warning
Alex Zinenko [Tue, 30 May 2023 15:58:45 +0000 (15:58 +0000)]
[mlir] silence msvc warning

17 months ago[mlir][llvm] Add LLVM TargetExtType
Lukas Sommer [Tue, 30 May 2023 15:45:54 +0000 (15:45 +0000)]
[mlir][llvm] Add LLVM TargetExtType

Add support for the `llvm::TargetExtType` to the MLIR LLVM dialect.

Target extension types were introduced to represent target-specific types, which are opaque to the compiler and optimizations.

The patch also enforces some of the constraints defined for the target extension type in the LLVM language reference manual.

Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com>
Reviewed By: ftynse, gysit, Dinistro

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

17 months ago[mlir][transform] Add op for adding attributes to payload IR
Quinn Dawkins [Tue, 30 May 2023 06:18:32 +0000 (02:18 -0400)]
[mlir][transform] Add op for adding attributes to payload IR

The ability to add attributes to payload IR is useful functionality
independent of any dialect. This is added here through `transform.annotate`
by enabling attributes tied to a `TransformParamTypeInterface` (which
internally refers to an Attribute) to be added to a target operation by
name.

The AnnotateOp does not produce a new handle as no existing handles
should be affected by adding an attribute. Existing attributes on
the payload with the same name will be overwritten.

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

17 months ago[LV] Use Legal::isUniform to detect uniform pointers.
Florian Hahn [Tue, 30 May 2023 15:42:55 +0000 (16:42 +0100)]
[LV] Use Legal::isUniform to detect uniform pointers.

Update collectLoopUniforms to identify uniform pointers using
Legal::isUniform. This is more powerful and  brings pointer
classification here in sync with setCostBasedWideningDecision
which uses isUniformMemOp. The existing mis-match in reasoning
can causes crashes due to D134460, which is fixed by this patch.

Fixes https://github.com/llvm/llvm-project/issues/60831.

Reviewed By: Ayal

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

17 months ago[clang] Extend __is_trivially_equality_comparable to check for hidden friends
Nikolas Klauser [Tue, 30 May 2023 15:33:13 +0000 (08:33 -0700)]
[clang] Extend __is_trivially_equality_comparable to check for hidden friends

This allows types to be considered trivially equality comparable if a defaulted hidden friend is used.

Reviewed By: erichkeane

Spies: cfe-commits

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

17 months ago[mlir] add initial chapters of the transform dialect tutorial
Alex Zinenko [Thu, 25 May 2023 20:26:27 +0000 (20:26 +0000)]
[mlir] add initial chapters of the transform dialect tutorial

The transform dialect has been around for a while and is sufficiently
stable at this point. Add the first three chapters of the tutorial
describing its usage and extension.

Reviewed By: springerm

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

17 months ago[NFC][CLANG] Fix nullptr dereference issue in Type::getSveEltType()
Manna, Soumi [Tue, 30 May 2023 14:58:02 +0000 (07:58 -0700)]
[NFC][CLANG] Fix nullptr dereference issue in Type::getSveEltType()

This patch uses castAs instead of getAs which will assert if the type
 doesn't match in clang::Type::getSveEltType(clang::ASTContext const &)

Reviewed By: erichkeane

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

17 months ago[VPlan] Handle invariant GEPs in isUniformAfterVectorization.
Florian Hahn [Tue, 30 May 2023 14:53:26 +0000 (15:53 +0100)]
[VPlan] Handle invariant GEPs in isUniformAfterVectorization.

This fixes a crash caused by legal treating a scalable GEP as invariant,
but isUniformAfterVectorization does not handle GEPs.

Partially fixes https://github.com/llvm/llvm-project/issues/60831.

Reviewed By: Ayal

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

17 months ago[flang][hlfir] lower hlfir.all into runtime call
Jacob Crawley [Wed, 24 May 2023 15:38:03 +0000 (15:38 +0000)]
[flang][hlfir] lower hlfir.all into runtime call

Depends on: D151111

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

17 months ago[flang] lower all intrinsic to hlfir.all operation
Jacob Crawley [Mon, 22 May 2023 15:06:49 +0000 (15:06 +0000)]
[flang] lower all intrinsic to hlfir.all operation

Carries out the lowering of the all intrinsic into HLFIR

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

17 months ago[flang] add hlfir.all intrinsic
Jacob Crawley [Mon, 22 May 2023 13:07:28 +0000 (13:07 +0000)]
[flang] add hlfir.all intrinsic

Adds a new HLFIR operation for the ALL intrinsic according to the
design set out in flang/docs/HighLevel.md

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

17 months ago[RISCV] Use v(f)slide1up for shuffle+insert idiom
Philip Reames [Tue, 30 May 2023 14:07:11 +0000 (07:07 -0700)]
[RISCV] Use v(f)slide1up for shuffle+insert idiom

This is pretty straight forward in the basic form. I did need to move the slideup matching earlier, but that looks generally profitable on it's own.

As follow ups, I plan to explore the v(f)slide1down variants, and see what I can do to canonicalize the shuffle then insert pattern (see _inverse tests at the end of the vslide1up.ll test).

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

17 months ago[mlir] [NFC] Add a newline to debug message at inserting of InterfaceMap
Kohei Yamaguchi [Tue, 30 May 2023 14:13:47 +0000 (14:13 +0000)]
[mlir] [NFC] Add a newline to debug message at inserting of InterfaceMap

At inserting of InterfaceMap, a debug message lacked a newline, so it repeatedly displayed this message within a single line.
Clean up the debug log by inserting a newline at the end of the message.

Reviewed By: rriddle

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

17 months ago[RISCV][NFC] Make Reduction scheduler resources SEW aware
Michael Maitland [Thu, 25 May 2023 17:09:37 +0000 (10:09 -0700)]
[RISCV][NFC] Make Reduction scheduler resources SEW aware

Create SchedWrites, WriteRes for reduction instructions that
are SEW specific. Future patches can use these resources
to customize the behavior of these resources depending on SEW.

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

17 months ago[mlir] fix mis-merge
Oleksandr "Alex" Zinenko [Tue, 30 May 2023 14:07:51 +0000 (16:07 +0200)]
[mlir] fix mis-merge

17 months ago[InstCombine] Remove adjustMinMax() fold (PR62088)
Nikita Popov [Tue, 30 May 2023 14:05:06 +0000 (16:05 +0200)]
[InstCombine] Remove adjustMinMax() fold (PR62088)

This fold is buggy if the constant adjustment overflows.
Additionally, since we now canonicalize to min/max intrinsics,
the constants picked here don't actually matter, as long as SPF
still recognizes the pattern.

Fixes https://github.com/llvm/llvm-project/issues/62088.

17 months ago[X86] Fix SunnyCove ROB/MicroOpBufferSize
Simon Pilgrim [Tue, 30 May 2023 14:00:49 +0000 (15:00 +0100)]
[X86] Fix SunnyCove ROB/MicroOpBufferSize

As raised on Issue #62602 - the IceLake scheduler model is still mainly a copy of the SkylakeServer model. This initial commit just fixes the ROB/MicroOpBufferSize to match the size reported on WikiChip/Agner, further fixes to follow in later commits.

17 months ago[mlir] clarify transform.foreach_match documentation
Oleksandr "Alex" Zinenko [Tue, 30 May 2023 14:00:59 +0000 (16:00 +0200)]
[mlir] clarify transform.foreach_match documentation

Clarify the restrictions on actions that are implied by the implementation as a post-order walk.

17 months ago[mlir][linalg] Fix bug in FuseIntoContainingOp implementation
Matthias Springer [Tue, 30 May 2023 13:54:43 +0000 (15:54 +0200)]
[mlir][linalg] Fix bug in FuseIntoContainingOp implementation

Do not replace uses inside the body of `scf.forall` ops with results of the same op.

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

17 months ago[mlir][linalg] FuseIntoContainingOp: Always set newContainingOp
Matthias Springer [Tue, 30 May 2023 13:12:54 +0000 (15:12 +0200)]
[mlir][linalg] FuseIntoContainingOp: Always set newContainingOp

All result handles must be set in case of success.

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

17 months ago[gn build] Port 96a14f388b1a
LLVM GN Syncbot [Tue, 30 May 2023 12:49:12 +0000 (12:49 +0000)]
[gn build] Port 96a14f388b1a

17 months agoRevert "[FuncSpec] Replace LoopInfo with BlockFrequencyInfo"
Nikita Popov [Tue, 30 May 2023 12:40:18 +0000 (14:40 +0200)]
Revert "[FuncSpec] Replace LoopInfo with BlockFrequencyInfo"

As reported on https://reviews.llvm.org/D150375#4367861 and
following, this change causes PDT invalidation issues. Revert
it and dependent commits.

This reverts commit 0524534d5220da5ecb2cd424a46520184d2be366.
This reverts commit ced90d1ff64a89a13479a37a3b17a411a3259f9f.
This reverts commit 9f992cc9350a7f7072a6dbf018ea07142ea7a7ed.
This reverts commit 1b1232047e83b69561fd64b9547cb0a0d374473a.

17 months ago[X86] lowerBuildVectorAsBroadcast - remove repeated hasAVX() check. NFC.
Simon Pilgrim [Tue, 30 May 2023 11:36:54 +0000 (12:36 +0100)]
[X86] lowerBuildVectorAsBroadcast - remove repeated hasAVX() check. NFC.

We already early-out at the top of the function.

17 months ago[X86] X86FixupVectorConstantsPass - attempt to replace full width integer vector...
Simon Pilgrim [Mon, 29 May 2023 16:16:05 +0000 (17:16 +0100)]
[X86] X86FixupVectorConstantsPass - attempt to replace full width integer vector constant loads with broadcasts on AVX2+ targets

lowerBuildVectorAsBroadcast will not broadcast splat constants in all cases, resulting in a lot of situations where a full width vector load that has failed to fold but is loading splat constant values could use a broadcast load instruction just as cheaply, and save constant pool space.

17 months ago[CodeGen] Add pre-commit tests for D148558
Igor Kirillov [Mon, 17 Apr 2023 18:03:09 +0000 (18:03 +0000)]
[CodeGen] Add pre-commit tests for D148558

This patch adds four new tests for upcoming functionality in LLVM:
* complex-deinterleaving-add-mull-fixed-contract.ll
* complex-deinterleaving-add-mull-scalable-contract.ll
* complex-deinterleaving-add-mull-fixed-fast.ll
* complex-deinterleaving-add-mull-scalable-fast.ll.

These tests were generated from the IR of vectorizable loops, which were
compiled from C++ code using different optimization flags in Clang. Each pair
of tests corresponds to Neon and SVE architectures, respectively, and
each pair contains tests compiled with -Ofast and -O3 -ffp-contract=fast
-ffinite-math-only optimization flags.
The tests were stripped of nnan and ninf flags as they have no impact on the
output.
The primary objective of these tests is to show the various sequences of
complex computations that may be encountered and to demonstrate the ability
of ComplexDeinterleaving to support any ordering.

Depends on D147451

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

17 months ago[libc][NFC] Move the Linux file implementation to a subdirectory
Joseph Huber [Tue, 30 May 2023 11:49:14 +0000 (06:49 -0500)]
[libc][NFC] Move the Linux file implementation to a subdirectory

This patch simply moves the special handling for `linux` files to a
subdirectory. This is done to make it easier in the future to extend
this support to targets (like the GPU) that will have different
dependencies.

Reviewed By: lntue

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

17 months ago[LV] Use early exit for stores storing the ptr operand. (NFC)
Florian Hahn [Tue, 30 May 2023 11:14:11 +0000 (12:14 +0100)]
[LV] Use early exit for stores storing the ptr operand. (NFC)

Cleanup suggested in D150991.

17 months agoReland 2nd attempt: [tsan] Add debugging interfaces into interface header.
Pierre Gousseau [Tue, 30 May 2023 10:12:54 +0000 (10:12 +0000)]
Reland 2nd attempt: [tsan] Add debugging interfaces into interface header.

Change __tsan_get_report_loc 6th argument 'size' to unsigned long *

Reviewers: vitalybuka, dvyukov

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

17 months ago[X86] getTargetConstantBitsFromNode - support extracting fp data from ConstantDataSeq...
Simon Pilgrim [Tue, 30 May 2023 10:38:20 +0000 (11:38 +0100)]
[X86] getTargetConstantBitsFromNode - support extracting fp data from ConstantDataSequential

Fixes issue introduced by 0f8e0f4228805cbecce13dcfadef4c48a4f0f4cd where SimplifyDemandedBits could crash when trying to extract fp data from broadcasted constants

17 months ago[InstCombine] Remove unused function 'isMustTailCall' (NFC)
Jie Fu [Tue, 30 May 2023 10:30:44 +0000 (18:30 +0800)]
[InstCombine] Remove unused function 'isMustTailCall' (NFC)

/data/llvm-project/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2467:13: error: unused function 'isMustTailCall' [-Werror,-Wunused-function]
static bool isMustTailCall(Value *V) {
            ^
1 error generated.

17 months ago[InstCombine] Remove computeKnownBits() fold for returns
Nikita Popov [Mon, 22 May 2023 14:09:51 +0000 (16:09 +0200)]
[InstCombine] Remove computeKnownBits() fold for returns

We try to fold constant computeKnownBits() with context for return
instructions only. Otherwise, we rely on SimplifyDemandedBits() to
fold instructions with constant known bits.

The presence of this special fold for returns is dangerous, because
it makes our tests lie about what works and what doesn't. Tests are
usually written by returning the result we're interested in, but
will go through this separate code path that is not used for anything
else. This patch removes the special fold.

This primarily regresses patterns of the style "assume(x); return x".
The responsibility of handling such patterns lies with passes like
EarlyCSE/GVN anyway, which will do this reliably, and not just for
returns.

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

17 months ago[RISCV] Generalise shouldExtendTypeInLibcall logic to apply to all <XLEN floats on...
Alex Bradbury [Tue, 30 May 2023 09:59:15 +0000 (10:59 +0100)]
[RISCV] Generalise shouldExtendTypeInLibcall logic to apply to all <XLEN floats on soft ABIs

This results in improved codegen for half/bf16 libcalls on soft ABIs

Adds a RISCVSubtarget helper method for determining if a soft FP ABI is
being targeted (future bf16 related patches make use of this).

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

17 months ago[compiler-rt] Refactor memintrinsic interceptors
Marco Elver [Tue, 30 May 2023 09:59:16 +0000 (11:59 +0200)]
[compiler-rt] Refactor memintrinsic interceptors

This moves memintrinsic interceptors (memcpy/memmove/memset) into a new
file sanitizer_common_interceptors_memintrinsics.inc.

This is in preparation of redefining builtins, however, we must be
careful to not redefine builtins in TUs that define interceptors of the
same name.

In all cases except for MSan, memintrinsic interceptors were moved to a
new TU $tool_interceptors_memintrinsics.cpp. In the case of MSan, it
turns out this is not yet necessary (as shown by the later patch
introducing memcpy tests).

NFC.

Reviewed By: vitalybuka

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

17 months ago[compiler-rt] Mark some performance critical buffers uninitialized
Marco Elver [Tue, 30 May 2023 09:59:09 +0000 (11:59 +0200)]
[compiler-rt] Mark some performance critical buffers uninitialized

With -ftrivial-auto-var-init, do not emit memset() calls for performance
critical stack variables.

Reviewed By: vitalybuka, dvyukov, MaskRay

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

17 months agoRevert "[mlir][bazel] Port for 660f714, third attempt"
Benjamin Kramer [Tue, 30 May 2023 09:41:24 +0000 (11:41 +0200)]
Revert "[mlir][bazel] Port for 660f714, third attempt"

This reverts commit 421a7f814fb15dedde1b0b13a9e4ddcf7b502086. Dependency
doesn't seem to be necessary and would pull in all of LLVM's codegen
into mlir users that don't require it.

17 months agoFix "not all control paths return a value" MSVC warning. NFC.
Simon Pilgrim [Tue, 30 May 2023 09:29:47 +0000 (10:29 +0100)]
Fix "not all control paths return a value" MSVC warning. NFC.

17 months ago[StaticAnalyzer] Fix block pointer type nullability check
tripleCC [Tue, 30 May 2023 09:20:05 +0000 (11:20 +0200)]
[StaticAnalyzer] Fix block pointer type nullability check

This patch fixes a false negative when the property type
is an objective-c block pointer.

Patch By tripleCC!

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

17 months ago[clang] Add test for CWG1397
Vlad Serebrennikov [Tue, 30 May 2023 09:03:01 +0000 (12:03 +0300)]
[clang] Add test for CWG1397

Resolution of this CWG breaks potential dependency loop between complete-class context of non-static data member initializer (NSDMI), and defaulted default constructor, which is `noexcept` depending on NSDMIs among other things.

For whatever reason in C++11 mode we issue an additional note and a different line number for the primary error. But I find the message itself even worse than aforementioned issues. It describes what's going on, but doesn't say what's bad about it. I find the previous version of this message more clear: https://github.com/llvm/llvm-project/commit/8dbc6b26171167b8ddf66a5f4b6d6fb9baf28336 . Created an issue for that: #62823

Reviewed By: #clang-language-wg, shafik

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

17 months ago[LLDB] Update AArch64/Windows XFAIl decorators on TestNamespace.py
Muhammad Omair Javaid [Tue, 30 May 2023 09:05:45 +0000 (13:05 +0400)]
[LLDB] Update AArch64/Windows XFAIl decorators on TestNamespace.py

17 months agoUse UNSUPPORTED annotation to disable Integration/Dialect/Vector/CPU/test-contraction...
Mehdi Amini [Tue, 30 May 2023 08:20:22 +0000 (01:20 -0700)]
Use UNSUPPORTED annotation to disable Integration/Dialect/Vector/CPU/test-contraction.mlir

Previous attempt to disable the test didn't seem to work as expected.

17 months ago[mlir][scf] NFC - Add debug information to scf pipelining
Nicolas Vasilache [Tue, 30 May 2023 07:32:32 +0000 (00:32 -0700)]
[mlir][scf] NFC - Add debug information to scf pipelining

17 months ago[builtins][test] Skip scalbn rounding tests on newlib
David Candler [Tue, 30 May 2023 07:57:27 +0000 (08:57 +0100)]
[builtins][test] Skip scalbn rounding tests on newlib

The picolib/newlib implementation of scalbn gives slightly different
results compared to glibc and compiler-rt's inlined
__compiler_rt_scalbn in certain rounding modes. Since these tests
are already disabled for msvc which doesn't respect the mode change,
this patch skips them for newlib as well.

Reviewed By: MaskRay

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

17 months ago[mlir] harden expensive-checks mode against ops with repeated operands
Alex Zinenko [Fri, 26 May 2023 15:50:59 +0000 (15:50 +0000)]
[mlir] harden expensive-checks mode against ops with repeated operands

Transform operations may indicate that they may accept and consume
several handles pointing to the same or nested payload entities. The
initial implementation of the expensive-checks mode was simply ignoring
such cases as consuming the second handle would fail the check after the
first handle invalidated it by consuming the same payload. Additional
checks had been added since then, which could now trigger assertions in
the expensive-checks module itself (instead of or in addition to
use-after-free assertions down the road), specifically because the
payload associations for invalidated handles is removed from the state
to enable other kinds of checking.

Rework the handling of transform operations with repeated handles so
use-after-consume is still reported properly if the consumption happened
by a preceding operation, as opposed to the a preceding operand of the
same operation that is still (corretly) ignored if the op requests that.

Depends on: D151560

Reviewed By: springerm

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

17 months agoDisable MLIR integration test that is failing on a bot, pending a LLVM backend fix
Mehdi Amini [Tue, 30 May 2023 07:20:18 +0000 (00:20 -0700)]
Disable MLIR integration test that is failing on a bot, pending a LLVM backend fix

17 months ago[NFC] [serialization] Refactor the outdated AbrrevToUse of VarDecl
Chuanqi Xu [Tue, 30 May 2023 07:05:41 +0000 (15:05 +0800)]
[NFC] [serialization] Refactor the outdated AbrrevToUse of VarDecl

The implementation and the comment of the AbrrevToUse of VarDecl
looks not consistent with the implementation. This patch refactors it.

17 months ago[clang][dataflow] Remove unnecessary `ASTContext` parameter from `ControlFlowContext...
Martin Braenne [Fri, 26 May 2023 09:52:55 +0000 (09:52 +0000)]
[clang][dataflow] Remove unnecessary `ASTContext` parameter from `ControlFlowContext::build` overload.

When introducing this new overload in https://reviews.llvm.org/D151183, I didn't consider that the `ASTContext` parameter was unnecessary because it could also be obtained from the `FunctionDecl`.

Reviewed By: gribozavr2, xazax.hun

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

17 months ago[mlir][llvm] Add thread-local address intrinsic
Lukas Sommer [Tue, 30 May 2023 06:44:31 +0000 (06:44 +0000)]
[mlir][llvm] Add thread-local address intrinsic

Add the `llvm.threadlocal.address` intrinsic to the LLVM dialect.

Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com>
Reviewed By: gysit, zero9178

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

17 months ago[NFC][hwasan] Don't copy ThreadStartArg
Vitaly Buka [Tue, 30 May 2023 06:49:46 +0000 (23:49 -0700)]
[NFC][hwasan] Don't copy ThreadStartArg

17 months ago[RISCV] Add more tests in zdinx-boundary-check.ll
Shao-Ce SUN [Fri, 26 May 2023 17:42:48 +0000 (01:42 +0800)]
[RISCV] Add more tests in zdinx-boundary-check.ll

Reviewed By: craig.topper

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

17 months ago[LSAN] Move ThreadCreate into child thread
Vitaly Buka [Thu, 18 May 2023 08:03:32 +0000 (01:03 -0700)]
[LSAN] Move ThreadCreate into child thread

Speeds up thread creation. Similar approach is already used
by other sanitizers.

17 months ago[clang] Solidate the implicit-module-header-maps.cpp lit test.
Haojian Wu [Tue, 30 May 2023 06:38:49 +0000 (08:38 +0200)]
[clang] Solidate the implicit-module-header-maps.cpp lit test.

On some systems, the second `split-file` command will fail because the current
directory is the one we have deleted, we switch to another directory
before running it.

17 months ago[bazel] Port for 9f6250f591057e68c0bda564716b6918b8e39a84, part2.
Haojian Wu [Tue, 30 May 2023 06:05:39 +0000 (08:05 +0200)]
[bazel] Port for 9f6250f591057e68c0bda564716b6918b8e39a84, part2.

The part1 was missing the generation of
arm_sme_draft_spec_subject_to_change.h, this patch adds it.

17 months ago[RISCV][NFC] Fix unmasked test for vp_cttz and vp_ctlz.
Jianjian GUAN [Tue, 30 May 2023 03:03:26 +0000 (11:03 +0800)]
[RISCV][NFC] Fix unmasked test for vp_cttz and vp_ctlz.

Reviewed By: craig.topper

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

17 months ago[ms-inline asm] Add error check for `getAsInteger`
Phoebe Wang [Tue, 30 May 2023 03:20:41 +0000 (11:20 +0800)]
[ms-inline asm] Add error check for `getAsInteger`

.Imm can get lexed as a real, but a real doesn't equal to .Imm, e.g.,
2.5 or .123e+8. We should report error for it rather than silently ignore.

Reviewed By: skan

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

17 months ago[RISCV] Teach performCombineVMergeAndVOps to handle instructions FMA instructions.
Craig Topper [Tue, 30 May 2023 02:44:43 +0000 (19:44 -0700)]
[RISCV] Teach performCombineVMergeAndVOps to handle instructions FMA instructions.

Previously we only handled instructions with merge ops that were
also masked. This patch supports instructions with merge ops that
aren't masked, like FMA.

I'm only folding into a TU vmerge for now. Supporting TA vmerge
shouldn't be much more work, but we need to make sure we get the
policy operand for the result correct. And of course we need more
tests.

Reviewed By: fakepaper56, frasercrmck

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

17 months ago[RISCV] Fix unmasked vp_abs select.
Jianjian GUAN [Mon, 29 May 2023 09:27:36 +0000 (17:27 +0800)]
[RISCV] Fix unmasked vp_abs select.

Make unmasked vp_abs select to umasked instructions.

Reviewed By: fakepaper56

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

17 months ago[mlir][spirv][complex] Support convert complex.constant
Lei Zhang [Tue, 30 May 2023 00:54:22 +0000 (17:54 -0700)]
[mlir][spirv][complex] Support convert complex.constant

Reviewed By: kuhar

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

17 months ago[mlir][complex] Canonicalize re/im(neg(create))
Lei Zhang [Mon, 29 May 2023 20:17:28 +0000 (13:17 -0700)]
[mlir][complex] Canonicalize re/im(neg(create))

When can just convert this to arith.negf.

Reviewed By: kuhar

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

17 months ago[gn] Port 9f6250f more
Nico Weber [Tue, 30 May 2023 00:24:25 +0000 (20:24 -0400)]
[gn] Port 9f6250f more

Follow-up to da54bd230a.
* Add dep to _cg and _sema targets only to CodeGen and Sema,
  like with the other Basic clang_tablegen()s
* Make tablegen_headers depend on arm_sme_draft_spec_subject_to_change
  so that the header gets installed

17 months agoMLIR/Cuda: Add the appropriate "HINTS" on CMake find_library and mark these REQUIRED
Mehdi Amini [Mon, 29 May 2023 08:38:44 +0000 (01:38 -0700)]
MLIR/Cuda: Add the appropriate "HINTS" on CMake find_library and mark these REQUIRED

The cmake logic to find cuda paths exposes some paths to search for the cuda
library, we need to propagate this through the call for find_library.
This was already done for cuSparse but not for cuda.

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

17 months ago[libc++] Add missing _LIBCPP_HIDE_FROM_ABI macro on constructor
Louis Dionne [Mon, 29 May 2023 21:24:15 +0000 (14:24 -0700)]
[libc++] Add missing _LIBCPP_HIDE_FROM_ABI macro on constructor

17 months ago[clangd] Remove unused variable IsBroadcasting
Kazu Hirata [Mon, 29 May 2023 21:17:03 +0000 (14:17 -0700)]
[clangd] Remove unused variable IsBroadcasting

The variable was introduced without a use by:

  commit 2bebc3d0602b407b3f351e782940959da5808f97
  Author: Sam McCall <sam.mccall@gmail.com>
  Date:   Tue Nov 20 10:56:03 2018 +0000

17 months ago[cland] Remove unused declaration getCurrentPreamble
Kazu Hirata [Mon, 29 May 2023 21:17:01 +0000 (14:17 -0700)]
[cland] Remove unused declaration getCurrentPreamble

The corresponding function definition was removed by:

  commit 2214b9076f1d3a4784820c4479e2417685e5c980
  Author: Kadir Cetinkaya <kadircet@google.com>
  Date:   Thu Apr 2 10:53:23 2020 +0200

17 months ago[RISCV][test] Expand bfloat.ll tests to include i16 bitcasts and load/store
Alex Bradbury [Mon, 29 May 2023 20:38:26 +0000 (21:38 +0100)]
[RISCV][test] Expand bfloat.ll tests to include i16 bitcasts and load/store

Pre-commit new tests used in D151663.

17 months ago[ConstraintElim] Add extra tests for and operand implying other op.
Florian Hahn [Mon, 29 May 2023 20:04:59 +0000 (21:04 +0100)]
[ConstraintElim] Add extra tests for and operand implying other op.

Extend test coverage for and conditions where the first operand implies
the second. The update includes the select form of AND and a few cases
where one of the AND operands gets simplified before solving.

17 months ago[clang-tidy] Update UnusedReturnValueCheck types
Roy Jacobson [Mon, 29 May 2023 19:57:39 +0000 (22:57 +0300)]
[clang-tidy] Update UnusedReturnValueCheck types

Update the types for UnusedReturnValueCheck after D151383.

1. Add std::errc, std:error_condition
2. Remove `absl::Status` - it's marked as `[[nodiscard]]` anyway so it's redundant (and might create double warnings) to check it.

Reviewed By: PiotrZSL

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

17 months ago[compiler-rt] [test] [asan] Fix Windows tests in i386 mode after StripFunctionName...
Martin Storsjö [Mon, 29 May 2023 19:49:34 +0000 (22:49 +0300)]
[compiler-rt] [test] [asan] Fix Windows tests in i386 mode after StripFunctionName() improvements

This applies the same fix as a32a16311050fbccc03638b197910dc1415f60ab
to a testcase which isn't executed in x86_64 mode.

17 months ago[libc++] Use the new .gen tests to implement __verbose_abort tests
Louis Dionne [Mon, 22 May 2023 19:47:00 +0000 (12:47 -0700)]
[libc++] Use the new .gen tests to implement __verbose_abort tests

This reduces the amount of boilerplate that we need to generate
for each commit. It also resolves a problem where the modular CI
would run extremely slow on this test because we'd define a macro
before including the standard library, defeating the module cache.

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

17 months ago[Analysis] Remove unused function stripIntegerCast
Kazu Hirata [Mon, 29 May 2023 19:19:14 +0000 (12:19 -0700)]
[Analysis] Remove unused function stripIntegerCast

The last use was removed by:

  commit d5b840131223f2ffef4e48ca769ad1eb7bb1869a
  Author: Philip Reames <preames@rivosinc.com>
  Date:   Thu May 11 08:10:49 2023 -0700

17 months ago[Analysis] Remove unused declarations visitEHBeginCatch and visitEHEndCatch
Kazu Hirata [Mon, 29 May 2023 19:19:13 +0000 (12:19 -0700)]
[Analysis] Remove unused declarations visitEHBeginCatch and visitEHEndCatch

The corresponding function definitions were removed by:

  commit 14e773500e036de57ed0ca4af6fddc1f8b6767d8
  Author: Reid Kleckner <rnk@google.com>
  Date:   Fri Oct 9 23:34:53 2015 +0000

17 months ago[Coroutines] Remove unused variable AsyncFuncTy
Kazu Hirata [Mon, 29 May 2023 18:56:53 +0000 (11:56 -0700)]
[Coroutines] Remove unused variable AsyncFuncTy

The last use was removed by:

  commit e760ec2a01fba0d90e2fea33cf99b75baa2c2a1c
  Author: Arnold Schwaighofer <aschwaighofer@apple.com>
  Date:   Thu Feb 11 08:25:31 2021 -0800

17 months ago[bugpoint] Remove unused declaration debugPassMiscompilation
Kazu Hirata [Mon, 29 May 2023 18:56:52 +0000 (11:56 -0700)]
[bugpoint] Remove unused declaration debugPassMiscompilation

The declaration seems to have been unused for at least 15 years.

17 months ago[Vectorize] Remove unused declaration requiresTooManyRuntimeChecks
Kazu Hirata [Mon, 29 May 2023 18:56:50 +0000 (11:56 -0700)]
[Vectorize] Remove unused declaration requiresTooManyRuntimeChecks

The corresponding function definition was removed by:

  commit 644a965c1efef68f22d9495e4cefbb599c214788
  Author: Florian Hahn <flo@fhahn.com>
  Date:   Mon Jul 4 15:10:48 2022 +0100

17 months ago[gn build] (manually) port 9f6250f
Zequan Wu [Mon, 29 May 2023 18:51:08 +0000 (14:51 -0400)]
[gn build] (manually) port 9f6250f

17 months ago[LV] Remove dead CHECK lines after 280656eae95a9cbf.
Florian Hahn [Mon, 29 May 2023 18:23:51 +0000 (19:23 +0100)]
[LV] Remove dead CHECK lines after 280656eae95a9cbf.

Those check lines were left over after adding new run lines in
280656eae95a9cbf.

17 months ago[ExecutionEngine] Remove unused declaration recordRuntimeRegistrationFunctions
Kazu Hirata [Mon, 29 May 2023 18:01:56 +0000 (11:01 -0700)]
[ExecutionEngine] Remove unused declaration recordRuntimeRegistrationFunctions

The declaration was added without a corresponding function definition
by:

  commit 217fd59cc5849f1afdbb8a74807a80b23f2da227
  Author: Lang Hames <lhames@gmail.com>
  Date:   Thu Jan 12 23:17:46 2023 -0800

17 months ago[ExecutionEngine] Remove unused declaration defineNonExistent
Kazu Hirata [Mon, 29 May 2023 18:01:54 +0000 (11:01 -0700)]
[ExecutionEngine] Remove unused declaration defineNonExistent

The declaration was added without a corresponding function definition
by:

  commit cb84e4827e43921659e75509dfb42ebf56c50502
  Author: Lang Hames <lhames@gmail.com>
  Date:   Wed Mar 25 13:07:00 2020 -0700

17 months ago[DebugInfo] Remove unused declaration getFirstFunctionInfoAddress
Kazu Hirata [Mon, 29 May 2023 18:01:53 +0000 (11:01 -0700)]
[DebugInfo] Remove unused declaration getFirstFunctionInfoAddress

The declaration was added without a corresponding function definition
by:

  commit d8e077e2caebc1415fb7af1714dd436adf99b6bf
  Author: Greg Clayton <gclayton@fb.com>
  Date:   Mon Mar 6 15:57:17 2023 -0800

17 months ago[AArch64] Remove unused declaration tryParseMRSSystemRegister
Kazu Hirata [Mon, 29 May 2023 17:53:46 +0000 (10:53 -0700)]
[AArch64] Remove unused declaration tryParseMRSSystemRegister

The corresponding definition was removed by:

  commit e8b4166accfa03b9693bea34e53eb384f4b99198
  Author: Bradley Smith <bradley.smith@arm.com>
  Date:   Wed Apr 9 14:43:06 2014 +0000

17 months ago[AArch64] Remove unused declaration legalizeShuffleVector
Kazu Hirata [Mon, 29 May 2023 17:53:45 +0000 (10:53 -0700)]
[AArch64] Remove unused declaration legalizeShuffleVector

The declaration was added without a corresponding function definition
by:

  commit 4c52fb1a5ee20846627d16e38f5dec08c08f8884
  Author: Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>
  Date:   Mon Aug 15 21:51:13 2022 +0300

17 months ago[AArch64] Remove unused declaration LowerSCALAR_TO_VECTOR
Kazu Hirata [Mon, 29 May 2023 17:53:43 +0000 (10:53 -0700)]
[AArch64] Remove unused declaration LowerSCALAR_TO_VECTOR

The corresponding function definition was removed by:

  commit 85d6a16c46616336c52792e7a490e70ea8b6461e
  Author: Tim Northover <tnorthover@apple.com>
  Date:   Fri Apr 4 09:03:09 2014 +0000

17 months ago[lld] Allow input files from compatible architectures on EC targets.
Jacek Caban [Wed, 5 Apr 2023 21:03:15 +0000 (23:03 +0200)]
[lld] Allow input files from compatible architectures on EC targets.

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

17 months ago[lld] Use correct machine type in ARM64EC COFF headers.
Jacek Caban [Tue, 21 Mar 2023 19:01:22 +0000 (20:01 +0100)]
[lld] Use correct machine type in ARM64EC COFF headers.

This adds very minimal support for ARM64EC/ARM64X targets,
just enough for interesting test cases. Next patches in the
series extend llvm-objdump and llvm-readobj to provide
better tests. Those will also be useful for testing further
ARM64EC LLD support.

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

17 months agoRevert "Revert "Host: generalise `GetXcodeSDKPath`""
Saleem Abdulrasool [Mon, 29 May 2023 16:35:19 +0000 (09:35 -0700)]
Revert "Revert "Host: generalise `GetXcodeSDKPath`""

This reverts commit c46d9af26cefb0b24646d3235b75ae7a1b8548d4.

Rename the variable to avoid `-Wchanges-meaning` warning.  Although, it
might be better to squelch the warning as it is of low value IMO.

17 months agoRevert "[llvm-debuginfod][NFC] Switch to OptTable"
Alex Brachet [Mon, 29 May 2023 16:31:04 +0000 (16:31 +0000)]
Revert "[llvm-debuginfod][NFC] Switch to OptTable"

This reverts commit 1610627d2b42c0daf8cc20649c50ddad222f001b.

17 months ago[mlir][llvm] Add rounding intrinsics
Lukas Sommer [Mon, 29 May 2023 15:58:50 +0000 (17:58 +0200)]
[mlir][llvm] Add rounding intrinsics

Add some of the missing libm rounding intrinsics to the LLVM dialect:
* `llvm.rint`
* `llvm.nearbyint`
* `llvm.lround`
* `llvm.llround`
* `llvm.lrint`
* `llvm.llrint`

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

17 months ago[AMDGPU][AsmParser][NFC] Refine parsing of NamedOperandU32 operands.
Ivan Kosarev [Mon, 29 May 2023 15:37:13 +0000 (16:37 +0100)]
[AMDGPU][AsmParser][NFC] Refine parsing of NamedOperandU32 operands.

Eliminates the need for the custom code in parseCustomOperand().

Part of <https://github.com/llvm/llvm-project/issues/62629>.

Reviewed By: dp

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

17 months ago[LSV] Return same bitwidth from getConstantOffset.
Justin Lebar [Mon, 29 May 2023 05:17:20 +0000 (22:17 -0700)]
[LSV] Return same bitwidth from getConstantOffset.

Previously, getConstantOffset could return an APInt with a different
bitwidth than the input pointers.  For example, we might be loading an
opaque 64-bit pointer, but stripAndAccumulateInBoundsConstantOffsets
might give a 32-bit offset.

This was OK in most cases because in gatherChains, we casted the APInt
back to the original ASPtrBits.

But it was not OK when considering selects.  We'd call getConstantOffset
twice and compare the resulting APInt's, which might not have the same
bit width.

This fixes that.  Now getConstantOffset always returns offsets with the
correct width, so we don't need the hack of casting it in gatherChains,
and it works correctly when we're handling selects.

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

17 months ago[MLIR] Add output argument to affineParallelize utility
Uday Bondhugula [Mon, 29 May 2023 03:22:40 +0000 (08:52 +0530)]
[MLIR] Add output argument to affineParallelize utility

Add output argument to affineParallelize utility. NFC.

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

17 months ago[X86] X86FixupVectorConstantsPass - attempt to replace full width fp vector constant...
Simon Pilgrim [Sat, 27 May 2023 16:59:19 +0000 (17:59 +0100)]
[X86] X86FixupVectorConstantsPass - attempt to replace full width fp vector constant loads with broadcasts on AVX+ targets

lowerBuildVectorAsBroadcast will not broadcast splat constants in all cases, resulting in a lot of situations where a full width vector load that has failed to fold but is loading splat constant values could use a broadcast load instruction just as cheaply, and save constant pool space.

NOTE: SSE3 targets can use MOVDDUP but not all SSE era CPUs can perform this as cheaply as a vector load, we will need to add scheduler model checks if we want to pursue this.

17 months ago[LLDB] Add XFAIL on AArch64/Windows to TestNamespace.py
Muhammad Omair Javaid [Mon, 29 May 2023 14:53:23 +0000 (18:53 +0400)]
[LLDB] Add XFAIL on AArch64/Windows to TestNamespace.py

17 months agoRevert "[ValueTracking][InstCombine] Add a new API to allow to ignore poison generati...
Florian Hahn [Mon, 29 May 2023 14:44:35 +0000 (15:44 +0100)]
Revert "[ValueTracking][InstCombine] Add a new API to allow to ignore poison generating flags or metadatas when implying poison"

This reverts commit 754f3ae65518331b7175d7a9b4a124523ebe6eac.

Unfortunately the change can cause regressions due to dropping flags
from instructions (like nuw,nsw,inbounds), prevent further optimizations
depending on those flags.

A simple example is the IR below, where `inbounds` is dropped with the
patch and the phase-ordering test added in 7c91d82ab912fae8b.

    define i1 @test(ptr %base, i64 noundef %len, ptr %p2) {
    bb:
      %gep = getelementptr inbounds i32, ptr %base, i64 %len
      %c.1 = icmp uge ptr %p2, %base
      %c.2 = icmp ult ptr %p2, %gep
      %select = select i1 %c.1, i1 %c.2, i1 false
      ret i1 %select
    }

For more discussion, see D149404.