platform/upstream/llvm.git
18 months ago[X86][NFC] Fix for warning C4334: '<<': result of 32-bit shift implicitly converted...
Shengchen Kan [Thu, 6 Apr 2023 09:11:30 +0000 (17:11 +0800)]
[X86][NFC] Fix for warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits

18 months ago[Inliner] Added test with nonnull callsite attribute
Dávid Bolvanský [Thu, 6 Apr 2023 09:06:36 +0000 (11:06 +0200)]
[Inliner] Added test with nonnull callsite attribute

18 months ago[FunctionAttrs] Add more nounwind tests (NFC)
Nikita Popov [Thu, 6 Apr 2023 08:53:46 +0000 (10:53 +0200)]
[FunctionAttrs] Add more nounwind tests (NFC)

Test variations where catch/filter catch all exceptions.

18 months ago[LoopVectorize] Fix zext/sext cost calculations when types are shrunk
David Sherwood [Wed, 29 Mar 2023 12:22:09 +0000 (12:22 +0000)]
[LoopVectorize] Fix zext/sext cost calculations when types are shrunk

In getInstructionCost if we know a zext/sext is going to be shrunk
we should only be changing the destination type, and leave the
source type unchanged. For example, we may change a zext from

  zext <16 x i8> %a to <16 x i32>

to

  zext <16 x i8> %a to <16 x i16>

However, we were previously calculating the cost for doing

  zext <16 x i16> %a to <16 x i16>

which is incorrect.

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

18 months ago[clang][Interp] Fix zero-initializing of floating types
Timm Bäder [Fri, 24 Mar 2023 07:33:59 +0000 (08:33 +0100)]
[clang][Interp] Fix zero-initializing of floating types

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

18 months ago[FunctionAttrs] Add additional nounwind inference tests (NFC)
Nikita Popov [Thu, 6 Apr 2023 08:41:10 +0000 (10:41 +0200)]
[FunctionAttrs] Add additional nounwind inference tests (NFC)

For PR61945.

18 months ago[clang][Interp][NFC] Context: Add getFloatSemantics()
Timm Bäder [Mon, 27 Mar 2023 13:03:01 +0000 (15:03 +0200)]
[clang][Interp][NFC] Context: Add getFloatSemantics()

We use this quite a bit, so add some convenience API for it.

18 months ago[X86][mem-fold] Simplify the logic and correct the comments for TB_ALIGN, NFCI
Shengchen Kan [Thu, 6 Apr 2023 08:36:01 +0000 (16:36 +0800)]
[X86][mem-fold] Simplify the logic and correct the comments for TB_ALIGN, NFCI

18 months ago[clang][Interp][NFC] Call emit*Ptr directly
Timm Bäder [Thu, 23 Mar 2023 14:37:09 +0000 (15:37 +0100)]
[clang][Interp][NFC] Call emit*Ptr directly

Instead of the version that uses a switch statement to figure this out.

18 months ago[GVNHoist][NFC] Regenerate test case.
luxufan [Thu, 6 Apr 2023 07:07:15 +0000 (15:07 +0800)]
[GVNHoist][NFC] Regenerate test case.

18 months ago[compiler-rt] [test] Only pass -incremental:no to the linker for MSVC/clang-cl
Martin Storsjö [Wed, 5 Apr 2023 21:05:12 +0000 (21:05 +0000)]
[compiler-rt] [test] Only pass -incremental:no to the linker for MSVC/clang-cl

The target_is_msvc variable in lit.cfg.py matches a similar pattern
used in the asan lit.cfg.py.

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

18 months ago[compiler-rt] [test] [fuzzer] Don't pass msvc/clang-cl specific flags to mingw tools
Martin Storsjö [Fri, 31 Mar 2023 15:23:57 +0000 (15:23 +0000)]
[compiler-rt] [test] [fuzzer] Don't pass msvc/clang-cl specific flags to mingw tools

This fixes building the tests so that the tests can start
executing (even if there still are lots of failures).

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

18 months ago[compiler-rt] Create the umbrella check-compiler-rt test target in non-standalone...
Martin Storsjö [Thu, 30 Mar 2023 09:35:08 +0000 (09:35 +0000)]
[compiler-rt] Create the umbrella check-compiler-rt test target in non-standalone builds too

I don't see why we can't have this target when built as a project alongside
llvm; especially in such build configs, it's useful to have one single target
for running all tests (in standalone builds, check-all does the same too),

Keep the creation of the check-all target only for standalone builds.

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

18 months ago[libunwind] [test] Add a mingw specific test config file
Martin Storsjö [Wed, 29 Mar 2023 21:36:51 +0000 (00:36 +0300)]
[libunwind] [test] Add a mingw specific test config file

This matches how it is done for libcxx and libcxxabi.

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

18 months ago[libunwind] Fflush stderr after each log message
Martin Storsjö [Wed, 5 Apr 2023 07:18:38 +0000 (10:18 +0300)]
[libunwind] Fflush stderr after each log message

In most configs, stderr is line buffered by default, but in some
cases on Windows (running in git bash, or running in Wine) stderr
can end up fully buffered.

See 2ec75a0869ab01fa9caf310e8a31eb7716182d30 for a similar change
for the output from lit itself.

