platform/upstream/llvm.git
20 months ago[RISCV] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 14:55:38 +0000 (15:55 +0100)]
[RISCV] Convert test to opaque pointers (NFC)

There is a minor change in operand order (of a commutative
instruction).

20 months ago[RISCV] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 14:47:32 +0000 (15:47 +0100)]
[RISCV] Convert some tests to opaque pointers (NFC)

The asm test has minor differences in instruction scheduling only.

20 months ago[clang][dataflow] Fix bug in handling of `return` statements.
Yitzhak Mandelbaum [Tue, 20 Dec 2022 19:41:19 +0000 (19:41 +0000)]
[clang][dataflow] Fix bug in handling of `return` statements.

The handling of return statements, added in support of context-sensitive
analysis, has a bug relating to functions that return reference
types. Specifically, interpretation of such functions can result in a crash from
a bad cast. This patch fixes the bug and guards all of that code with the
context-sensitive option, since there's no reason to execute at all when
context-sensitive analysis is off.

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

20 months agoInstSimplify: Split isKnownNeverInfinity tests into separate file
Matt Arsenault [Thu, 22 Dec 2022 13:51:07 +0000 (08:51 -0500)]
InstSimplify: Split isKnownNeverInfinity tests into separate file

This fixes an annoying assymmetry in the test organization. We have
known-never-nan.ll for dedicated isKnownNeverNaN handling tests, but
the isKnownNeverInfinity were in floating-point-compare.ll. Move the
more targeted tests into a separate file to match.

20 months agoValueTracking: Add test for isKnownNeverInfinity for fptrunc
Matt Arsenault [Sun, 4 Dec 2022 14:09:41 +0000 (09:09 -0500)]
ValueTracking: Add test for isKnownNeverInfinity for fptrunc

20 months agoValueTracking: Add test for fneg isKnownNeverNaN handling
Matt Arsenault [Thu, 17 Nov 2022 16:02:14 +0000 (08:02 -0800)]
ValueTracking: Add test for fneg isKnownNeverNaN handling

This didn't have a negative test.

20 months ago[clang][dataflow] Account for global variables in constructor initializers.
Yitzhak Mandelbaum [Wed, 21 Dec 2022 22:05:09 +0000 (22:05 +0000)]
[clang][dataflow] Account for global variables in constructor initializers.

Previously, the analysis modeled global variables appearing in the _body_ of
any function (including constructors). But, that misses those appearing in
constructor _initializers_. This patch adds the initializers to the set of
expressions used to determine which globals to model.

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

20 months ago[clang][dataflow] Simplify handling of nullopt-optionals.
Yitzhak Mandelbaum [Wed, 21 Dec 2022 22:48:04 +0000 (22:48 +0000)]
[clang][dataflow] Simplify handling of nullopt-optionals.

Previously, in the case of an optional constructed from `nullopt`, we relied on
the value constructed for the `nullopt`. This complicates the implementation and
exposes it to bugs (indeed, one such was found), yet doesn't improve the
engine. Instead, this patch constructs a fresh optional representation, rather
than relying on the underlying nullopt representation.

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

20 months agoMIR: Fix test error message
Matt Arsenault [Thu, 22 Dec 2022 13:57:16 +0000 (08:57 -0500)]
MIR: Fix test error message

20 months ago[mlir][vector] Add additional scalar vector transfer foldings
Matthias Springer [Thu, 22 Dec 2022 13:05:51 +0000 (14:05 +0100)]
[mlir][vector] Add additional scalar vector transfer foldings

* Rewrite vector.transfer_write of vectors with 1 element to
  memref.store
* Rewrite vector.extract(vector.transfer_read) to memref.load

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

20 months agoclang/HIP: Fix missing test for __frsqrt_rn
Matt Arsenault [Tue, 22 Nov 2022 16:21:18 +0000 (11:21 -0500)]
clang/HIP: Fix missing test for __frsqrt_rn

20 months ago[RISCV] Name instructions in tests (NFC)
Nikita Popov [Thu, 22 Dec 2022 13:30:38 +0000 (14:30 +0100)]
[RISCV] Name instructions in tests (NFC)

20 months ago[test][lldb-vscode] Relax assertion to allow multiple compile units returned.
Jordan Rupprecht [Thu, 22 Dec 2022 13:19:29 +0000 (05:19 -0800)]
[test][lldb-vscode] Relax assertion to allow multiple compile units returned.

I don't think the intent of this test is to make sure we only have one compile unit; it's to make sure request_compileUnits returns something sensible. Relax the test case to just make sure that the main source file is one of the compile units returned, even if there are others.

Fixes llvm.org/pr49418.

Reviewed By: labath

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

20 months agoMIR: Don't assert if a virtual register uses a non-allocatable class
Matt Arsenault [Thu, 22 Dec 2022 12:31:05 +0000 (07:31 -0500)]
MIR: Don't assert if a virtual register uses a non-allocatable class

20 months ago[VPlan] Move VF and UF string generation to getName() (NFC).
Florian Hahn [Thu, 22 Dec 2022 13:15:01 +0000 (13:15 +0000)]
[VPlan] Move VF and UF string generation to getName() (NFC).

