Commit Graph

432132 Commits

Author SHA1 Message Date
Rashmi Mudduluru 13bc713109 fixes clang-tidy/checks/list.rst: a line was accidentally removed in 95a92995d4 2022-08-05 12:36:03 -07:00
Ben Langmuir fb89cc0ddb [clang][modules] Don't depend on sharing FileManager during module build
Sharing the FileManager between the importer and the module build should
only be an optimization. Add a cc1 option -fno-modules-share-filemanager
to allow us to test this. Fix the path to modulemap files, which
previously depended on the shared FileManager when using path mapped to
an external file in a VFS.

Differential Revision: https://reviews.llvm.org/D131076
2022-08-05 12:24:40 -07:00
Ben Langmuir d038bb196c [clang] Fix redirection behaviour for cached FileEntryRef
In 6a79e2ff19 we changed Filemanager::getEntryRef() to return the
redirecting FileEntryRef instead of looking through the redirection.
This commit fixes the case when looking up a cached file path to also
return the redirecting FileEntryRef. This mainly affects the behaviour
of calling getNameAsRequested() on the resulting entry ref.

Differential Revision: https://reviews.llvm.org/D131273
2022-08-05 12:23:38 -07:00
Jack Kirk 3e0e5568a6 [CUDA] Fixed sm version constrain for __bmma_m8n8k128_mma_and_popc_b1.
As stated in
https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#warp-level-matrix-instructions-wmma-mma:
".and operation in single-bit wmma requires sm_80 or higher."

tra@: Fixed a bug in builtins-nvptx-mma.py test generator and regenerated the tests.

Differential Revision: https://reviews.llvm.org/D131265
2022-08-05 12:14:06 -07:00
Philip Reames 9a9848f4b9 [RISCVInsertVSETVLI] Remove an unsound optimization
This fixes a bug reported privately by @craig.topper. Here's an example which illustrates the problem:

vsetivli a1, a0, e32, m1, ta, mu # both DefInfo and PrevInfo
vsetivli a2, a1, e32, m4, ta, mu

With the unsound result being:

vsetivli a1, a0, e32, m1, ta, mu
vsetivli a2, a0, e32, m4, ta, mu

Consider the case where this is running on a machine with VLEN=512,. For this case, the VLMAXs are 16 and 64 respectively.

Consider for a0 = 33. The correct result is: a1 = 16, and a2 = 16

After the unsound optimization: a1 = 16 and a2 = 33

This particular example used VLMAXs which differed by more than a power of two. With a difference of only one power of two, there's another form of this bug which involves the AVL < 2 x VLMAX special case, but that ones more complicated to construct as many examples turn out accidentally sound.

This patch takes the approach of simply removing the unsound optimization, but there are multiple sound sub-cases of it. I plan to return to at least a couple of them, but figured it was cleaner to remove the unsound optimization (for ease of backporting), and then review the new optimizations on their own.

Differential Revision: https://reviews.llvm.org/D131264
2022-08-05 12:13:08 -07:00
Zhaoshi Zheng 99e50e5838 [WinEH][ARM64] Split Unwind Info for Fucntions Larger than 1MB
Create function segments and emit unwind info of them.

A segment must be less than 1MB and no prolog or epilog is splitted between two
segments.

This patch should generate correct, though not optimal, unwind info for large
functions. Currently it only generate pacted info (.pdata) only for functions
that are less than 1MB (single-segment functions). This is NFC from before this
patch.

The next step is to enable (.pdata) only unwind info for the first segment or
segments that have neither prolog or epilog in a multi-segment function.

Another future work item is to further split segments that require more than 255
code words or have more than 65535 epilogs.

Reference:
https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling#function-fragments

Differential Revision: https://reviews.llvm.org/D130049
2022-08-05 11:46:41 -07:00
Slava Zakharin f1eb945f9a [flang] Propagate lowering options from driver.
This commit addresses concerns raised in D129497.

Propagate lowering options from driver to expressions lowering
via AbstractConverter instance. A single use case so far is
using optimized TRANSPOSE lowering with O1/O2/O3.

bbc does not support optimization level switches, so it uses
default LoweringOptions (e.g. optimized TRANSPOSE lowering
is enabled by default, but an engineering -opt-transpose=false
option can still override this).

