Commit Graph

418746 Commits

Author SHA1 Message Date
Igor Kudrin 568404e897 [tests] Make 'object-emission' imply 'default_triple'
If 'config.target_triple' is empty, there is no sense to define the
'object-emission' tag.

Differential Revision: https://reviews.llvm.org/D121994
2022-03-22 16:46:48 +04:00
Igor Kudrin d7681d9f77 [NVPTX] Avoid a crash when 'llc' is called with '-filetype=null'
For '-filetype=null', 'NVPTXTargetStreamer' is not created, so the
return value of 'OutStreamer->getTargetStreamer()' should be checked
before calling the methods.

Differential Revision: https://reviews.llvm.org/D122001
2022-03-22 16:46:47 +04:00
Igor Kudrin 2881696b40 [tests] Force (some) X86-specific tests to use an explicit triple
These tests are located in 'X86' subfolders which means that they should
be compiled for that target. As they did not have the target specified
explicitly, they in fact were compiled for a default target triple. Not
all targets support all required features for these tests; for example,
if NVPTX is used as a default triple, the tests fail. The patch makes the
tests run for 'x86_64', thus they pass regardless of the default target.

Differential Revision: https://reviews.llvm.org/D121998
2022-03-22 16:46:47 +04:00
Bryan Chan 5269dd7f48 [ThinLTO] Work around buggy FileCheck pattern; NFC
Update the FileCheck patterns in a test case to prevent a path name
containing the `@` character from causing it to fail unnecessarily,
e.g. during a Jenkins CI job.
2022-03-22 08:40:10 -04:00
Vince Bridgers 985888411d [analyzer] Refactor makeNull to makeNullWithWidth (NFC)
Usages of makeNull need to be deprecated in favor of makeNullWithWidth
for architectures where the pointer size should not be assumed. This can
occur when pointer sizes can be of different sizes, depending on address
space for example. See https://reviews.llvm.org/D118050 as an example.

This was uncovered initially in a downstream compiler project, and
tested through those systems tests.

steakhal performed systems testing across a large set of open source
projects.

Co-authored-by: steakhal
Resolves: https://github.com/llvm/llvm-project/issues/53664

Reviewed By: NoQ, steakhal

Differential Revision: https://reviews.llvm.org/D119601
2022-03-22 07:35:13 -05:00
Sanjay Patel 9e9bda2e8f [InstCombine] try to narrow shifted bswap-of-zext
This is the IR counterpart to 370ebc9d9a
which provided a bswap narrowing fix for issue #53867.

Here we can be more general (although I'm not sure yet
what would happen for illegal types in codegen - too
rare to worry about?):
https://alive2.llvm.org/ce/z/3-CPfo

This will be more effective if we have moved the shift
after the bswap as proposed in D122010, but it is
independent of that patch.

Differential Revision: https://reviews.llvm.org/D122166
2022-03-22 08:22:30 -04:00
Sanjay Patel c4f31d1da5 [InstCombine] add tests for shift-of-bswap; NFC 2022-03-22 08:22:30 -04:00
David Green c56dd20f69 [AArch64] Add extra insert subvector cost model tests. NFC 2022-03-22 12:20:19 +00:00
alex-t 7636c9a929 [AMDGPU] use scalar shift for SALU users in frame index elimination
In the frame index lowering we have to insert shift and add
instructions to adjust stack object access.  We need to take care of the stack
object user kind and use scalar shift/add for scalar users.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D121524
2022-03-22 13:16:24 +01:00
Djordje Todorovic 73777b4c35 [Debugify] Optimize debugify original mode
Before we start addressing the issue with having
a lot of false positives when using debugify in
the original mode, we have made a few patches that
should speed up the execution of the testing
utility Passes.