This has no effect on libunwind when the log messages aren't enabled
via the environment variables.

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

18 months ago[libunwind] Fix a typo in a debug log message. NFC.
Martin Storsjö [Wed, 5 Apr 2023 07:56:42 +0000 (10:56 +0300)]
[libunwind] Fix a typo in a debug log message. NFC.

This typo (unw_step instead of unw_get_proc_info) has been around since
the initial public commit of libunwind.

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

18 months ago[libcxxabi, libunwind] [test] Quote the python path properly for LIB*_EXECUTOR
Martin Storsjö [Fri, 27 Aug 2021 11:35:02 +0000 (11:35 +0000)]
[libcxxabi, libunwind] [test] Quote the python path properly for LIB*_EXECUTOR

This is the same as c218c80c730a14a1cbcebd588b18220a879702c6,
but for libcxxabi and libunwind.

This fixes running tests on Windows with Python installed in
e.g. "C:\Program Files\Python38".

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

18 months ago[InstCombine] Remove addrspacecast bitcast extraction fold (NFC)
Nikita Popov [Thu, 6 Apr 2023 07:48:39 +0000 (09:48 +0200)]
[InstCombine] Remove addrspacecast bitcast extraction fold (NFC)

This is not relevant for opaque pointers, and as such no longer
necessary.

18 months ago[SimpleLoopUnswitch] Fix SCEV invalidation issue
Bjorn Pettersson [Tue, 28 Mar 2023 16:07:52 +0000 (18:07 +0200)]
[SimpleLoopUnswitch] Fix SCEV invalidation issue

This patch is making sure that we use getTopMostExitingLoop when
finding out which loops to forget, when dealing with
unswitchNontrivialInvariants and unswitchTrivialSwitch. It seems
to at least be needed for unswitchNontrivialInvariants as detected
by the included test case.

Note that unswitchTrivialBranch already used getTopMostExitingLoop.
This was done in commit 4a9cde5a791cd49b96993e6. The commit
message in that commit says "If the patch makes sense, I will also
update those places to a similar approach ...", referring to these
functions mentioned above. As far as I can tell that never happened,
but this is an attempt to finally fix that.

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

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

18 months ago[InstCombine] Remove various checks for opaque pointers (NFC)
Nikita Popov [Thu, 6 Apr 2023 07:26:15 +0000 (09:26 +0200)]
[InstCombine] Remove various checks for opaque pointers (NFC)

All pointers are opaque now, so these are no longer necessary.

18 months ago[clang][Interp] Record initialization via conditional operator
Timm Bäder [Wed, 11 Jan 2023 14:59:29 +0000 (15:59 +0100)]
[clang][Interp] Record initialization via conditional operator

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

18 months ago[LoopVectorize] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 6 Apr 2023 07:30:42 +0000 (09:30 +0200)]
[LoopVectorize] Convert some tests to opaque pointers (NFC)

18 months ago[libc] Remove dead code
Guillaume Chatelet [Thu, 6 Apr 2023 07:33:41 +0000 (07:33 +0000)]
[libc] Remove dead code

18 months ago[AVR] Fix incorrect expansion of pseudo instructions LPMWRdZ/ELPMWRdZ
Ben Shi [Mon, 9 Jan 2023 08:15:41 +0000 (16:15 +0800)]
[AVR] Fix incorrect expansion of pseudo instructions LPMWRdZ/ELPMWRdZ

The 'ELPM' instruction has three forms:

--------------------------
| form        | feature  |
| ----------- | -------- |
| ELPM        | hasELPM  |
| ELPM Rd, Z  | hasELPMX |
| ELPM Rd, Z+ | hasELPMX |
--------------------------

The second form is always used in the expansion of pseudo instructions
LPMWRdZ/ELPMWRdZ. But for devices without ELPMX and with only ELPM,
only the first form can be used.

Reviewed By: aykevl, Miss_Grape

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

18 months ago[clang][dataflow] Use `isRecordType()` where appropriate.
Martin Braenne [Wed, 5 Apr 2023 12:32:13 +0000 (12:32 +0000)]
[clang][dataflow] Use `isRecordType()` where appropriate.

This is less verbose than checking for class, struct, and union individually,
and I believe it's also more efficient (not that that should be the overriding
concern).

Reviewed By: sammccall, xazax.hun

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

18 months ago[InstCombine] Remove GEP of bitcast folds (NFC)
Nikita Popov [Thu, 6 Apr 2023 07:14:49 +0000 (09:14 +0200)]
[InstCombine] Remove GEP of bitcast folds (NFC)

These only support typed pointers, and as such are no longer
relevant.

18 months ago[C++20] [Coroutines] Handle function-try-block in SemaCoroutine
Chuanqi Xu [Thu, 6 Apr 2023 07:10:24 +0000 (15:10 +0800)]
[C++20] [Coroutines] Handle function-try-block in SemaCoroutine

In https://reviews.llvm.org/D146758, we handled the rare case that the
coroutine has a function-try-block. But it will be better to handle it
in the Sema part. This patch handles the preprocess.