Differential Revision: https://reviews.llvm.org/D130204
2022-08-05 11:29:45 -07:00
Jonas Devlieghere 9c81b743e3
[lldb] Improve EXC_RESOURCE exception reason
Jason noted that the stop message we print for a memory high water mark
notification (EXC_RESOURCE) could be clearer. Currently, the stop
reason looks like this:

  * thread #3, queue = 'com.apple.CFNetwork.LoaderQ', stop reason =
    EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=14 MB, unused=0x0)

It's hard to read the message because the exception and the type
(EXC_RESOURCE RESOURCE_TYPE_MEMORY) blend together. Additionally, the
"observed=0x0" should not be printed for memory limit exceptions.

I wanted to continue to include the resource type from
<kern/exc_resource.h> while also explaining what it actually is. I used
the wording from the comments in the header. With this path, the stop
reason now looks like this:

  * thread #5, stop reason = EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high
    watermark memory limit exceeded) (limit=14 MB)

rdar://40466897

Differential revision: https://reviews.llvm.org/D131130
2022-08-05 11:19:46 -07:00
Jeff Bailey f493b21e16 [libc] Update look and feel of libc.llvm.org
This design is borrowed from the lldb folks (thank you!) to declutter
the page.

 * The version number at the top is removed.
 * Links are pushed over to a sidebar
 * The sidebar has headings

There are other minor changes:

* The warning about this project not being ready is now an RST "warning"
* Links to the Bug Reports and the Source Code are Added
* Refer to this project as either "The LLVM C LIbrary" or "The libc"

Tested:
Built locally

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D131242
2022-08-05 18:18:40 +00:00
Jim Ingham 0948f1cf81 Reapply the commits to enable accurate hit-count detection for watchpoints.
This commit combines the initial commit (7c240de609af), a fix for x86_64 Linux
(3a0581501e76) and a fix for thinko in a last minute rewrite that I really
should have run the testsuite on.

Also, make sure that all the "I need to step over watchpoint" plans execute
before we call a public stop.  Otherwise, e.g. if you have N watchpoints and
a Signal, the signal stop info will get us to stop with the watchpoints in a
half-done state.

Differential Revision: https://reviews.llvm.org/D130674
2022-08-05 11:01:27 -07:00
Eugene Zhulenev 292e8ed49a [mlir] Use SymbolUserOpInterface in LLVM::AddressOfOp verifier
Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D131271
2022-08-05 10:51:30 -07:00
Lei Zhang 1f7544a679 [mlir][spirv] Add default Vulkan memory space to storage class mapping
Reviewed By: ThomasRaoux, kuhar

Differential Revision: https://reviews.llvm.org/D131128
2022-08-05 12:30:14 -04:00
Lei Zhang 713f85d595 [mlir][spirv] Add a pass to map memref memory space
MemRef types now can carry an attribute to represent the memory
space. Still, upper layers in the compilation stack mostly use
nuemric values. They don't mean much (other than differentiating
separate memory domains) in MLIR's multi-level settings. Those
numeric memory space inside MemRef types need to be translated
into concrete SPIR-V storage classes during lowering to pin down
to concrete memory types.

Thus far we have been hardcoding an arbitrary mapping from memory
space to storage class for converting MemRef types. This works fine
for only targeting Vulkan; it falls apart if we want to target other
SPIR-V consumers like OpenCL, as different consumers might want
different storage classes for the buffer/variable of the same
lifetime. For example, StorageClass in Vulkan vs. CrossWorkgroup
in OpenCL.

So putting up a new pass to let the user to control how to map
MemRef memory spaces into SPIR-V storage classes. This provides
more flexibility and can address the awkwardness in the current
SPIR-V type converter. This pass should be the prelimiary step
towards lowering MemRef related types/ops into SPIR-V.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D130317
2022-08-05 12:20:06 -04:00
Sanjay Patel b63fc26d33 [InstSimplify] make uses of isImpliedCondition more efficient (NFCI)
As suggested in the post-commit comments for 019d76196f,
this makes the usage symmetric with the 'and' patterns and should
be more efficient.
2022-08-05 12:06:47 -04:00
Paul Walker 0533c39a76 [SVE] Expand DUPM patterns to handle all integer vector types.
NOTE: i8 vector splats are ignored because the immediate range of
DUP already has full coverage.

Differential Revision: https://reviews.llvm.org/D131078
2022-08-05 16:00:08 +00:00
Than McIntosh 24a62bfe9a tsan: fix bug in shadow reset introduced in D128909
Correct a bug in the code that resets shadow memory introduced as part
of a previous change for the Go race detector (D128909). The bug was
that only the most recently added shadow segment was being reset, as
opposed to the entire extent of the segment created so far. This
fixes a bug identified in Google internal testing (b/240733951).

