LLVM GN Syncbot [Thu, 2 Feb 2023 12:37:18 +0000 (12:37 +0000)]
[gn build] Port
8a8f77c1b849
Phoebe Wang [Thu, 2 Feb 2023 12:16:29 +0000 (20:16 +0800)]
[X86][FP16][NFC] Add round and fptosi tests to show suboptimal codegen
Michael Buch [Wed, 1 Feb 2023 13:42:24 +0000 (13:42 +0000)]
[lldb][SymbolFileDWARF] Support by-name lookup of global variables in inline namespaces
Currently evaluating an expression involving a global variable inside
an inline namespace will fail to lookup said variable. This is because
the `SymbolFileDWARF::FindGlobalVariables` discards from consideration
all DIEs whose decl_context doesn't exactly match that of the lookup.
This patch relaxes this restriction by checking whether C++ rules
would permit the lookup. This is permitted by the DWARFv5 spec in
chapter `3.2.2 Namespace Entries`:
```
A namespace may have a DW_AT_export_symbols attribute which is a flag
which indicates that all member names defined within the namespace may be
referenced as if they were defined within the containing namespace.
```
The motivation for this is evaluating `std::ranges` expressions, which
heavily rely on global variables inside inline namespaces. E.g.,
`std::views::all(...)` is just an invocation of the `operator()`
on `std::ranges::views::__cpo::all`.
**Testing**
* Added API tests
Differential Revision: https://reviews.llvm.org/D143068
Michael Buch [Tue, 31 Jan 2023 18:05:41 +0000 (18:05 +0000)]
[lldb][Test] Fix import-std-module and data-formatter tests on older compilers
Fixes API tests for older compilers.
Since https://reviews.llvm.org/D141828 defaulted
arguments will be omitted, but older Clang's won't.
Differential Revision: https://reviews.llvm.org/D143022
David Spickett [Wed, 7 Dec 2022 14:25:42 +0000 (14:25 +0000)]
[runtimes] Don't override LLVM_ENABLE_PER_TARGET_RUNTIME_DIR set from llvm
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is set in llvm/CMakeLists.txt
and in llvm/runtimes/CMakeLists.txt.
This meant that anything you passed down, or any platform not using
this layout yet would have it enabled despite it being OFF earlier.
To fix this, check if we have already defined the variable
and if so, use that value.
bultin_register_target I don't fully understand the purpose of.
So for now I have left it setting the value to ON. The rest will
respect what was previously set.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D139536
Sander de Smalen [Tue, 31 Jan 2023 22:20:46 +0000 (22:20 +0000)]
[InstCombine] Promote expression tree with @llvm.vscale when zero-extending result.
The LoopVectorizer emits the (scaled) element count as i32, which for
scalable VFs results in calls to @llvm.vscale.i32(). This value is scaled
and further zero-extended to i64.
The zero-extend can be folded away by executing the whole expression in i64
type using @llvm.vscale.i64(). Any logical `and` that would needed to mask
the result can be further folded away by KnownBits analysis when
vscale_range is set.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D143016
ManuelJBrito [Thu, 2 Feb 2023 10:11:53 +0000 (10:11 +0000)]
[Clang] Add builtin_nondeterministic_value
Differential Revision: https://reviews.llvm.org/D142388
Andrew Gozillon [Wed, 1 Feb 2023 18:29:59 +0000 (12:29 -0600)]
[FLANG][MLIR] Update all module symbol references after changing FuncOp symbol during external name mangling
This fixes an issue where the symbols for operations that were not directly
handled by the rewriting in ExternalNameConversion.cpp were not updated
accurately when a FuncOp symbol was modified. Resulting in a name
mismatch between the FuncOp and the operation holding a symbol to
the FuncOp.
This fix works by updating all of the symbols relating to a FuncOp in a
module, this did not show up as an issue previously as fir::CallOps were
getting specific handling and only fir::CallOps were being tested. So
as the more larger case is now being handled the specific handling for
fir::CallOps has been removed (but is still handled by the fix).
Reviewers:
clementval
Differential Revision: https://reviews.llvm.org/D142918
Serguei Katkov [Thu, 2 Feb 2023 09:56:13 +0000 (16:56 +0700)]
[TTI][NFC] Introduce option to set predictable branch threshold
Currently TargetTransformInfo::getPredictableBranchThreshold() method
returns hardcoded value 99. This value affects the decision whether to
convert select instruction to branch or not in several passes:
SelectOptimize, CodeGenPrepare, SimplifyCFG.
It would be useful to make possible to play with that threshold in order
to test select-optimize heuristics.
Option was originally introduced in the TargetLoweringBase, but was
removed in the revision
664d0c052c315 and not restored in the TTI
Patch Author: aleksandr.popov
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D143060
Iain Sandoe [Fri, 27 Jan 2023 10:56:45 +0000 (10:56 +0000)]
[C++20][Modules] Handle template declarations in header units.
This addresses part of https://github.com/llvm/llvm-project/issues/60079
The test for external functions was not considering function templates.
Differential Revision: https://reviews.llvm.org/D142704
Quentin Colombet [Tue, 24 Jan 2023 10:29:37 +0000 (11:29 +0100)]
[mlir][tensor|memref] Harden the checks on dim op
Prior to this patch it was possible to use the dim operation on a 0-D
memref/tensor.
Unless we want to change the semantic of a 0-D shape, this doesn't make
sense because, paraphrasing the dim op semantic, this is guaranteed to
produce something that is undefined. (The requested index is guaranteed
to be equal to or greater than the rank.)
Harden the type requirements for the dim op by disallowing 0-D shaped
types.
This "fixes" llvm.org/PR60195 by rejecting dim op on 0-D shapes instead of
crashing during LLVM conversion.
Differential Revision: https://reviews.llvm.org/D142445
Johannes Doerfert [Thu, 2 Feb 2023 10:10:07 +0000 (02:10 -0800)]
[Attributor][NFC] Improve debug messages
Johannes Doerfert [Thu, 2 Feb 2023 10:01:40 +0000 (02:01 -0800)]
[OpenMP][FIX] Ensure to determine aligned regions properly
There were missing checks in the aligned region code, copy-paste errors
(= usage of the IsReachedFromAlignedBarrierOnly value instead of
IsReachingAlignedBarrierOnly value on the forward pass), and a missing
update of the call state for sync declarations and definitions.
Partially fixes https://github.com/llvm/llvm-project/issues/60425
Johannes Doerfert [Thu, 2 Feb 2023 09:06:00 +0000 (01:06 -0800)]
[Attributor][FIX] Ensure we use the right AAExecutionDomain
Before we might have ended up queriying the AAExecutionDomain of a
different function, which resulted in wrong optimistic results.
Partially fixes https://github.com/llvm/llvm-project/issues/60425
Pavel Labath [Thu, 2 Feb 2023 10:09:40 +0000 (11:09 +0100)]
[lldb] Try harder to optimize away a test variable
The test was checking that we can print an error message when a variable
is optimized away, but the optimizer got smarter (D140404) in tracking
the variable's value (so that we were not able to recover its value).
Using a value in an argument registers (argc) makes it more likely to be
overwritten by subsequent function calls (and permanently lost).
Samuel Parker [Mon, 30 Jan 2023 09:36:15 +0000 (09:36 +0000)]
[DAGCombine] Fold redundant select
If a chain of two selects share a true/false value and are controlled
by two setcc nodes, that are never both true, we can fold away one of
the selects. So, the following:
(select (setcc X, const0, eq), Y,
(select (setcc X, const1, eq), Z, Y))
Can be combined to:
select (setcc X, const1, eq) Z, Y
Differential Revision: https://reviews.llvm.org/D142535
Mikael Holmen [Thu, 2 Feb 2023 09:26:25 +0000 (10:26 +0100)]
[lld] Fix gcc compiler warnings related to variadic macro [NFC]
gcc warned like
../../lld/ELF/InputSection.cpp:75:37: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
75 | invokeELFT(parseCompressedHeader);
| ^
Valentin Clement [Thu, 2 Feb 2023 09:23:06 +0000 (10:23 +0100)]
[flang] Use rank from the allocate object when allocate with mold
The rank from the allocate object might be different from the rank
from the mold expression. Use the rank from the allocate object
when applying to mold so the bounds can be set correctly.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D143078
Bing1 Yu [Wed, 1 Feb 2023 14:51:06 +0000 (22:51 +0800)]
[X86][NFC] Move MemoryFoldTable2Addr MemoryFoldTable0~4 into X86InstrFoldTables.def
Reviewed By: pengfei, skan
Differential Revision: https://reviews.llvm.org/D142083
eopXD [Wed, 1 Feb 2023 04:49:31 +0000 (20:49 -0800)]
[Clang][RISCV] Bump rvv intrinsics version to v0.11
The LLVM now supports v0.11 of the RVV intrinsics. Users can use the macro
`riscv_v_intrinsic` to distinguish what kind of intrinsics is supported in
the compiler.
Please refer to tag descriptions under
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tags
Reviewed By: kito-cheng, asb
Differential Revision: https://reviews.llvm.org/D143051
Chris Cotter [Thu, 2 Feb 2023 07:01:14 +0000 (07:01 +0000)]
[clang-tidy] Implement CppCoreGuideline F.54
Warn when a lambda specifies a default capture and captures
``this``. Offer FixIts to correct the code.
Reviewed By: njames93, carlosgalvezp
Differential Revision: https://reviews.llvm.org/D141133
LiaoChunyu [Thu, 2 Feb 2023 07:13:45 +0000 (15:13 +0800)]
[RISCV] Add precommit tests for D142071;
Mikael Holmen [Thu, 2 Feb 2023 06:50:59 +0000 (07:50 +0100)]
[clang] Fix warning about unused variable [NFC]
gcc warned about
../../clang/lib/Sema/AnalysisBasedWarnings.cpp:2187:23: warning: unused variable 'FC' [-Wunused-variable]
2187 | if (const auto *FC = dyn_cast<CallExpr>(Operation)) {
| ^~
luxufan [Wed, 1 Feb 2023 06:10:57 +0000 (14:10 +0800)]
[Local][InstCombine][GVN] Handle !noundef metadata in combineMetadata
Handle !noundef metadata in comhineMetadata. The behavior of violating
!noundef metadata is undefined behavior. So if K dominates J, we can
preserve it uncontionally, otherwise, we preserve it if both K and J
have !noundef metadata been set.
This patch also makes !noundef metadata added in KnownIDs when doing
instruction combine for phi node or global value numbering for loads.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142801
gonglingqin [Thu, 2 Feb 2023 06:00:04 +0000 (14:00 +0800)]
[LoongArch] Implement TargetLowering::isLegalAddressingMode() hook
Use the exact addressing mode information instead of the default to
make better use of offsets in instructions.
Differential Revision: https://reviews.llvm.org/D142874
Qiu Chaofan [Thu, 2 Feb 2023 05:59:51 +0000 (13:59 +0800)]
[PowerPC] Use default attributes for more intrinsics
Reviewed By: shchenz, amyk
Differential Revision: https://reviews.llvm.org/D141566
Serge Pavlov [Wed, 1 Feb 2023 05:43:43 +0000 (12:43 +0700)]
Use ArrayRef instead of raw pointers. NFC
Change signature of TargetLowering::getRoundingControlRegisters so that
it returns ArrayRef, not plain pointer.
Differential Revision: https://reviews.llvm.org/D143049
Chris Bieneman [Thu, 2 Feb 2023 05:19:35 +0000 (23:19 -0600)]
[DX] Speculative fix for big endian encoding
I missed byte swapping the size field.
Weining Lu [Thu, 2 Feb 2023 03:39:25 +0000 (11:39 +0800)]
[LoongArch] Honor the `--target-abi` option when generating e_flags
Reviewed By: xen0n, MaskRay
Differential Revision: https://reviews.llvm.org/D142837
WANG Xuerui [Thu, 2 Feb 2023 03:33:59 +0000 (11:33 +0800)]
[LoongArch] Implement handling of triple-implied ABIs
According to the [[ https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html | LoongArch Toolchain Conventions ]]
it is possible to specify the ABI modifier (the "D" part of "LP64D")
via the environment field in the target triple. This is needed for
proper support for Debian-style multiarch tuples as well, so add triple
awareness to `LoongArchSubtarget` via addition of
`LoongArchABI::computeTargetABI`. Let the explicit `--target-abi`
argument intuitively take precedence over the triple-implied ABI.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D142685
wanglei [Thu, 2 Feb 2023 02:34:27 +0000 (10:34 +0800)]
[ExecutionEngine] Enable ExecutionEngine regression tests on LoongArch
This patch also sets `UNSUPPORTED` on some tests which need `mcjit` and
`emulated tls` support.
Depends on D142950
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D142954
Rahul Kayaith [Sun, 29 Jan 2023 00:18:19 +0000 (19:18 -0500)]
[mlir] Require explicit casts when using TypedValue
Currently `TypedValue` can be constructed directly from `Value`, hiding
errors that could be caught at compile time. For example the following
will compile, but crash/assert at runtime:
```
void foo(TypedValue<IntegerType>);
void bar(TypedValue<FloatType> v) {
foo(v);
}
```
This change removes the constructors and replaces them with explicit
llvm casts.
Depends on D142852
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D142855
Rahul Kayaith [Thu, 26 Jan 2023 18:43:56 +0000 (13:43 -0500)]
[mlir] Use TypedValue in single result traits
Ops with a single result currently get a `getResult()` method +
conversion operator to `Value` through the `OneResult` trait. By moving
these to the `OneTypedResult` trait instead, we can use `TypedValue` as
the return type to get more specfic types.
When the result type is unknown ODS adds the
`OneTypedResult<mlir::Type>` trait, in which case there is no change in
the resulting API.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D142852
Rahul Kayaith [Mon, 30 Jan 2023 04:34:10 +0000 (23:34 -0500)]
[mlir] Simplify a few cast implementations
`{Attribute,Type}::classof` are never actually called at runtime due to
the early exit in their `CastInfo` implementations. By using `if
constexpr` we can avoid needing to define them.
We also don't need to check `is_same_v` here, since this is already
covered by `is_base_of_v`.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D142863
Fangrui Song [Thu, 2 Feb 2023 02:41:02 +0000 (18:41 -0800)]
[MC] Simplify code with parseComma
wanglei [Wed, 1 Feb 2023 02:14:43 +0000 (10:14 +0800)]
[LoongArch] Implement isUsedByReturnOnly for tailcall more libcalls
Similar to D131087 for RISCV.
Reviewed By: xen0n
Differential Revision: https://reviews.llvm.org/D142958
Shengchen Kan [Sun, 29 Jan 2023 07:07:15 +0000 (15:07 +0800)]
[X86][MC][bugfix] Report error for mismatched modifier in inline asm and remove function getX86SubSuperRegisterOrZero
```
MCRegister getX86SubSuperRegister*(MCRegister Reg, unsigned Size,
bool High = false);
```
A strange behavior of the functions `getX86SubSuperRegister*` was
introduced by llvm-svn:145579: The returned register may not
match the parameters when a 8-bit high register is required.
And llvm-svn: 175762 refined the code and dropped the comments, then we
knew nothing happened there from the code :-(
These two functions are only called with `Size=8` and `High=true` in two places.
One is in `X86FixupBWInsts.cpp` for liveness of registers and the other is in
`X86AsmPrinter.cpp` for inline asm.
For the first one, we provide an alternative in this patch.
For the second one, the strange behaviour caused a bug that an erorr was not reported for mismatched modifier.
```
void f() {
char x;
asm volatile ("mov %%ah, %h0" :"=r"(x)::"%eax", "%ebx", "%ecx", "%edx", "edi", "esi");
}
```
```
$ gcc -S test.c
error: extended registers have no high halves
```
```
$ clang -S test.c
no error
```
so we fix the bug in this patch.
`getX86SubSuperRegister` is just a wrapper of `getX86SubSuperRegisterOrZero` with a `assert`.
I belive we should remove the latter.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D142834
Chen Zheng [Fri, 9 Dec 2022 05:27:14 +0000 (00:27 -0500)]
[DAGCombiner] handle more store value forwarding
When lowering calls on target like PPC, some stack loads
will be generated for by value parameters. Node CALLSEQ_START
prevents such loads from being combined.
Suggested by @RolandF, this patch removes the unnecessary
loads for the byval parameter by extending ForwardStoreValueToDirectLoad
Reviewed By: nemanjai, RolandF
Differential Revision: https://reviews.llvm.org/D138899
Chen Zheng [Fri, 9 Dec 2022 10:08:03 +0000 (05:08 -0500)]
[DAGCombiner][NFC] add testcases for D138899
Lang Hames [Thu, 2 Feb 2023 01:42:30 +0000 (17:42 -0800)]
[JITLink] Ensure that in-flight alloc is abandoned on error in post-alloc phase.
If an error occurs during the post-allocation phase (JITLinkerBase::linkPhase2)
then we need to call JITLinkMemoryManager::InFlightAlloc::abandon so that the
allocation has a chance to clean up. This was already handled for later phases,
but we were skipping the abandon step when we bailed out of phase 2.
Fangrui Song [Thu, 2 Feb 2023 01:58:23 +0000 (17:58 -0800)]
[RISCV][MC] Simplify .option and make error messages more conventional
and add line/column information to tests.
Mircea Trofin [Thu, 2 Feb 2023 01:39:34 +0000 (17:39 -0800)]
Revert (and fix properly) "Uninitialize the file descriptor."
This reverts commit
f514b0e144db063931d19a8ebc2dc42083d0eb2f.
The culprit is that InEC is initialized before Inbound, and Inbound's
initialization happens through a call to openFileForRead. However, the
typical initialization order warnings don't fire; so the behavior was:
Inbound is initialized correctly by openFileForRead; then it's reset to
whatever initializer value (0 originally).
A fix is to move Inbound's decl upfront. I'd still prefer initializing
it to something - and -1 seems like a more appropriate value (it causes
a fail-fast rather than a hang due to trying to read from a
valid-looking but unopen fd).
Kirill Stoimenov [Thu, 2 Feb 2023 01:32:16 +0000 (01:32 +0000)]
[HWASAN] Set os_id in Thread::Init to make sure that the thread can be found by GetThreadByOsIDLocked.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D143125
Mircea Trofin [Thu, 2 Feb 2023 01:30:05 +0000 (17:30 -0800)]
Uninitialize the file descriptor.
Unblocking the build. Investigating why the value can't be initialized
(even to e.g. -1) before calling open.
Xiang Li [Fri, 13 Jan 2023 18:05:36 +0000 (13:05 -0500)]
[HLSL] [Dirver] add dxv as a VerifyDebug Job
New option --dxv-path is added for dxc mode to set the installation path for dxv.
If cannot find dxv, a warning will be report.
dxv will be executed with command line dxv file_name -o file_name.
It will validate and sign the file and overwrite it.
Differential Revision: https://reviews.llvm.org/D141705
Nikolas Klauser [Wed, 1 Feb 2023 15:04:53 +0000 (16:04 +0100)]
[libc++] Avoid ODR violations in __exception_guard
Having an ODR violation with `__exception_guard` seems to be problematic in LTO builds. To avoid the ODR violation, give the class different names for exception/no-exceptions mode and have an alias to the correct class.
Reviewed By: ldionne, #libc, alexfh
Spies: aeubanks, dblaikie, joanahalili, alexfh, rupprecht, libcxx-commits
Differential Revision: https://reviews.llvm.org/D143071
Chris Bieneman [Thu, 2 Feb 2023 00:39:01 +0000 (18:39 -0600)]
[DX] Begin adding support for pipeline state
DirectX shader pipeline state validation information is a fairly
complicated to serialize data structure. This patch adds the first bit
of support for reading and writing the runtime info structure which
comes first in the encoded data.
Subsequent patches will flesh out the remaining fields of the data
structure.
There is no official documentation for the format, but the format is
roughly documented in the code comment here:
https://github.com/microsoft/DirectXShaderCompiler/blob/main/include/dxc
/DxilContainer/DxilPipelineStateValidation.h#L731
Reviewed By: python3kgae
Differential Revision: https://reviews.llvm.org/D141649
Jim Ingham [Thu, 2 Feb 2023 00:40:32 +0000 (16:40 -0800)]
Fix typo: FineLineEntriesForFileIndex -> FindLineEntriesForFileIndex.
Lang Hames [Wed, 1 Feb 2023 22:48:46 +0000 (14:48 -0800)]
[ORC] Merge redundant jitlink::Symbol -> JITSymbolFlags mappings.
Adds a getJITSymbolFlagsForSymbol function that returns the JITSymbolFlags
for a given jitlink::Symbol, and replaces severalredundant copies of that
mapping with calls to the new function. This fixes a bug in
LinkGraphMaterializationUnit::scanLinkGraph where we were failing to set the
JITSymbolFlags::Weak flag for weak symbols, and a bug in
ObjectLinkingLayer::claimOrExternalizeWeakAndCommonSymbols where we were
failing to set the JITSymbolFlags::Callable flag for callable symbols.
Kirill Stoimenov [Wed, 1 Feb 2023 22:00:13 +0000 (22:00 +0000)]
[LSAN] Add GetUserAddr function which returns the user visible address of an internal pointer
For HWASAN this would be the tagged address. It is the same pointer when pointer tagging is not used. Coincidently this also fixes some test which rely on comparing pointers.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D143121
Shivam Gupta [Thu, 2 Feb 2023 00:28:04 +0000 (05:58 +0530)]
Revert "[Clang] Add -Wtype-limits to -Wextra for GCC compatibility"
This reverts commit
95668c0d97e6184729f3a3e9621a58d9edffb6b0.
This discovers a warning in
https://reviews.llvm.org/rGa68d4b11465f5b3326be1dd820f59fac275b7581.
and broke the x86_64-linux sanitizer
buildbot: https://lab.llvm.org/buildbot/#/builders/37/builds/19910.
Petr Hosek [Wed, 1 Feb 2023 08:11:22 +0000 (08:11 +0000)]
[Driver][Fuchsia] Remove relative vtable multilib
We have made relative vtable the default for Fuchsia C++ ABI so this
is no longer needed.
Differential Revision: https://reviews.llvm.org/D143050
Mircea Trofin [Thu, 2 Feb 2023 00:27:44 +0000 (16:27 -0800)]
Fix windows bot breakages due to D143110
Craig Topper [Wed, 1 Feb 2023 23:29:06 +0000 (15:29 -0800)]
[RISCV] Slightly simplify how the X*_PD registers for Zdinx are declared. NFC
Instead of manually listing 16 different even numbers, use a range
and then multiply.
Mircea Trofin [Wed, 1 Feb 2023 22:01:55 +0000 (14:01 -0800)]
[mlgo] Make InteractiveModelRunner actually work with named pipes
Turns out raw_fd_stream doesn't work with named pipes, so we just need
to lower the abstraction. Updated the unittest accordingly. Because
mkfifo's path argument requires a certain naming pattern on Windows
(IIUC), restricted the test to Linux only.
Differential Revision: https://reviews.llvm.org/D143110
Kirill Stoimenov [Wed, 1 Feb 2023 22:01:32 +0000 (22:01 +0000)]
[LSAN] Enable some tests which are passing as is in HWASAN.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D143114
Michael Spencer [Wed, 1 Feb 2023 01:52:51 +0000 (17:52 -0800)]
[Clang][DependencyScanner] Remove secondary actions from -cc1
The -arcmt-action= and -objcmt-migrate* actions were being passed to
module builds. This caused these builds to fail, as they are secondary
actions that suppress emitting modules.
Differential Revision: https://reviews.llvm.org/D143040
Mitch Phillips [Wed, 1 Feb 2023 23:08:06 +0000 (15:08 -0800)]
Remove another unnecessary integer-check.
Same as
b3b940d1501e39563ac549c3a5a89b25ae8ab7b8
Mitch Phillips [Wed, 1 Feb 2023 23:04:06 +0000 (15:04 -0800)]
Remove unnecessary comparison.
Popped up after https://reviews.llvm.org/D142826 added extra flags to
-Wextra, which is used by our sanitizer buildbots
(https://lab.llvm.org/buildbot/#/builders/37/builds/19910).
This check seems unnecessary, it's a bad cargo-cult after the buffer
size was expanded to allow >= 4GiB after
https://reviews.llvm.org/rGd6c15b661ab0aabb00f1219ce4af7136938e67e2.
V Donaldson [Wed, 1 Feb 2023 20:52:42 +0000 (12:52 -0800)]
[flang] Allow compiler directives in the specification part of a module
Lowering code currently allows for directives inside a program or
subprogram, or outside any program unit. Directives may also appear
in the specification part of a module, as in:
module mm
interface
subroutine ss(aa)
!dir$ ignore_tkr(tkr) aa
integer :: aa(*)
end subroutine ss
end interface
end module
With some exceptions such as OpenMP directives, most directives are
currently ignored, so this code should generate an "ignoring all compiler
directives" message.
Guozhi Wei [Wed, 1 Feb 2023 22:48:31 +0000 (22:48 +0000)]
Revert "[GVN] Improve PRE on load instructions"
This reverts commit
5f1448fe1585b5677d5f0064e4eeac3b493d8a18.
Guozhi Wei [Wed, 1 Feb 2023 22:48:06 +0000 (22:48 +0000)]
Revert "[GVN] Don't count debug instructions when limit the number of checked instructions"
This reverts commit
f494b366ff8a076a72a8e1b7a6f401686d6eb0e6.
Peter Klausler [Thu, 19 Jan 2023 22:32:09 +0000 (14:32 -0800)]
[flang] Avoid crashing from recursion on very tall expression parse trees
In the parse tree visitation framework (Parser/parse-tree-visitor.h)
and in the semantic analyzer for expressions (Semantics/expression.cpp)
avoid crashing due to stack size limitations by using an iterative
traversal algorithm rather than straightforward recursive tree walking.
The iterative approach is the obvious one of building a work queue and
using it to (in the case of the parse tree visitor) call the visitor
object's Pre() and Post() routines on subexpressions in the same order
as they would have been called during a recursive traversal.
This change helps the compiler survive some artificial stress tests
and perhaps with future exposure to machine-generated source code.
Differential Revision: https://reviews.llvm.org/D142771
Peter Klausler [Wed, 1 Feb 2023 22:05:57 +0000 (14:05 -0800)]
[flang] Fix build warning
It's basically impossible to write a switch statement with a case
for every enumerator in an enum class if the cases each have a
return statement and get it to compile without warnings for all
of our build compilers & versions. Rewrite as a sequence of
if statements.
Nikolas Klauser [Tue, 31 Jan 2023 12:03:57 +0000 (13:03 +0100)]
[libc++] Look for Clang 17 when compiling clang-tidy checks
This allows compiling the clang-tidy checks when you only have ToT clang
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D142973
Kazu Hirata [Wed, 1 Feb 2023 21:54:51 +0000 (13:54 -0800)]
[flang] Fix a warning
This patch fixes:
flang/lib/Evaluate/check-expression.cpp:509:3: error: default label
in switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
Erik Desjardins [Wed, 1 Feb 2023 21:46:59 +0000 (13:46 -0800)]
[Clang] avoid relying on StringMap iteration order when roundtripping -analyzer-config
I am working on another patch that changes StringMap's hash function,
which changes the iteration order here, and breaks some tests,
specifically:
clang/test/Analysis/NSString.m
clang/test/Analysis/shallow-mode.m
with errors like:
generated arguments do not match in round-trip
generated arguments #1 in round-trip: <...> "-analyzer-config" "ipa=inlining" "-analyzer-config" "max-nodes=75000" <...>
generated arguments #2 in round-trip: <...> "-analyzer-config" "max-nodes=75000" "-analyzer-config" "ipa=inlining" <...>
To avoid this, sort the options by key, instead of using the default map
iteration order.
Reviewed By: jansvoboda11, MaskRay
Differential Revision: https://reviews.llvm.org/D142861
Craig Topper [Wed, 1 Feb 2023 21:38:03 +0000 (13:38 -0800)]
[RISCV] Reuse RISCVRegWithSubRegs class to shorten some code in RISCVRegisterInfo.td. NFC
Jan Svoboda [Wed, 1 Feb 2023 21:42:19 +0000 (13:42 -0800)]
[clang][deps] Give the fake file a unique name in by-module-name scans
When scanning dependencies of a module, the command line we're given doesn't have an input file, which the driver needs to be happy. We've been creating a fake in-memory input file named after the module. However, this can hide files/directories on the actual filesystem, leading to errors.
This patch works around that issue by generating a unique file name, which won't collide with the actual file system.
We could also change the driver APIs so that we're able to specify an "assumed" input file. This would be more work, though, since the driver assumes the input name comes from the actual command-line.
Depends on D140176.
Reviewed By: artemcm
Differential Revision: https://reviews.llvm.org/D140177
Jan Svoboda [Wed, 1 Feb 2023 21:35:11 +0000 (13:35 -0800)]
[clang][deps] NFC: Split out the module-based API from the TU-based API
For users of the C++ API, the return type of `getFullDependencies` doesn't make sense when asking for dependencies of a module. In the returned `FullDependenciesResult` instance, only `DiscoveredModules` is useful (the graph of modular dependecies). The `FullDeps` member is trying to describe a translation unit it was never given. Its command line also refers to a file in the in-memory VFS we create in the scanner, leaking the implementation detail.
This patch splits the API and improves layering and naming of the return types.
Depends on D140175.
Reviewed By: artemcm
Differential Revision: https://reviews.llvm.org/D140176
Jan Svoboda [Wed, 1 Feb 2023 21:03:11 +0000 (13:03 -0800)]
[clang][deps] Remove support for the deprecated driver API
This API is no longer necessary, so let's remove it to simplify the internal APIs.
Reviewed By: benlangmuir, artemcm
Differential Revision: https://reviews.llvm.org/D140175
Peter Klausler [Sat, 7 Jan 2023 01:49:15 +0000 (17:49 -0800)]
[flang] Check for global name conflicts (19.2)
Global names should be checked for conflicts even when not BIND(C).
Differential Revision: https://reviews.llvm.org/D142761
Owen Pan [Sat, 28 Jan 2023 10:51:36 +0000 (02:51 -0800)]
[clang-format] Support clang-format on/off line comments as prefix
Closes #60264.
Differential Revision: https://reviews.llvm.org/D142804
Amir Ayupov [Wed, 1 Feb 2023 20:35:46 +0000 (12:35 -0800)]
[BOLT][CMake] Add dependency on llvm_vcsrevision_h
The dependence is needed since Utils includes VCSRevision.h, and other
LLVM components that include this header also have the llvm_vcsrevision_h
dependency.
Fixes #60460.
Reviewed By: #bolt, ayermolo
Differential Revision: https://reviews.llvm.org/D143101
Tue Ly [Wed, 1 Feb 2023 19:25:25 +0000 (14:25 -0500)]
[libc][math] Fix setting exceptional value for tanf to work with gcc.
See https://github.com/llvm/llvm-project/issues/59866
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D143098
Peter Klausler [Thu, 5 Jan 2023 22:11:54 +0000 (14:11 -0800)]
[flang] Catch bad inquiries in specification expressions
When a descriptor inquiry or inquiry function's result is
not constant and is known to be impossible to correctly determine
at runtime, raise an error. For example, LEN(X) when X is
a local allocatable variable with deferred length.
Differential Revision: https://reviews.llvm.org/D142759
Lei Zhang [Wed, 1 Feb 2023 19:35:25 +0000 (19:35 +0000)]
[mlir][spirv] Fix vector type mismatch in UnifyAliasedResourcePass
For the cases where we have aliases of `vector<4xf16>` and
`vector<4xf32>`, we need to do casting before composite
construction.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D143042
Aditya Kumar [Wed, 1 Feb 2023 20:10:56 +0000 (12:10 -0800)]
add arcanist patch to fix arc diff
Another patch to fix arcanist on newer php versions. See previous patch
here: https://reviews.llvm.org/D129232
Authored by: Justin Stitt (justinstitt)
Reviewed by: nickdesaulniers, hiraditya, foad
Differential Revision: https://reviews.llvm.org/D131699
Peter Klausler [Tue, 3 Jan 2023 23:09:50 +0000 (15:09 -0800)]
[flang] Catch character length errors in pointer associations
When character lengths are known at compilation time, report an error
when a data target with a known length does not match the explicit length
of a pointer that is being associated with it; see 10.2.2.3 paragraph 5.
Differential Revision: https://reviews.llvm.org/D142755
Joseph Huber [Wed, 1 Feb 2023 19:52:22 +0000 (13:52 -0600)]
[Clang] Fix test after changing the order of input files
Summary:
Forget to update these tests after moving the input earlier.
Joseph Huber [Wed, 1 Feb 2023 19:48:27 +0000 (13:48 -0600)]
[LinkerWrapper] Adjust placement of input files for the linker
Summary:
The placement of input files can change the result of the linker. We
should put the input files earlier to avoid this.
Petr Hosek [Wed, 1 Feb 2023 09:45:35 +0000 (09:45 +0000)]
[Driver][Fuchsia] Support --emit-static-lib in Fuchsia driver
This allows building static libraries with Clang driver.
Differential Revision: https://reviews.llvm.org/D143092
Peter Klausler [Thu, 29 Dec 2022 18:07:10 +0000 (10:07 -0800)]
[flang] Catch statement function typing error
Emit an error message when the right-hand side expression of a statement function
definition cannot be converted to the type of the statement function.
Differential Revision: https://reviews.llvm.org/D142745
Craig Topper [Wed, 1 Feb 2023 18:55:35 +0000 (10:55 -0800)]
[RISCV] Move the even register check for rv32zdinx later in the matching process.
And remove the IsRV64 checks for isGPRAsFPR and isGPRPF64AsFPR.
Overall I think this results in a better diagnostic experience. We
now do a better job of matching Zdinx instructions even if the registers
aren't correct and report an error for missing features like RV64.
Unfortunately, this makes it difficult to recover the error location
for the invalid odd register when we do report it. But to make up
for it, I gave a more specific error message.
It doesn't look like binutils gives any warning or error for odd registers.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D142997
Nikolas Klauser [Fri, 20 Jan 2023 08:26:37 +0000 (09:26 +0100)]
[libc++] Forward ranges::sort to instantiations in the dylib
This patch removes `_WrapAlgPolicy` and related functionality. Instead, we explicitly forward to `__sort` now if we have an instantiation inside the dylib. If we don't we just call `__introsort`.
Reviewed By: ldionne, #libc
Spies: sstefan1, libcxx-commits
Differential Revision: https://reviews.llvm.org/D140824
usama hameed [Wed, 1 Feb 2023 19:06:19 +0000 (11:06 -0800)]
[Sanitizers] fix -fno-sanitize-link-runtime for darwin
rdar://
99200922
Differential Revision: https://reviews.llvm.org/D142421
Nikolas Klauser [Fri, 20 Jan 2023 07:13:32 +0000 (08:13 +0100)]
[libc++] Split ranges.transform.binary.pass.cpp up
`ranges.transform.binary.pass.cpp` took ~25s to compile. `ranges.transform.binary.range.pass.cpp` and `ranges.transform.binary.iterator.pass.cpp` take ~13s each.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D142183
Nikolas Klauser [Fri, 20 Jan 2023 08:18:07 +0000 (09:18 +0100)]
[libc++] Remove explicit instantiations of __insertion_sort_incomplete and __sort5 from the dylib
These instantiations were never visible, because they are only used in `__sort`, which is also explicitly instantiated in the dylib.
Reviewed By: ldionne, #libc
Spies: #libc_vendors, emaste, nemanjai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D142185
Tue Ly [Wed, 1 Feb 2023 18:37:55 +0000 (13:37 -0500)]
[libc][Obvious] Add a default clause to RoundingModeUtils.h to suppress gcc
warning.
Mitch Phillips [Wed, 1 Feb 2023 18:35:56 +0000 (10:35 -0800)]
Revert "Fix tsan problem where the per-thread shared_ptr() can be locked right before the cache is destroyed causing a race where it tries to remove an entry from a destroyed cache."
This reverts commit
bcc10817d5569172ee065015747e226280e9b698.
Reason: Broke the aarch64-asan bot. More information available in the
Phabricator review: https://reviews.llvm.org/D140931
Steven Wu [Wed, 1 Feb 2023 18:34:05 +0000 (10:34 -0800)]
[Module] Respect `-fno-pch-timestamps` when building modules
Always respect the FrontendOption to not include timestamps in PCH or
Modules when `-fno-pch-timestamps` is specified.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D141632
Stella Stamenova [Wed, 1 Feb 2023 18:25:20 +0000 (10:25 -0800)]
[mlir] Pin for the PyPi requirements for mlir
This change is pinning the requirements to a specific version (or a range) depending on the requirement. A couple of considerations:
* numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str, and np.int which are used heavily in onnx-mlir
* not all versions of each package are available on every platform - to the best of my knowledge, these ranges should work on Ubuntu, CentOS and Windows
Adding a minimum and maximum version, or pinning to a specific versions where possible, helps with two major goals - security and maintainability. It gives us an opportunity to make sure that the packages being used are not part of a security attack as well as guaranteeing that they support the features that mlir depends on (see note about numpy deprecation).
Let me know if you are aware of better versions or ranges to pin to.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D142563
Mircea Trofin [Wed, 1 Feb 2023 18:23:28 +0000 (10:23 -0800)]
[mlgo] Allow logging the spec for the "advice", if needed
This is for the interactive model runner, so it can confirm the tensor
spec of the advice with its host.
Jorge Gorbe Moya [Wed, 1 Feb 2023 18:12:41 +0000 (10:12 -0800)]
[Hexagon] Use %t for output file in test introduced in
97d51e3fa8e8 (NFCI).
Felipe de Azevedo Piovezan [Fri, 6 Jan 2023 18:52:22 +0000 (15:52 -0300)]
Reland "[codegen] Store address of indirect arguments on the stack"
The commit was reverted due to a regression in debug information of an
optimized code test in lldb. This has since been addressed by:
1. rGf753e5be8239: [LiveDebugValues] Allow EntryValue with OP_deref
expressions
2. rG055f2f04e658: [mem2reg][debuginfo] Handle op_deref when converting
dbg.declare
Differential Revision: https://reviews.llvm.org/D141381
Petr Hosek [Wed, 1 Feb 2023 17:29:54 +0000 (17:29 +0000)]
[CMake] Save and restore CMAKE_EXE_LINKER_FLAGS manually
cmake_push_check_state and cmake_pop_check_state doesn't save and
restore CMAKE_EXE_LINKER_FLAGS so we need to do it manually.
Differential Revision: https://reviews.llvm.org/D143088
Joseph Huber [Wed, 1 Feb 2023 18:01:44 +0000 (12:01 -0600)]
[LinkerWrapper] Fix passing `-rpath` directly to clang
Summary:
This code passed the value of `-rpath` directly to the clang invocation.
If we're using the linker then it'll be fine. However, if the linker is
`gcc` as is the case when doing `-fopenmp-targets=x86_64` then this will
cause problems. This patch adds the `-Wl,-rpath,` to feed it to the
linker correctly.
Nikolas Klauser [Tue, 10 Jan 2023 00:56:53 +0000 (01:56 +0100)]
[libc++] Add a clang-tidy check to make sure we use _Uglyfied attribute names
Reviewed By: ldionne, #libc
Spies: krytarowski, jdoerfert, libcxx-commits
Differential Revision: https://reviews.llvm.org/D142322
Ramon de C Valle [Wed, 1 Feb 2023 16:42:28 +0000 (16:42 +0000)]
Add CFI integer types normalization
This commit adds a new option (i.e.,
`-fsanitize-cfi-icall-normalize-integers`) for normalizing integer types
as vendor extended types for cross-language LLVM CFI/KCFI support with
other languages that can't represent and encode C/C++ integer types.
Specifically, integer types are encoded as their defined representations
(e.g., 8-bit signed integer, 16-bit signed integer, 32-bit signed
integer, ...) for compatibility with languages that define
explicitly-sized integer types (e.g., i8, i16, i32, ..., in Rust).
``-fsanitize-cfi-icall-normalize-integers`` is compatible with
``-fsanitize-cfi-icall-generalize-pointers``.
This helps with providing cross-language CFI support with the Rust
compiler and is an alternative solution for the issue described and
alternatives proposed in the RFC
https://github.com/rust-lang/rfcs/pull/3296.
For more information about LLVM CFI/KCFI and cross-language LLVM
CFI/KCFI support for the Rust compiler, see the design document in the
tracking issue https://github.com/rust-lang/rust/issues/89653.
Reviewed By: pcc, samitolvanen
Differential Revision: https://reviews.llvm.org/D139395
Chris Cotter [Wed, 1 Feb 2023 17:38:30 +0000 (17:38 +0000)]
[llvm][NFC] Use move instead of copy
Summary: For functions that accept an rvalue reference type
parameter, use move to avoid copying the parameter.
These were found when implementing CppCoreGuideline F.18 in
clang-tidy.
Committed on behalf of ccotter (Chris Cotter)
Reviewers: Michael137 thieta
Differential Revision: https://reviews.llvm.org/D142825