18 months ago[InstCombine] Remove visitGEPOfBitcast() fold (NFC)
Nikita Popov [Wed, 5 Apr 2023 14:40:50 +0000 (16:40 +0200)]
[InstCombine] Remove visitGEPOfBitcast() fold (NFC)

This does not apply to opaque pointers, and as such is no longer
necessary.

18 months ago[clang][dataflow] Eliminate code duplication in Environment::createValueUnlessSelfRef...
Martin Braenne [Wed, 5 Apr 2023 11:20:33 +0000 (11:20 +0000)]
[clang][dataflow] Eliminate code duplication in Environment::createValueUnlessSelfReferential().

Reviewed By: sammccall

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

18 months ago[X86] Add InstFixup for masked `unpck{l|h}pd` -> masked `shufpd`
Noah Goldstein [Thu, 6 Apr 2023 06:11:30 +0000 (01:11 -0500)]
[X86] Add InstFixup for masked `unpck{l|h}pd` -> masked `shufpd`

This is a follow up D147507 which removed the prior transformation to
`shufps` which was incorrect as the mask was for 64-bit double
elements, not 32-bit float elements. Using `shufpd` for the
replacement, however, preserves the mask semantics and has the same
benefits as `shufps`.

Reviewed By: pengfei, RKSimon

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

18 months ago[gn build] Port 8d7c865c2e22
LLVM GN Syncbot [Thu, 6 Apr 2023 06:23:53 +0000 (06:23 +0000)]
[gn build] Port 8d7c865c2e22

18 months ago[runtimes] Fix typo from e787ef86634553131f8e47bd8eaaede987cf20e2
Shoaib Meenai [Thu, 6 Apr 2023 06:22:28 +0000 (23:22 -0700)]
[runtimes] Fix typo from e787ef86634553131f8e47bd8eaaede987cf20e2

The variable name was incorrect, which was breaking runtimes builds.

18 months ago[docs] Also mention Discord on Contributing.rst page
Kristof Beyls [Tue, 7 Mar 2023 09:56:20 +0000 (10:56 +0100)]
[docs] Also mention Discord on Contributing.rst page

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

18 months ago[RISCV] Support __builtin_nontemporal_load/store by MachineMemOperand
Piyou Chen [Mon, 6 Feb 2023 03:37:13 +0000 (19:37 -0800)]
[RISCV] Support __builtin_nontemporal_load/store by MachineMemOperand

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

18 months ago[X86][InstCombine] Avoid -Wparentheses warnings introduced in D145220, NFCI
Shengchen Kan [Thu, 6 Apr 2023 05:49:15 +0000 (13:49 +0800)]
[X86][InstCombine] Avoid -Wparentheses warnings introduced in D145220, NFCI

18 months ago[AMDGPU][GISel] Add inverse ballot intrinsic
Jessica Del [Thu, 16 Mar 2023 16:17:20 +0000 (17:17 +0100)]
[AMDGPU][GISel] Add inverse ballot intrinsic