Differential Revision: https://reviews.llvm.org/D131256
2022-08-05 11:36:58 -04:00
Sanjay Patel 019d76196f [InstSimplify] use isImpliedCondition() instead of semi-duplicated code
We get a couple of improvements from recognizing swapped
operand patterns that were not handled by the replicated
code.

This should also enable simplifying larger patterns as
seen in issue #56653 and issue #56654, but that requires
enhancements to isImpliedCondition() itself.
2022-08-05 10:59:09 -04:00
Filipp Zhinkin 249a7ed750 [x86] add tests for bitwise logic of funnel shifts; NFC
Baseline tests for D130994
2022-08-05 10:45:43 -04:00
Nikita Popov 542977d438 Revert "[compiler-rt][CMake] Enable TF intrinsics on powerpc32 Linux"
As mentioned in https://reviews.llvm.org/D121379#3690593, this
change broke the build of compiler-rt targeting powerpc using GCC.
The 32-bit powerpc target is not supposed to emit 128-bit libcalls
-- if it does, then that's a backend bug and needs to be fixed there.

This reverts commit 8f24a56a3a.

Differential Revision: https://reviews.llvm.org/D130988
2022-08-05 16:43:44 +02:00
Tue Ly 131dda9acc [libc] Implement sincosf function correctly rounded to all rounding modes.
Refactor common range reductions and evaluations for sinf, cosf, and
sincosf.  Added exhaustive tests for sincosf.

Performance before the patch:
```
System LIBC reciprocal throughput : 30.205
LIBC reciprocal throughput        : 30.533

System LIBC latency : 67.961
LIBC latency        : 61.564
```
Performance after the patch:
```
System LIBC reciprocal throughput : 30.409
LIBC reciprocal throughput        : 20.273

System LIBC latency : 67.527
LIBC latency        : 61.959
```

Reviewed By: orex

Differential Revision: https://reviews.llvm.org/D130901
2022-08-05 09:58:01 -04:00
Mirko Brkusanin 19bb535ed9 [AMDGPU] Remove unused MIMG tablegen variants
There are no AMDGPUSampleVariant versions for _G16, it is treated more like a
modifier for derivatives (_D) (also for intrinsics where it is overloaded type
instead of part of instrinsic name) so we ended up making more variants for
these instruction then we actually needed.

32-bit derivatives need 6 dwords at most, while 16-bit need 4 at most. Using
same AMDGPUSampleVariant for both, we ended up creating 2 extra variants per
instruction than were necessary.

In total this deletes 260 unused tablegen records.

Differential Revision: https://reviews.llvm.org/D131252
2022-08-05 15:30:47 +02:00
Aaron Ballman 4bc9e60306 Removing redundant code; NFC
The same predicate is checked on line 12962 just above the removed code.
2022-08-05 09:17:20 -04:00
Alexander Belyaev 6b03bae346 Revert "[mlir] Extract offsets-sizes-strides computation from `makeTiledShape(s)`."
This reverts commit 56d94b3b90.
2022-08-05 14:53:35 +02:00
Dawid Jurczak 1bd31a6898 [NFC] Add SmallVector constructor to allow creation of SmallVector<T> from ArrayRef of items convertible to type T
Extracted from https://reviews.llvm.org/D129781 and address comment:
https://reviews.llvm.org/D129781#3655571

Differential Revision: https://reviews.llvm.org/D130268
2022-08-05 13:35:41 +02:00
David Green b2de84633a [ConstProp] Don't fallthorugh for poison constants on vctp and active_lane_mask.
Given a poison constant as input, the dyn_cast to a ConstantInt would
fail so we would fall through to the generic code that attempts to fold
each element of the input vectors. The inputs to these intrinsics are
not vectors though, leading to a compile time crash. Instead bail out
properly for poison values by returning nullptr. This doesn't try to
define what poison means for these intrinsics.

Fixes #56945
2022-08-05 11:19:36 +01:00
David Spickett c401dbde71 [llvm][IROutliner] Account for return void in sort comparator
This fixes 69 llvm tests that failed when EXPENSIVE_CHECKS was enabled.
llvm/test/Transforms/IROutliner/outlining-commutative-operands-opposite-order.ll
is one example.

When we have EXPENSIVE_CHECKS, _GLIBCXX_DEBUG is defined. This means
that libstdc++ will call the compare function to check if it is
implemented correctly (that !(a < a) is true).