For example, when testing a large project
(let's say LLVM project itself), we can face
a lot of potential DI issues. Usually, we use
-verify-each-debuginfo-preserve (that is very
similar to -debugify-each) -- it collects
DI metadata before each Pass, and after the Pass
it checks if the Pass preserved the DI metadata.
However, we can speed up this process, since we
don't need to collect DI metadata before each
Pass -- we could use the DI metadata that are
collected after the previous Pass from
the pipeline as an input for the next Pass.

This patch speeds up the utility for ~2x.

Differential Revision: https://reviews.llvm.org/D115622
2022-03-22 12:14:00 +01:00
Shraiysh Vaishay ebec5e5c8f [flang][OpenMP] Lowering critical construct
This patch adds translation from PFT to FIR for critical construct.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: kiranchandramohan <kiranchandramohan@gmail.com>

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122218
2022-03-22 16:26:18 +05:30
Simon Pilgrim 5a65f0b4d9 [X86][SandyBridge] Remove superfluous mmx store from vector load schedule model group
Noticed by D122216
2022-03-22 10:48:29 +00:00
alex-t 0a488cba2c [AMDGPU] use scalar shift for SALU users in frame index elimination
In the frame index lowering we have to insert shift and add
instructions to adjust stack object access.  We need to take care of the stack
object user kind and use scalar shift/add for scalar users.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D121524
2022-03-22 11:43:23 +01:00
Simon Moll 7de383c892 [VP] Fix VPintrinsic::getStaticVectorLength for vp.merge|select
VPIntrinsic::getStaticVectorLength infers the operational vector length
of a VPIntrinsic instance from a type that is used with the intrinsic.
The function used the mask operand before. Yet, vp.merge|select do not
have a mask operand (in the predicating sense that the other VP
intrinsics are using them - it is a selection mask for them). Fallback
to the return type to fix this.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D121913
2022-03-22 11:41:23 +01:00
Nikita Popov 51ba13b1ae [CGStmtOpenMP] Remove uses of deprecated Address constructor 2022-03-22 11:00:08 +01:00
Shengchen Kan 021b42367a [X86] Rename MMX_MOVD64from64rm to MMX_MOVD64from64mr b/c it stores sth, NFC
Reviewed By: pengfei, RKSimon

Differential Revision: https://reviews.llvm.org/D122216
2022-03-22 17:59:28 +08:00
serge-sans-paille a53b689f0c Fix missing include under -DEXPENSIVE_CHECK
Regression introduced by f1985a3f85
2022-03-22 10:37:56 +01:00
Zakk Chen 9ab18cc535 [RISCV] Add policy operand for masked vid and viota IR intrinsics.
Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D120227
2022-03-22 02:32:31 -07:00
Haojian Wu 1579090141 Reland "[pseudo] Split greatergreater token."
It was reverted, because the test had a lift-time issue.
Reland f66d3758bd with a fix.
2022-03-22 10:27:52 +01:00
Alex Bradbury 86cc731f4c [WebAssembly] Always emit functype directives for defined functions
This fixes bug <https://github.com/llvm/llvm-project/issues/54022>. For
now this means that defined functions will have two .functype directives
emitted. Given discussion in that bug has suggested interest in moving
towards using something other than .functype to mark the beginning of a
function (which would, as a side-effect, solve this issue), this patch
doesn't attempt to avoid that duplication.

Some test cases that used CHECK-LABEL: foo rather than CHECK-LABEL: foo:
are broken by this change. This patch updates those test cases to always
have a colon at the end of the CHECK-LABEL string.

Differential Revision: https://reviews.llvm.org/D122134
2022-03-22 09:24:58 +00:00
Nikita Popov f42b1954a0 [CodeGen][RISCV] Avoid deprecated address constructor 2022-03-22 10:15:19 +01:00
Martin Storsjö 3e7a8aab75 [clang-tidy] Don't try to build CTTestTidyModule for Windows with dylibs
In MinGW mode, it's possible to build LLVM/Clang with
LLVM_LINK_LLVM_DYLIB (which implicitly enables plugins too). Other
existing ways of building plugins on Windows is to build with
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, where each executable exports its
symbols.

With LLVM_LINK_LLVM_DYLIB, we can't generally skip building plugins
even if they are set up with PLUGIN_TOOL, as some plugins (e.g.
under clang/examples) set up that way do build properly (as
they manually call clang_target_link_libraries, which links in the
libclang-cpp.dll dylib).

For CTTestTidyModule, there's no corresponding dylib that would
provide the same exports.

Differential Revision: https://reviews.llvm.org/D121687
2022-03-22 11:08:32 +02:00
serge-sans-paille f1985a3f85 Cleanup includes: Transforms/IPO
Preprocessor output diff: -238205 lines
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D122183
2022-03-22 10:06:28 +01:00
Nikita Popov b8f0e12847 [CodeGen] Remove some uses of deprecated Address constructor
Remove two stray uses in CodeGenModule and CGCUDANV.
2022-03-22 10:02:35 +01:00
serge-sans-paille 8b295d1ca2 Cleanup includes: Linker
Preprocessor output diff: -7300 lines
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D122182
2022-03-22 09:51:21 +01:00
Nikita Popov 767ec883e3 [CodeGen] Avoid deprecated Address ctor in EmitLoadOfPointer()
This requires some adjustment in caller code, because there was
a confusion regarding the meaning of the PtrTy argument: This
argument is the type of the pointer being loaded, not the addresses
being loaded from.
2022-03-22 09:42:31 +01:00
Nikita Popov a9656bd1bc [CodeGen][OpenMP] Make EmitLoadOfPointer() type consistent
If necessary insert a bitcast beforehand, so the LLVM-level pointer
type and the Clang-level pointer type line up.
2022-03-22 09:37:48 +01:00
Stanislav Gatev 2ddd57ae1e [clang][dataflow] Model the behavior of optional and std swap
Differential Revision: https://reviews.llvm.org/D122129

Reviewed-by: ymandel, xazax.hun
2022-03-22 08:35:34 +00:00
Zakk Chen abb5a985e9 [RISCV] Support mask policy for RVV IR intrinsics.
Add the UsesMaskPolicy flag to indicate the operations result
would be effected by the mask policy. (ex. mask operations).

It means RISCVInsertVSETVLI should decide the mask policy according
by mask policy operand or passthru operand.
If UsesMaskPolicy is false (ex. unmasked, store, and reduction operations),
the mask policy could be either mask undisturbed or agnostic.
Currently, RISCVInsertVSETVLI sets UsesMaskPolicy operations default to
MA, otherwise to MU to keep the current mask policy would not be changed
for unmasked operations.

Add masked-tama, masked-tamu, masked-tuma and masked-tumu test cases.
I didn't add all operations because most of implementations are using
the same pseudo multiclass. Some tests maybe be duplicated in different
tests. (ex. masked vmacc with tumu shows in vmacc-rv32.ll and masked-tumu)
I think having different tests only for policy would make the testing
clear.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120226
2022-03-22 01:19:16 -07:00
Lian Wang 0ff19b1905 [RISCV][NFC] Add some check prefixes to remove redundant checks in some IR tests
Reviewed By: frasercrmck, jacquesguan

Differential Revision: https://reviews.llvm.org/D122211
2022-03-22 08:14:08 +00:00
Petr Hosek abe997bb2d [CMake][Fuchsia] Switch to lld on Apple platforms
lld Mach-O backend supports all our use cases now.

Differential Revision: https://reviews.llvm.org/D122047
2022-03-22 01:06:30 -07:00
Shengchen Kan 6902734eb3 [X86] Simplify attributes of the generated memory folding table (NFCI)
This reduces the gaps between tables in X86GenFoldTables.inc and X86InstrFoldTables.cpp
2022-03-22 16:02:54 +08:00
gysit 1d259f9f02 [mlir][affine] Add affine.min / affine.max canonicalization.
The revision introduces a affine.min and affine.max canonicalization pattern that orders the result expressions. It flattens the result expressions to arrays of dimension and symbol coefficients plus one constant coefficient and rearranges them in lexicographic order.

Without the pattern, CSE will not eliminate two affine.min / affine.max operation if the results are ordered differently. For example, the operations
```
  %1 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
  %2 = affine.min affine_map<(d0) -> (-d0 + 27, 8)>(%arg4)
```
doe not CSE. After applying the pattern, the two operations are equivalent
```
  %1 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
  %2 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
```
which enables CSE.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D121819
2022-03-22 07:17:19 +00:00
Siva Chandra Reddy b950a0d44d [libc][Obvious] Remove an unnecessary dep and use inline_memcpy.
An unnecessary dep of the getenv function is removed. From the x86_64
loader, a call to __llvm_libc::memcpy is replaced with call to
__llvm_libc::inline_memcpy.
2022-03-22 07:08:57 +00:00
Chuanqi Xu 902f4708fe [NFC] [Coroutines] Remove unnecessary check and constraints on SmallVector
The CoroSplit pass would check the existence of coroutine intrinsic
before starting work. It is not necessary and wasteful since it would
iterate over the Module.

This patch also removes the constraint on the corresponding of the
SmallVector for the possible coroutines in the Modules. The original
value is 4. Given coroutines is used actually in practice. 4 is really
relatively a low threshold.
2022-03-22 14:24:46 +08:00
Yeting Kuo ecd7a0132a [RISCV] Add basic cost model for vector casting
To perform the cost model of vector casting, the patch consider most vector
casts as their scalar form and consider those vector form of free scalr castings
as 1.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D121771
2022-03-22 14:17:08 +08:00
Sheng 23423c0ea8 [TableGen] Fix a misuse of getValueAsBitsInit
`getValueAsBitsInit` will assert when the "SoftFail" isn't presented.

But given the 'if' statement below, we should've allowed this situation.

This patch fix this.
2022-03-22 06:04:36 +00:00
Petr Hosek e4e281eae9 Revert "[bootstrap] Allow passing options to sub-builds for all targets"
This reverts commit 240e06dfe7.
2022-03-21 22:21:30 -07:00
Shraiysh Vaishay ddc90da478 [mlir] Printing oilist element
This patch attempts to deduce when the oilist element must be printed
based on the optional arguments to it. This especially helps creating
an operation accurately because with the current implementation, the
inferred unit attributes must be manually added to print the clauses
appropriately.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D121579
2022-03-22 10:48:03 +05:30
jacquesguan f863df9a05 [RISCV][NFC] Add common check prefix to reduce duplicate check lines.
Differential Revision: https://reviews.llvm.org/D122120
2022-03-22 11:06:52 +08:00
Ella Ma 9f90254286 [analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file
This error was found when analyzing MySQL with CTU enabled.

When there are space characters in the lookup name, the current
delimiter searching strategy will make the file path wrongly parsed.
And when two lookup names have the same prefix before their first space
characters, a 'multiple definitions' error will be wrongly reported.

e.g. The lookup names for the two lambda exprs in the test case are
`c:@S@G@F@G#@Sa@F@operator int (*)(char)#1` and
`c:@S@G@F@G#@Sa@F@operator bool (*)(char)#1` respectively. And their
prefixes are both `c:@S@G@F@G#@Sa@F@operator` when using the first space
character as the delimiter.

Solving the problem by adding a length for the lookup name, making the
index items in the format of `<USR-Length>:<USR File> <Path>`.

---

In the test case of this patch, we found that it will trigger a "triple
mismatch" warning when using `clang -cc1` to analyze the source file
with CTU using the on-demand-parsing strategy in Darwin systems. And
this problem is also encountered in D75665, which is the patch
introducing the on-demand parsing strategy.
We temporarily bypass this problem by using the loading-ast-file
strategy.

Refer to the [discourse topic](https://discourse.llvm.org/t/60762) for
more details.

Differential Revision: https://reviews.llvm.org/D102669
2022-03-22 10:28:42 +08:00
jacquesguan e609417cdc [mlir][Math] Add more constant folder for Math ops.
This revision add constant folder for abs, copysign, ctlz, cttz and
ctpop.

Differential Revision: https://reviews.llvm.org/D122115
2022-03-22 10:23:15 +08:00
Carl Ritson 8e64d84995 [MachineSink] Check block prologue interference
Sinking must check for interference between the block prologue
and the instruction being sunk.
Specifically check for clobbering of uses by the prologue, and
overwrites to prologue defined registers by the sunk instruction.

Reviewed By: rampitec, ruiling

Differential Revision: https://reviews.llvm.org/D121277
2022-03-22 11:15:37 +09:00
Louis Dionne 6a7f055117 [libc++] Re-enable workaround for pre-ranges CTAD in std::span
See https://reviews.llvm.org/D121626 for details -- this re-enables the
CTAD we removed, since it does break some stuff as well (even though it's
not nearly as bad as the removed constructors fixed by D121626).

Differential Revision: https://reviews.llvm.org/D122184
2022-03-21 21:56:42 -04:00
Louis Dionne 8907302f88 [cmake] Handle iOS, watchOS and tvOS when finding compiler-rt on Apple
This patch uses CMAKE_OSX_SYSROOT, which should contain the SDK path
that we're building against on Apple platforms, to determine which
platform we are compiling for and set the compiler-rt suffix accordingly.

Differential Revision: https://reviews.llvm.org/D122161
2022-03-21 21:55:09 -04:00
Petr Hosek 7f7f4be78a [Clang] Set -mlinker-version explicitly in the lto test
This test assumes that the driver will set -object_path_lto linker
flag and it requests the platform linker with -fuse-ld=. When lld is
used as the host linker, the host linker version is unset and so
Clang won't set -object_path_lto since that flag is set conditionally
only when linker version is at least 116. We set the linker version
explicitly to make sure that -object_path_lto is set. That approach
is already used elsewhere in the test.

Differential Revision: https://reviews.llvm.org/D122110
2022-03-21 18:33:50 -07:00
Petr Hosek c624cc2527 [CMake][Clang] Skip host link version detection for lld on Darwin
When lld is being used as host linker, skip version detection since
lld version cannot be used interchangeably with ld64 version and lld
is already handled specially in Clang driver.

Differential Revision: https://reviews.llvm.org/D122109
2022-03-21 18:32:03 -07:00
Joseph Huber a619072c61 [OpenMP] Manually unroll the argument copy loop
The unroll pragma did not properly work as the loop bound was not known
when we optimize the runtime and we then added a "unroll disable"
metadata which prevented unrolling later when the bounds were known.
For now we manually unroll to make sure up to 16 elements are handled
nicely. This helps optimizations to look through the argument passing.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D109164
2022-03-21 20:54:11 -04:00
Arthur Eubanks 2362c4ecdc Revert "Revert "[OpaquePtr][LLParser] Automatically detect opaque pointers in .ll files""
This reverts commit 9c96a6bbfd.

Issues were already fixed at head.
2022-03-21 17:24:56 -07:00
Arthur Eubanks 10ffe80a24 Revert "Revert "[OpaquePointers][BitcodeReader] Enable -opaque-pointers if we see an opaque pointer type""
This reverts commit 80ec0ebfdc.

Issues were already fixed at head.
2022-03-21 17:24:56 -07:00