The inverse ballot intrinsic takes in a boolean mask for all lanes and
returns the boolean for the current lane. See SPIR-V's
`subgroupInverseBallot()` in the [[ https://github.com/KhronosGroup/GLSL/blob/master/extensions/khr/GL_KHR_shader_subgroup.txt | GL_KHR_shader_subgroup extension ]].
This allows decision making via branch and select instructions with a manually
manipulated mask.

Implemented in GlobalISel and SelectionDAG, since currently both are supported.
The SelectionDAG required pseudo instructions to use the custom inserter.

The boolean mask needs to be uniform for all lanes.
Therefore we expect SGPR input. In case the source is in a
VGPR, we insert one or more `v_readfirstlane` instructions.

Reviewed By: nhaehnle

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

18 months ago[X86][mem-fold] Refine the code in X86FoldTablesEmitter.cpp, NFCI
Shengchen Kan [Thu, 6 Apr 2023 05:32:42 +0000 (13:32 +0800)]
[X86][mem-fold] Refine the code in X86FoldTablesEmitter.cpp, NFCI

1. Construct RecognizableInstrBase for Mem Inst only once in IsMatch
2. Correct the comments
3. Use std::make_tuple to simplify the compare

18 months ago[CodeGen] Speedup stack slot sharing during stack coloring (interval overlapping...
Valery Pykhtin [Tue, 14 Mar 2023 15:30:46 +0000 (16:30 +0100)]
[CodeGen] Speedup stack slot sharing during stack coloring (interval overlapping test).

AMDGPU code with enabled address sanitizer generates tons of stack objects (> 200000 in my testcase) and
takes forever to compile due to the time spent on stack slot sharing.

While LiveRange::overlaps method has logarithmic complexity on the number of segments in the involved
liveranges the problem is that when a new interval is assigned to a used color it's tested against
overlapping every other assigned interval for that color.

Instead I decided to join all assigned intervals for a color into a single interval and this allows to
have logarithmic complexity on the number of segments for the joined interval.

This patch reduced time spent on stack slot coloring pass from 628 to 3 seconds on my testcase.

Reviewed By: arsenm

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

18 months ago[mlir][bufferization] Add bufferization.eliminate_empty_tensors transform op
Matthias Springer [Thu, 6 Apr 2023 05:17:54 +0000 (14:17 +0900)]
[mlir][bufferization] Add bufferization.eliminate_empty_tensors transform op

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

18 months ago[X86] Add AMX_COMPLEX to Graniterapids
Freddy Ye [Thu, 6 Apr 2023 02:15:11 +0000 (10:15 +0800)]
[X86] Add AMX_COMPLEX to Graniterapids

This patch also rename __AMXCOMPLEX__ to __AMX_COMPLEX__

Reviewed By: skan, xiangzhangllvm

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

18 months ago[mlir] Use BaseMemRefType for ranked/unranked memrefs
Matthias Springer [Thu, 6 Apr 2023 04:21:00 +0000 (13:21 +0900)]
[mlir] Use BaseMemRefType for ranked/unranked memrefs

This makes `RankedOrUnrankedMemRefOf` consistent with `TensorOf`.

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

18 months ago[mlir] Use RankedTensorType when rank is required
Matthias Springer [Thu, 6 Apr 2023 04:20:41 +0000 (13:20 +0900)]
[mlir] Use RankedTensorType when rank is required

`RankedTensorOf` and `TensorRankOf` (in Tablegen files) now generate code that uses `RankedTensorType` instead of `TensorType`. This gives us more accurate type information (e.g., when calling `op.getType()`).

Also use restrict tensor.expand_shape/tensor.collapse_shape/tensor.pad to ranked tensors. Only cast ops should deal with unranked tensors.

Also improves a few places in the code base (e.g., Toy tutorial) where a ranked tensor is assumed (e.g., because `getRank` is called) but a `TensorType` is currently used: cast to `RankedTensorType` directly, so that the assertion is triggered directly at the cast.

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

18 months ago[X86][mem-fold] Refine the code in X86FoldTablesEmitter.cpp, NFCI
Shengchen Kan [Thu, 6 Apr 2023 04:04:50 +0000 (12:04 +0800)]
[X86][mem-fold] Refine the code in X86FoldTablesEmitter.cpp, NFCI

1. Avoid vulnerable assumption: the enum of reg/memory format are continous
2. Remove redundant inline keyword
3. Replace getValueFromBitsInit with byteFromBitsInit b/c both Form and
   Opcode can be represented in 1 byte

18 months ago[mlir][bufferize] Simplify one_shot_bufferize transform op
Matthias Springer [Thu, 6 Apr 2023 03:58:46 +0000 (12:58 +0900)]
[mlir][bufferize] Simplify one_shot_bufferize transform op

Restrict the op to functions and modules. Such ops are modified in-place. The transform now consumes the handle and produces a new handle. The `target_is_module` attribute is no longer needed because a result handle is produced in either case.

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

18 months ago[mlir][linalg] Use TrackingListener for VectorizeOp
Matthias Springer [Thu, 6 Apr 2023 02:51:03 +0000 (11:51 +0900)]
[mlir][linalg] Use TrackingListener for VectorizeOp

This is needed so that the transform dialect interpreter is notified about deleted payload ops.

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

19 months ago[LAA] Group implementation of stride speculation into one file [nfc]
Philip Reames [Thu, 6 Apr 2023 01:12:47 +0000 (18:12 -0700)]
[LAA] Group implementation of stride speculation into one file [nfc]

These utilities are only used in one place, so move them there and make them static.

19 months agoRecommit [C++20] [Modules] Don't load declaration eagerly for named modules
Chuanqi Xu [Thu, 6 Apr 2023 03:01:58 +0000 (11:01 +0800)]
Recommit [C++20] [Modules] Don't load declaration eagerly for named modules

Close https://github.com/llvm/llvm-project/issues/61064.

The root cause of the issue is that we will deserilize some declarations
eagerly when reading the BMI. However, many declarations in the BMI are
not necessary for the importer. So it wastes a lot of time.

The new commit handles the MSVC's extension #pragma comment and #pragma
detect_mismatch to follow MSVC's behavior. See pr61783 for details.

19 months agoRevert "[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside...
Alexey Lapshin [Thu, 6 Apr 2023 02:55:26 +0000 (04:55 +0200)]
Revert "[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test."

This reverts commit 9ef701318b4590e1fa8bb61906d5957d7b1f6a2f.

19 months ago[RISCV] Add vector load/store intrinsics to getTgtMemIntrinsic.
Craig Topper [Thu, 6 Apr 2023 02:28:05 +0000 (19:28 -0700)]
[RISCV] Add vector load/store intrinsics to getTgtMemIntrinsic.

This constructs a proper memory operand for these intrinsics.

Segment load/store will be added in a separate patch.

Reviewed By: kito-cheng

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

19 months ago[PowerPC] Update pr61315.ll to address D146632 failure
Maryam Moghadas [Thu, 6 Apr 2023 01:56:19 +0000 (20:56 -0500)]
[PowerPC] Update pr61315.ll to address D146632 failure

This patch is to update pr61315.ll what was needed as part of
D146632 and caused build failures.

Reviewed By: stefanp

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

19 months ago[RISCV] Support vector type strict_[su]int_to_fp and strict_fp_to_[su]int.
Yeting Kuo [Tue, 28 Mar 2023 13:57:36 +0000 (21:57 +0800)]
[RISCV] Support vector type strict_[su]int_to_fp and strict_fp_to_[su]int.

Also the patch loose the fixed vector contraint in llvm/lib/IR/Verifier.cpp.

Reviewed By: craig.topper

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

19 months ago[mlir][arith] Add ValueBoundsOpInterface impls
Matthias Springer [Thu, 6 Apr 2023 01:46:48 +0000 (10:46 +0900)]
[mlir][arith] Add ValueBoundsOpInterface impls

These ops are useful for unit testing. (They do not fold/canonicalize with affine.apply etc.)

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

19 months ago[SelectionDAG] Expand VP SDNodes by default.
Craig Topper [Thu, 6 Apr 2023 01:52:28 +0000 (18:52 -0700)]
[SelectionDAG] Expand VP SDNodes by default.

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

19 months ago[mlir][memref] Add ValueBoundsOpInterface impls
Matthias Springer [Thu, 6 Apr 2023 01:35:12 +0000 (10:35 +0900)]
[mlir][memref] Add ValueBoundsOpInterface impls

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

19 months ago[mlir][linalg] ValueBoundsOpInterface: Add affine.apply op
Matthias Springer [Thu, 6 Apr 2023 01:15:11 +0000 (10:15 +0900)]
[mlir][linalg] ValueBoundsOpInterface: Add affine.apply op

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

19 months ago[PowerPC] Fix the xxperm swap requirements
Maryam Moghadas [Wed, 22 Mar 2023 14:14:00 +0000 (09:14 -0500)]
[PowerPC] Fix the xxperm swap requirements

This patch is to fix the xxperm vector operand swap condition so that the
single-use operand is in V2 to prevent copying, it also fixes the subtarget
condition to exploit the xpperm.

Reviewed By: stefanp

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

19 months ago[mlir][Interfaces] Add ValueBoundsOpInterface
Matthias Springer [Thu, 6 Apr 2023 00:41:15 +0000 (02:41 +0200)]
[mlir][Interfaces] Add ValueBoundsOpInterface

Ops can implement this interface to specify lower/upper bounds for their result values and block arguments. Bounds can be specified for:
* Index-type values
* Dimension sizes of shapes values

The bounds are added to a constraint set. Users can query this constraint set to compute bounds wrt. to a user-specified set of values. Only EQ bounds are supported at the moment.

This revision also contains interface implementations for various tensor dialect ops, which illustrates how to implement this interface.

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

19 months ago[RISCV][CostModel] Add tests for first class aggregate loads and stores
Philip Reames [Thu, 6 Apr 2023 00:41:05 +0000 (17:41 -0700)]
[RISCV][CostModel] Add tests for first class aggregate loads and stores

This adds coverage for the code change in 27b6ddbf6.

19 months ago[RISCV] Speculative fix for issue reported against D147470 post commit
Philip Reames [Thu, 6 Apr 2023 00:25:12 +0000 (17:25 -0700)]
[RISCV] Speculative fix for issue reported against D147470 post commit

19 months ago[Driver] Fix rpath for compiler-rt
Yaxun (Sam) Liu [Wed, 5 Apr 2023 23:38:37 +0000 (19:38 -0400)]
[Driver] Fix rpath for compiler-rt

The compiler-rt library path can be either {resource_dir}/lib/{triple}
or {resource_dir}/lib/{OS}/{arch} depending on whether
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default is ON or OFF.
Currently, the rpath added by -rtlib-add-rpath only adds
the latter. This patch checks both and adds the one that exists.

Reviewed by: Fangrui Song

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

19 months agoFix the check in StopInfoBreakpoint for "are we currently running an expression"
Jim Ingham [Thu, 6 Apr 2023 00:10:42 +0000 (17:10 -0700)]
Fix the check in StopInfoBreakpoint for "are we currently running an expression"

We were checking "WasTheLastResumeForUserExpression" but that returns true even
if that expression was completed, provided we haven't run again.  This uses a
better check.

This is actually fairly hard to trigger.  It happens the first time you hit an
objc_exception_throw breakpoint and invoke that frame recognizer for that.  But
I couldn't trigger it using a Python based frame recognizer.  So I wrote a test
for the objc_exception_throw_breakpoint recognizer which should have been there
anyway...  It fails (the target auto-continues) w/o this patch and succeeds with
it.

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

19 months ago[gn] port 405ceaa09de0
Nico Weber [Thu, 6 Apr 2023 00:13:57 +0000 (20:13 -0400)]
[gn] port 405ceaa09de0

19 months agoRevert "[scudo] Switch to use MemMap in tests"
Chia-hung Duan [Thu, 6 Apr 2023 00:06:34 +0000 (00:06 +0000)]
Revert "[scudo] Switch to use MemMap in tests"

This reverts commit 4151477021170d8937f8fc820187d5934eb93c7d.

19 months ago[scudo] Fix __require_constant_initialization__ on Android
Chia-hung Duan [Wed, 5 Apr 2023 22:38:32 +0000 (22:38 +0000)]
[scudo] Fix __require_constant_initialization__ on Android

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

19 months ago[lsan] Rename IgnoreObjectLocked into IgnoreObject
Vitaly Buka [Wed, 5 Apr 2023 23:16:49 +0000 (16:16 -0700)]
[lsan] Rename IgnoreObjectLocked into IgnoreObject

We don't lock allocator for this call.

19 months ago[hwasan] Use GetBlockBegin instead of GetBlockBeginFastLocked
Vitaly Buka [Wed, 5 Apr 2023 23:12:04 +0000 (16:12 -0700)]
[hwasan] Use GetBlockBegin instead of GetBlockBeginFastLocked

Asan and lsan use non-locked version as well.
IgnoreObjectLocked name is missleading.

19 months ago[mlir][sparse][gpu] end-to-end example with sparse GPU pipeline
Aart Bik [Tue, 4 Apr 2023 22:14:32 +0000 (15:14 -0700)]
[mlir][sparse][gpu] end-to-end example with sparse GPU pipeline

Reviewed By: Peiming

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

19 months ago[MSP430] Add CFI instructions for MSP430.
Ilia Kuklin [Wed, 5 Apr 2023 22:49:53 +0000 (15:49 -0700)]
[MSP430] Add CFI instructions for MSP430.

Implement emission of DWARF CFI instructions for MSP430. This includes descriptions of stack frame layout and location of callee-saved registers that could be used for backtracing.

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

19 months ago[Tests] More InlineCost tests with attributes only on callsites
Dávid Bolvanský [Wed, 5 Apr 2023 22:49:55 +0000 (00:49 +0200)]
[Tests] More InlineCost tests with attributes only on callsites

19 months ago[Clang][NFC] Refactor "Designators" to be more similar
Bill Wendling [Tue, 4 Apr 2023 23:17:52 +0000 (16:17 -0700)]
[Clang][NFC] Refactor "Designators" to be more similar

This makes the two interfaces for designators more similar so that it's
easier to merge them together in a future refactoring.

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

19 months agoLazily deserialize default member initializers.
Richard Smith [Wed, 5 Apr 2023 21:28:57 +0000 (14:28 -0700)]
Lazily deserialize default member initializers.

This is important to break deserialization cycles, where a lambda in a
default member initializer can refer to the field as its context
declaration, and the initializer of the field can refer back to the
lambda.

This is a follow-up to bc73ef0031b5, which applied the same fix to
variable declarations for the same reason.

19 months agoRegAllocFast: Fix dropping subreg indexes on unassigned subreg defs
Matt Arsenault [Fri, 3 Mar 2023 17:11:58 +0000 (13:11 -0400)]
RegAllocFast: Fix dropping subreg indexes on unassigned subreg defs

This was assuming all register operands were assigned to physical registers.
This should ignore the operands which weren't assigned in this run.

Fixes #61134

19 months ago[mlir][sparse][gpu] sparse GPU code generator pipeline setup
Aart Bik [Wed, 5 Apr 2023 19:57:23 +0000 (12:57 -0700)]
[mlir][sparse][gpu] sparse GPU code generator pipeline setup

Reviewed By: Peiming

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

19 months ago[isel] Pre-commit test for pr61964 fix
Han Zhu [Wed, 5 Apr 2023 22:01:04 +0000 (15:01 -0700)]
[isel] Pre-commit test for pr61964 fix

19 months ago[Tests] Added InlineCost test when arg is known as dereferenceable
Dávid Bolvanský [Wed, 5 Apr 2023 21:58:06 +0000 (23:58 +0200)]
[Tests] Added InlineCost test when arg is known as dereferenceable

19 months ago[AMDGPU] Add Lower Bound to PipelineSolver
Jeff Byrnes [Thu, 23 Mar 2023 16:59:31 +0000 (09:59 -0700)]
[AMDGPU] Add Lower Bound to PipelineSolver

19 months agoReland "[-Wunsafe-buffer-usage] Fix-Its transforming `&DRE[any]` to `&DRE.data()...
Ziqing Luo [Wed, 5 Apr 2023 21:52:49 +0000 (14:52 -0700)]
Reland "[-Wunsafe-buffer-usage] Fix-Its transforming `&DRE[any]` to `&DRE.data()[any]`"

This commit relands 87b5807d3802b932c06d83c4287014872aa2caab, where a
test fails on a few specific targets.  Now hard-code a target
for the test.

19 months ago[flang] Nonconformant assigned gotos
V Donaldson [Wed, 5 Apr 2023 18:13:36 +0000 (11:13 -0700)]
[flang] Nonconformant assigned gotos

Modify code generation for assigned gotos to generate a runtime error
for most cases that violate F90 Clause 8.2.4, rather than treating a
nonconformant GOTO as a nop. For example, generate a runtime error for
a GOTO that attempts to branch to a label for a FORMAT statement.
Relax the requirement that an assigned GOTO with a label list must
branch to a label in the list, and instead allow a branch to any valid
assigned GOTO target in scope.

19 months ago[clang-format] Fix bugs with "LambdaBodyIndentation: OuterScope"
Jon Phillips [Wed, 5 Apr 2023 21:28:56 +0000 (14:28 -0700)]
[clang-format] Fix bugs with "LambdaBodyIndentation: OuterScope"

The previous implementation of the option corrupted the parenthesis
state stack. (See https://reviews.llvm.org/D102706.)

Fixes #55708.
Fixes #53212.
Fixes #52846.
Fixes #59954.

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

19 months ago[scudo] Switch to use MemMap in tests
Chia-hung Duan [Wed, 5 Apr 2023 21:19:11 +0000 (21:19 +0000)]
[scudo] Switch to use MemMap in tests

Reviewed By: cferris

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

19 months ago[scudo] Manage pages with MemMap in Secondary Allocator
Chia-hung Duan [Tue, 4 Apr 2023 21:32:22 +0000 (21:32 +0000)]
[scudo] Manage pages with MemMap in Secondary Allocator

Replace the uses of raw map()/unmap(), .etc calls with MemMap. Also
remove the direct use of MapPlatformData in the secondary allocator.

Also add setMemoryPermission() in MemMap.

Reviewed By: cryptoad

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

19 months ago[scudo] Manage pages with MemMap in SizeClassAllocator64
Chia-hung Duan [Tue, 4 Apr 2023 20:13:13 +0000 (20:13 +0000)]
[scudo] Manage pages with MemMap in SizeClassAllocator64

Introduce a new data structure to manage the allocated pages from the
system. This is meant to deprecate certain memory system call wrappers
in Scudo, e.g., map()/unmap(). Besides, we would like to make
MapPlatformData to be appeared in platform specific data structure only.
Given that there are several allocators in Scudo and each of them has
different way of page management. The deprecation will be done in
several CLs. In this commit, we start from SizeClassAllocator64.

Reviewed By: cferris

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

19 months ago[amdgpu][nfc] Remove dead code associated with LDS lowering
Jon Chesterfield [Wed, 5 Apr 2023 21:24:21 +0000 (22:24 +0100)]
[amdgpu][nfc] Remove dead code associated with LDS lowering

Pass disabled since approximately D104962 for miscompiling openmp

The functions under ReplaceConstant miscompile phis as noted in D112717 and
have no users in tree other than the disabled pass. It seems likely it has no
users out of tree.

Deletes the test cases associated with the disabled pass as well.

Reviewed By: rampitec

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

19 months agoMark threadIdx.x and friends as noundef.
Justin Lebar [Wed, 5 Apr 2023 06:36:06 +0000 (23:36 -0700)]
Mark threadIdx.x and friends as noundef.

threadIdx.x and similar functions never return undef.

Simple enough to say, but why does it matter?

Consider the following IR that reads threadIdx.x and blockIdx.x.

  %a = call i32 @llvm.nvvm.read.ptx.sreg.ctaid.x(), !range !138
  %b = call i32 @llvm.nvvm.read.ptx.sreg.tid.x(), !range !139
  %c = shl nuw nsw i32 %a, 6
  %linear_index = or i32 %c, %b
  %linear_index.fr = freeze i32 %linear_index

If %a or %b may be undef, then computeKnownBits will not recurse through
the freeze instruction.  Therefore we will not know anything about the
known bits of linear_index.fr, even though we have range metadata!  Bad
Things fall out of this.

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

19 months ago[flang] Keep the extended value for assumed-type optional
Valentin Clement [Wed, 5 Apr 2023 20:34:23 +0000 (13:34 -0700)]
[flang] Keep the extended value for assumed-type optional

Keep the extended value when lowering optional assumed type
dummy argument. The extended value is needed to lower correctly the
rest of the code.

Reviewed By: PeteSteinfeld, jeanPerier

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

19 months ago[libc] Only add extra runtime dependencies if the target exists
Joseph Huber [Wed, 5 Apr 2023 20:30:48 +0000 (15:30 -0500)]
[libc] Only add extra runtime dependencies if the target exists

Summary:
If the target for these tools doesn't exist we should simply assume that
they will be provided externally. This allows building `libc` standalone
with an external installation of `clang`.

19 months agoUpdate clang :: Driver/debug-options.c to fix the buildbots
Matthew Voss [Wed, 5 Apr 2023 20:25:04 +0000 (13:25 -0700)]
Update clang :: Driver/debug-options.c to fix the buildbots

The format of the LTO debug options generated for orbis-ld changed,
breaking this test.

https://lab.llvm.org/buildbot/#/builders/230/builds/11367

19 months ago[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test.
Alexey Lapshin [Wed, 5 Apr 2023 18:45:00 +0000 (20:45 +0200)]
[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD_LOCAL inside unit test.

Not all platform support C++11 thread_local. Use portable
LLVM_THREAD_LOCAL macro instead.

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

19 months ago[OpenMP] Add tool dependencies in runtimes mode
Joseph Huber [Wed, 5 Apr 2023 19:24:34 +0000 (14:24 -0500)]
[OpenMP] Add tool dependencies in runtimes mode

The OpenMP offloading device runtime depends on multiple tools. We
should ensure that these tools are build before invoking the OpenMP
build.

Reviewed By: tra

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

19 months ago[libc] Search for the CUDA patch explicitly when testing
Joseph Huber [Wed, 5 Apr 2023 19:16:53 +0000 (14:16 -0500)]
[libc] Search for the CUDA patch explicitly when testing

The packaged version of the `libc` library does not depend on the CUDA
installation because it only uses `clang` and emits LLVM-IR. However,
for testing we directly need the CUDA toolkit to emit and execute the
files. This patch explicitly passes `--cuda-path` to the relevant
compilations for NVPTX testing.

Reviewed By: tra

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

19 months ago[CMake] Support runtimes targets without specifying triple
Petr Hosek [Wed, 30 Jun 2021 06:34:18 +0000 (23:34 -0700)]
[CMake] Support runtimes targets without specifying triple

Currently, for BUILTIN_TARGETS and RUNTIME_TARGETS you can either use
the special "default" value, or a target triple.

For the "default" value, we don't set any target triple and passthrough
a subset of CMake variables into the subbuild. This is typically used
on Darwin where we build universal binaries and a single target triple
therefore isn't sufficient.

For the target triple value, you can set arbitrary CMake variables
through RUNTIMES_<target>_<variable>, but we always set target triple
to <target>. This gives more flexibility, because we can precisely
control what variables are set in the subbuild, but is unsuitable for
platforms like Darwin.

To address this, we would like to introduce a third option which is
similar to the second option, except we won't set target triple in
the subbuild (you can always do so yourself by setting the appropriate
CMake variable, e.g. RUNTIMES_<name>_CMAKE_C_COMPILER_TARGET=<triple>).

This change is a first step in that direction, by eliminating the support
of target triples from builtin_register_target and runtime_register_target
helper functions.

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

19 months ago[NFC][clang] Fix Coverity static analyzer tool concerns about auto_causes_copy
Manna, Soumi [Wed, 5 Apr 2023 19:41:54 +0000 (15:41 -0400)]
[NFC][clang] Fix Coverity static analyzer tool concerns about auto_causes_copy

    Reported by Coverity:

    AUTO_CAUSES_COPY
    Unnecessary object copies can affect performance

    Inside FrontendActions.cpp file,
    In clang::DumpModuleInfoAction::ExecuteAction(): Using the auto keyword without an & causes the copy of an object of type pair.

    Inside ComputeDependence.cpp file,
    In clang::computeDependence(clang::OverloadExpr *, bool, bool, bool): Using the auto keyword without an & causes the copy of an object of type TemplateArgumentLoc.

    Reviewed By: erichkeane, aaron.ballman

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

19 months ago[PS4][clang] Fix the format of the LTO debug options passed to orbis-ld
Matthew Voss [Wed, 5 Apr 2023 19:57:21 +0000 (12:57 -0700)]
[PS4][clang] Fix the format of the LTO debug options passed to orbis-ld

Currently, we pass multiple LTO debug options to orbis-ld like this:

orbis-ld --lto=thin --lto-thin-debug-options=<arg1> --lto-thin-debug-options=<arg2> ...

When it should be like this:

orbis-ld --lto=thin "--lto-thin-debug-options= <arg1> <arg2>" ...

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

19 months ago[clang][deps] NFC: Make PCH test more debuggable
Jan Svoboda [Wed, 5 Apr 2023 19:27:07 +0000 (12:27 -0700)]
[clang][deps] NFC: Make PCH test more debuggable

Overwriting CDB files made it difficult to debug earlier clang-scan-deps invocations. This commit creates separate files for each.

19 months ago[clang][deps] NFC: Don't collect PCH input files
Jan Svoboda [Wed, 5 Apr 2023 19:25:10 +0000 (12:25 -0700)]
[clang][deps] NFC: Don't collect PCH input files

Since b4c83a13, PCH input files are no longer necessary.

19 months agoRemove unintended __sanitizer_get_allocation_bounds declaration
Thurston Dang [Mon, 3 Apr 2023 23:44:29 +0000 (23:44 +0000)]
Remove unintended __sanitizer_get_allocation_bounds declaration

This removes an unintentional function declaration, that was accidentally
added in D147005 (from an incomplete refactoring of __sanitizer_get_allocation_bounds).

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

19 months agoRevert "[clang][lit] Make LIT aware of env CLANG_CRASH_DIAGNOSTICS_DIR."
Francesco Petrogalli [Wed, 5 Apr 2023 18:53:20 +0000 (20:53 +0200)]
Revert "[clang][lit] Make LIT aware of env CLANG_CRASH_DIAGNOSTICS_DIR."

This reverts commit 029212617ca8bdedd949d17bf2d33750605ea607.

Reverting because of failures when setting
`CLANG_CRASH_DIAGNOSTICS_DIR` before invoking `ninja check-clang`.

19 months ago[libc][NFC] Rework generic memory operations
Guillaume Chatelet [Wed, 5 Apr 2023 18:47:39 +0000 (18:47 +0000)]
[libc][NFC] Rework generic memory operations

19 months agoAdd release note for D147569.
Zequan Wu [Wed, 5 Apr 2023 18:43:52 +0000 (14:43 -0400)]
Add release note for D147569.

19 months ago[Coverage] Fix crash when visiting PseudoObjectExpr.
Zequan Wu [Tue, 4 Apr 2023 20:40:11 +0000 (16:40 -0400)]
[Coverage] Fix crash when visiting PseudoObjectExpr.

This is a split of D147073.

Fixes #45481

Reviewed By: aaron.ballman

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