This happens even if there is only one item and here, we expect
to see one return void or multiple return constant integer.

Don't sort if we have 1 item, but do assert that it is the 1
ret void we expect. In the comparator, assert that neither
Value is a nullptr in case one ended up in a the list somehow.

Reviewed By: AndrewLitteken

Differential Revision: https://reviews.llvm.org/D130230
2022-08-05 09:36:43 +00:00
Phoebe Wang 2312b747b8 [X86] Move getting module flag into `runOnMachineFunction` to reduce compile-time. NFCI
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D131245
2022-08-05 01:58:17 -07:00
Dimitry Andric 45c056b1fb [CMake] Find python before searching for python modules
In the top-level llvm `CMakeLists.txt`, we need to call
`find_package(Python3)` *before* including `config-ix.cmake`, otherwise
the latter will not be able to successfully search for python modules
using `find_python_module()`. Also set `LLVM_MINIMUM_PYTHON_VERSION`
before calling `find_package(Python3)`, moving it to `CMakeLists.txt`
from `HandleLLVMOptions.cmake`.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D131191
2022-08-05 10:48:09 +02:00
Chuanqi Xu 809b416641 [NFC] Requires x86-registered-target for test/pr56919.cpp 2022-08-05 16:46:38 +08:00
Balázs Kéri 501faaa0d6 [clang][analyzer] Add more wide-character functions to CStringChecker
Support for functions wmempcpy, wmemmove, wmemcmp is added to the checker.
The same tests are copied that exist for the non-wide versions, with
non-wide functions and character types changed to the wide version.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D130470
2022-08-05 10:32:53 +02:00
Nathan James 4c106c93eb
[clangd] Change the url for clang-tidy check documentation
In 6e566bc552, The directory structure of the documentation for clang-tidy checks was changed, however clangd wasn't updated.
Now all the links generated will point to old dead pages.
This updated clangd to use the new page structure.

Reviewed By: sammccall, kadircet

Differential Revision: https://reviews.llvm.org/D128379
2022-08-05 08:42:52 +01:00
wanglei 57eb77d411 [LoongArch] Implement more of the ABI
According to the description of the LoongArch abi documentation,
(https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html)
the calling convention of LoongArch is almost the same as the RISCV's
(except for the vector part), so we borrow the implementation of RISCV.

This patch only guarantees the correctness of lp64d, because only the
part of lp64d is described in detail in the documentation.

Differential Revision: https://reviews.llvm.org/D130249
2022-08-05 15:14:16 +08:00
David Green 408378a0b3 [AArch64] Tone down the number of repeated fmov N2 scheduling tests. NFC 2022-08-05 08:11:57 +01:00
Chuanqi Xu 230d6f93aa [Coroutines] Remove lifetime intrinsics for spliied allocas in coroutine frames
Closing https://github.com/llvm/llvm-project/issues/56919

It is meaningless to preserve the lifetime markers for the spilled
allocas in the coroutine frames and it would block some optimizations
too.
2022-08-05 14:50:43 +08:00
David Green 38c2366b3f [AArch64][GlobalISel] Recognise some CCMPri
This is a simple addition to emitConditionalComparison, to match CCMP
with immediates using getIConstantVRegValWithLookThrough, letting it
select the CCMPri variants of the instructions.

Differential Revision: https://reviews.llvm.org/D131073
2022-08-05 07:48:42 +01:00
Xiang Li b2c9ff7273 [NFC][HLSL] Fix build error caused missing typo update.
setHLSLFnuctionAttributes to setHLSLFunctionAttributes.

Differential Revision: https://reviews.llvm.org/D131240
2022-08-04 23:20:25 -07:00
Xiang Li 6134629af0 [NFC][HLSL] Fix typo in CGHLSLRuntime.
Change setHLSLFnuctionAttributes to setHLSLFunctionAttributes.

Differential Revision: https://reviews.llvm.org/D131238
2022-08-04 23:08:40 -07:00
Austin Kerbow b568cb1064 [AMDGPU] Pre-commit tests for D130797 2022-08-04 22:52:54 -07:00
Timm Bäder d1942855c4 [clang] Consider array filler in MaybeElementDependentArrayfiller()
Any InitListExpr may have an array filler and since we may be evaluating
the array filler as well, we need to take into account that the array
filler expression might make the InitListExpr element dependent.

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

Differential Revision: https://reviews.llvm.org/D131155
2022-08-05 06:47:49 +02:00
Timm Bäder 8b74074731 [clang][sema] Fix collectConjunctionTerms()
Consider:

