Commit Graph

432706 Commits

Author SHA1 Message Date
Sam Estep 43b298ea12 [clang][dataflow] Don't crash when caller args are missing storage locations
This patch modifies `Environment`'s `pushCall` method to pass over arguments that are missing storage locations, instead of crashing.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D131600
2022-08-10 17:50:34 +00:00
jackalcooper f230d91592 [mlir][spirv] Turn various passes to plain OperationPass
Made passes converting ops from other dialects to spirv OperationPass,
so that downstream compiler could put them in a proper nested pass
manager to lower device code only.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D131591
2022-08-10 13:50:07 -04:00
Ofek Shilon 73a1b162a4 Add docs for function attributes hot/cold
Following https://reviews.llvm.org/D92493, this add docs for the hot
and cold function attributes.

Differential Revision: https://reviews.llvm.org/D130933
2022-08-10 13:48:43 -04:00
Mark de Wever 70074cf397 [libc++] Fixes string_view comparison operators.
While implementing `operator<=>` for `string_view` (D130295) @philnik
pointed out `common_type` should be `type_identity`. Since it was an
existing issue that wasn't addressed.

This addresses the issue for both the new and existing equality and
comparison operators. The test is based on the example posted in
D130295.

Reviewed By: philnik, #libc, huixie90

Differential Revision: https://reviews.llvm.org/D131322
2022-08-10 19:38:50 +02:00
Venkata Ramanaiah Nalamothu 486594119d [AMDGPU] Fix prologue/epilogue markers in .debug_line table for trivial functions
All the prologue instructions should have unknown source location
co-ordinates while the epilogue instructions should have source
location of last non-debug instruction after which epilogue
instructions are insrted.

This ensures the prologue/epilogue markers are generated correctly
in the line table.

Changes are brought in from the downstream CFI patches.

Reviewed By: scott.linder

Differential Revision: https://reviews.llvm.org/D131485
2022-08-10 23:00:19 +05:30
Ilya Biryukov e3b5254d71 [MC] Avoid calling vector<FieldInfo> members before FieldInfo is defined
The C++ Standard requires a complete type T when using any members of
`vector<T>`, see
https://eel.is/c++draft/vector#overview-4.

This only breaks with latest libc++ in C++20 mode and does not show up
in common configurations.
We have an internal experimental configuration that discovered this.

Reviewed By: alexfh

Differential Revision: https://reviews.llvm.org/D131595
2022-08-10 19:20:09 +02:00
Slava Zakharin 08b4cf3620 [mlir][math] Added basic support for IPowI operation.
The operation computes pow(b, p), where 'b' and 'p' are signed integers
of the same width. The result's type matches the operands' type.

Differential Revision: https://reviews.llvm.org/D129809
2022-08-10 10:11:53 -07:00
Mark de Wever 35bb1f5f34 [NFC][libc++][test] Removes unneeded code.
In D130295 @mumbleskates wondered why `std::strong_ordering::equal` had
special code since it's the same as `std::strong_ordering::equivalent`.

This is indeed the case so the special case can be removed.

Reviewed By: mumbleskates, #libc, avogelsgesang, ldionne

Differential Revision: https://reviews.llvm.org/D131419
2022-08-10 19:00:55 +02:00
Kazu Hirata 558caf6d2b [MCParser] Fix a warning
This patch fixes:

  llvm/lib/MC/MCParser/COFFMasmParser.cpp:333:28: error: comparison of
  integers of different signs: 'unsigned int' and 'int'
  [-Werror,-Wsign-compare]
2022-08-10 09:56:44 -07:00
Simon Pilgrim 4178e33470 [CostModel] Update RUN -passes=* to double quotes to appease update scripts on windows
DOS really doesn't like `` quotes to be used in command lines