The VFs and UFs may be more constrained as the plans are transformed
(e.g. see D135017 for an example).

To make sure the VFs/UFs included in the VPlan dump are accurate,
generate them when accessing a plan's name, rather than include them in
the name string set after initial construction.

20 months ago[mlir][Tosa] Apply ClangTidy performance findings (NFC)
Adrian Kuegel [Thu, 22 Dec 2022 13:13:30 +0000 (14:13 +0100)]
[mlir][Tosa] Apply ClangTidy performance findings (NFC)

20 months ago[NVPTX] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 13:01:56 +0000 (14:01 +0100)]
[NVPTX] Convert test to opaque pointers (NFC)

20 months ago[MIR] Convert tests to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 12:58:29 +0000 (13:58 +0100)]
[MIR] Convert tests to opaque pointers (NFC)

20 months ago[CodeGen] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 12:57:14 +0000 (13:57 +0100)]
[CodeGen] Convert test to opaque pointers (NFC)

20 months agoclang/HIP: Fix broken implementations of __make_mantissa* functions
Matt Arsenault [Mon, 21 Nov 2022 03:30:09 +0000 (19:30 -0800)]
clang/HIP: Fix broken implementations of __make_mantissa* functions

The optimizer was folding the entire function to return 0. This
meant to be checking the character content of the pointer is the
string terminator, not null.

Also just make null inputs undefined. My docs for nanf say the
behavior of the argument is unspecified and segfaults on my system.

20 months ago[BPF] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 11:56:50 +0000 (12:56 +0100)]
[BPF] Convert test to opaque pointers (NFC)

20 months ago[AMDGPU] Simplify simplifyAMDGCNMemoryIntrinsicDemanded. NFC.
Jay Foad [Thu, 22 Dec 2022 11:21:11 +0000 (11:21 +0000)]
[AMDGPU] Simplify simplifyAMDGCNMemoryIntrinsicDemanded. NFC.

20 months ago[Clang][LoongArch] Add intrinsic for rdtime_d, rdtimeh_w and rdtimel_w
gonglingqin [Thu, 22 Dec 2022 11:18:22 +0000 (19:18 +0800)]
[Clang][LoongArch] Add intrinsic for rdtime_d, rdtimeh_w and rdtimel_w

Add these intrinsics to keep consistent with GCC [1].

[1]: https://github.com/gcc-mirror/gcc/blob/master/gcc/config/loongarch/larchintrin.h#L33

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

20 months ago[Clang][LoongArch] Add intrinsic for asrtle, asrtgt, lddir, ldpte and cpucfg
gonglingqin [Thu, 22 Dec 2022 08:59:56 +0000 (16:59 +0800)]
[Clang][LoongArch] Add intrinsic for asrtle, asrtgt, lddir, ldpte and cpucfg

`__cpucfg` is required by Linux [1].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/asm/loongarch.h#n59

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

20 months ago[clang-format] Add InsertBraces to operator== in Format.h
Owen Pan [Thu, 22 Dec 2022 10:24:01 +0000 (02:24 -0800)]
[clang-format] Add InsertBraces to operator== in Format.h

20 months ago[AArch64][SVE] Remove dso_local and local_unnamed_addr from muladdsub.ll
Matt Devereau [Thu, 22 Dec 2022 10:00:57 +0000 (10:00 +0000)]
[AArch64][SVE] Remove dso_local and local_unnamed_addr from muladdsub.ll

20 months ago[clang-format] Add 'friend' to QualifierOrder
Micah Weston [Thu, 22 Dec 2022 09:54:04 +0000 (01:54 -0800)]
[clang-format] Add 'friend' to QualifierOrder

For cases of defining friend functions, qualifier ordering can
allow multiple positions for the 'friend' token.

Closes #59450.

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

20 months ago[AArch64][InstCombine] Fuse ADD+MUL and SUB+MUL AArch64 instrinsics
Matt Devereau [Thu, 15 Dec 2022 16:09:13 +0000 (16:09 +0000)]
[AArch64][InstCombine] Fuse ADD+MUL and SUB+MUL AArch64 instrinsics

Fold (ADD p c (MUL p a b)) into (MAD p a b c)
Fold (FADD p c (FMUL p a b)) into (FMAD p a b c)
Fold (FSUB p c (FMUL p a b)) into (FNMSB p a b c)

Fold (ADD p (MUL p a b) c) into (MLA p c a b)
Fold (FADD p (FMUL p a b) c) into (FMLA p c a b)
Fold (SUB p (MUL p a b) C) into (MLS p c a b)
Fold (FSUB p (FMUL p a b) c) into (FMLS p c a b)

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

20 months ago[mlir][vector] Fold vector.extractelement(vector.broadcast)
Matthias Springer [Thu, 22 Dec 2022 09:22:37 +0000 (10:22 +0100)]
[mlir][vector] Fold vector.extractelement(vector.broadcast)

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

20 months ago[X86] Support ANDNP combine through vector_shuffle
Evgenii Kudriashov [Wed, 21 Dec 2022 12:45:41 +0000 (20:45 +0800)]
[X86] Support ANDNP combine through vector_shuffle

