Commit Graph

436697 Commits

Author SHA1 Message Date
serge-sans-paille 9029ed2e4b [BOLT] Fix (part of) dylib compatibility
Non-LLVM components should not be listed as part of LLVM_LINK_COMPONENTS.

Differential Revision: https://reviews.llvm.org/D134278
2022-09-22 10:41:40 +02:00
serge-sans-paille 3ca61941c1 Revert "[bolt] Fix (part of) dylib compatibility"
This reverts commit 34ad83d883.
2022-09-22 10:41:21 +02:00
serge-sans-paille 34ad83d883 [bolt] Fix (part of) dylib compatibility
Non-LLVM component should not be listed as part of LLVM_LINK_COMPONENTS

Differential Revision: https://reviews.llvm.org/D134278
2022-09-22 10:32:40 +02:00
Ivan Radanov Ivanov e01c7f092f [MLIR] Revert default NVIDIA GPU version
Due to integration tests failing revert mlir::SerializeToCubinPass defaults to old ones (changed in https://reviews.llvm.org/D134153)

Reviewed By: akuegel

Differential Revision: https://reviews.llvm.org/D134414
2022-09-22 10:19:38 +02:00
Ilia Diachkov 4421b24fe2 [SPIRV] fix build with clang and use PoisonValue instead of UndefValue
The patch fixes the SPIRV backend build using clang. It also replaces
UndefValue with PoisonValue in SPIRVRegularizer.cpp.

Fixes: #57773

Differential Revision: https://reviews.llvm.org/D134071
2022-09-22 11:49:54 +03:00
Florian Hahn 5be203ec4d
[llvm-reduce] Add test with debug nodes not being removed.
Add a test where llvm-reduce at the moment cannot drop unneeded debug
metadata nodes referenced by DICompileUnit and DISubpgoram.
2022-09-22 08:49:57 +01:00
LLVM GN Syncbot c7652eca1e [gn build] Port 32a8260ccc 2022-09-22 07:29:04 +00:00
serge-sans-paille d442040292 [clang] Fix interaction between asm labels and inline builtins
One must pick the same name as the one referenced in CodeGenFunction when
generating .inline version of an inline builtin, otherwise they are not
correctly replaced.

Differential Revision: https://reviews.llvm.org/D134362
2022-09-22 09:24:47 +02:00
Christudasan Devadasan 32a8260ccc -dot-machine-cfg for printing MachineFunction to a dot file
This pass allows a user to dump a MIR function to a dot file
and view it as a graph. It is targeted to provide a similar
functionality as -dot-cfg pass on LLVM-IR. As of now the pass
also support below flags:
-dot-mcfg-only [optional][won't print instructions in the
graph just block name]
-mcfg-dot-filename-prefix [optional][prefix to add to output dot file]
-mcfg-func-name [optional] [specify function name or it's
substring, handy if mir file contains multiple functions and
you need to see graph of just one]

More flags and details can be introduced as per the requirements
in future. This pass is inspired from -dot-cfg IR pass and APIs
are written in almost identical format.

Patch by Yashwant Singh <Yashwant.Singh@amd.com> (yassingh)

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D133709
2022-09-22 12:48:33 +05:30
Chenbing Zheng e500f8f8a8 [InstCombine] Precommit tests for shl_trunc_icmp. nfc 2022-09-22 15:08:38 +08:00
Juan Manuel MARTINEZ CAAMAÑO b1f76e8c57 [NFC] Remove unused set construction from DILocation::getMergedLocation
Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D134357
2022-09-22 07:00:02 +00:00
LiaoChunyu fcfa9c7fcd [RelocationResolver] Add R_RISCV_SET{16,32}
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D134408
2022-09-22 14:05:03 +08:00
Craig Topper 8b8e18e11f [RISCV] Replace RISCVISD::GREV/GORC/SHFL/UNSHFL with BREV8/ORC_B/ZIP/UNZIP.
With Zbp removed, we no longer need the generalized forms.

The computeKnownBitsForTargetNode code brev8/orc.b is still based
on the general form with the shift amount forced to 7.
2022-09-21 21:57:59 -07:00
Craig Topper 182aa0cbe0 [RISCV] Remove support for the unratified Zbp extension.
This extension does not appear to be on its way to ratification.

Still need some follow up to simplify the RISCVISD nodes.
2022-09-21 21:22:42 -07:00
Congzhe Cao 22c91df52c [LoopInterchange][PR57148] Ensure the correct form of IR after transformation
This is a bugfix patch that resolves the following two bugs in loop interchange:

1. PR57148 which is an assertion error due to of loss of LCSSA form after interchange,
   as referred to test1() in pr57148.ll.
2. Use before def for the outermost loop induction variables after interchange,
   as referred to test2() in pr57148.ll.

The fix in this patch is that:

1. In cases where the LCSSA form is not maintained after interchange, we update the IR
   to the LCSSA form again.
2. We split the phi nodes in the inner loop header into a separate basic block to avoid
   the situation where use of the outer indvar appears before its def after interchange.
   Previously we already did this for innermost loops, now we do it for non-innermost
   loops (e.g., middle loops) as well.

Reviewed By: bmahjour, Meinersbur, #loopoptwg

Differential Revision: https://reviews.llvm.org/D132055
2022-09-22 00:20:53 -04:00
Fanchen Kong 8a2729fea7 [WebAssembly] Improve codegen for loading scalars from memory to v128
Use load32_zero instead of load32_splat to load the low 32 bits from memory to
v128. Test cases are added to cover this change.

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D134257
2022-09-21 21:05:44 -07:00
Congzhe Cao 6782d71680 [LoopPassManager] Ensure to construct loop nests with the outermost loop
This patch is to resolve the bug reported and discussed in
https://reviews.llvm.org/D124926#3718761 and https://reviews.llvm.org/D124926#3719876.

The problem is that loop interchange is a loopnest pass under the new pass manager,
but the loop nest may not be constructed correctly by the loop pass manager after
running loop interchange and before running the next pass, which might cause problems
when it continues running the next pass.

The reason that the loop nest is constructed incorrectly is that the outermost
loop might have changed after interchange, and what was the original outermost
loop is not the current outermost loop anymore. Constructing the loop nest based
on the original outermost loop would generate an invalid loop nest.

The fix in this patch is that, in the loop pass manager before running each loopnest
pass, we re-cosntruct the loop nest based on the current outermost loop, if LPMUpdater
notifies the loop pass manager that the previous loop nest has been invalidated by passes
like loop interchange.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D132199
2022-09-21 23:59:26 -04:00
LiaoChunyu d22ea5be51 [RelocationResolver] Add R_RISCV_SET8
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D134164
2022-09-22 11:49:33 +08:00
Chuanqi Xu 327141fb1d [C++] [Coroutines] Prefer aligned (de)allocation for coroutines -
implement the option2 of P2014R0

This implements the option2 of
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2014r0.pdf.

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

Although wg21 didn't get consensus for the direction of the problem,
we're happy to have some implementation and user experience first. And
from issue56671, the option2 should be the pursued one.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D133341
2022-09-22 11:28:29 +08:00
Corentin Jabot c932cef32a Update Unicode to 15.0
Unicode 15.0 adds 4,489 characters, for a total of 149,186 characters.
These additions include 2 new scripts along with 20 new emoji characters,
and 4,193 CJK ideographs.

This changes modify most existing tables including
 - XID_Start/XID_Continue in Clang
 - The character name database (used by \N{} in Clang)
 - The list of formattable/printable codepoints
 - The case folding algorithm (which we had not updated since Unicode 9)
 - The list of nonspacing/enclosing marks used by the column width
   computation algorithm. The rest of the column width algorithm
   is not updated.

Reviewed By: tahonermann

Differential Revision: https://reviews.llvm.org/D133807
2022-09-22 05:03:01 +02:00
Craig Topper 3b8ec0fde5 [RISCV] Remove some unused Predicates from tablegen. NFC
Specifically predicates for extensions that are subsets of other
extensions. These predicates should never be used. Should always
check the superset extension or the superset ORed with the sub extendsion.
2022-09-21 18:26:43 -07:00
River Riddle 72fddfb599 [mlir] Flip PDL to use Both accessors
This allows for incrementally updating the old API usages without
needing to update everything at once. PDL will be left on Both
for a little bit and then flipped to prefixed when all APIs have been
updated.

Differential Revision: https://reviews.llvm.org/D134387
2022-09-21 17:36:13 -07:00
River Riddle 986b5c56ea [mlir] Flip Async/GPU/OpenACC/OpenMP to use Both accessors
This allows for incrementally updating the old API usages without
needing to update everything at once. These will be left on Both
for a little bit and then flipped to prefixed when all APIs have been
updated.

Differential Revision: https://reviews.llvm.org/D134386
2022-09-21 17:36:13 -07:00
Jan Korous 85d97aac80 [analyzer] Support implicit parameter 'self' in path note
showBRParamDiagnostics assumed stores happen only via function parameters while that
can also happen via implicit parameters like 'self' or 'this'.
The regression test caused a failed assert in the original cast to ParmVarDecl.

Differential Revision: https://reviews.llvm.org/D133815
2022-09-21 17:26:09 -07:00
Vitaly Buka ba39a6e14a [msan] Instrument vtest instrinsics
Instrumentation just ORs shadow of inputs.
I assume some result shadow bits can be reset if we go into specifics of particular checks,
but as-is it is still an improvement against existing default strict instruction handler, when
every set bit of input shadow is  reported as an error.

Reviewed By: kda

Differential Revision: https://reviews.llvm.org/D134123
2022-09-21 16:57:44 -07:00
Craig Topper 2445548469 [RISCV] Add a couple more fp_to_sint_sat/uint_sat tests. NFC 2022-09-21 16:44:02 -07:00
Craig Topper 7efb8b8308 [RISCV] Add tests for fixed vector fp_to_sint_sat/fp_to_sint_sat. NFC 2022-09-21 16:16:37 -07:00
Fangrui Song 8edeedfb21 [test] Fix CodeGen/arm-crc32.c to not write an output to CWD
CWD may be read-only in some testing environments.
2022-09-21 16:13:25 -07:00
Katherine Rasmussen adb2ba5ca3 [flang] Write semantics test for atomic_xor
Write a semantics test for the atomic intrinsic subroutine,
atomic_xor.

Reviewed By: rouson

Differential Revision: https://reviews.llvm.org/D134298
2022-09-21 15:50:14 -07:00
Chris Bieneman e77c40ffbd [NFC] Make dxil namespace consistent
We have namespaces `DXIL` and `dxil`, which is just confusing. This
renames `DXIL` -> `dxil` making everything consistent.

While the LLVM coding standards don't have a clear direction here, I
chose lower case because by my current unscientific count there are
more places where we had the lowercase namespace than the uppercase.
2022-09-21 17:48:13 -05:00
Michael Wyman aa4bcaab96 Remove the unused/undefined `_cmd` parameter in `objc_direct` methods.
When `objc_direct` methods were implemented, the implicit `_cmd` parameter was left as an argument to the method implementation function, but was unset by callers; if the method body referenced the `_cmd` variable, a selector load would be emitted inside the body. However, this leaves an unused argument in the ABI, and is unnecessary.

This change removes the empty/unset argument, and if `_cmd` is referenced inside an `objc_direct` method it will emit local storage for the implicit variable. From the ABI perspective, `objc_direct` methods will have the implicit `self` parameter, immediately followed by whatever explicit arguments are defined on the method, rather than having one unset/undefined register in the middle.

Differential Revision: https://reviews.llvm.org/D131424
2022-09-21 15:37:48 -07:00
Craig Topper 1d8a7adca6 [RISCV] Rename RISCVISD::SINT_TO_FP_VL/UINT_TO_FP_VL. NFC
Name them after the instructions VFCVT_RTZ_X(U)_F_VL to make it
clear that the ISD nodes don't have the poison semantics of
ISD::SINT_TO_FP/UINT_TO_FP.

I play to reuse this node for a FP_TO_SINT_SAT/FP_TO_UINT_SAT
patch and need the instruction semantics.
2022-09-21 15:33:04 -07:00
Vitaly Buka 6fd959d625 [msan] Handle x86_avx_cmp_pd_256 and x86_avx_cmp_ps_256
Removed FIXME which looks irrelevant. The error message happens only without -mattr=+avx.
E.g.
GOOD: opt llvm/test/Instrumentation/MemorySanitizer/avx-intrinsics-x86.ll -passes=msan -o - | llc -O3 -o /dev/null -mattr=+avx
BAD: opt llvm/test/Instrumentation/MemorySanitizer/avx-intrinsics-x86.ll -passes=msan -o - | llc -O3 -o /dev/null

So nothing to fix here.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D134119
2022-09-21 15:17:02 -07:00
Ivan Radanov Ivanov f9211330f6 [MLIR] Set default NVIDIA GPU version 2022-09-21 18:10:59 -04:00
Ivan Radanov Ivanov 2f7a774ed7 [MLIR] Add a create function for mlir::SerializeToCubinPass
Differential Revision: https://reviews.llvm.org/D134153
2022-09-21 18:02:59 -04:00
Kazu Hirata 9ac934d1bf [Analysis] Make members of InlineCost const (NFC)
Once we create an instance of InlineCost, we don't change its
contents.

Differential Revision: https://reviews.llvm.org/D134388
2022-09-21 14:47:24 -07:00
Philip Reames 8c46881a53 [TTI] Recognize fp constants in getOperandInfo
We were recognizing vectors of floats, but not scalars.  That's a tad odd.
2022-09-21 14:34:34 -07:00
Vitaly Buka e078dd5342 [test][msan] Precommit part of D134119 2022-09-21 14:20:25 -07:00
Fangrui Song 8805e5d1b7 [Hexagon] Fix -Wunused-variable in non-assertion builds after f6e7ad5604 2022-09-21 14:14:45 -07:00
Florian Mayer a3153381af [libunwind] Handle G in personality string
Tested with the following program:

```
static volatile int* x = nullptr;

void throws()  __attribute__((noinline)) {
  if (getpid() == 0)
    return;
  throw "error";
}

void maybe_throws()  __attribute__((noinline)) {
  volatile int y = 1;
  x = &y;
  throws();
  y = 2;
}

int main(int argc, char** argv) {
  int y;
  try {
    maybe_throws();
  } catch (const char* e) {
    //printf("Caught\n");
  }
  y = *x;
  printf("%d\n", y); // should be MTE failure.
  return 0;
}
```

Built using `clang++ -c -O2 -target aarch64-linux -fexceptions -march=armv8-a+memtag -fsanitize=memtag-heap,memtag-stack`

Currently only Android implements runtime support for MTE stack tagging.

Without this change, we crash on `__cxa_get_globals` when trying to catch
the exception (because the stack frame __cxa_get_globals frame will fail due
to tags left behind on the stack). With this change, we crash on the `y = *x;`
as expected, because the stack frame has been untagged, but the pointer hasn't.

Reviewed By: #libunwind, compnerd, MaskRay

Differential Revision: https://reviews.llvm.org/D128998
2022-09-21 14:13:32 -07:00
Fangrui Song 23e4299261 [Driver] Add --gcc-install-dir=
This option specifies a GCC installation directory such as
/usr/lib/gcc/x86_64-linux-gnu/12, /usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.0 .

It is intended to replace --gcc-toolchain=, which specifies a directory where
`lib/gcc{,-cross}` can be found. When --gcc-toolchain= is specified, the
selected `lib/gcc/$triple/$version` installation uses complex logic and the
largest GCC version is picked. There is no way to specify another version in the
presence of multiple GCC versions.

D25661 added gcc-config detection for Gentoo: `ScanGentooConfigs`.
The implementation may be simplified by using --gcc-install-dir=.

Reviewed By: mgorny

Differential Revision: https://reviews.llvm.org/D133329
2022-09-21 14:11:15 -07:00
Fangrui Song 2d975f1efe [GlobalISel] Fix std::max after D134380 2022-09-21 14:09:04 -07:00
Jay Foad 5c7ee894f8 AMDGPU: Stop validating earlyclobber operands in assembler
This validation was introduced in D34003 for v_qsad/v_mqsad instructions
but it applies to all instructions with earlyclobber operands, which now
includes v_mad_i64/v_mad_u64.

In all these cases I do not think there is documentation saying that the
destination must not overlap the sources. Rather there are *some* cases
where the instruction may not function correctly if there is an overlap,
and we are using earlyclobber as a conservative way of preventing
codegen from generating those cases.

I think it is unhelpful for the assembler to enforce the earlyclobber
restriction because it prevents assembling cases where the programmer
knows that in fact the overlap is safe.

See also: https://github.com/llvm/llvm-project/issues/57610

Differential Revision: https://reviews.llvm.org/D134272
2022-09-21 21:46:59 +01:00
Amara Emerson 85cd376f70 [GlobalISel] Fix known bits for G_ASSERT_ALIGN.
I don't know what was going on originally with these tests. It seems reasonable
to have the immediate be the same byte alignment unit as the IR, in which case
we need to take the log2 in order to set the right number of low bits.

This fixes a miscompile in chromium.

Differential Revision: https://reviews.llvm.org/D134380
2022-09-21 21:34:05 +01:00
owenca e347c0fc9b [clang-format][NFC] Reformat the clang/unittests/Format directory
Also add a .clang-format file to clang/include/clang/Format and
clang/unittests/Format to keep the directories formatted.
2022-09-21 13:26:59 -07:00
Leonard Chan eef5db2c74 Revert "[llvm] Support forward-referenced globals with dso_local_equivalent"
This reverts commit 411020ad1c.

One of the tests here fails on some upstream builders:
https://lab.llvm.org/buildbot#builders/16/builds/35314
2022-09-21 20:14:30 +00:00
Evgeny Shulgin 3285f9a239 [Clang] Support case and default labels at end of compound statement
Direct continuation of https://reviews.llvm.org/D133887

Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D134207
2022-09-21 19:37:22 +00:00
Aaron Ballman b63b4d8966 Add tests & update the C99 DR statuses for dr315 and dr316 2022-09-21 15:33:03 -04:00
Leonard Chan 411020ad1c [llvm] Support forward-referenced globals with dso_local_equivalent
See https://github.com/llvm/llvm-project/issues/57815.

dso_local_equivalent would fail with an assertion on forward-referenced
globals. This is an issue that only comes up in textual IR, which is why
we've never seen this assertion with clang.

Differential Revision: https://reviews.llvm.org/D134234
2022-09-21 19:31:35 +00:00
Xiang Li 52d7ce0cc1 [HLSL] Allow SV_GroupIndex for lib profile.
Lib profile could include all kind of entry functions.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D134326
2022-09-21 12:29:58 -07:00