Adhemerval Zanella [Mon, 14 Dec 2020 17:24:53 +0000 (17:24 +0000)]
[obj2yaml][yaml2obj] - Add AArch64 STO_AARCH64_VARIANT_PCS support
Reviewed By: grimar, MaskRay
Differential Revision: https://reviews.llvm.org/D93235
Nathan James [Thu, 17 Dec 2020 14:09:08 +0000 (14:09 +0000)]
[clang-tidy][NFC] Reduce copies of Intrusive..FileSystem
Swapped a few instances where a move is more optimal or the target doesn't need to hold a reference.
Florian Hahn [Thu, 17 Dec 2020 13:42:29 +0000 (13:42 +0000)]
[SimplifyCFG] Preserve !annotation in FoldBranchToCommonDest.
When folding a branch to a common destination, preserve !annotation on
the created instruction, if the terminator of the BB that is going to be
removed has !annotation. This should ensure that !annotation is attached
to the instructions that 'replace' the original terminator.
Reviewed By: jdoerfert, lebedev.ri
Differential Revision: https://reviews.llvm.org/D93410
Jun Ma [Wed, 16 Dec 2020 07:05:49 +0000 (15:05 +0800)]
[InstCombine] Remove scalable vector restriction in InstCombineCasts
Differential Revision: https://reviews.llvm.org/D93389
Jez Ng [Thu, 17 Dec 2020 00:14:57 +0000 (19:14 -0500)]
[lld-macho] Use LC_LOAD_WEAK_DYLIB for dylibs with only weakrefs
Note that dylibs without *any* refs will still be loaded in the usual
(strong) fashion.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D93435
Jez Ng [Wed, 16 Dec 2020 02:05:06 +0000 (21:05 -0500)]
[lld-macho] Add support for weak references
Weak references need not necessarily be satisfied at runtime (but they must
still be satisfied at link time). So symbol resolution still works as per usual,
but we now pass around a flag -- ultimately emitting it in the bind table -- to
indicate if a given dylib symbol is a weak reference.
ld64's behavior for symbols that have both weak and strong references is
a bit bizarre. For non-function symbols, it will emit a weak import. For
function symbols (those referenced by BRANCH relocs), it will emit a
regular import. I'm not sure what value there is in that behavior, and
since emulating it will make our implementation more complex, I've
decided to treat regular weakrefs like function symbol ones for now.
Fixes PR48511.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D93369
Lucas Prates [Wed, 9 Dec 2020 16:13:36 +0000 (16:13 +0000)]
[ARM] Adding v8.7-A command-line support for the ARM target
This extends the command-line support for the 'armv8.7-a' architecture
name to the ARM target.
Based on a patch written by Momchil Velikov.
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D93231
Lucas Prates [Mon, 16 Nov 2020 14:48:22 +0000 (14:48 +0000)]
[ARM][AAarch64] Initial command-line support for v8.7-A
This introduces command-line support for the 'armv8.7-a' architecture name
(and an alias without the '-', as usual), and for the 'ls64' extension name.
Based on patches written by Simon Tatham.
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D91776
Lucas Prates [Mon, 16 Nov 2020 14:23:14 +0000 (14:23 +0000)]
[AArch64] Adding the v8.7-A LD64B/ST64B Accelerator extension
This adds support for the v8.7-A LD64B/ST64B Accelerator extension
through a subtarget feature called "ls64". It adds four 64-byte
load/store instructions with an operand in the new GPR64x8 register
class, and one system register that's part of the same extension.
Based on patches written by Simon Tatham.
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D91775
Lucas Prates [Thu, 12 Nov 2020 10:54:28 +0000 (10:54 +0000)]
[AArch64] Add a GPR64x8 register class
This adds a GPR64x8 register class that will be needed as the data
operand to the LD64B/ST64B family of instructions in the v8.7-A
Accelerator Extension, which load or store a contiguous range of eight
x-regs. It has to be its own register class so that register allocation
will have visibility of the full set of registers actually read/written
by the instructions, which will be needed when we add intrinsics and/or
inline asm access to this piece of architecture.
Patch written by Simon Tatham.
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D91774
Lucas Prates [Thu, 12 Nov 2020 09:50:58 +0000 (09:50 +0000)]
[ARM][AArch64] Adding basic support for the v8.7-A architecture
This introduces support for the v8.7-A architecture through a new
subtarget feature called "v8.7a". It adds two new "WFET" and "WFIT"
instructions, the nXS limited-TLB-maintenance qualifier for DSB and TLBI
instructions, a new CPU id register, ID_AA64ISAR2_EL1, and the new
HCRX_EL2 system register.
Based on patches written by Simon Tatham and Victor Campos.
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D91772
Lucas Prates [Mon, 30 Nov 2020 15:23:27 +0000 (15:23 +0000)]
[NFC][AArch64] Capturing multiple feature requirements in AsmParser messages
This enables the capturing of multiple required features in the AArch64
AsmParser's SysAlias error messages.
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D92388
Lucas Prates [Wed, 11 Nov 2020 16:38:54 +0000 (16:38 +0000)]
[NFC][AArch64] Move AArch64 MSR/MRS into a new decoder namespace
This removes the general forms of the AArch64 MSR and MRS instructions
from the same decoding table that contains many more specific
instructions that supersede them. They're now in a separate decoding
table of their own, called "Fallback", which is only consulted in the
event of the main decoder table failing to produce an answer.
This should avoid decoding conflicts on future specialized instructions
in the MSR space.
Patch written by Simon Tatham.
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D91771
Florian Hahn [Thu, 17 Dec 2020 12:59:02 +0000 (12:59 +0000)]
[IRBuilder] Generalize debug loc handling for arbitrary metadata.
This patch extends IRBuilder to allow adding/preserving arbitrary
metadata on created instructions.
Instead of using references to specific metadata nodes (like DebugLoc),
IRbuilder now keeps a vector of (metadata kind, MDNode *) pairs, which
are added to each created instruction.
The patch itself is a NFC and only moves the existing debug location
handling over to the new system. In a follow-up patch it will be used to
preserve !annotation metadata besides !dbg.
The current approach requires iterating over MetadataToCopy to avoid
adding duplicates, but given that the number of metadata kinds to
copy/preserve is going to be very small initially (0, 1 (for !dbg) or 2
(!dbg and !annotation)) that should not matter.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D93400
Guillaume Chatelet [Thu, 17 Dec 2020 13:16:14 +0000 (13:16 +0000)]
[libc] revamp memory function benchmark
The benchmarking infrastructure can now run in two modes:
- Sweep Mode: which generates a ramp of size values (same as before),
- Distribution Mode: allows the user to select a distribution for the size paramater that is representative from production.
The analysis tool has also been updated to handle both modes.
Differential Revision: https://reviews.llvm.org/D93210
Pavel Labath [Thu, 17 Dec 2020 13:17:03 +0000 (14:17 +0100)]
[lldb-vscode] Speculative fix for raciness in TestVSCode_attach
The test appears to expect the inferior to be stopped, but the custom
"attach commands" leave it in a running state.
It's unclear how this could have ever worked.
Alex Zinenko [Thu, 17 Dec 2020 13:09:11 +0000 (14:09 +0100)]
[mlir] Fix syntax error in markdown documentation
Michał Górny [Thu, 17 Dec 2020 12:54:59 +0000 (13:54 +0100)]
[lldb] [unittests] Filter FreeBSD through CMake rather than #ifdef
Michał Górny [Tue, 15 Dec 2020 15:15:22 +0000 (16:15 +0100)]
[lldb] [unittests] Add tests for NetBSD register offsets/sizes
Differential Revision: https://reviews.llvm.org/D93299
Cullen Rhodes [Wed, 9 Dec 2020 13:18:22 +0000 (13:18 +0000)]
[LV] Disable epilogue vectorization for scalable VFs
Epilogue vectorization doesn't support scalable vectorization factors
yet, disable it for now.
Reviewed By: sdesmalen, bmahjour
Differential Revision: https://reviews.llvm.org/D93063
Simon Pilgrim [Thu, 17 Dec 2020 12:06:28 +0000 (12:06 +0000)]
[DebugInfo] Fix MSVC build by adding back necessary reverse_iterator != operator
Put back the std::reverse_iterator<DWARFDie::iterator> != operator that was removed in D78938 to fix VS2019 builds
Sam McCall [Thu, 17 Dec 2020 11:41:44 +0000 (12:41 +0100)]
[clangd] Add llvm:: qualifier to work around GCC bug. NFC
Some old GCC versions seem to miss the default template parameter when
using the clang/Basic/LLVM.h forward declarations of SmallVector.
See D92788
Kerry McLaughlin [Thu, 17 Dec 2020 11:12:14 +0000 (11:12 +0000)]
[AArch64] Renamed sve-masked-scatter-legalise.ll. NFC.
Martin Storsjö [Tue, 15 Dec 2020 07:15:37 +0000 (09:15 +0200)]
[libcxx] Remove ifdefs in the message to static_assert. NFC.
Differential Revision: https://reviews.llvm.org/D93283
Alex Zinenko [Thu, 17 Dec 2020 11:19:52 +0000 (12:19 +0100)]
[mlir] Move LLVM Dialect Op documentation to ODS
This was long overdue. The initial documentation for the LLVM dialect was
introduced before ODS had support for long descriptions. This is now possible,
so the documentation is moved to ODS, which can serve as a single source of
truth. The high-level description of the dialect structure is updated to
reflect that.
Depends On: D93315
Reviewed By: rriddle, mehdi_amini
Differential Revision: https://reviews.llvm.org/D93425
Alex Zinenko [Tue, 15 Dec 2020 17:29:12 +0000 (18:29 +0100)]
[mlir] partially update LLVM dialect documentation
Rewrite the parts of the documentation that became stale: context/module
handling and type system. Expand the type system description.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D93315
Kerry McLaughlin [Thu, 17 Dec 2020 10:36:52 +0000 (10:36 +0000)]
[SVE][CodeGen] Add bfloat16 support to scalable masked gather
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D93307
dfukalov [Wed, 9 Dec 2020 12:06:50 +0000 (15:06 +0300)]
[NFC] Reduce include files dependency and AA header cleanup (part 2).
Continuing work started in https://reviews.llvm.org/D92489:
Removed a bunch of includes from "AliasAnalysis.h" and "LoopPassManager.h".
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D92852
Simon Pilgrim [Thu, 17 Dec 2020 11:02:34 +0000 (11:02 +0000)]
[X86] Remove extract_subvector(subv_broadcast_load()) fold.
This was needed in an earlier version of D92645, but isn't now - and I've just noticed that it was potentially flawed depending on the relevant widths of the broadcasted and extracted subvectors.
Krasimir Georgiev [Thu, 17 Dec 2020 10:48:42 +0000 (11:48 +0100)]
fix a -Wunused-variable warning in release build
Raphael Isemann [Thu, 17 Dec 2020 10:23:11 +0000 (11:23 +0100)]
[lldb] Add std::array to the supported template list of the CxxModuleHandler
Identical to the other patches that add STL containers to the supported
templated list.
Barry Revzin [Thu, 17 Dec 2020 10:41:35 +0000 (10:41 +0000)]
Make LLVM build in C++20 mode
Part of the <=> changes in C++20 make certain patterns of writing equality
operators ambiguous with themselves (sorry!).
This patch goes through and adjusts all the comparison operators such that
they should work in both C++17 and C++20 modes. It also makes two other small
C++20-specific changes (adding a constructor to a type that cases to be an
aggregate, and adding casts from u8 literals which no longer have type
const char*).
There were four categories of errors that this review fixes.
Here are canonical examples of them, ordered from most to least common:
// 1) Missing const
namespace missing_const {
struct A {
#ifndef FIXED
bool operator==(A const&);
#else
bool operator==(A const&) const;
#endif
};
bool a = A{} == A{}; // error
}
// 2) Type mismatch on CRTP
namespace crtp_mismatch {
template <typename Derived>
struct Base {
#ifndef FIXED
bool operator==(Derived const&) const;
#else
// in one case changed to taking Base const&
friend bool operator==(Derived const&, Derived const&);
#endif
};
struct D : Base<D> { };
bool b = D{} == D{}; // error
}
// 3) iterator/const_iterator with only mixed comparison
namespace iter_const_iter {
template <bool Const>
struct iterator {
using const_iterator = iterator<true>;
iterator();
template <bool B, std::enable_if_t<(Const && !B), int> = 0>
iterator(iterator<B> const&);
#ifndef FIXED
bool operator==(const_iterator const&) const;
#else
friend bool operator==(iterator const&, iterator const&);
#endif
};
bool c = iterator<false>{} == iterator<false>{} // error
|| iterator<false>{} == iterator<true>{}
|| iterator<true>{} == iterator<false>{}
|| iterator<true>{} == iterator<true>{};
}
// 4) Same-type comparison but only have mixed-type operator
namespace ambiguous_choice {
enum Color { Red };
struct C {
C();
C(Color);
operator Color() const;
bool operator==(Color) const;
friend bool operator==(C, C);
};
bool c = C{} == C{}; // error
bool d = C{} == Red;
}
Differential revision: https://reviews.llvm.org/D78938
Simon Pilgrim [Thu, 17 Dec 2020 10:12:51 +0000 (10:12 +0000)]
[X86] Add X86ISD::SUBV_BROADCAST_LOAD and begin removing X86ISD::SUBV_BROADCAST (PR38969)
Subvector broadcasts are only load instructions, yet X86ISD::SUBV_BROADCAST treats them more generally, requiring a lot of fallback tablegen patterns.
This initial patch replaces constant vector lowering inside lowerBuildVectorAsBroadcast with direct X86ISD::SUBV_BROADCAST_LOAD loads which helps us merge a number of equivalent loads/broadcasts.
As well as general plumbing/analysis additions for SUBV_BROADCAST_LOAD, I needed to wrap SelectionDAG::makeEquivalentMemoryOrdering so it can handle result chains from non generic LoadSDNode nodes.
Later patches will continue to replace X86ISD::SUBV_BROADCAST usage.
Differential Revision: https://reviews.llvm.org/D92645
Krasimir Georgiev [Thu, 17 Dec 2020 10:16:08 +0000 (11:16 +0100)]
[libc] add back math.h #include utils/FPUtil/ManipulationFunctions.h
This partially reverts
cee1e7d14f4628d6174b33640d502bff3b54ae45:
[libc][NFC][Obvious] Remove few unnecessary #include directives in tests.
That commit causes a test failure in our configuration:
[ RUN ] ILogbTest.SpecialNumbers_ilogb
third_party/llvm/llvm-project/libc/test/src/math/ILogbTest.h:28: FAILURE
Expected: FP_ILOGBNAN
Which is:
2147483647
To be equal to: func(__llvm_libc::fputil::FPBits<T>::buildNaN(1))
Which is: -
2147483648
Raphael Isemann [Thu, 17 Dec 2020 09:46:26 +0000 (10:46 +0100)]
[lldb] Unify the two CreateTypedef implementations in TypeSystemClang
To get LLDB one step closer to fulfil the software redundancy requirements of
modern aircrafts, we apparently decided to have two separately maintained
implementations of `CreateTypedef` in TypeSystemClang. Let's pass on the idea of
an LLDB-powered jetliner and deleted one implementation.
On a more serious note: This function got duplicated a long time ago when the
idea of CompilerType with a backing TypeSystemClang subclass happened
(
56939cb31061d24ae3d1fc62da38b57e78bb2556). One implementation was supposed to
be called from CompilerType::CreateTypedef and the other has just always been
around to create typedefs. By accident one of the implementations is only used
by the PDB parser while the CompilerType::CreateTypedef backend is used by the
rest of LLDB.
We also had some patches over the year that only fixed one of the two functions
(D18099 for example only fixed up the CompilerType::CreateTypedef
implementation). D51162 and D86140 both fixed the same missing `addDecl` call
for one of the two implementations.
This patch:
* deletes the `CreateTypedefType` function as its only used by the PDB parser
and the `CreateTypedef` implementation is anyway needed as it's the backend
implementation of CompilerType.
* replaces the calls in the PDB parser by just calling the CompilerType wrapper.
* moves the documentation to the remaining function.
* moves the check for empty typedef names that was only in the deleted
implementation to the other (I don't think this fixes anything as I believe
all callers are already doing the same check).
I'll fix up the usual stuff (not using StringRef, not doing early exit) in a NFC
follow-up.
This patch is not NFC as the PDB parser now calls the function that has the fix
from D18099.
Reviewed By: labath, JDevlieghere
Differential Revision: https://reviews.llvm.org/D93382
sameeran joshi [Fri, 4 Dec 2020 07:34:52 +0000 (13:04 +0530)]
[Flang][openmp]Fix crash in OpenMP semantic check( bug 48308)
Fixes the bug reported in https://bugs.llvm.org/show_bug.cgi?id=48308
Reviewed By: kiranchandramohan, clementval
Differential Revision: https://reviews.llvm.org/D92638
mydeveloperday [Thu, 17 Dec 2020 09:39:37 +0000 (09:39 +0000)]
[clang-format] PR35514 brace-init member initializers in function-try-blocks are not formatted correctly
https://bugs.llvm.org/show_bug.cgi?id=35514
Initializer lists with a try-block are incorrectly formatted.
e.g.
```
Foo(int abc, int def) try : _abc(abc), _def{def}, _ghi{1} {
callA();
callB();
} catch (std::exception&) {
}
```
is formatted as:
```
Foo(int abc, int def) try : _abc(abc), _def { def }
, _ghi{1} {
callA();
callB();
}
catch (std::exception&) {
}
```
This revision adds support in the parseTryCatch for braced initializers in the initializer list
Reviewed By: curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D93296
David Spickett [Tue, 15 Dec 2020 16:17:28 +0000 (16:17 +0000)]
[llvm][AArch64] Actually check expected FPU for CPUs
We were passing this as an argument but never using
it. ARM has always checked this.
Note that the FPU list is shared between ARM and AArch64
so there is no AArch64::getFPUName, just ARM::getFPUName.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D93387
Florian Hahn [Thu, 17 Dec 2020 08:47:46 +0000 (08:47 +0000)]
[InstCombine] Preserve !annotation for newly created instructions.
When replacing an instruction with !annotation with a newly created
replacement, add the !annotation metadata to the replacement.
This mostly covers cases where the new instructions are created using
the ::Create helpers. Instructions created by IRBuilder will be handled
by D91444.
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D93399
Andrzej Warzynski [Thu, 17 Dec 2020 09:04:41 +0000 (09:04 +0000)]
[clang][nfc] Update comment to match the opening `{`
Michał Górny [Sat, 28 Nov 2020 10:11:01 +0000 (11:11 +0100)]
[lldb] [POSIX-DYLD] Update the cached exe path after attach
Fix the POSIX-DYLD plugin to update the cached executable path after
attaching. Previously, the path was cached in DYLDRendezvous
constructor and not updated afterwards. This meant that if LLDB was
attaching to a process (e.g. via connecting to lldb-server), the code
stored the empty path before DidAttach() resolved it. The fix updates
the cached path in DidAttach().
This fixes a new instance of https://llvm.org/pr17880
Differential Revision: https://reviews.llvm.org/D92264
Michał Górny [Fri, 4 Dec 2020 17:56:46 +0000 (18:56 +0100)]
[lldb] [POSIX-DYLD] Add libraries from initial rendezvous brkpt hit
Explicitly consider the libraries reported on the initial rendezvous
breakpoint hit added. This is necessary on FreeBSD since the dynamic
loader issues only a single 'consistent' state rendezvous breakpoint hit
for all the libraries present in DT_NEEDED. It is also helpful on Linux
where it ensures that ld-linux is considered loaded as well
as the shared system libraries reported afterwards.
Reenable memory maps on FreeBSD since this fixed the issue triggered
by them.
Differential Revision: https://reviews.llvm.org/D92187
Alex Zinenko [Wed, 16 Dec 2020 17:32:26 +0000 (18:32 +0100)]
[mlir] Support index and memref types in llvm.mlir.cast
This operation is designed to support partial conversion, more specifically the
IR state in which some operations expect or produce built-in types and some
operations produce and expect LLVM dialect types. It is reasonable for it to
support cast between built-in types and any equivalent that could be produced
by the type conversion. (At the same time, we don't want the dialect to depend
on the type conversion as it could lead to a dependency cycle). Introduce
support for casting from index to any integer type and back, and from memref to
bare pointer or memref descriptor type and back.
Contrary to what the TODO in the code stated, there are no particular
precautions necessary to handle the bare pointer conversion for memerfs. This
conversion applies exclusively to statically-shaped memrefs, so we can always
recover the full descriptor contents from the type.
This patch simultaneously tightens the verification for other types to only
accept matching pairs of types, e.g., i64 and !llvm.i64, as opposed to the
previous implementation that only checked if the types were generally allowed
byt not for matching, e.g. i64 could be "casted" to !llvm.bfloat, which is not
the intended semantics.
Move the relevant test under test/Dialect/LLVMIR because it is not specific to
the conversion pass, but rather exercises an op in the dialect. If we decide
this op does not belong to the LLVM dialect, both the dialect and the op should
move together.
Reviewed By: silvas, ezhulenev
Differential Revision: https://reviews.llvm.org/D93405
QingShan Zhang [Thu, 17 Dec 2020 07:59:30 +0000 (07:59 +0000)]
Expand the fp_to_int/int_to_fp/fp_round/fp_extend as libcall for fp128
X86 and AArch64 expand it as libcall inside the target. And PowerPC also
want to expand them as libcall for P8. So, propose an implement in the
legalizer to common the logic and remove the code for X86/AArch64 to
avoid the duplicate code.
Reviewed By: Craig Topper
Differential Revision: https://reviews.llvm.org/D91331
Fangrui Song [Thu, 17 Dec 2020 07:28:32 +0000 (23:28 -0800)]
Use basic_string::find(char) instead of basic_string::find(const char *s, size_type pos=0)
Many (StringRef) cannot be detected by clang-tidy performance-faster-string-find.
Wei Mi [Mon, 14 Dec 2020 22:49:20 +0000 (14:49 -0800)]
[NFC][SampleFDO] Preparation to support multiple sections with the same type
in ExtBinary format.
Currently ExtBinary format doesn't support multiple sections with the same type
in the profile. We add the support in this patch. Previously we use the section
type to identify a section uniquely. Now we introduces a LayoutIndex in the
SecHdrTableEntry and use the LayoutIndex to locate the target section. The
allocations of NameTable and FuncOffsetTable are adjusted accordingly.
Currently it works as a NFC because it won't change anything for current layout.
The test for multiple sections support will be included in another patch where a
new type of profile containing multiple sections with the same type is
introduced.
Differential Revision: https://reviews.llvm.org/D93254
Xiang1 Zhang [Thu, 17 Dec 2020 04:23:29 +0000 (20:23 -0800)]
[Debugify] Support checking Machine IR debug info
Add mir-check-debug pass to check MIR-level debug info.
For IR-level, currently, LLVM have debugify + check-debugify to generate
and check debug IR. Much like the IR-level pass debugify, mir-debugify
inserts sequentially increasing line locations to each MachineInstr in a
Module, But there is no equivalent MIR-level check-debugify pass, So now
we support it at "mir-check-debug".
Reviewed By: djtodoro
Differential Revision: https://reviews.llvm.org/D91595
Kazu Hirata [Thu, 17 Dec 2020 05:57:48 +0000 (21:57 -0800)]
[GCN] Remove unused function handleNewInstruction (NFC)
The function was added without a user on Dec 22, 2016 in commit
7e274e02ae088923e67cd13b99d52644532ad1cc. It seems to be unused since
then.
Kazu Hirata [Thu, 17 Dec 2020 05:30:44 +0000 (21:30 -0800)]
[IR, CodeGen] Use llvm::is_contained (NFC)
Mircea Trofin [Wed, 16 Dec 2020 18:20:12 +0000 (10:20 -0800)]
[NFC] factor update test function test builder as a class
This allows us to have shared logic over multiple test runs, e.g. do we
have unused prefixes, or which function bodies have conflicting outputs
for a prefix appearing in different RUN lines.
This patch is just wrapping existing functionality, and replacing its uses.
A subsequent patch would then fold the current functionality into the newly
introduced class.
Differential Revision: https://reviews.llvm.org/D93413
Craig Topper [Thu, 17 Dec 2020 04:55:23 +0000 (20:55 -0800)]
[RISCV] Infer mask type from data type for vector vle and vse intrinsics.
The mask type should have the same number of elements as the data
type.
Similar to D93409 which did this for arithmetic intrinsics.
River Riddle [Thu, 17 Dec 2020 04:35:25 +0000 (20:35 -0800)]
[mlir][NFC] Remove StandardTypes.h now that all usages point to BuiltinTypes.h
Differential Revision: https://reviews.llvm.org/D93430
Craig Topper [Thu, 17 Dec 2020 04:04:48 +0000 (20:04 -0800)]
[RISCV] Infer mask type for vector intrinsics from the data type
We can use LLVMScalarOrSameVectorWidth<0, llvm_i1_ty> to infer the mask type from the anyvector_ty. This will save us from needing to pass it to getDeclaration when creating these intrinsics from clang.
No tests updates are needed because our declarations are exploiting a behavior in the IR parser where the declaration of an intrinsic doesn't need to mention all the types as long as there isn't a name conflict in the file.
Reviewed By: khchen
Differential Revision: https://reviews.llvm.org/D93409
Xiang1 Zhang [Thu, 17 Dec 2020 04:12:01 +0000 (20:12 -0800)]
Revert "[Debugify] Support checking Machine IR debug info"
This reverts commit
50aaa8c274910d78d7bf6c929a34fe58b1f45579.
Hsiangkai Wang [Wed, 16 Dec 2020 08:46:21 +0000 (16:46 +0800)]
[RISCV] Define vector widening mul intrinsics.
Define vector widening mul intrinsics and lower them to V instructions.
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93381
Hsiangkai Wang [Wed, 16 Dec 2020 08:25:46 +0000 (16:25 +0800)]
[RISCV] Define vector mul/div/rem intrinsics.
Define vector mul/div/rem intrinsics and lower them to V instructions.
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93380
Hsiangkai Wang [Tue, 15 Dec 2020 06:59:22 +0000 (14:59 +0800)]
[RISCV] V does not imply F.
If users want to use vector floating point instructions, they need to
specify 'F' extension additionally.
Differential Revision: https://reviews.llvm.org/D93282
Matt Arsenault [Thu, 15 Oct 2020 22:40:02 +0000 (18:40 -0400)]
AMDGPU: Remove SGPRSpillVGPRDefinedSet hack
These VGPRs should be reserved and therefore do not need "correct"
liveness. They should not have undef uses, which can still cause
issues.
Zakk Chen [Tue, 15 Dec 2020 14:53:16 +0000 (06:53 -0800)]
[RISCV] Define vle/vse intrinsics.
Define vle/vse intrinsics and lower to V instructions.
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D93359
Xiang1 Zhang [Tue, 15 Dec 2020 07:48:11 +0000 (23:48 -0800)]
[Debugify] Support checking Machine IR debug info
Add mir-check-debug pass to check MIR-level debug info.
For IR-level, currently, LLVM have debugify + check-debugify to generate
and check debug IR. Much like the IR-level pass debugify, mir-debugify
inserts sequentially increasing line locations to each MachineInstr in a
Module, But there is no equivalent MIR-level check-debugify pass, So now
we support it at "mir-check-debug".
Reviewed By: djtodoro
Differential Revision: https://reviews.llvm.org/D91595
Johannes Doerfert [Mon, 23 Nov 2020 17:48:59 +0000 (11:48 -0600)]
[OpenMP] Add initial support for `omp [begin/end] assumes`
The `assumes` directive is an OpenMP 5.1 feature that allows the user to
provide assumptions to the optimizer. Assumptions can refer to
directives (`absent` and `contains` clauses), expressions (`holds`
clause), or generic properties (`no_openmp_routines`, `ext_ABCD`, ...).
The `assumes` spelling is used for assumptions in the global scope while
`assume` is used for executable contexts with an associated structured
block.
This patch only implements the global spellings. While clauses with
arguments are "accepted" by the parser, they will simply be ignored for
now. The implementation lowers the assumptions directly to the
`AssumptionAttr`.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D91980
Nico Weber [Thu, 17 Dec 2020 01:49:56 +0000 (20:49 -0500)]
[gn build] (manually) port
ddffcdf0a66
Arthur Eubanks [Wed, 16 Dec 2020 23:38:58 +0000 (15:38 -0800)]
[test] Cleanup some CGSCCPassManager tests
Don't iterate over SCC as we potentially modify it.
Verify module (and fix some broken ones).
Only run pass once and make sure that it's actually run.
Rename tests to just end in a number since I'm planning on adding a
bunch more which won't have good individual names. Instead, add comments
on the transformations that each test does.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D93427
Nathan James [Thu, 17 Dec 2020 00:24:58 +0000 (00:24 +0000)]
[clang-tidy] Add a diagnostic callback to parseConfiguration
Currently errors detected when parsing the YAML for .clang-tidy files are always printed to errs.
For clang-tidy binary workflows this usually isn't an issue, but using clang-tidy as a library for integrations may want to handle displaying those errors in their own specific way.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D92920
Tres Popp [Wed, 16 Dec 2020 21:08:34 +0000 (22:08 +0100)]
[mlir] Modify linalg loops test to have nested regions
Differential Revision: https://reviews.llvm.org/D93418
LLVM GN Syncbot [Thu, 17 Dec 2020 00:07:28 +0000 (00:07 +0000)]
[gn build] Port
ac068e014b2
Atmn [Sun, 6 Dec 2020 02:41:09 +0000 (21:41 -0500)]
[OpenMP][Libomptarget][NFC] Use CMake Variables
This patchs adds CMake variables to add subdirectories and include
directories for libomptarget and explicitly gives the location of source
files.
Differential Revision: https://reviews.llvm.org/D93290
Hongtao Yu [Wed, 16 Dec 2020 20:54:50 +0000 (12:54 -0800)]
[CSSPGO] Consume pseudo-probe-based AutoFDO profile
This change enables pseudo-probe-based sample counts to be consumed by the sample profile loader under the regular `-fprofile-sample-use` switch with minimal adjustments to the existing sample file formats. After the counts are imported, a probe helper, aka, a `PseudoProbeManager` object, is automatically launched to verify the CFG checksum of every function in the current compilation against the corresponding checksum from the profile. Mismatched checksums will cause a function profile to be slipped. A `SampleProfileProber` pass is scheduled before any of the `SampleProfileLoader` instances so that the CFG checksums as well as probe mappings are available during the profile loading time. The `PseudoProbeManager` object is set up right after the profile reading is done. In the future a CFG-based fuzzy matching could be done in `PseudoProbeManager`.
Samples will be applied only to pseudo probe instructions as well as probed callsites once the checksum verification goes through. Those instructions are processed in the same way that regular instructions would be processed in the line-number-based scenario. In other words, a function is processed in a regular way as if it was reduced to just containing pseudo probes (block probes and callsites).
**Adjustment to profile format **
A CFG checksum field is being added to the existing AutoFDO profile formats. So far only the text format and the extended binary format are supported. For the text format, a new line like
```
!CFGChecksum: 12345
```
is added to the end of the body sample lines. For the extended binary profile format, we introduce a metadata section to store the checksum map from function names to their CFG checksums.
Differential Revision: https://reviews.llvm.org/D92347
Guozhi Wei [Wed, 16 Dec 2020 23:42:08 +0000 (15:42 -0800)]
[MBP] Add whole chain to BlockFilterSet instead of individual BB
Currently we add individual BB to BlockFilterSet if its frequency satisfies
LoopFreq / Freq <= LoopToColdBlockRatio
LoopFreq is edge frequency from outside to loop header.
LoopToColdBlockRatio is a command line parameter.
It doesn't make sense since we always layout whole chain, not individual BBs.
It may also cause a tricky problem. Sometimes it is possible that the LoopFreq
of an inner loop is smaller than LoopFreq of outer loop. So a BB can be in
BlockFilterSet of inner loop, but not in BlockFilterSet of outer loop,
like .cold in the test case. So it is added to the chain of inner loop. When
work on the outer loop, .cold is not added to BlockFilterSet, so the edge to
successor .problem is not counted in UnscheduledPredecessors of .problem chain.
But other blocks in the inner loop are added BlockFilterSet, so the whole inner
loop chain can be layout, and markChainSuccessors is called to decrease
UnscheduledPredecessors of following chains. markChainSuccessors calls
markBlockSuccessors for every BB, even it is not in BlockFilterSet, like .cold,
so .problem chain's UnscheduledPredecessors is decreased, but this edge was not
counted on in fillWorkLists, so .problem chain's UnscheduledPredecessors
becomes 0 when it still has an unscheduled predecessor .pred! And it causes
problems in following various successor BB selection algorithms.
Differential Revision: https://reviews.llvm.org/D89088
alex-t [Tue, 15 Dec 2020 16:05:56 +0000 (19:05 +0300)]
Disable Jump Threading for the targets with divergent control flow
Details: Jump Threading does not make sense for the targets with divergent CF
since they do not use branch prediction for speculative execution.
Also in the high level IR there is no enough information to conclude that the branch is divergent or uniform.
This may cause errors in further CF lowering.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D93302
Tom Roeder [Wed, 2 Dec 2020 01:23:55 +0000 (17:23 -0800)]
[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.
This allows ASTs to be merged when they contain GenericSelectionExpr
nodes (this is _Generic from C11). This is needed, for example, for
CTU analysis of C code that makes use of _Generic, like the Linux
kernel.
The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter. Additionally, this change adds support for structural
equivalence of _Generic in the AST.
Reviewed By: martong, aaron.ballman
Differential Revision: https://reviews.llvm.org/D92600
Tom Roeder [Wed, 16 Dec 2020 22:58:22 +0000 (14:58 -0800)]
Test commit: add valid punctuation to a comment. NFC.
Gulfem Savrun Yeniceri [Wed, 16 Dec 2020 23:05:35 +0000 (15:05 -0800)]
[IR] Fixed the typo in attributes test
Fixed the typo introduced in D90275.
Differential Revision: https://reviews.llvm.org/D93420
Harald van Dijk [Wed, 16 Dec 2020 22:39:57 +0000 (22:39 +0000)]
[X86] Avoid %fs:(%eax) references in x32 mode
The ABI explains that %fs:(%eax) zero-extends %eax to 64 bits, and adds
that the TLS base address, but that the TLS base address need not be
at the start of the TLS block, TLS references may use negative offsets.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D93158
Thomas Preud'homme [Tue, 15 Dec 2020 23:05:45 +0000 (23:05 +0000)]
[Test] Fix undef var in catch-undef-behavior.c
Commit
9e52c43090f8cd980167bbd2719878ae36bcf6b5 removed the directive
defining LINE_1600 but left a string substitution to that variable in a
CHECK-NOT directive. This will make that CHECK-NOT directive always fail
to match, no matter the string.
This commit follows the pattern done in
9e52c43090f8cd980167bbd2719878ae36bcf6b5 of simplifying the CHECK-NOT to
only look for the function name and the opening parenthesis, thereby not
requiring the LINE_1600 variable.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D93350
Alexander Belyaev [Wed, 16 Dec 2020 22:09:04 +0000 (23:09 +0100)]
Revert "[mlir] Lookup the latest value with a legal type when remapping values."
This reverts commit
f8184d4c44dff1fab13122221f0c23ab50936647.
Mehdi Amini [Wed, 16 Dec 2020 04:18:41 +0000 (04:18 +0000)]
Improve the verifier diagnostic on dominance error
Address PR47937
Differential Revision: https://reviews.llvm.org/D93361
Roman Lebedev [Wed, 16 Dec 2020 20:04:41 +0000 (23:04 +0300)]
[SimplifyCFG] Teach mergeEmptyReturnBlocks() to preserve DomTree
A first real transformation that didn't already knew how to do that,
but it's pretty tame - either change successor of all the predecessors
of a block and carefully delay deletion of the block until afterwards
the DomTree updates are appled, or add a successor to the block.
There wasn't a great test coverage for this, so i added extra, to be sure.
Roman Lebedev [Wed, 16 Dec 2020 21:11:42 +0000 (00:11 +0300)]
[SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock() already knows how to preserve DomTree
... so just ensure that we pass DomTreeUpdater it into it.
Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.
Roman Lebedev [Wed, 16 Dec 2020 19:34:05 +0000 (22:34 +0300)]
[SimplifyCFG] MergeBlockIntoPredecessor() already knows how to preserve DomTree
... so just ensure that we pass DomTreeUpdater it into it.
Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.
Roman Lebedev [Wed, 16 Dec 2020 18:48:29 +0000 (21:48 +0300)]
[SimplifyCFG] removeUnreachableBlocks() already knows how to preserve DomTree
... so just ensure that we pass DomTreeUpdater it into it.
Apparently, there were no dedicated tests just for that functionality,
so i'm adding one here.
Roman Lebedev [Wed, 16 Dec 2020 18:26:43 +0000 (21:26 +0300)]
[NFCI][SimplifyCFG] Mark all the SimplifyCFG tests that already don't invalidate DomTree as such
First step after
e1133179587dd895962a2fe4d6eb0cb1e63b5ee2,
in these tests, DomTree is valid afterwards, so mark them as such,
so that they don't regress.
In further steps, SimplifyCFG transforms shall taught to preserve DomTree,
in as small steps as possible.
Fangrui Song [Wed, 16 Dec 2020 22:02:25 +0000 (14:02 -0800)]
[AArch64InstPrinter] Use * 4096 instead of << 12
Left shirting a negative integer is undefined before C++20.
Louis Dionne [Wed, 16 Dec 2020 22:00:09 +0000 (17:00 -0500)]
[libc++] Fix CI Dockerfile
Installing clang-format-11 doesn't seem to work if it's done before
we've installed LLVM. I must admit I didn't try to get to the bottom
of the issue, since installing it after seems to work.
Reid Kleckner [Wed, 16 Dec 2020 21:48:47 +0000 (13:48 -0800)]
Fix split-debug.c test on Windows
Rong Xu [Wed, 16 Dec 2020 21:11:59 +0000 (13:11 -0800)]
[PGO] Use the sum of profile counts to fix the function entry count
Raw profile count values for each BB are not kept after profile
annotation. We record function entry count and branch weights
and use them to compute the count when needed. This mechanism
works well in a perfect world, but often breaks in real programs,
because of number prevision, inconsistent profile, or bugs in
BFI). This patch uses sum of profile count values to fix
function entry count to make the BFI count close to real profile
counts.
Differential Revision: https://reviews.llvm.org/D61540
Marek Kurdej [Wed, 16 Dec 2020 21:33:10 +0000 (16:33 -0500)]
[libc++] Install git-clang-format on CI nodes.
Two problems fixed:
* an old version of clang-format get installed by default (6.0).
* git-clang-format is not present, only git-clang-format-<version> (e.g. git-clang-format-6.0).
Solution:
* install clang-format-11 with explicit version
* make symlink git-clang-format to the latest version of git-clang-format-<version>
Differential Revision: https://reviews.llvm.org/D93201
Reid Kleckner [Wed, 16 Dec 2020 21:33:06 +0000 (13:33 -0800)]
Fix XCore test on Windows, the register order is reversed, for reasons unknown
Sanjay Patel [Wed, 16 Dec 2020 21:13:55 +0000 (16:13 -0500)]
[VectorCombine] adjust test alignments for better coverage; NFC
Fangrui Song [Wed, 16 Dec 2020 21:29:40 +0000 (13:29 -0800)]
[libc++abi] Remove redundant null pointer check in operator delete
Similar to D52401. Normally operator delete is defined in libc++abi
(LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS is off by default).
C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function
If ptr is a null pointer, no action shall occur.
free on MSDN:
If memblock is NULL, the pointer is ignored and free immediately returns.
Reviewed By: #libc_abi, ldionne
Differential Revision: https://reviews.llvm.org/D93339
Nikita Popov [Wed, 16 Dec 2020 20:34:47 +0000 (21:34 +0100)]
[DSE] Pass MemoryLocation by const ref (NFC)
Mircea Trofin [Tue, 15 Dec 2020 17:00:05 +0000 (09:00 -0800)]
[NFC] Remove unused prefixes in llvm/test/CodeGen/X86
Differential Revision: https://reviews.llvm.org/D92965
Sanjay Patel [Wed, 16 Dec 2020 19:22:46 +0000 (14:22 -0500)]
[VectorCombine] optimize alignment for load transform
Here's another minimal step suggested by D93229 / D93397 .
(I'm trying to be extra careful in these changes because
load transforms are easy to get wrong.)
We can optimistically choose the greater alignment of a
load and its pointer operand. As the test diffs show, this
can improve what would have been unaligned vector loads
into aligned loads.
When we enhance with gep offsets, we will need to adjust
the alignment calculation to include that offset.
Differential Revision: https://reviews.llvm.org/D93406
Shivanshu Goyal [Wed, 16 Dec 2020 20:01:54 +0000 (12:01 -0800)]
Print source location in the error message when parens are missing around sizeof typename and the expression is inside macro expansion
Given the following code:
```
void Foo(int);
void Baz()
{
Bar(sizeof int);
}
```
The error message which is printed today is this:
```
error: expected parentheses around type name in sizeof expression
```
There is no source location printed whatsoever, so fixing a compile break like this becomes extremely hard in a large codebase.
My change improves the error message. But it doesn't output a FixItHint because I wasn't able to figure out how to get the locations for left and right parens. So any tips would be appreciated.
```
<source>:7:6: error: expected parentheses around type name in sizeof expression
Bar(sizeof int);
^
```
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D91129
Richard Smith [Wed, 16 Dec 2020 19:59:57 +0000 (11:59 -0800)]
PR47474: Add test for Clang's current behavior.
Our current behavior rejects the example, following the current language
rules, but it's likely the rules will be revised to allow this example.
Mitch Phillips [Wed, 16 Dec 2020 19:57:55 +0000 (11:57 -0800)]
[sanitizer-common] Pickup llvm-symbolizer from $OUT/bin IFF exists.
Fix-forward for D93352.
Slight rework of the same idea, pickup the external symbolizer from the
binary directory iff it exists.
Yaxun (Sam) Liu [Thu, 10 Dec 2020 21:30:24 +0000 (16:30 -0500)]
[clang-offload-bundler] Add option -allow-missing-bundles
There are out-of-tree tools using clang-offload-bundler to extract
bundles from bundled files. When a bundle is not in the bundled
file, clang-offload-bundler is expected to emit an error message
and return non-zero value. However currently clang-offload-bundler
silently generates empty file for the missing bundles.
Since OpenMP/HIP toolchains expect the current behavior, an option
-allow-missing-bundles is added to let clang-offload-bundler
create empty file when a bundle is missing when unbundling.
The unbundling job action is updated to use this option by
default.
clang-offload-bundler itself will emit error when a bundle
is missing when unbundling by default.
Changes are also made to check duplicate targets in -targets
option and emit error.
Differential Revision: https://reviews.llvm.org/D93068
Emma Blink [Wed, 16 Dec 2020 19:42:07 +0000 (14:42 -0500)]
Mark implicit coroutine variables as being implicit
This prevents the clang-tidy readability-identifier-naming check from
triggering on implicit __coro_gro and __promise variables in coroutines.
Eugene Zhulenev [Wed, 16 Dec 2020 10:17:53 +0000 (02:17 -0800)]
[mlir] Async: re-enable tests after fixing fkakines
Test flakiness was fixed by: https://github.com/llvm/llvm-project/commit/
9edcedf7f222ce7c893d1e3bf19b3a7a1f0f2218
Runs these tests to verify that all parts of the lowering work correctly.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D93384
Eugene Zhulenev [Wed, 16 Dec 2020 13:14:12 +0000 (05:14 -0800)]
[mlir] AsyncRuntime: mode runtime declarations to mlir::runtime namespace
Define Async runtime related typedefs in the `mlir::runtime` namespace.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D93391