Combine
```
   and (vector_shuffle<Z,...,Z>
            (insert_vector_elt undef, (xor X, -1), Z), undef), Y
   ->
   andnp (vector_shuffle<Z,...,Z>
              (insert_vector_elt undef, X, Z), undef), Y
```

Reviewed By: RKSimon, pengfei

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

20 months agoRevert "Revert "[DebugInfo] Correctly recognize bitfields when emitting dwarf""
Juan Manuel MARTINEZ CAAMAÑO [Thu, 22 Dec 2022 08:31:36 +0000 (03:31 -0500)]
Revert "Revert "[DebugInfo] Correctly recognize bitfields when emitting dwarf""

https://reviews.llvm.org/D140195 should have fixed the fail in
green-dragon that was reported in https://reviews.llvm.org/D96334 and
resulted in the revert.

This reverts commit 920de9c94caff0b3ac21bf637487b07cb9aea98a.

20 months ago[bazel] Fix some --features=layering_check issues
Fangrui Song [Thu, 22 Dec 2022 08:12:58 +0000 (00:12 -0800)]
[bazel] Fix some --features=layering_check issues

20 months ago[mlir][llvm] Cleanup LLVM IR control flow import test (NFC).
Tobias Gysi [Thu, 22 Dec 2022 07:49:00 +0000 (08:49 +0100)]
[mlir][llvm] Cleanup LLVM IR control flow import test (NFC).

Use a FileCheck variable to match the switch op argument
instead of hardcoding the argument name.

Reviewed By: ftynse, Dinistro

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

20 months ago[bazel] Make TargetParser depend on config to fix --features=layering_check
Fangrui Song [Thu, 22 Dec 2022 06:59:36 +0000 (22:59 -0800)]
[bazel] Make TargetParser depend on config to fix --features=layering_check

While here, apply `buidifier`.

20 months ago[RISCV] Add more abs+zext test cases. NFC
Craig Topper [Wed, 21 Dec 2022 23:08:12 +0000 (15:08 -0800)]
[RISCV] Add more abs+zext test cases. NFC

20 months ago[clang][C++20] Add test for crash in NestedRequirement.
Utkarsh Saxena [Thu, 22 Dec 2022 05:49:29 +0000 (06:49 +0100)]
[clang][C++20] Add test for crash in NestedRequirement.

20 months ago[RISCV] Merge Masked and unMasked RVV manual codegen
Piyou Chen [Thu, 22 Dec 2022 04:27:44 +0000 (20:27 -0800)]
[RISCV] Merge Masked and unMasked RVV manual codegen

RVV intrinsic function will generate riscv_vector_builtin_cg.inc for CGBuiltin.cpp to produce the corresponding RVV intrinsic LLVM IR.

In this stage, riscv_vector.td will describe the bunch of manual codegen C++ code to tell CGBuiltin how to handle these instructions.

In this patch, we merge the masked RVV manual codegen and unmasked RVV manual codegen to reduce the number of manual codegen, and make more policy addition easier in the future.

This is a clean-up job that will not affect the RVV intrinsic functionality.

Reviewed By: kito-cheng

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

20 months agoFix out-of-bound access in TransformNestedRequirement.
Utkarsh Saxena [Thu, 22 Dec 2022 04:18:45 +0000 (05:18 +0100)]
Fix out-of-bound access in TransformNestedRequirement.

20 months ago[AMDGPU][Test] Update perfhint test to use opaque pointers
Yashwant Singh [Thu, 22 Dec 2022 04:17:28 +0000 (09:47 +0530)]
[AMDGPU][Test] Update perfhint test to use opaque pointers

Reviewed By: arsenm

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

20 months agoLinker: Disallow linking appending globals with different addrspaces
Matt Arsenault [Wed, 21 Dec 2022 17:35:42 +0000 (12:35 -0500)]
Linker: Disallow linking appending globals with different addrspaces

The current appending linkage handling implicitly assumes this by
using a basic ConstantExpr::getBitCast to resolve type
mismatches. Avoid this edge case so we don't need to keep the type
mismatch replacement code around after opaque pointers.

20 months ago[RISCV][NFC] Use Arrayref in TargetLowering functions.
ping.deng [Wed, 21 Dec 2022 12:25:00 +0000 (20:25 +0800)]
[RISCV][NFC] Use Arrayref in TargetLowering functions.

Reviewed By: kito-cheng

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

20 months ago[NFC] Rename Function::isDebugInfoForProfiling to shouldEmit[...]
Mircea Trofin [Thu, 22 Dec 2022 02:36:59 +0000 (18:36 -0800)]
[NFC] Rename Function::isDebugInfoForProfiling to shouldEmit[...]

The function name was misleading - the expectation set both by the name
and by other members of Function (like isDeclaration or isIntrinsic)
would be that the function somehow would "be" "debug info for
profiling". But that's not the case - the property indicates (as the
comment over the declaration also explains) whether debug info should be
emitted (for profiling).

20 months ago[M68k] Fix MachineFunctionInfo initialization after 69e75ae695d9ef1360a2a1fbefd6e0e04...
Fangrui Song [Thu, 22 Dec 2022 02:07:39 +0000 (18:07 -0800)]
[M68k] Fix MachineFunctionInfo initialization after 69e75ae695d9ef1360a2a1fbefd6e0e0456c3f7b