Some prep work as I'm intending to resurrect D79483 soon
2022-08-10 17:54:06 +01:00
Denys Petrov 7e2b995e0c [analyzer] [NFC] Add more test cases for equality tracking
Summary: Cover `ConstraintAssignor::assign(EquivalenceClass, RangeSet)` function with more regression tests.

Differential Revision: https://reviews.llvm.org/D131514
2022-08-10 19:52:55 +03:00
Jeff Niu 5c5af910fe [mlir][LLVMIR] "Modernize" Insert/ExtractValueOp
This patch "modernizes" the LLVM `insertvalue` and `extractvalue`
operations to use DenseI64ArrayAttr, since they only require an array of
indices and previously there was confusion about whether to use i32 or
i64 arrays, and to use assembly format.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D131537
2022-08-10 12:51:11 -04:00
Slava Zakharin 80dcc907a8 [NFC] Restructured SimplifyIntrinsicsPass::getOrCreateFunction.
I would like to add DOT_PRODUCT support in this pass, so this restructuring
is the first step to allow some code reuse inside getOrCreateFunction().

Differential Revision: https://reviews.llvm.org/D131530
2022-08-10 09:40:57 -07:00
Simon Pilgrim 77d33f4c1b [Analysis] Remove unused CostModelAnalysis::getInstructionCost helper. NFCI.
Everything now uses TTI costs calls directly
2022-08-10 17:21:46 +01:00
Manoj Gupta 06fc5a7714 Driver: Refactor and support per target dirs in baremetal
Refactor baremetal driver code to reduce the bespoke
additions and base class overrides.
This lets us use the per target runtimes like other clang
targets. E.g. clang -target armv7m-cros-none-eabi will now
be able to use the runtimes installed at
<resource_dir>/lib/armv7m-cros-none-eabi instead of the hardcoded
path <resource_dir>/lib/baremetal.
The older code paths should still continue to work as before if
<resource_dir>/lib/<tuple> does not exist.

Reviewed By: MaskRay, barannikov88

