Jonathan Peyton [Mon, 1 Nov 2021 19:23:54 +0000 (14:23 -0500)]
[OpenMP][libomp][CMake] use uppercase_CMAKE_BUILD_TYPE
Have standalone builds define uppercase_CMAKE_BUILD_TYPE and use it.
llvm/CMakeLists.txt defines uppercase_CMAKE_BUILD_TYPE for regular LLVM
builds with OpenMP enabled.
Differential Revision: https://reviews.llvm.org/D112951
Vy Nguyen [Tue, 9 Nov 2021 15:42:21 +0000 (10:42 -0500)]
Reland "[lld-macho] Fix assertion failure in registerCompactUnwind""
PR/52372
Differential Revision: https://reviews.llvm.org/D112977
New changes:
- use llvm-otool instead of `otool` which doesn't in exist on non-OSX platforms
- add llvm-otool to the set of tools used by test so that the bot will use the <build_dir>/bin/llvm-otool instead of the unqualified `llvm-otool` (which may not exist)
- update tests since the latest (TOT) llvm-otool prints a space between two bytes and the old one doesn't.
Andy Yankovsky [Mon, 8 Nov 2021 14:44:31 +0000 (15:44 +0100)]
[lldb-vscode] Add presentation hints for scopes
Scopes can have an optional hint for how to present this scope in the UI:
https://microsoft.github.io/debug-adapter-protocol/specification#Types_Scope
The IDEs can use the hint to present the data accordingly. For example,
Visual Studio has a separate Registers window, which is populated with the
data from the scope with `presentationHint: "registers"`.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D113400
zijunzhao [Tue, 9 Nov 2021 16:36:06 +0000 (16:36 +0000)]
Revert "add tsan shared lib"
This reverts commit
92c9b340be4164f44772ddf5a50a4a5acdbd6607.
Sanjay Patel [Tue, 9 Nov 2021 15:48:47 +0000 (10:48 -0500)]
[InstCombine] allow commute in sub-of-umax fold
This fold was added with:
83c2fb9f66be
...but missed the commuted pattern:
https://alive2.llvm.org/ce/z/_tYEGy
Sanjay Patel [Tue, 9 Nov 2021 15:35:13 +0000 (10:35 -0500)]
[InstCombine] add/move tests for sub-of-umax; NFC
Martin Storsjö [Tue, 9 Nov 2021 08:14:16 +0000 (10:14 +0200)]
[libcxx] Add a dependency on unwind in cxx_static, if LIBCXXABI_USE_LLVM_UNWINDER is set
Even if building cxx_static in itself doesn't actually link in the
requested unwinder, add a synthetic dependency so that building
cxx_static makes sure that the unwinder that was requested to be used
also gets built.
This makes sure that tests (when run with just a plain "ninja check-cxx")
actually use the newly built unwinder, as intended.
Differential Revision: https://reviews.llvm.org/D113467
Nathan Sidwell [Tue, 9 Nov 2021 15:39:22 +0000 (07:39 -0800)]
[clang] [docs] Fix markup
code-block needs a blank line
Differential Revision: https://reviews.llvm.org/D113425
Vy Nguyen [Tue, 9 Nov 2021 15:31:47 +0000 (10:31 -0500)]
Revert "[lld-macho] Fix assertion failure in registerCompactUnwind"
broke windows build - reverting to investigate
This reverts commit
b2d92584742e333799ed6a3687c801dde9bb6174.
Nathan Sidwell [Mon, 8 Nov 2021 17:45:26 +0000 (09:45 -0800)]
[clang] GCC directive extension extension: Hash NNN lines
Some time back I extended GCC's '# NNN' line marker semantics.
Specifically popping to a blank filename will restore the filename to
that of the popped-to include. Restore to line 5 of including file
(escaped BOL #'s to avoid git eliding them):
\# 5 "" 2
Added documentation for this line control extension.
This was useful in developing modules tests, but turned out to also be
useful with machine-generated source code. Specifically, a generated
include file that itself includes fragments from elsewhere. The
ability to pop to the generated include file -- with its full path
prefix -- is useful for diagnostic & debug purposes. For instance
something like:
// Machine generated -- DO NOT EDIT
Type Var = {
\# 7 "encoded.dsl" 1 // push to snippet-container
{snippet, of, code}
\# 6 " 2 // Restore to machined-generated source
,
};
// user-code
...
\#include "dsl.h"
...
That pop to "" will restore the filename to '..includepath../dsl.h',
which is better than restoring to plain "dsl.h".
Differential Revision: https://reviews.llvm.org/D113425
Simon Pilgrim [Tue, 9 Nov 2021 15:11:21 +0000 (15:11 +0000)]
[X86] combineMulToPMADDWD - handle any pow2 vector type and split to legal types
combineMulToPMADDWD is currently limited to legal types, but there's no reason why we can't handle any larger type that the existing SplitOpsAndApply code can use to split to legal X86ISD::VPMADDWD ops.
This also exposed a missed opportunity for pre-SSE41 targets to handle SEXT ops from types smaller than vXi16 - without PMOVSX instructions these will always be expanded to unpack+shifts, so we can cheat and convert this into a ZEXT(SEXT()) sequence to make it a valid PMADDWD op.
Differential Revision: https://reviews.llvm.org/D110995
Kazu Hirata [Tue, 9 Nov 2021 15:11:13 +0000 (07:11 -0800)]
[llvm] Use MachineBasicBlock::{successors,predecessors} (NFC)
Vy Nguyen [Tue, 2 Nov 2021 20:28:31 +0000 (16:28 -0400)]
[lld-macho] Fix assertion failure in registerCompactUnwind
PR/52372
Differential Revision: https://reviews.llvm.org/D112977
Matt Morehouse [Tue, 9 Nov 2021 14:52:32 +0000 (06:52 -0800)]
[HWASan] Ensure RNG is initialized in GenerateRandomTag
Fixes a CHECK-failure caused by glibc's pthread_getattr_np
implementation calling realloc. Essentially, Thread::GenerateRandomTag
gets called during Thread::Init and before Thread::InitRandomState:
HWAddressSanitizer: CHECK failed: hwasan_thread.cpp:134 "((random_buffer_)) != (0)" (0x0, 0x0) (tid=314)
#0 0x55845475a662 in __hwasan::CheckUnwind()
#1 0x558454778797 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long)
#2 0x558454766461 in __hwasan::Thread::GenerateRandomTag(unsigned long)
#3 0x55845475c58b in __hwasan::HwasanAllocate(__sanitizer::StackTrace*, unsigned long, unsigned long, bool)
#4 0x55845475c80a in __hwasan::hwasan_realloc(void*, unsigned long, __sanitizer::StackTrace*)
#5 0x5584547608aa in realloc
#6 0x7f6f3a3d8c2c in pthread_getattr_np
#7 0x5584547790dc in __sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)
#8 0x558454779651 in __sanitizer::GetThreadStackAndTls(bool, unsigned long*, unsigned long*, unsigned long*, unsigned long*)
#9 0x558454761bca in __hwasan::Thread::InitStackAndTls(__hwasan::Thread::InitState const*)
#10 0x558454761e5c in __hwasan::HwasanThreadList::CreateCurrentThread(__hwasan::Thread::InitState const*)
#11 0x55845476184f in __hwasan_thread_enter
#12 0x558454760def in HwasanThreadStartFunc(void*)
#13 0x7f6f3a3d6fa2 in start_thread
#14 0x7f6f3a15b4ce in __clone
Also reverts
7a3fb71c3cbdd80666335fa8f6f071b43f0b922a, as it's now
unneeded.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D113045
serge-sans-paille [Fri, 15 Oct 2021 13:18:52 +0000 (15:18 +0200)]
Misleading unicode identifier detection pass
Detect when an identifier contains some Right-To-Left characters.
This pass relates to https://trojansource.codes/
Differential Revision: https://reviews.llvm.org/D112914
Sergei Larin [Wed, 7 Feb 2018 17:55:58 +0000 (11:55 -0600)]
Update MaxMinLatency even if dependencies have been already scheduled.
Covers an extremely rare corner case on internal book keeping.
Kerry McLaughlin [Tue, 9 Nov 2021 09:51:00 +0000 (09:51 +0000)]
[LoopVectorize] Extract the last lane from a uniform store
Changes VPReplicateRecipe to extract the last lane from an unconditional,
uniform store instruction. collectLoopUniforms will also add stores to
the list of uniform instructions where Legal->isUniformMemOp is true.
setCostBasedWideningDecision now sets the widening decision for
all uniform memory ops to Scalarize, where previously GatherScatter
may have been chosen for scalable stores.
This fixes an assert ("Cannot yet scalarize uniform stores") in
setCostBasedWideningDecision when we have a loop containing a
uniform i1 store and a scalable VF, which we cannot create a scatter for.
Reviewed By: sdesmalen, david-arm, fhahn
Differential Revision: https://reviews.llvm.org/D112725
Valentin Clement [Tue, 9 Nov 2021 14:37:49 +0000 (15:37 +0100)]
[fir] Add fir.convert op conversion from FIR to LLVM IR
Add conversion pattern for the `fir.convert` operation.
This patch is part of the upstreaming effort from fir-dev branch.
This patch was previously landed with a truncated version that
was failing the windows buildbot.
Reviewed By: rovka, awarzynski
Differential Revision: https://reviews.llvm.org/D113469
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Pavel Labath [Thu, 4 Nov 2021 12:23:12 +0000 (13:23 +0100)]
[lldb] Fix cross-platform kills
This patch fixes an amusing bug where a Platform::Kill operation would
happily terminate a proces on a completely different platform, as long
as they have the same process ID. This was due to the fact that the
implementation was iterating through all known (debugged) processes in
order terminate them directly.
This patch just deletes that logic, and makes everything go through the
OS process termination APIs. While it would be possible to fix the logic
to check for a platform match, it seemed to me that the implementation
was being too smart for its own good -- accessing random Process
objects without knowing anything about their state is risky at best.
Going through the os ensures we avoid any races.
I also "upgrade" the termination signal to a SIGKILL to ensure the
process really dies after this operation.
Differential Revision: https://reviews.llvm.org/D113184
Kristóf Umann [Mon, 8 Nov 2021 13:40:45 +0000 (14:40 +0100)]
[analyzer][docs] Fix the incorrect structure of the checker docs
The alpha.security.cert section came right after alpha.security, making it look
like checkers like alpha.security.MmapWriteExec belonged to that package.
Differential Revision: https://reviews.llvm.org/D113397
Valentin Clement [Tue, 9 Nov 2021 14:03:51 +0000 (15:03 +0100)]
Revert "[fir] Add fir.convert op conversion from FIR to LLVM IR"
This reverts commit
165879ec31ed5cc6e4e1a2524c86fc80b81ebbda.
Windows buildbot failure
Valentin Clement [Tue, 9 Nov 2021 13:54:21 +0000 (14:54 +0100)]
[fir] Add fir.convert op conversion from FIR to LLVM IR
Add conversion pattern for the `fir.convert` operation.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: rovka, awarzynski
Differential Revision: https://reviews.llvm.org/D113469
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Sanjay Patel [Tue, 9 Nov 2021 13:27:09 +0000 (08:27 -0500)]
[InstCombine] enhance vector bitwise select matching
(Cond & C) | (~bitcast(Cond) & D) --> bitcast (select Cond, (bc C), (bc D))
This is part of fixing:
https://llvm.org/PR34047
That report shows a case where a bitcast is sitting between the select condition
candidate and its 'not' value due to current cast canonicalization rules.
There's a bitcast type restriction that might be violated in existing matching,
but I still need to investigate if that is possible -
Alive2 shows we can only do this transform safely when the bitcast is from
narrow to wide vector elements (otherwise poison could leak into elements
that were safe in the original code):
https://alive2.llvm.org/ce/z/Hf66qh
Differential Revision: https://reviews.llvm.org/D113035
Chris Jackson [Tue, 9 Nov 2021 13:26:54 +0000 (13:26 +0000)]
[DebugInfo][LSR] Add test for use of IV with a SCEV containing undef
Added a lit test that checks scev-based salvagaing does not select IVs
that have a SCEV containing an undef.
Original Differential Revision: https://reviews.llvm.org/D111810
Denys Shabalin [Tue, 9 Nov 2021 11:02:33 +0000 (12:02 +0100)]
[mlir] Add nano precision clock to execution engine
Reviewed By: ftynse, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D113476
Valentin Clement [Tue, 9 Nov 2021 13:26:40 +0000 (14:26 +0100)]
[fir] Force target for FIR to LLVM IR conversion
Valentin Clement [Tue, 9 Nov 2021 13:15:07 +0000 (14:15 +0100)]
[fir] Add complex operations conversion from FIR LLVM IR
This patch add conversion for primitive operations on complex types.
- fir.addc
- fir.subc
- fir.mulc
- fir.divc
- fir.negc
This adds also the type conversion for !fir.complex<KIND> type.
This patch is part of the upstreaming effort from fir-dev branch.
This patch was updated to avoid failure on windows buildbot.
Flang codegen does not support windows target so we force the test
to use a known target instead.
Reviewed By: kiranchandramohan, rovka
Differential Revision: https://reviews.llvm.org/D113434
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Chris Jackson [Tue, 9 Nov 2021 12:22:59 +0000 (12:22 +0000)]
[DebugInfo][LSR] Add more stringent checks on IV selection and salvage
attempts
Prevent the selection of IVs that have a SCEV containing an undef. Also
prevent salvaging attempts for values for which a SCEV could not be
created by ScalarEvolution and have only SCEVUknown.
Reviewed by: Orlando
Differential Revision: https://reviews.llvm.org/D111810
Florian Hahn [Tue, 9 Nov 2021 12:56:22 +0000 (12:56 +0000)]
[SimplifyCFG] Add early bailout if Use is not in same BB.
Without this patch, passingValueIsAlwaysUndefined will iterate over all
instructions from I to the end of the basic block, even if the use is
outside the block.
This patch adds an early bail out, if the use instruction is outside I's
BB. This can greatly reduce compile-time in cases where very large basic
blocks are involved, with a large number of PHI nodes and incoming
values.
Note that the refactoring makes the handling of the case where I is a
phi and Use is in PHI more explicit as well: for phi nodes, we can also
directly bail out. In the existing code, we would iterate until we reach
the end and return false.
Based on an earlier patch by Matt Wala.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D113293
David Pagan [Tue, 9 Nov 2021 12:33:39 +0000 (07:33 -0500)]
Initial parsing/sema for 'align' clause
Added basic parsing/sema/serialization support for 'align' clause for use with
'allocate' directive.
Andrew Savonichev [Tue, 9 Nov 2021 12:30:19 +0000 (15:30 +0300)]
[AArch64] Add Machine InstCombiner patterns for FMUL indexed variant
This patch adds DUP+FMUL => FMUL_indexed pattern to InstCombiner.
FMUL_indexed is normally selected during instruction selection, but it
does not work in cases when VDUP and VMUL are in different basic
blocks.
Differential Revision: https://reviews.llvm.org/D99662
Salman Javed [Tue, 9 Nov 2021 12:03:26 +0000 (01:03 +1300)]
[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)
Calling clang-tidy on ClangTidyDiagnosticConsumer.cpp gives a
"unmatched NOLINTBEGIN without a subsequent NOLINTEND" warning.
The "NOLINTBEGIN" and "NOLINTEND" string literals used in the
implementation of `createNolintError()` get mistaken for actual
NOLINTBEGIN/END comments used to suppress clang-tidy warnings.
Rewrite the string literals so that they can no longer be mistaken for
actual suppression comments.
Differential Revision: https://reviews.llvm.org/D113472
Valentin Clement [Tue, 9 Nov 2021 12:07:36 +0000 (13:07 +0100)]
Revert "[fir] Add complex operations conversion from FIR LLVM IR"
This reverts commit
b9bc64ba147fb90c199c56ec644e24fcabe74a5c.
flang-x86_64-windows is failing with this patch
Daniel Kiss [Thu, 4 Nov 2021 15:29:12 +0000 (16:29 +0100)]
Reland "[libcxxabi][ARM] Make CXX_end_cleanup compatible with Armv6-M"
On Armv6-M the branch may not able to reach the _Unwind_Resume function because it's relocation(R_ARM_THM_JUMP11) is in -2048, 2047 range only.
Reviewed By: chill, stuij, lenary
Differential Revision: https://reviews.llvm.org/D113181
Simon Pilgrim [Tue, 9 Nov 2021 10:18:00 +0000 (10:18 +0000)]
[SelectionDAG] Merge FoldConstantVectorArithmetic into FoldConstantArithmetic (PR36544)
This patch merges FoldConstantVectorArithmetic back into FoldConstantArithmetic.
Like FoldConstantVectorArithmetic we now handle vector ops with any operand count, but we currently still only handle binops for scalar types - this can be improved in future patches - in particular some common unary/trinary ops still have poor constant folding.
There's one change in functionality causing test changes - FoldConstantVectorArithmetic bails early if the build/splat vector isn't all constant (with some undefs) elements, but FoldConstantArithmetic doesn't - it instead attempts to fold the scalar nodes and bails if they fail to regenerate a constant/undef result, allowing some additional identity/undef patterns to be handled.
Differential Revision: https://reviews.llvm.org/D113300
Roman Lebedev [Tue, 9 Nov 2021 11:19:18 +0000 (14:19 +0300)]
[NFC][X86][Costmodel] Add i16 replication shuffle costmodel test coverage
Alexey Lapshin [Mon, 8 Nov 2021 15:34:32 +0000 (18:34 +0300)]
[llvm-dwarfdump] dump link to the immediate parent.
It is often useful to know which die is the parent of the current die.
This patch adds information about parent offset into the dump:
0x0000000b: DW_TAG_compile_unit
DW_AT_producer ("by_hand")
0x00000014: DW_TAG_base_type (0x0000000b) <<<<<<<<<<<<<<
DW_AT_name ("int")
Now it is easy to see which die is the parent of the current die.
This patch makes that behaviour to be default.
We can make it to be opt-in if neccessary.
This functionality differs from already existed "--show-parents"
in that sence that parent information is shown for all dies and
only link to the immediate parent is shown.
Differential Revision: https://reviews.llvm.org/D113406
Max Kazantsev [Tue, 9 Nov 2021 11:11:46 +0000 (18:11 +0700)]
[NFC] Get rid of hardcoded magical constant and use Optionals instead
Refactor calculateIterationsToInvariance so that it doesn't need a magical
constant to signify unknown answer.
Roman Lebedev [Tue, 9 Nov 2021 10:59:40 +0000 (13:59 +0300)]
[TTI] Adjust `getReplicationShuffleCost()` interface
It is trivial to produce DemandedSrcElts given DemandedReplicatedElts,
so don't pass the former. Also, it isn't really useful so far
to have the overload taking the Mask, so just inline it.
Simon Pilgrim [Tue, 9 Nov 2021 11:02:13 +0000 (11:02 +0000)]
Revert rGe1eec7601b6988b35ae3cdc8d67cf3cf4e1361dd "[XCOFF][yaml2obj] support for the auxiliary file header."
This is failing on MSVC builds: https://lab.llvm.org/buildbot/#/builders/86/builds/23436
Dmitry Makogon [Tue, 9 Nov 2021 09:51:41 +0000 (16:51 +0700)]
Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs"
This reapplies patch
db289340c841990055a164e8eb2a3b5ff25677bf.
The test failures on build with expensive checks caused by the patch happened due
to the fact that we sorted loop Phis in replaceCongruentIVs using llvm::sort,
which shuffles the given container if the expensive checks are enabled,
so equivalent Phis in the sorted vector had different mutual order from run
to run. replaceCongruentIVs tries to replace narrow Phis with truncations
of wide ones. In some test cases there were several Phis with the same
width, so if their order differs from run to run, the narrow Phis would
be replaced with a different Phi, depending on the shuffling result.
The patch
ae14fae0ff4304022beda5ab484f84ac0fdda807 fixed this issue by
replacing llvm::sort with llvm::stable_sort.
Florian Hahn [Tue, 9 Nov 2021 10:28:06 +0000 (10:28 +0000)]
[VPlan] Guard code to dump instructions after
d9361bfbe2ce.
This should fix build failures when built without assertions enabled,
e.g.
https://lab.llvm.org/buildbot/#/builders/205/builds/172
Florian Hahn [Tue, 9 Nov 2021 10:18:16 +0000 (10:18 +0000)]
[VPlan] Add initial inner-loop VPlan verification.
This patch adds a function to verify general properties of VPlans. The
first check makes sure that all phi-like recipes are at the beginning of
a block, with no other recipes in between.
Note that this currently may not hold for VPBlendRecipes at the moment,
as other recipes may be inserted before the VPBlendRecipe during mask
creation.
Note that this patch depends on D111300 and D111301, which fix code that
breaks the checked invariant.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D111302
Valentin Clement [Tue, 9 Nov 2021 10:04:55 +0000 (11:04 +0100)]
[fir] Add complex operations conversion from FIR LLVM IR
This patch add conversion for primitive operations on complex types.
- fir.addc
- fir.subc
- fir.mulc
- fir.divc
- fir.negc
This adds also the type conversion for !fir.complex<KIND> type.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: rovka
Differential Revision: https://reviews.llvm.org/D113434
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Djordje Todorovic [Tue, 9 Nov 2021 09:55:34 +0000 (10:55 +0100)]
[cmake] By default do not instrument compiler-rt if LLVM_BUILD_INSTRUMENTED_COVERAGE is ON
Applying the same rules as for LLVM_BUILD_INSTRUMENTED build in the cmake files.
By having this patch, we are able to disable/enable instrument+coverage build
of the compiler-rt project when building instrumented LLVM.
Differential Revision: https://reviews.llvm.org/D108127
Esme-Yi [Tue, 9 Nov 2021 09:48:40 +0000 (09:48 +0000)]
[XCOFF][yaml2obj] support for the auxiliary file header.
Summary:
This patch adds yaml2obj supporting for the auxiliary
file header of XCOFF.
Reviewed By: DiggerLin, jhenderson
Differential Revision: https://reviews.llvm.org/D111487
Justas Janickas [Tue, 9 Nov 2021 09:42:17 +0000 (09:42 +0000)]
Revert "[OpenCL] Allow optional __generic in __remove_address_space utility"
This reverts commit
81081daef0299ad59fca299c7cde3888fa691c6a.
Dmitry Makogon [Tue, 9 Nov 2021 08:41:47 +0000 (15:41 +0700)]
[SCEVExpander] Use stable_sort to sort loop Phis in SCEVExpander::replaceCongruentIVs
This is a fix for test failures on expensive checks build caused by
db289340c841990055a164e8eb2a3b5ff25677bf.
With LLVM_ENABLE_EXPENSIVE_CHECKS enabled the llvm::sort shuffles the given container.
However, the sort is only called when the TTI is passed to replaceCongruentIVs.
In the mentioned patch we pass it TTI, so the sort happens. But due to shuffling
equivalent Phis may appear in different order from run to run.
With the stable_sort instead of sort this is impossible - the order of sorted Phis
is preserved.
Diana Picus [Mon, 1 Nov 2021 10:07:34 +0000 (10:07 +0000)]
[fir] TargetRewrite: Rewrite COMPLEX values
Rewrite function signatures and calls to functions that accept or return
COMPLEX values.
Also teach insert_value and extract_value about the MLIR ComplexType, by
adding AnyComplex to AnyCompositeLike.
This patch is part of the effort for upstreaming the fir-dev branch.
Differential Revision: https://reviews.llvm.org/D113273
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Co-authored-by: Tim Keith <tkeith@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Jay Foad [Wed, 3 Nov 2021 15:45:24 +0000 (15:45 +0000)]
[CodeGen] Fix assertion failure in TwoAddressInstructionPass::rescheduleMIBelowKill
This fixes an assertion failure with -early-live-intervals when trying
to update the live intervals for a debug instruction, which don't even
have slot indexes.
Differential Revision: https://reviews.llvm.org/D113116
Shao-Ce SUN [Tue, 9 Nov 2021 09:19:50 +0000 (17:19 +0800)]
[NFC][RISCV] Fix wrong predicates of vfwredsum
Groverkss [Tue, 9 Nov 2021 08:37:59 +0000 (14:07 +0530)]
[MLIR][NFC] FlatAffineConstraints: Refactor division representation computation
This patch factors out division representation computation from upper-lower bound
inequalities to a separate function. This is done to improve readability and reuse.
This patch is marked NFC since the only change is factoring out existing code
to a separate function.
Reviewed By: grosser
Differential Revision: https://reviews.llvm.org/D113463
Kazu Hirata [Tue, 9 Nov 2021 08:26:06 +0000 (00:26 -0800)]
[Hexagon] Use MachineBasicBlock::{successors,predecessors} (NFC)
Carlos Galvez [Fri, 5 Nov 2021 09:13:33 +0000 (09:13 +0000)]
[CUDA] Bump supported CUDA version to 11.5
Differential Revision: https://reviews.llvm.org/D113249
Justas Janickas [Tue, 21 Sep 2021 11:47:00 +0000 (12:47 +0100)]
[OpenCL] Allow optional __generic in __remove_address_space utility
Clang builtin utility `__remove_address_space` now works if generic
address space is not supported in C++ for OpenCL 2021.
Differential Revision: https://reviews.llvm.org/D110155
Diana Picus [Fri, 29 Oct 2021 07:11:12 +0000 (07:11 +0000)]
[flang] Add TargetRewrite pass
This patch adds the basic infrastructure for the TargetRewrite pass,
which rewrites certain FIR dialect operations into target specific
forms. In particular, it converts boxchar function parameters, call
arguments and return values. Other convertions will be included in
future patches.
This patch is part of the effort for upstreaming the fir-dev branch.
Differential Revision: https://reviews.llvm.org/D112910
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Co-authored-by: Tim Keith <tkeith@nvidia.com>
LLVM GN Syncbot [Tue, 9 Nov 2021 07:11:34 +0000 (07:11 +0000)]
[gn build] Port
ef717f385232
Atmn Patel [Tue, 9 Nov 2021 07:09:41 +0000 (02:09 -0500)]
Revert "[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files"
This reverts commit
81a7cad2ffc18f15b732f69d991c8398c979c5ca.
LLVM GN Syncbot [Tue, 9 Nov 2021 06:54:23 +0000 (06:54 +0000)]
[gn build] Port
81a7cad2ffc1
Atmn Patel [Tue, 9 Nov 2021 04:16:54 +0000 (23:16 -0500)]
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are
just code bloat. By removing them, the codebase gets a bit cleaner.
Reviewed By: jdoerfert, JonChesterfield, tianshilei1992
Differential Revision: https://reviews.llvm.org/D113421
Akira Hatanaka [Tue, 9 Nov 2021 05:19:07 +0000 (21:19 -0800)]
[ObjC][ARC] Replace uses of ObjC intrinsics that are arguments of
operand bundle "clang.arc.attachedcall" with ObjC runtime functions
The existing code only handles the case where the intrinsic being
rewritten is used as the called function pointer of a call/invoke.
Jonas Devlieghere [Tue, 9 Nov 2021 05:01:36 +0000 (21:01 -0800)]
[debugserver] Put building for arm64e behind a CMake flag
LLVM GN Syncbot [Tue, 9 Nov 2021 04:15:33 +0000 (04:15 +0000)]
[gn build] Port
6cad45d5c6f5
Nico Weber [Tue, 9 Nov 2021 04:14:44 +0000 (23:14 -0500)]
[gn build] (manually) port
38be8f4057c1 (llvm-tli-checker)
Vitaly Buka [Tue, 9 Nov 2021 03:10:10 +0000 (19:10 -0800)]
[NFC][dfsan] Split Init and ThreadStart
Vitaly Buka [Tue, 9 Nov 2021 03:12:56 +0000 (19:12 -0800)]
Partially revert "[NFC][msan] Split ThreadStart and Init"
I don't know if removing "if (!start_routine_)" from ThreadStart
is NFC.
This reverts commit
b3267bb3afd3c70a415ae81c855462affae92f6b.
Liqiang Tao [Tue, 9 Nov 2021 03:01:48 +0000 (11:01 +0800)]
[llvm][Inline] Add a module level inliner
Add module level inliner, which is a minimum viable product at this point.
Also add some tests for it.
RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-August/152297.html
Reviewed By: kazu
Differential Revision: https://reviews.llvm.org/D106448
Vitaly Buka [Tue, 9 Nov 2021 02:54:51 +0000 (18:54 -0800)]
[NFC][msan] Split ThreadStart and Init
Akira Hatanaka [Tue, 9 Nov 2021 02:01:48 +0000 (18:01 -0800)]
[ObjC][ARC] Use operand bundle "clang.arc.attachedcall" on x86-64
https://reviews.llvm.org/D92808 made clang use the operand bundle
instead of emitting retainRV/claimRV calls on arm64. This commit makes
changes to clang that are needed to use the operand bundle on x86-64.
Differential Revision: https://reviews.llvm.org/D111331
Akira Hatanaka [Tue, 9 Nov 2021 01:50:08 +0000 (17:50 -0800)]
[ObjC][ARC] Handle operand bundle "clang.arc.attachedcall" on targets
that don't use the inline asm marker
This patch makes the changes to the ARC middle-end passes that are
needed to handle operand bundle "clang.arc.attachedcall" on targets that
don't use the inline asm marker for the retainRV/autoreleaseRV
handshake (e.g., x86-64).
Note that anyone who wants to use the operand bundle on their target has
to teach their backend to handle the operand bundle. The x86-64 backend
already knows about the operand bundle (see
https://reviews.llvm.org/D94597).
Differential Revision: https://reviews.llvm.org/D111334
ZijunZhao [Wed, 1 Sep 2021 21:52:25 +0000 (21:52 +0000)]
add tsan shared lib
Change-Id: Ic83ff1ec86d6a7d61b07fa3df7e0cb2790b5ebc7
Vitaly Buka [Tue, 9 Nov 2021 02:23:42 +0000 (18:23 -0800)]
[NFC] Move setuid.c test into sanitizer_common
River Riddle [Tue, 9 Nov 2021 01:40:17 +0000 (01:40 +0000)]
[mlir] Remove the non-templated DenseElementsAttr::getSplatValue
This predates the templated variant, and has been simply forwarding
to getSplatValue<Attribute> for some time. Removing this makes the
API a bit more uniform, and also helps prevent users from thinking
it is "cheap".
River Riddle [Tue, 9 Nov 2021 01:05:41 +0000 (01:05 +0000)]
[Tablegen] Collect all global state into one managed static
Tablegen uses copious amounts of global state for uniquing various records.
This was fine under the original vision where tablegen was a tool, and not a
library, but there are various usages of tablegen that want to use it as a library.
One concrete example is that downstream we have a kythe indexer for tablegen
constructs that allows for IDEs to serve go-to-definition/references/and more.
We currently (kind of hackily) keep the tablegen parts in a shared library that
gets loaded/unloaded.
This revision starts to remedy this by globbing all of the static state into a
managed static so that they can at least be unloaded with llvm_shutdown.
A better solution would be to feed in a context variable (much like how
the IR in LLVM/MLIR do), but that is a more invasive change that can come later.
Differential Revision: https://reviews.llvm.org/D108934
Paul Robinson [Tue, 9 Nov 2021 01:22:10 +0000 (17:22 -0800)]
Fix test dependencies to add llvm-tli-checker
Wouter van Oortmerssen [Mon, 8 Nov 2021 23:27:14 +0000 (15:27 -0800)]
[WebAssembly] fix __stack_pointer being added to .debug_aranges
When emitting a reloc for the Wasm global __stack_pointer, it was inadvertedly added to the symbols used for generating aranges, which caused some aranges to use it as the end symbol in a symbol diff, which caused a reloc for it to be emitted, which then caused an assert in `wasm64` since we have no 64-bit relocs for Wasm globals.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=52376
Differential Revision: https://reviews.llvm.org/D113438
Paul Robinson [Tue, 9 Nov 2021 00:29:28 +0000 (16:29 -0800)]
Add llvm-tli-checker
A new tool that compares TargetLibraryInfo's opinion of the availability
of library function calls against the functions actually exported by a
specified set of libraries. Can be helpful in verifying the correctness
of TLI for a given target, and avoid mishaps such as had to be addressed
in D107509 and
94b4598d.
The tool currently supports ELF object files only, although it's unlikely
to be hard to add support for other formats.
Re-commits 62dd488 with changes to use pre-generated objects, as not all
bots have ld.lld available.
Differential Revision: https://reviews.llvm.org/D111358
River Riddle [Tue, 9 Nov 2021 00:05:55 +0000 (00:05 +0000)]
[mlir] Refactor ElementsAttr's value access API
There are several aspects of the API that either aren't easy to use, or are
deceptively easy to do the wrong thing. The main change of this commit
is to remove all of the `getValue<T>`/`getFlatValue<T>` from ElementsAttr
and instead provide operator[] methods on the ranges returned by
`getValues<T>`. This provides a much more convenient API for the value
ranges. It also removes the easy-to-be-inefficient nature of
getValue/getFlatValue, which under the hood would construct a new range for
the type `T`. Constructing a range is not necessarily cheap in all cases, and
could lead to very poor performance if used within a loop; i.e. if you were to
naively write something like:
```
DenseElementsAttr attr = ...;
for (int i = 0; i < size; ++i) {
// We are internally rebuilding the APFloat value range on each iteration!!
APFloat it = attr.getFlatValue<APFloat>(i);
}
```
Differential Revision: https://reviews.llvm.org/D113229
Wouter van Oortmerssen [Fri, 5 Nov 2021 00:21:00 +0000 (17:21 -0700)]
[WebAssembly] Fix fixBrTableIndex removing instruction without checking uses
Fixes: https://bugs.llvm.org/show_bug.cgi?id=52352
Differential Revision: https://reviews.llvm.org/D113230
Paul Robinson [Mon, 8 Nov 2021 23:47:35 +0000 (15:47 -0800)]
Revert "Add llvm-tli-checker"
Not all bots have ld.lld available.
This reverts commit
62dd488164f5b68cce1ac3825f857b0108476c3c.
Jessica Clarke [Mon, 8 Nov 2021 23:44:45 +0000 (23:44 +0000)]
[bugpoint] Fix repeated off-by-one error in debug output
This resulted in the final argument being dropped from the output, which
can be rather important.
Fangrui Song [Mon, 8 Nov 2021 23:20:16 +0000 (15:20 -0800)]
[docs] Remove outdated documentation for the legacy Atom-based LLD
The outdated documentation diverges a lot from the current state of
COFF/Mach-O/ELF/wasm ports and may just confuse users. It is better rewriting
some if useful.
Tested with `ninja docs-lld-html`
Reviewed By: #lld-macho, lhames, Jez Ng
Differential Revision: https://reviews.llvm.org/D113432
Chia-hung Duan [Mon, 8 Nov 2021 22:56:40 +0000 (22:56 +0000)]
[mlir-tblgen] Support `either` in Tablegen DRR.
Add a new directive `either` to specify the operands can be matched in either order
Reviewed By: jpienaar, Mogball
Differential Revision: https://reviews.llvm.org/D110666
Vyacheslav Zakharin [Tue, 21 Sep 2021 19:17:55 +0000 (12:17 -0700)]
[NFC] Initial documentation for declare target indirect support.
Differential Revision: https://reviews.llvm.org/D110193
Craig Topper [Mon, 8 Nov 2021 23:05:27 +0000 (15:05 -0800)]
[RISCV] Use TargetConstant for CSR number for READ_CSR/WRITE_CSR.
This is consistent with what we do for other operands that are required
to be constants.
I don't think this results in any real changes. The pattern match
code for isel treats ConstantSDNode and TargetConstantSDNode the same.
Arthur Eubanks [Fri, 5 Nov 2021 18:07:54 +0000 (11:07 -0700)]
[NFC][FuncAttrs] Keep track of modified functions
This is in preparation for only invalidating analyses on changed
functions.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D113303
Paul Robinson [Mon, 8 Nov 2021 22:44:32 +0000 (14:44 -0800)]
Add llvm-tli-checker
A new tool that compares TargetLibraryInfo's opinion of the availability
of library function calls against the functions actually exported by a
specified set of libraries. Can be helpful in verifying the correctness
of TLI for a given target, and avoid mishaps such as had to be addressed
in D107509 and
94b4598d.
The tool currently supports ELF object files only, although it's unlikely
to be hard to add support for other formats.
Differential Revision: https://reviews.llvm.org/D111358
Marius Brehler [Mon, 8 Nov 2021 22:40:09 +0000 (22:40 +0000)]
[mlir][docs] Unify style (nfc)
Akira Hatanaka [Mon, 8 Nov 2021 22:39:16 +0000 (14:39 -0800)]
[ObjC][ARC] Invalidate an entry of UnderlyingObjCPtrCache when the
instruction the key points to is deleted
Use weak value handles for both the key and the value. The entry is
invalid if either value handle is null.
This fixes an assertion failure in BasicAAResult::alias that is caused
by UnderlyingObjCPtrCache returning a wrong value.
I don't have a test case for this patch that fails reliably.
rdar://
83984790
David CARLIER [Mon, 8 Nov 2021 22:26:32 +0000 (22:26 +0000)]
[compiler-rt] TlsBaseAddr value for darwin arm64
getting the tls base address. unlike linux arm64, the tpidr_el0 returns always 0 (aka unused)
thus using tpidrro_el0 instead clearing up the cpu id encoded in the lower bits.
Reviewed-By: yln
Differential Revision: https://reviews.llvm.org/D112866
Ard Biesheuvel [Mon, 8 Nov 2021 21:22:04 +0000 (22:22 +0100)]
[ARM] implement LOAD_STACK_GUARD for remaining targets
Currently, LOAD_STACK_GUARD on ARM is only implemented for Mach-O targets, and
other targets rely on the generic support which may result in spilling of the
stack canary value or address, or may cause it to be kept in a callee save
register across function calls, which means they essentially get spilled as
well, only by the callee when it wants to free up this register.
So let's implement LOAD_STACK GUARD for other targets as well. This ensures
that the load of the stack canary is rematerialized fully in the epilogue.
This code was split off from
D112768: [ARM] implement support for TLS register based stack protector
for which it is a prerequisite.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D112811
Arthur O'Dwyer [Sat, 6 Nov 2021 18:37:49 +0000 (14:37 -0400)]
[libc++] [test] Eliminate the libcpp-no-if-constexpr feature flag.
At this point, every supported compiler that claims a -std=c++17 mode
should also support `if constexpr`. This was an issue for GCC 5
and GCC 6, but hasn't been an issue since GCC 7. (Our current
minimum supported GCC version, IIUC, is GCC 10 or 11.)
Differential Revision: https://reviews.llvm.org/D113348
Snehasish Kumar [Mon, 8 Nov 2021 21:57:32 +0000 (13:57 -0800)]
[NFC] Update the test compiler to use clangxx.
This ensures that the c++ test gets the right CXXFLAGS if required.
Volodymyr Sapsai [Fri, 15 Oct 2021 00:45:53 +0000 (17:45 -0700)]
[modules] Update visibility for merged ObjCProtocolDecl definitions.
Merge definition visibility the same way we do for other decls. Without
the fix the added test emits `-Wobjc-method-access` as it cannot find a
visible protocol. Make this warning `-Werror` so the test would fail
when protocol visibility regresses.
rdar://
83600696
Differential Revision: https://reviews.llvm.org/D111860
Michael Liao [Fri, 15 Oct 2021 03:41:16 +0000 (23:41 -0400)]
[InferAddressSpaces] Support assumed addrspaces from addrspace predicates.
- CUDA cannot associate memory space with pointer types. Even though Clang could add extra attributes to specify the address space explicitly on a pointer type, it breaks the portability between Clang and NVCC.
- This change proposes to assume the address space from a pointer from the assumption built upon target-specific address space predicates, such as `__isGlobal` from CUDA. E.g.,
```
foo(float *p) {
__builtin_assume(__isGlobal(p));
// From there, we could assume p is a global pointer instead of a
// generic one.
}
```
This makes the code portable without introducing the implementation-specific features.
Note that NVCC starts to support __builtin_assume from version 11.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D112041
Chia-hung Duan [Mon, 8 Nov 2021 21:34:02 +0000 (21:34 +0000)]
Static verifier for type/attribute in DRR
Generate static function for matching the type/attribute to reduce the
memory footprint.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D110199
Peter Klausler [Mon, 1 Nov 2021 23:24:01 +0000 (16:24 -0700)]
[flang] Don't reference non-invariant symbols in shape expressions
When an array's shape involves references to symbols that are not
invariant in a scope -- the classic example being a dummy array
with an explicit shape involving other dummy arguments -- the
compiler was creating shape expressions that referenced those
symbols. This might be valid if those symbols are somehow
captured and copied at each entry point to a subprogram, and
the copies referenced in the shapes instead, but that's not
the case.
This patch introduces a new expression predicate IsScopeInvariantExpr(),
which defines a class of expressions that contains constant expressions
(in the sense that the standard uses that term) as well as references
to items that may be safely accessed in a context-free way throughout
their scopes. This includes dummy arguments that are INTENT(IN)
and not VALUE, descriptor inquiries into descriptors that cannot
change, and bare LEN type parameters within the definitions of
derived types. The new predicate is then used in shape analysis
to winnow out results that would have otherwise been contextual.
Differential Revision: https://reviews.llvm.org/D113309
Adrian Prantl [Mon, 8 Nov 2021 20:42:09 +0000 (12:42 -0800)]
Attempt to work around type checking error on older compilers
Mogball [Mon, 8 Nov 2021 20:36:10 +0000 (20:36 +0000)]
[mlir][ods] fix c++11 build
Fangrui Song [Mon, 8 Nov 2021 20:39:08 +0000 (12:39 -0800)]
[ELF][ARM] Improve error message for unknown relocation
Like rLLD354040.
Before: `error: unrecognized relocation Unknown (254)`
Now: `error: unknown relocation (254) against symbol foo`