20 months ago[ARC][M68k] Fix INITIALIZE_PASS after D140364
Fangrui Song [Thu, 22 Dec 2022 01:53:11 +0000 (17:53 -0800)]
[ARC][M68k] Fix INITIALIZE_PASS after D140364

20 months agoAMDGPU: Use DenormalMode type in FP mode tracking
Matt Arsenault [Tue, 6 Dec 2022 16:59:49 +0000 (11:59 -0500)]
AMDGPU: Use DenormalMode type in FP mode tracking

This simplies a future patch. The MIR handling should be fixed. We're
still printing these in custom MachineFunctionInfo as bools (plus the
inverted meaning is hard to follow).

20 months ago[bazel] fix bazel file
Peiming Liu [Thu, 22 Dec 2022 01:24:52 +0000 (01:24 +0000)]
[bazel] fix bazel file

Reviewed By: yijia1212

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

20 months ago[LoongArch] Fix build after createMachineFunctionInfo change c774fd55008dbd2be51bc25f...
wanglei [Thu, 22 Dec 2022 01:13:42 +0000 (09:13 +0800)]
[LoongArch] Fix build after createMachineFunctionInfo change c774fd55008dbd2be51bc25f4c6f534978e73d95

20 months ago[OpenMP][libomptarget] Centralize host pinned buffers map to NextGen's PluginInterface
Kevin Sala [Wed, 21 Dec 2022 22:04:13 +0000 (23:04 +0100)]
[OpenMP][libomptarget] Centralize host pinned buffers map to NextGen's PluginInterface

This patch moves the management/tracking of host pinned buffers to the common PluginInterface
in NextGen plugins. For the moment, the management consists of tracking the host pinned
allocations into a map in each device.

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

20 months ago[mlir] Gate test checking statistics on their availability.
Will Dietz [Thu, 22 Dec 2022 00:46:27 +0000 (18:46 -0600)]
[mlir] Gate test checking statistics on their availability.

Fixes #59620.

20 months ago[NFC][OpenMP][libomptarget] Return null if error detected during allocation in NextGe...
Kevin Sala [Thu, 22 Dec 2022 00:41:50 +0000 (01:41 +0100)]
[NFC][OpenMP][libomptarget] Return null if error detected during allocation in NextGen AMDGPU

20 months agoRevert "Revert "[mlir][py] Enable building ops with raw inputs""
Jacques Pienaar [Thu, 22 Dec 2022 00:22:39 +0000 (16:22 -0800)]
Revert "Revert "[mlir][py] Enable building ops with raw inputs""

Fix Python 3.6.9 issue encountered due to type checking here. Will
add back in follow up.

This reverts commit 1f47fee2948ef48781084afe0426171d000d7997.