Differential Revision: https://reviews.llvm.org/D131225
2022-08-10 09:13:30 -07:00
Kevin Athey d7a47a9bb5 Desist from passing function location to __msan_set_alloca_origin4.
This is done by calling __msan_set_alloca_origin and providing the location of the variable by using the call stack.
This is prepatory work for dropping variable names when track-origins is enabled.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D131205
2022-08-10 09:02:53 -07:00
Eric Astor 4b566933cf [ms] [llvm-ml] Add support for the (many) optional SEGMENT parameters
Add support for many parameters to the SEGMENT directive

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D131523
2022-08-10 15:55:23 +00:00
Alexander Belyaev 47cf004076 [mlir] Fix win build by using has_value() instead of hasValue() for Optional. 2022-08-10 17:48:35 +02:00
Ivan Murashko e78c80e3d6 [clang] SourceManager: fix at SourceManager::getFileIDLoaded for the case of invalid SLockEntry
There is a fix for the search procedure at `SourceManager::getFileIDLoaded`. It might return an invalid (not loaded) entry. That might cause clang/clangd crashes. At my case the scenario was the following:
- `SourceManager::getFileIDLoaded` returned an invalid file id for a non loaded entry and incorrectly set `SourceManager::LastFileIDLookup` to the value
- `getSLocEntry` returned `SourceManager::FakeSLocEntryForRecovery` introduced at [D89748](https://reviews.llvm.org/D89748).
- The result entry is not tested at `SourceManager::isOffsetInFileID`and as result the call `return SLocOffset < getSLocEntryByID(FID.ID+1).getOffset();` returned `true` value because `FID.ID+1` pointed to a non-fake entry
- The tested offset was marked as one that belonged to the fake `SLockEntry`

Such behaviour might cause a weird clangd crash when preamble contains some header files that were removed just after the preamble created. Unfortunately it's not so easy to reproduce the crash in the form of a LIT test thus I provided the fix only.

Test Plan:
```
ninja check-clang
```

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D130847
2022-08-10 16:37:42 +01:00
Louis Dionne b1009bbd9e [libc++] Add missing includes of <cstddef> 2022-08-10 11:35:41 -04:00
Umesh Kalappa 9757f4f2dd [PowerPC] Don't use the S30 and S31 regs for the pic code
These changes to address issue
https://github.com/llvm/llvm-project/issues/55857.

Since R30/S30 is used as pointer (32 bits) for GOT Table in the ppc32 ABI,
remove it from the SPE callee save register when PIC is enabled.

This prevents emitting the SPE load and store for S30 and S31 regs.

Differential revision: https://reviews.llvm.org/D127495
2022-08-10 10:31:27 -05:00
Joseph Huber fdbb15355e [Libomptarget][CUDA] Check CUDA compatibilty correctly
We recently added support for multi-architecture binaries in
libomptarget. This is done by extracting the architecture from the
embedded image and comparing it with the major and minor version
supported by the current CUDA installation. Previously we just compared
these directly, which was not correct for binary compatibility. The CUDA
documentation states that we can consider any image with an equivalent
major or a greater or equal to minor compatible with the current image.
Change the check to use this new logic in the CUDA plugin.

Fixes #57049

Reviewed By: jdoerfert, ye-luo

Differential Revision: https://reviews.llvm.org/D131567
2022-08-10 11:15:27 -04:00
Amaury Séchet 9bceb8981d [X86] (0 - SetCC) | C -> (zext (not SetCC)) * (C + 1) - 1 if we can get a LEA out of it.
This adresses various regression in D131260 , as well as is a useful optimization in itself.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D131358
2022-08-10 15:12:00 +00:00
Justin Hibbits f43b228581 PowerPC: Don't hoist float multiply + add to fused operation on SPE
SPE doesn't have a fmadd instruction, so don't bother hoisting a
multiply and add sequence to this, as it'd become just a library call.
Hoisting happens too late for the CTR usability test to veto using the
CTR in a loop, and results in an assert "Invalid PPC CTR loop!".
2022-08-10 11:04:27 -04:00
Mohammed Nurul Hoque 30abc1a6a1 [ConstantFolding] Eliminate atan and atan2 calls
From the opengroup specifications, atan2 may fail if the result
underflows and atan may fail if the argument is subnormal, but
we assume that does not happen and eliminate the calls if we
can constant fold the result at compile-time.

Differential Revision: https://reviews.llvm.org/D127964
2022-08-10 11:01:50 -04:00
Louis Dionne f5738c5145 [libc++] Make __libcpp_verbose_abort [[noreturn]]
This will allow using it in functions that are [[noreturn]] themselves.

Differential Revision: https://reviews.llvm.org/D131408
2022-08-10 10:37:15 -04:00
Simon Pilgrim 25340410c9 Revert rGa772f775a2ba401e95a0bbe73deb6300f1dc12c0 "[clang-tidy] Support C++14 in bugprone-signal-handler."
This was breaking a number of buildbots: https://lab.llvm.org/buildbot/#/builders/139/builds/26335
2022-08-10 15:25:04 +01:00
David Truby e4642d78a8 [clang] Correct documentation for NEON and SVE operator support
Previously the language extension documentation didn't mention SVE and
was incomplete in listing the C/C++ operators supported on NEON. This
corrects the documentation to be in line with the implementation.
2022-08-10 15:16:38 +01:00
Simon Pilgrim b92c7dc211 [X86] Use DAG.getFreeze() to create freeze node. NFC. 2022-08-10 15:03:56 +01:00
Sam Estep 000c8fef86 [clang][dataflow] Analyze constructor bodies
This patch adds the ability to context-sensitively analyze constructor bodies, by changing `pushCall` to allow both `CallExpr` and `CXXConstructExpr`, and extracting the main context-sensitive logic out of `VisitCallExpr` into a new `transferInlineCall` method which is now also called at the end of `VisitCXXConstructExpr`.

Reviewed By: ymandel, sgatev, xazax.hun

Differential Revision: https://reviews.llvm.org/D131438
2022-08-10 14:01:45 +00:00
Alexander Belyaev 42f32f69ad [mlir] Extract offsets-sizes-strides computation from `makeTiledShape(s)`.
This change separates computation of the actual parameters of the subset and
the materialization of subview/extract_slice. That way the users can still use
Linalg tiling logic even if they use different operations to materialize the
subsets.

Differential Revision: https://reviews.llvm.org/D131053
2022-08-10 15:37:38 +02:00
Pavel Kosov f63e2cfb7f [LLDB] Add basic floating point ops to IR interpreter
Patch adds support for fadd, fsub, fdiv, fmul and fcmp to IR interpreter.

~~~

OS Laboratory. Huawei RRI. Saint-Petersburg

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D126359
2022-08-10 16:34:52 +03:00
Jake Egan c1226585b3 [AIX][tests] XFAIL for system-aix instead
The Clang folding for floating-point sometimes calls out to the host.
2022-08-10 09:31:42 -04:00
Alex Zinenko 2e2ad53979 [mlir] Generate C++ doc comments for interfaces
When emitting the declarations for interface methods defined in ODS,
also emit their descriptions as C++ comments. This makes the
documentation accessible to C++ tooling such as IDEs that offers better
usability than reading it form the .td or the website.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D130478
2022-08-10 15:12:29 +02:00
Edd Barrett fa250250b2
Migrate llvm.experimental.patchpoint() to ptr.
This intrinsic used a typed pointer for a call target operand. This
change updates the operand to be an opaque pointer and updates all
pointers in all test files that use the intrinsic.

Differential revision: https://reviews.llvm.org/D131261
2022-08-10 13:18:02 +01:00
Simon Pilgrim 8623da5f74 [DAG] visitFREEZE - generalize freeze(op()) -> op(freeze()) to any number of operands
canCreateUndefOrPoison currently only handles unary ops, but we intend to change that soon - this more closely matches the pushFreezeToPreventPoisonFromPropagating behaviour where the freeze is pushed up to a single operand value, as long as all others are guaranteed not to be poison/undef.

However, pushFreezeToPreventPoisonFromPropagating would freeze all uses of the value - whilst this variant requires the frozen value to be only used in the op - we can look at generalize multiple uses later if the need arises.
2022-08-10 13:12:46 +01:00
Jacques Pienaar 1f02ad7131 [mlir][shape] Update meet to handle all size & shape types
Also tighten up return type inference & compatibility functions.

Differential Revision: https://reviews.llvm.org/D130866
2022-08-10 05:08:24 -07:00
Wei Yi Tee 8a4c40bfe8 [clang][dataflow] Store DeclContext of block being analysed in Environment if available.
Differential Revision: https://reviews.llvm.org/D131065
2022-08-10 11:27:03 +00:00
David Truby 286d59ef6f [clang][AArch64][SVE] Add unary +/- operators for SVE types
This patch enables the unary promotion and negation operators on
SVE types.

Differential Revision: https://reviews.llvm.org/D130984
2022-08-10 10:32:43 +00:00
Simon Pilgrim bbc27d0148 [DAG] canCreateUndefOrPoison - add freeze(truncate(x)) -> truncate(freeze(x)) support 2022-08-10 11:27:22 +01:00
David Spickett 552dccf311 [LLDB][AArch64][NFC] Fix some clang-format annotations
We don't want the DEFINE_ macros or the array registers
being clang formatted.

RegisterInfos_arm64.h was missing the off annotation and
RegisterInfos_arm64_sve.h needed the off moving to before
the macro definitions.
2022-08-10 10:22:21 +00:00
David Truby b1b9c39629 [AArch64][SVE] Use SVE for VLS fcopysign for wide vectors
Currently fcopysign for VLS vectors lowers through NEON even when the
vector width is wider than a NEON vector, causing bad codegen as the
vectors are split. This patch causes SVE to be used for these vectors
instead, giving much better codegen on wide VLS vectors.

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D128642
2022-08-10 10:17:19 +00:00
Balázs Kéri a772f775a2 [clang-tidy] Support C++14 in bugprone-signal-handler.
Check `bugprone-signal-handler` is improved to check for
C++-specific constructs in signal handlers. This check is
valid until C++17.

Reviewed By: whisperity

Differential Revision: https://reviews.llvm.org/D118996
2022-08-10 12:00:16 +02:00
Alex Bradbury 47b1f8362a [RISCV] Implement isUsedByReturnOnly TargetLowering hook in order to tailcall more libcalls
Prior to this patch, libcalls inserted by the SelectionDAG legalizer
could never be tailcalled. The eligibility of libcalls for tail calling
is is partly determined by checking TargetLowering::isInTailCallPosition
and comparing the return type of the libcall and the calleer.
isInTailCallPosition in turn calls TargetLowering::isUsedByReturnOnly
(which always returns false if not implemented by the target).

This patch provides a minimal implementation of
TargetLowering::isUsedByReturnOnly - enough to support tail calling
libcalls on hard float ABIs. Soft-float ABIs are left for a follow on
patch. libcall-tail-calls.ll also shows missed opportunities to tail
call integer libcalls, but this is due to issues outside of
the isUsedByReturnOnly hook.

Differential Revision: https://reviews.llvm.org/D131087
2022-08-10 10:50:29 +01:00
Nikita Popov 8d6f61b6ad Revert "[Flang] Use find_program() to find clang-tblgen"
This reverts commit 3bba12a81e.

While this fixes doc generation in standalone flang builds, it
breaks them for combined builds of clang and flang.
2022-08-10 11:39:31 +02:00
Alex Bradbury 7e7860c5d7 [X86][NFCI] Remove target-specific branch optimisation that's handled in BranchFolding
This specific optimisation is handled in OptimizeBlock in BranchFolding
so is redundant. As discussed on the review thread, I've verified that
we have test coverage for that optimisation within test/CodeGen/X86 by
disabling the BranchFolding version of this transform after applying
this patch and rerunning the test suite.

Differential Revision: https://reviews.llvm.org/D129204
2022-08-10 10:35:31 +01:00
Alex Bradbury 104a24ec8b [WebAssembly] Produce error when encountering unlowerable Wasm global accesses
WebAssembly globals are represented as IR globals with the wasm_var
address space (AS1). Prior to this patch, a wasm global load that isn't
lowerable will produce a failure to select, while a wasm global store
will produced incorrect code. This patch ensures we consistently produce
a clear error.

As noted in the test cases, it's conceivable that a frontend or an
optimisation pass could produce similar IR even in the presence of the
semantic restrictions on pointers to Wasm globals in the frontend, which
is a separate problem to address.

Differential Revision: https://reviews.llvm.org/D131387
2022-08-10 10:34:10 +01:00
Phoebe Wang 800d5e178f Revert "Reland "[compiler-rt][BF16] Provide __truncsfbf2 only when __bf16 is available""
This reverts commit 0729d00135.

Buildbot https://lab.llvm.org/buildbot/#/builders/19/builds/11989 failed
with "error: ISO C requires a translation unit to contain at least one declaration [-Werror,-Wempty-translation-unit]"
2022-08-10 17:27:44 +08:00
Simon Pilgrim df3ea7365e [DAG] Use DAG.getFreeze() to create freeze node. NFC. 2022-08-10 10:26:26 +01:00
jacquesguan b6b1c0d1c4 [RISCV] Add cost model for fp-mask cast op.
The cost of convert from or to mask vector is different from other cases. We could not use PowDiff to calculate it. This patch set it to 3 as we use 3 instruction to make it.

Differential Revision: https://reviews.llvm.org/D131149
2022-08-10 17:14:37 +08:00