A == 5 && A != 5

IfA is 5, the old collectConjunctionTerms() would call itself again for
the LHS (which it ignores), then the RHS (which it also ignores) and
then just return without ever adding anything to the Terms array.

Differential Revision: https://reviews.llvm.org/D131070
2022-08-05 06:45:32 +02:00
Xiang Li 906e41f4e3 [HLSL] clang codeGen for HLSLShaderAttr.
Translate HLSLShaderAttr to IR level.
 1. Skip mangle for hlsl entry functions.
 2. Add function attribute for hlsl entry functions.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D124752
2022-08-04 21:23:57 -07:00
Shilei Tian 294bbdc0b8 [NFC] Fix wrong header in `LibC.cpp` 2022-08-04 23:54:07 -04:00
Paul Kirth a812b39e8c [llvm][ir] Add missing license to ProfDataUtils
We failed to add these in D128860 or D128858

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D131226
2022-08-05 03:39:13 +00:00
Florian Mayer fc6a6ee507 [libunwind] undef NDEBUG for assert.h in tests.
This makes sure the assertions also get verified in optimized builds.
This matches what is already done in bad_unwind_info.pass.cpp.

Reviewed By: #libunwind, MaskRay

Differential Revision: https://reviews.llvm.org/D131210
2022-08-04 19:55:40 -07:00
Jeff Bailey 3b631e47fe [libc] Trivial implementation of std::optional
This class has only the minimum functionality in it to provide what the
TZ variable parsing needs.  In particular, the standard makes guarantees
about how trivial the destructors are, throws an expception if it's used
incorrectly, etc.  There are also missing features.

Tested:
Trivial testsuite added, and use in development.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D129920
2022-08-05 02:51:44 +00:00
jacquesguan 40d74fcb55 [mlir][Math] Add constant folder for Atan2Op.
This patch adds constant folder for Atan2Op which only supports single and double precision floating-point.

Differential Revision: https://reviews.llvm.org/D131050
2022-08-05 10:30:58 +08:00
Phoebe Wang 7f648d27a8 Reland "[X86][MC] Always emit `rep` prefix for `bsf`"
`BMI` new instruction `tzcnt` has better performance than `bsf` on new
processors. Its encoding has a mandatory prefix '0xf3' compared to
`bsf`. If we force emit `rep` prefix for `bsf`, we will gain better
performance when the same code run on new processors.

GCC has already done this way: https://c.godbolt.org/z/6xere6fs1

Fixes #34191

Reviewed By: craig.topper, skan

Differential Revision: https://reviews.llvm.org/D130956
2022-08-05 10:22:48 +08:00
Tue Ly c308a88716 [libc] Add subtraction for UInt<N> class.
Add subtraction operators (-, -=) for UInt<N> class.

Reviewed By: michaelrj, orex

Differential Revision: https://reviews.llvm.org/D131196
2022-08-04 20:37:43 -04:00
Walter Erquinigo 6fb744be76 [trace][intel pt] Support a new kernel section in LLDB’s trace bundle schema
Add a new "kernel" section with following schema.

```
"kernel": {
  "loadAddress"?: decimal | hex string | string decimal
  # This is optional. If it's not specified, use default address 0xffffffff81000000.
  "file": string
  # path to the kernel image
}
```

Here's more details of the diff:
- If "kernel" section exist, it means current tracing mode is //KernelMode//.
- If tracing mode is //KernelMode//, the "processes" section must be empty and the "kernel" and "cpus" section must be provided. This is tested with `TestTraceLoad`.
- "kernel" section is parsed and turned into a new process with a single module which is the kernel image. The kernel process has N fake threads, one for each cpu.

Reviewed By: wallace

Differential Revision: https://reviews.llvm.org/D130805
2022-08-04 17:15:08 -07:00
Ellis Hoag 6f4c3c0f64 [InstrProf][attempt 2] Add new format for -fprofile-list=
In D130807 we added the `skipprofile` attribute. This commit
changes the format so we can either `forbid` or `skip` profiling
functions by adding the `noprofile` or `skipprofile` attributes,
respectively. The behavior of the original format remains
unchanged.

Also, add the `skipprofile` attribute when using
`-fprofile-function-groups`.

This was originally landed as https://reviews.llvm.org/D130808 but was
reverted due to a Windows test failure.

Differential Revision: https://reviews.llvm.org/D131195
2022-08-04 17:12:56 -07:00