20 months ago[mlir] Fix a warning
Kazu Hirata [Thu, 22 Dec 2022 00:15:09 +0000 (16:15 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp:33:12:
  error: variable 'foundDynamicDim' set but not used
  [-Werror,-Wunused-but-set-variable]

20 months ago[NFC][SROA] More tests for variable indexed promotion
Roman Lebedev [Thu, 22 Dec 2022 00:12:17 +0000 (03:12 +0300)]
[NFC][SROA] More tests for variable indexed promotion

20 months ago[mlir] Fix a warning
Kazu Hirata [Thu, 22 Dec 2022 00:10:28 +0000 (16:10 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/include/mlir/Analysis/AliasAnalysis/LocalAliasAnalysis.h:24:7:
  error: 'mlir::LocalAliasAnalysis' has virtual functions but
  non-virtual destructor [-Werror,-Wnon-virtual-dtor]

20 months ago[libc][obvious] fix bazel after removing vector
Michael Jones [Wed, 21 Dec 2022 23:22:27 +0000 (15:22 -0800)]
[libc][obvious] fix bazel after removing vector

The vector class was removed from the source code and cmake but not from
the bazel which caused bazel issues. This patch fixes that.

Reviewed By: sivachandra

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

20 months ago[gn build] Port ec11388b3342
LLVM GN Syncbot [Wed, 21 Dec 2022 23:32:10 +0000 (23:32 +0000)]
[gn build] Port ec11388b3342

20 months ago[gn] another fixup for 47df55f3ef5 -- LoongArch is experimental, not RISCV
Nico Weber [Wed, 21 Dec 2022 23:31:39 +0000 (18:31 -0500)]
[gn] another fixup for 47df55f3ef5 -- LoongArch is experimental, not RISCV

20 months ago[gn] fixup for 47df55f3ef5
Nico Weber [Wed, 21 Dec 2022 23:25:45 +0000 (18:25 -0500)]
[gn] fixup for 47df55f3ef5

20 months ago[gn] Don't include RISCV in targets build for 'all'
Nico Weber [Wed, 21 Dec 2022 23:23:47 +0000 (18:23 -0500)]
[gn] Don't include RISCV in targets build for 'all'

RISCV build and tests are often broken.

You can use `llvm_targets_to_build = "experimental"` to enable
_all_ targets, including the experimental ones. If RISCV is listed
in llvm_targets_to_build, it's built as before.

20 months ago[NFC] test commit
Nilay Vaish [Wed, 21 Dec 2022 22:54:25 +0000 (14:54 -0800)]
[NFC] test commit

20 months ago[LiveDebugValues] Remove LexicalScope param from VarLoc (NFC)
Heejin Ahn [Thu, 15 Dec 2022 21:58:51 +0000 (13:58 -0800)]
[LiveDebugValues] Remove LexicalScope param from VarLoc (NFC)

It doesn't seem to be used anymore.

Reviewed By: dschuff

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

20 months agoclang: Add __builtin_elementwise canonicalize and copysign
Matt Arsenault [Thu, 8 Dec 2022 03:48:27 +0000 (22:48 -0500)]
clang: Add __builtin_elementwise canonicalize and copysign

Just copy paste from the other functions. I also need fma, but
the current code seems to assume 1 or 2 arguments.

20 months agoRevert "[mlir][py] Enable building ops with raw inputs"
Jacques Pienaar [Wed, 21 Dec 2022 22:53:12 +0000 (14:53 -0800)]
Revert "[mlir][py] Enable building ops with raw inputs"

Reverting to fix build bot.

This reverts commit 3781b7905d8d808e5d4e97d597263f8ac48541b8.

20 months ago[NFC][SROA] More tests for variable indexed promotion
Roman Lebedev [Wed, 21 Dec 2022 22:35:23 +0000 (01:35 +0300)]
[NFC][SROA] More tests for variable indexed promotion

20 months ago[clangd] Fix crashing race in ClangdServer shutdown with stdlib indexing
Sam McCall [Wed, 21 Dec 2022 18:16:14 +0000 (19:16 +0100)]
[clangd] Fix crashing race in ClangdServer shutdown with stdlib indexing

In principle it's OK for stdlib-indexing tasks to run after the TUScheduler is
destroyed, as mostly they just update the dynamic index. We do drain the
stdlib-indexing queue before destroying the index.

However the task captures references to the PreambleCallbacks object, which is
owned by the TUScheduler. Once this is destroyed (explicitly, early in
~ClangdServer) an outstanding stdlib-indexing task may use-after-free.

The fix here is to avoid capturing references to the PreambleCallbacks.
Alternatives would be to have TUScheduler (exclusively) not own its callbacks
so they could live longer, or explicitly stopping the TUScheduler instead of
early-destroying it. These both seem more invasive.

See https://reviews.llvm.org/D115232 for some more context.

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

20 months ago[lld-macho] Emit map file entries for more synthetic sections
Jez Ng [Wed, 21 Dec 2022 22:26:02 +0000 (17:26 -0500)]
[lld-macho] Emit map file entries for more synthetic sections

We now handle the GOT, TLV, and stubs/lazy pointer sections.

Reviewed By: #lld-macho, thevinster, thakis

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

20 months agoLoongArch: Update for MachineFunctionInfo construction change
Matt Arsenault [Wed, 21 Dec 2022 22:24:59 +0000 (17:24 -0500)]
LoongArch: Update for MachineFunctionInfo construction change

20 months ago[NFC][SROA] More tests for promotion with variable index
Roman Lebedev [Wed, 21 Dec 2022 21:59:56 +0000 (00:59 +0300)]
[NFC][SROA] More tests for promotion with variable index

Also, delete the InstCombine test, it's not going to be relevant.

20 months ago[LV] Add createTripCountSCEV helper (NFC).
Florian Hahn [Wed, 21 Dec 2022 22:02:31 +0000 (22:02 +0000)]
[LV] Add createTripCountSCEV helper (NFC).

Split off helper function in preparation for D135017.

20 months ago[SPIR-V] Add atomic_flag builtin implementation
Michal Paszkowski [Wed, 21 Dec 2022 21:51:59 +0000 (22:51 +0100)]
[SPIR-V] Add atomic_flag builtin implementation

This change provides implementation details for atomic_flag builtins and
adds an extended atomic_flag.ll test from the LLVM SPIR-V Translator.

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

20 months agoReland "[NFC][SROA] `speculateSelectInstLoads()`: play nice with typed pointers for...
Roman Lebedev [Wed, 21 Dec 2022 21:08:16 +0000 (00:08 +0300)]
Reland "[NFC][SROA] `speculateSelectInstLoads()`: play nice with typed pointers for now"

This reverts commit bf88ba0f8718c1e89e28e977839ad0a6186d44fe,
relands 9f27f4536e19e93349b0662338408efe6d1cb2fd, but without a bug:
we *REALLY* should not be defaulting to address space 0
when address space is not specified...

20 months ago[llvm][SelectionDAGISel] support -{start|stop}-{before|after}= for remaining targets
Nick Desaulniers [Wed, 21 Dec 2022 21:11:36 +0000 (13:11 -0800)]
[llvm][SelectionDAGISel] support -{start|stop}-{before|after}= for remaining targets

Follow up to the series:
1. https://reviews.llvm.org/D140161
2. https://reviews.llvm.org/D140349
3. https://reviews.llvm.org/D140331
4. https://reviews.llvm.org/D140323

Completes the work from the previous two for remaining targets.

This creates the following named passes that can be run via
`llc -{start|stop}-{before|after}`:
- arc-isel
- arm-isel
- avr-isel
- bpf-isel
- csky-isel
- hexagon-isel
- lanai-isel
- loongarch-isel
- m68k-isel
- msp430-isel
- mips-isel
- nvptx-isel
- ppc-codegen
- riscv-isel
- sparc-isel
- systemz-isel
- ve-isel
- wasm-isel
- xcore-isel

A nice way to write tests for SelectionDAGISel might be to use a RUN:
line like:
llc -mtriple=<triple> -start-before=<arch>-isel -stop-after=finalize-isel -o -

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

Reviewed By: asb, zixuan-wu

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

20 months ago[lld][COFF] Fix lld-link crash when several .obj files built with /Zi refer to a...
Sylvain Audi [Thu, 15 Dec 2022 15:56:47 +0000 (10:56 -0500)]
[lld][COFF] Fix lld-link crash when several .obj files built with /Zi refer to a .pdb file that failed to load

This patch relaxes the constraints on the error message saved in PDBInputFile when failing to load a pdb file.

Storing an `Error` member infers that it must be accessed exactly once, which doesn't fit in several scenarios:
- If an invalid PDB file is provided as input file but never used, a loading error is created but never handled, causing an assert at shutdown.
- PDB file created using MSVC's `/Zi` option : The loading error message must be displayed once per obj file.

Also, the state of `PDBInputFile` was altered when reading (taking) the `Error` member, causing issues:
 - accessing it (taking the `Error`) makes the object look valid whereas it's not properly initialized
 - read vs write concurrency on a same `PDBInputFile` in the ghash parallel algorithm

The solution adopted here was to instead store an optional error string, and generate Error objects from it on demand.

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

20 months ago[libc][Obvious] Fix an off-by-one error introduced by eb9cc253cb048b6dbf2fcd73ac55b5e...
Siva Chandra Reddy [Wed, 21 Dec 2022 21:10:42 +0000 (21:10 +0000)]
[libc][Obvious] Fix an off-by-one error introduced by eb9cc253cb048b6dbf2fcd73ac55b5eda0184ed3.

20 months ago[llvm][AArch64ISelDAGToDAG] support -{start|stop}-{before|after}=aarch64-isel
Nick Desaulniers [Wed, 21 Dec 2022 20:28:37 +0000 (12:28 -0800)]
[llvm][AArch64ISelDAGToDAG] support -{start|stop}-{before|after}=aarch64-isel

Follow a similar pattern as AMDGPUDAGToDAGISel's constructor so that we
can use INITIALIZE_PASS to register a pass. This allows for more fine
grain testability of SelectionDAGISel via:

   llc -stop-{before,after}=aarch64-isel

Link: https://github.com/llvm/llvm-project/issues/59538
See also: https://reviews.llvm.org/D140323

Reviewed By: MaskRay

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

20 months ago[libc] Gracefully handle allocation failures around BlockStore.
Siva Chandra Reddy [Wed, 21 Dec 2022 07:27:08 +0000 (07:27 +0000)]
[libc] Gracefully handle allocation failures around BlockStore.

Reviewed By: lntue

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

20 months ago[libc][NFC] Use the custom operator new from strndup.
Siva Chandra Reddy [Wed, 21 Dec 2022 07:36:23 +0000 (07:36 +0000)]
[libc][NFC] Use the custom operator new from strndup.

Reviewed By: lntue

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

20 months ago[RISCV] Check the sign bits of the input of RISCVISD::ABSW in computeNumSignBitsForTa...
Craig Topper [Wed, 21 Dec 2022 20:50:10 +0000 (12:50 -0800)]
[RISCV] Check the sign bits of the input of RISCVISD::ABSW in computeNumSignBitsForTargetNode.

We created a SIGN_EXTEND_INREG when we created the ABSW so the
input should have 33 sign bits, but check it to be safe.

20 months ago[RISCV] Add test cases for i8/i16 abs followed by zext.
Craig Topper [Wed, 21 Dec 2022 20:08:07 +0000 (12:08 -0800)]
[RISCV] Add test cases for i8/i16 abs followed by zext.

The andi, zext.h and slli+srli shift pairs at the end of the generated
output are unnecessary if the input is sign extended.

20 months agosort some method declarations. NFC
Nick Desaulniers [Wed, 21 Dec 2022 20:22:22 +0000 (12:22 -0800)]
sort some method declarations. NFC

Precommit sort and format of methods from D140331.

Link: https://reviews.llvm.org/D140331
Link: https://github.com/llvm/llvm-project/issues/59538
20 months ago[NFC][SROA] Add tests for alloca promotion in presence of variably-indexed load
Roman Lebedev [Wed, 21 Dec 2022 20:13:17 +0000 (23:13 +0300)]
[NFC][SROA] Add tests for alloca promotion in presence of variably-indexed load

20 months ago[DIrectX backend] emit metadata for entry.
Xiang Li [Mon, 12 Dec 2022 17:51:33 +0000 (12:51 -0500)]
[DIrectX backend] emit metadata for entry.

New named metadata "dx.entryPoints" is added to save all entries.

Each entry is in format of
!{ptr to function, name, signature, resource table, extra}

For compute shader, the extra will save num of threads in format of {i32 x, i32 y, i32 z}

For library profile, an empty entry will be added to save the resource table for the library.

Signature and resource table metadata is not generated yet.

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

20 months ago[mlir] Clear running passes in crashreporter
Jacques Pienaar [Wed, 21 Dec 2022 19:43:03 +0000 (11:43 -0800)]
[mlir] Clear running passes in crashreporter

Clear active contexts and running passes whenever finalizing crash
report message. Ran into segfault where a failure in dynamic pipeline
resulted in querying a pass whose passmanager had already been destroyed
come time for creating summary of running passes. Conservatively clear
both running states as I don't think there is recovery intended from
pass pipeline failure.

Additionally restrict to one reproducer per report - else we end up
clobbering the same reproducer file over and over again. So instead of
ending with last reproducer we now end up with the first reproducer
while not creating and clobbering reproducers over and over again.

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

20 months ago[Flang] Reword the overview document
Peter Steinfeld [Fri, 16 Dec 2022 20:05:16 +0000 (12:05 -0800)]
[Flang] Reword the overview document

I brought the overview document up to date and added information for
most compilation phases to dump out the reeults of the phase.

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

20 months agoHeaders: further refine the `stdatomic.h` MSVC inclusion
Saleem Abdulrasool [Wed, 21 Dec 2022 16:45:28 +0000 (16:45 +0000)]
Headers: further refine the `stdatomic.h` MSVC inclusion

The `stdatomic.h` header cannot be included under MSVC when in C++ mode
as the toolsets prior to 17.5.0 Preview 2 do not support the C11
atomics.  However, some toolsets prior to the aforementioned version
support the atomics under the C++ mode.  In these versions the MSVC
toolset protects against the contamination by entirely eliding the
declarations, resulting in build failures in some cases.  Unfortunately,
e0c3142af075e2ef89395dbed5939071345eb622 accidentally regressed the C
case when fixing the C++ support.

Unfortunately, we cannot test this reliably as we need to inject a
header after the resource path as a system header path, which we do not
have a reliable means of doing.

Fixes: #59640

20 months ago[AArch64] Guard {vmull_p64, vmull_high_p64} with 'aes' target guard.
Mingming Liu [Tue, 20 Dec 2022 21:53:34 +0000 (13:53 -0800)]
[AArch64] Guard {vmull_p64, vmull_high_p64} with 'aes' target guard.

The 'aes' target guard includes both FEAT_AES and FEAT_PMULL currently.

In this way, cpp code that uses these intrinsics without specifying the required extension gets better hint.
- Before, compile crashes with LLVM ISel internal message (see issue [[ https://github.com/llvm/llvm-project/issues/59599 | 59599 ]]).
- After, clang hints that target 'aes' is required in the command.

Reviewed By: dmgreen

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

20 months ago[RISCV] Add DAG combine to fold (select C, (add X, Y), Y) -> (add (select C, X, 0...
Craig Topper [Wed, 21 Dec 2022 18:39:41 +0000 (10:39 -0800)]
[RISCV] Add DAG combine to fold (select C, (add X, Y), Y) -> (add (select C, X, 0), Y).

Similar for sub, or, and xor. These are all operations that have 0
as a neutral value. This is based on a similar tranform in InstCombine.

This allows us to remove some XVentanaCondOps patterns and
some code from DAGCombine for RISCVISD::SELECT_CC.

Reviewed By: asb

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

20 months ago[Clang] Modify sanity check assert in AggExprEmitter::VisitInitListExpr to cover...
Shafik Yaghmour [Wed, 21 Dec 2022 18:47:52 +0000 (10:47 -0800)]
[Clang] Modify sanity check assert in AggExprEmitter::VisitInitListExpr to cover anonymous struct in a union GNU extension

AggExprEmitter::VisitInitListExpr sanity checks that an empty union is really
empty and not a semantic analysis failure. The assert is missing that we allow
anonymous structs as a GNU extension. I have updated the assert to take that into account.

This fixes: https://github.com/llvm/llvm-project/issues/58800

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

20 months ago[BOLT][NFC] Make DWOId std::optional
Amir Ayupov [Wed, 21 Dec 2022 18:09:46 +0000 (10:09 -0800)]
[BOLT][NFC] Make DWOId std::optional

Reviewed By: #bolt, ayermolo

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

20 months ago[RISCV] Add more test cases to select.ll. NFC
Craig Topper [Wed, 21 Dec 2022 18:20:59 +0000 (10:20 -0800)]
[RISCV] Add more test cases to select.ll. NFC

These are test for select (and (x , 0x1) == 0), (z ^ y), y ) and select (and (x , 0x1) == 0), (z | y), y )

These can be made branchless by using ((x-1) & z ) ^ y.

20 months ago[ARC] Fix build after createMachineFunctionInfo change 69e75ae695d9ef1360a2a1fbefd6e0...
Fangrui Song [Wed, 21 Dec 2022 18:35:05 +0000 (10:35 -0800)]
[ARC] Fix build after createMachineFunctionInfo change 69e75ae695d9ef1360a2a1fbefd6e0e0456c3f7b

20 months ago[AArch64] Additional RSHRN pattern tests. NFC
David Green [Wed, 21 Dec 2022 18:32:52 +0000 (18:32 +0000)]
[AArch64] Additional RSHRN pattern tests. NFC

20 months ago[libc++] Rename __tuple to __tuple_dir to avoid file collision
Michał Górny [Sun, 4 Dec 2022 06:39:41 +0000 (07:39 +0100)]
[libc++] Rename __tuple to __tuple_dir to avoid file collision

Rename the `__tuple` directory in libc++ headers to `__tuple_dir`
to avoid file collision when installing.  Historically, `__tuple` has
been a file and it has been replaced by a directory
in 2d52c6bfae801b016dd3627b8c0e7c4a99405549.  Replacing a regular file
with a directory (or more importantly, the other way around when
downgrading) is not universally supported.  Since this is an internal
header, its actual name should not matter, so just rename it to avoid
problems.

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

20 months ago[mlir][py] Enable building ops with raw inputs
Jacques Pienaar [Wed, 21 Dec 2022 18:10:31 +0000 (10:10 -0800)]
[mlir][py] Enable building ops with raw inputs

For cases where we can automatically construct the Attribute allow for more
user-friendly input. This is consistent with C++ builder generation as well
choice of which single builder to generate here (most
specialized/user-friendly).

Registration of attribute builders from more pythonic input is all Python side.
The downside is that
  * extra checking to see if user provided a custom builder in op builders,
  * the ODS attribute name is load bearing
upside is that
  * easily change these/register dialect specific ones in downstream projects,
  * adding support/changing to different convenience builders are all along with
    the rest of the convenience functions in Python (and no additional changes
    to tablegen file or recompilation needed);

Allow for both building with Attributes as well as raw inputs. This change
should therefore be backwards compatible as well as allow for avoiding
recreating Attribute where already available.

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

20 months ago[flang] Use Assign() runtime for copy-in/copy-out.
Slava Zakharin [Wed, 21 Dec 2022 01:13:25 +0000 (17:13 -0800)]
[flang] Use Assign() runtime for copy-in/copy-out.

The loops generated under IsContiguous check for copy-in/copy-out
result in LLVM backend spending too much time optimizing them.
At the same time, the copy loops do not provide any optimization
opportunities with the surrounding code (since they are executed
under runtime IsContiguous check), so the copy code may be optimized
on its own and this can be done in runtime.

I thought I could implement and use new APIs for packing/unpacking
non-contiguous data (interfaces added in D136378), but then I found
that Assign() is already doing what is needed. If performance
becomes an issue for these loops, we can optimize code in Assign()
rather than creating new APIs.

Thus, this change makes use of Assign() for copy-in/copy-out
of boxed objects, and this is done only if the objects
are non-contiguous during execution. Copies for non-boxed
objects (e.g. for passing as VALUE dummy argument) are still
done inline, because they can potentially be optimized with
surrounding loops.

I added internal -inline-copyinout-for-boxes option to revert to the old
behavior just to make it easier to triage performance regressions,
if any appear after the change.

CPU2017/521.wrf compiles for 2179 seconds without the change and
the module_dm.f90 compiled with -O0 (without -O0 this single
module compiles for 5775 seconds). With the change total compilation
time of the benchmark reduces to 722 seconds.

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

20 months ago[mlir] Fix SameOperandsAndResultType to check encoding.
Jacques Pienaar [Wed, 21 Dec 2022 17:49:18 +0000 (09:49 -0800)]
[mlir] Fix SameOperandsAndResultType to check encoding.

Encoding was accidentally left out here even though it forms part of the type.
This is small tightening step and I'll look at follow on to tighten more.

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

20 months agomlir/LinalgOps: fix name of generated .yamlgen in comments
Ramkumar Ramachandra [Tue, 13 Dec 2022 16:43:36 +0000 (17:43 +0100)]
mlir/LinalgOps: fix name of generated .yamlgen in comments

Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Differential Revision: https://reviews.llvm.org/D139946

20 months ago[Driver] Fix tests not to fail randomly on Windows
Paul Robinson [Wed, 21 Dec 2022 17:36:36 +0000 (09:36 -0800)]
[Driver] Fix tests not to fail randomly on Windows

These used a regex that didn't guard against backslashes, so
getting "lucky" with a temp dir name could make them fail.

20 months agoRevert "BEGIN_PUBLIC"
Mitch Phillips [Wed, 21 Dec 2022 17:18:01 +0000 (09:18 -0800)]
Revert "BEGIN_PUBLIC"

This reverts commit a6d6d40d8bd062514fc379a6bf70fb1b7220be6f.

Reason: Broke the ASan/MSan bots. More information in phabricator:
https://reviews.llvm.org/D140406

20 months ago[libc++] Add FreeBSD ABI list
Ed Maste [Tue, 20 Dec 2022 20:21:11 +0000 (15:21 -0500)]
[libc++] Add FreeBSD ABI list

Generated via `nina generate-cxx-abilist`.

Reviewed By: Mordante, ldionne, philnik
Differential Revision: https://reviews.llvm.org/D140431