Vitaly Buka [Wed, 2 Dec 2020 15:28:45 +0000 (07:28 -0800)]
[NFC][sanitizer] Fix test on 32bit platform
Yaxun (Sam) Liu [Wed, 11 Nov 2020 13:39:00 +0000 (08:39 -0500)]
[CUDA][HIP] Diagnose reference of host variable
This patch diagnoses invalid references of global host variables in device,
global, or host device functions.
Differential Revision: https://reviews.llvm.org/D91281
Yaxun (Sam) Liu [Tue, 3 Nov 2020 20:24:41 +0000 (15:24 -0500)]
[CUDA][HIP] Fix capturing reference to host variable
In C++ when a reference variable is captured by copy, the lambda
is supposed to make a copy of the referenced variable in the captures
and refer to the copy in the lambda. Therefore, it is valid to capture
a reference to a host global variable in a device lambda since the
device lambda will refer to the copy of the host global variable instead
of access the host global variable directly.
However, clang tries to avoid capturing of reference to a host global variable
if it determines the use of the reference variable in the lambda function is
not odr-use. Clang also tries to emit load of the reference to a global variable
as load of the global variable if it determines that the reference variable is
a compile-time constant.
For a device lambda to capture a reference variable to host global variable
and use the captured value, clang needs to be taught that in such cases the use of the reference
variable is odr-use and the reference variable is not compile-time constant.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D91088
Bardia Mahjour [Wed, 2 Dec 2020 15:07:41 +0000 (10:07 -0500)]
[LV] Epilogue Vectorization with Optimal Control Flow (Recommit)
This is yet another attempt at providing support for epilogue
vectorization following discussions raised in RFC http://llvm.1065342.n5.nabble.com/llvm-dev-Proposal-RFC-Epilog-loop-vectorization-tt106322.html#none
and reviews D30247 and D88819.
Similar to D88819, this patch achieve epilogue vectorization by
executing a single vplan twice: once on the main loop and a second
time on the epilogue loop (using a different VF). However it's able
to handle more loops, and generates more optimal control flow for
cases where the trip count is too small to execute any code in vector
form.
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D89566
Ahsan Saghir [Wed, 2 Dec 2020 15:03:18 +0000 (09:03 -0600)]
[PowerPC] Mark sanitizer test case unsupported for powerpc64
The author of "https://reviews.llvm.org/D92428" marked
'resize_tls_dynamic.cpp' with XFAIL for powerpc64 since
it fails on a bunch of PowerPC buildbots. However, the
original test case passes on clang-ppc64le-rhel bot. So
marking this as XFAIL makes this bot to fail as the test
case passes unexpectedly. We are marking this unsupported
on all PowerPC64 for now until it is fixed for all the
PowerPC buildbots.
Nico Weber [Wed, 2 Dec 2020 04:31:57 +0000 (23:31 -0500)]
[mac/lld] Make --reproduce work with thin archives
See http://reviews.llvm.org/rL268229 and
http://reviews.llvm.org/rL313832 which did the same for the ELF port.
Differential Revision: https://reviews.llvm.org/D92456
Christian Sigg [Sat, 28 Nov 2020 12:35:55 +0000 (13:35 +0100)]
Add `Operation* OpState::operator->()` to provide more convenient access to members of Operation.
Given that OpState already implicit converts to Operator*, this seems reasonable.
The alternative would be to add more functions to OpState which forward to Operation.
Reviewed By: rriddle, ftynse
Differential Revision: https://reviews.llvm.org/D92266
Sanjay Patel [Wed, 2 Dec 2020 14:00:49 +0000 (09:00 -0500)]
[SLP] use 'match' for binop/select; NFC
This might be a small improvement in readability, but the
real motivation is to make it easier to adapt the code to
deal with intrinsics like 'maxnum' and/or integer min/max.
There is potentially help in doing that with D92086, but
we might also just add specialized wrappers here to deal
with the expected patterns.
Alex Zinenko [Thu, 26 Nov 2020 17:32:30 +0000 (18:32 +0100)]
[OpenMPIRBuilder] forward arguments as pointers to outlined function
OpenMPIRBuilder::createParallel outlines the body region of the parallel
construct into a new function that accepts any value previously defined outside
the region as a function argument. This function is called back by OpenMP
runtime function __kmpc_fork_call, which expects trailing arguments to be
pointers. If the region uses a value that is not of a pointer type, e.g. a
struct, the produced code would be invalid. In such cases, make createParallel
emit IR that stores the value on stack and pass the pointer to the outlined
function instead. The outlined function then loads the value back and uses as
normal.
Reviewed By: jdoerfert, llitchev
Differential Revision: https://reviews.llvm.org/D92189
Hans Wennborg [Mon, 30 Nov 2020 15:21:54 +0000 (16:21 +0100)]
[ThinLTO] Import symver directives for imported symbols (PR48214)
When importing symbols from another module, also import any
corresponding symver directives.
Differential revision: https://reviews.llvm.org/D92335
Hans Wennborg [Wed, 2 Dec 2020 13:45:49 +0000 (14:45 +0100)]
Simplify append to module inline asm string in IRLinker::run()
This also removes the empty extra "module asm" that would be created,
and updates the test to reflect that while making it more explicit.
Broken out from https://reviews.llvm.org/D92335
Kazushi (Jam) Marukawa [Wed, 2 Dec 2020 04:23:02 +0000 (13:23 +0900)]
[VE] Add vand, vor, and vxor intrinsic instructions
Add vand, vor, and vxor intrinsic instructions and regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92454
Anirudh Prasad [Wed, 2 Dec 2020 12:24:13 +0000 (07:24 -0500)]
[SystemZ] Adding extra extended mnemonics for SystemZ target
This patch consists of the addition of some common additional
extended mnemonics to the SystemZ target.
- These are jnop, jct, jctg, jas, jasl, jxh, jxhg, jxle,
jxleg, bru, brul, br*, br*l.
- These mnemonics and the instructions they map to are
defined here, Chapter 4 - Branching with extended
mnemonic codes.
- Except for jnop (which is a variant of brc 0, label), every
other mnemonic is marked as a MnemonicAlias since there is
already a "defined" instruction with the same encoding
and/or condition mask values.
- brc 0, label doesn't have a defined extended mnemonic, thus
jnop is defined using as an InstAlias. Furthermore, the
applyMnemonicAliases function is called in the overridden
parseInstruction function in SystemZAsmParser.cpp to ensure
any mnemonic aliases are applied before any further
processing on the instruction is done.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D92185
David Sherwood [Wed, 7 Oct 2020 08:21:39 +0000 (09:21 +0100)]
[SVE] Add support for scalable vectors with vectorize.scalable.enable loop attribute
In this patch I have added support for a new loop hint called
vectorize.scalable.enable that says whether we should enable scalable
vectorization or not. If a user wants to instruct the compiler to
vectorize a loop with scalable vectors they can now do this as
follows:
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !2
...
!2 = !{!2, !3, !4}
!3 = !{!"llvm.loop.vectorize.width", i32 8}
!4 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}
Setting the hint to false simply reverts the behaviour back to the
default, using fixed width vectors.
Differential Revision: https://reviews.llvm.org/D88962
Abhina Sreeskantharajan [Wed, 2 Dec 2020 13:22:40 +0000 (08:22 -0500)]
[SystemZ][NFC]Move all SystemZ tests to init-s390x.c
This patch moves all s390x tests in init.c and init-zos.c to init-s390x.c.
Reviewed By: muiez
Differential Revision: https://reviews.llvm.org/D92048
Cheng Wang [Thu, 12 Nov 2020 03:42:04 +0000 (11:42 +0800)]
[libc] Add strncpy implementation.
Add libc strncpy implementation.
Reviewed By: sivachandra, gchatelet
Differential Revision: https://reviews.llvm.org/D91399
Pedro Tammela [Fri, 27 Nov 2020 22:29:56 +0000 (22:29 +0000)]
[LLDB/Python] Fix segfault on Python scripted entrypoints
The code that gets the ScriptInterpreter was not considering the
case that it receives a Lua interpreter.
Differential Revision: https://reviews.llvm.org/D92249
Georgii Rymar [Mon, 30 Nov 2020 12:38:42 +0000 (15:38 +0300)]
[llvm-readobj, libSupport] - Refine the implementation of the code that dumps build attributes.
This implementation of `ELFDumper<ELFT>::printAttributes()` in llvm-readobj has issues:
1) It crashes when the content of the attribute section is empty.
2) It uses `unwrapOrError` and `reportWarning` calls, though
ideally we want to use `reportUniqueWarning`.
3) It contains a TODO about redundant format version check.
`lib/Support/ELFAttributeParser.cpp` uses a hardcoded constant instead of the named constant.
This patch fixes all these issues.
Differential revision: https://reviews.llvm.org/D92318
Cullen Rhodes [Fri, 27 Nov 2020 17:30:29 +0000 (17:30 +0000)]
[InstructionsTest] NFC: Replace VectorType::get(.., .., true) with ScalableVectorType::get
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D92467
Marek Kurdej [Wed, 2 Dec 2020 10:39:43 +0000 (11:39 +0100)]
[libc++] [docs] Mark LWG2296 as complete not only on clang.
std::addressof was made constexpr in gcc 7.
libc++ fixed it in
ac473034fc771e5f1b4ef0ac405df70ed27412a1 (Provide a constexpr addressof with GCC 7.)
Marek Kurdej [Wed, 2 Dec 2020 10:19:22 +0000 (11:19 +0100)]
[libc++] [docs] Mark P1424 as superseded by P1902.
Jay Foad [Tue, 1 Dec 2020 11:55:50 +0000 (11:55 +0000)]
[AMDGPU] Stop adding an implicit def of vcc_hi for wave32
This doesn't seem to be needed for anything.
Differential Revision: https://reviews.llvm.org/D92400
Georgii Rymar [Wed, 2 Dec 2020 10:01:52 +0000 (13:01 +0300)]
[llvm-readelf/obj] - Lowercase the warning message reported.
Our warnings/errors reported are using lowercase normally.
This addresses one of review comments from D92382.
Georgii Rymar [Tue, 1 Dec 2020 12:05:23 +0000 (15:05 +0300)]
[llvm-readelf/obj] - Report unique warnings in `parseDynamicTable`.
This makes the warnings reported to be unique and adds test cases.
Differential revision: https://reviews.llvm.org/D92382
Raphael Isemann [Wed, 2 Dec 2020 09:35:07 +0000 (10:35 +0100)]
[lldb] Don't reject empty or unnamed template parameter packs
We currently reject all templates that have either zero args or that have a
parameter pack without a name. Both cases are actually allowed in C++, so
rejecting them leads to LLDB instead falling back to a dummy 'void' type. This
leads to all kind of errors later on (most notable, variables that have such
template types appear to be missing as we can't have 'void' variables and
inheriting from such a template type will cause Clang to hit some asserts when
finding that the base class is 'void').
This just removes the too strict tests and adds a few tests for this stuff (+
some combinations of these tests with preceding template parameters).
Things that I left for follow-up patches:
* All the possible interactions with template-template arguments which seem like a whole new source of possible bugs.
* Function templates which completely lack sanity checks.
* Variable templates are not implemented.
* Alias templates are not implemented too.
* The rather strange checks that just make sure that the separate list of
template arg names and values always have the same length. I believe those
ought to be asserts, but my current plan is to move both those things into a
single list that can't end up in this inconsistent state.
Reviewed By: JDevlieghere, shafik
Differential Revision: https://reviews.llvm.org/D92425
David Green [Wed, 2 Dec 2020 09:22:41 +0000 (09:22 +0000)]
[Intrinsics] Re-remove experimental_vector_reduce intrinsics
These were re-added by
fbfb1c790982277eaa5134c2b6aa001e97fe828d but
should not have been. This removes the old experimental versions of the
reduction intrinsics again, leaving the new non experimental ones.
Differential Revision: https://reviews.llvm.org/D92411
Qiu Chaofan [Wed, 2 Dec 2020 09:12:20 +0000 (17:12 +0800)]
[PowerPC] Fix FLT_ROUNDS_ on little endian
In lowering of FLT_ROUNDS_, FPSCR content will be moved into FP register
and then GPR, and then truncated into word.
For subtargets without direct move support, it will store and then load.
The load address needs adjustment (+4) only on big-endian targets. This
patch fixes it on using generic opcodes on little-endian and subtargets
with direct-move.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D91845
Georgii Rymar [Tue, 1 Dec 2020 10:59:47 +0000 (13:59 +0300)]
[llvm-readelf/obj] - Refine the error message about the broken string table.
This:
1) Changes `reportWarning` to `reportUniqueWarning` (no-op here).
2) Adds more context to the message.
3) Merges `broken-dynsym-link.test` into `dyn-symbols.test`, adds more testing.
Differential revision: https://reviews.llvm.org/D92380
Qiu Chaofan [Wed, 2 Dec 2020 09:02:26 +0000 (17:02 +0800)]
[Clang] Don't adjust align for IBM extended double
Commit
6b1341eb fixed alignment for 128-bit FP types on PowerPC.
However, the quadword alignment adjustment shouldn't be applied to IBM
extended double (ppc_fp128 in IR) values.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D92278
Georgii Rymar [Fri, 27 Nov 2020 18:42:35 +0000 (21:42 +0300)]
[LLD][ELF] - Don't keep empty output sections which have explicit program headers.
This reverts a side effect introduced in the code cleanup patch D43571:
LLD started to emit empty output sections that are explicitly assigned to a segment.
This patch fixes the issue by removing the !sec.phdrs.empty() special case from
isDiscardable. As compensation, we add an early phdrs propagation step (see the inline comment).
This is similar to one that we do in adjustSectionsAfterSorting.
Differential revision: https://reviews.llvm.org/D92301
Hanhan Wang [Wed, 2 Dec 2020 08:00:36 +0000 (00:00 -0800)]
[mlir][doc] Correct method names in DialectConversion.md to match the code.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D92416
Marek Kurdej [Wed, 2 Dec 2020 07:57:02 +0000 (08:57 +0100)]
[libc++] [P0482] [C++20] Implement missing bits for codecvt and codecvt_byname.
Add codecvt*<char16_t, char8_t> and codecvt*<char32_t, char8_t>.
Deprecate codecvt<char(16|32)_t, char>.
Enable disabled tests.
Update _LIBCPP_STD_VER to use 20 for C++20. Add _LIBCPP_DEPRECATED_IN_CXX20 macro.
Reviewed By: ldionne, #libc, #libc_abi
Differential Revision: https://reviews.llvm.org/D91517
Martin Storsjö [Tue, 1 Dec 2020 11:37:16 +0000 (13:37 +0200)]
[libcxx] Apply msvcrt specific exception for lgamma() to mingw configurations, too
This fixes linking code that uses some bits of the <random> header
on mingw targets.
Differential Revision: https://reviews.llvm.org/D92379
Marek Kurdej [Wed, 2 Dec 2020 07:52:35 +0000 (08:52 +0100)]
[libc++] [docs] Update and move NOTES.txt to docs/Contributing.rst.
Also, add notes about exporting ABI symbols.
Later, we can add notes about using git-clang-format before sending a patch for review.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D92300
Raphael Isemann [Wed, 2 Dec 2020 07:39:51 +0000 (08:39 +0100)]
[lldb][NFC] Fix test file name in lang/cpp/non-type-template-param
The 'AlignAsBaseClass' part was a leftover form the align_as test that served as
the template for this test.
Max Kazantsev [Wed, 2 Dec 2020 06:15:06 +0000 (13:15 +0700)]
[Test] One CodeGen test showing missing opportunity on move elimination
Max Kazantsev [Wed, 2 Dec 2020 06:14:49 +0000 (13:14 +0700)]
[Test] One more IndVars test
QingShan Zhang [Wed, 2 Dec 2020 05:37:45 +0000 (05:37 +0000)]
[PowerPC] Promote the i1 to i64 for SINT_TO_FP/FP_TO_SINT
i1 is the native type for PowerPC if crbits is enabled. However, we need
to promote the i1 to i64 as we didn't have the pattern for i1.
Reviewed By: Qiu Chao Fang
Differential Revision: https://reviews.llvm.org/D92067
River Riddle [Wed, 2 Dec 2020 05:05:13 +0000 (21:05 -0800)]
[mlir][PDL] Forward captured single entity constraint functions instead of copy-capture
Nico Weber [Wed, 2 Dec 2020 00:00:48 +0000 (19:00 -0500)]
[mac/lld] Include archive name in diagnostics
Also, for .o files, include full path as given on link command line.
Before:
lld: error: undefined symbol [...], referenced from sandbox_logging.o
After:
lld: error: undefined symbol [...], referenced from libseatbelt.a(sandbox_logging.o)
Move archiveName up to InputFile so we can consistently use toString()
to print InputFiles in diags, and pass it to the ObjFile ctor. This
matches the ELF and COFF ports.
Differential Revision: https://reviews.llvm.org/D92437
Kazu Hirata [Wed, 2 Dec 2020 03:42:14 +0000 (19:42 -0800)]
[Transforms] Remove unused declaration fillImplicitControlFlowInfo (NFC)
The definition was removed on Aug 7, 2018 in commit
640cb0036548293c74949801ba9f831344789e99, but the declaration has
remained since.
Chen Zheng [Thu, 26 Nov 2020 09:26:23 +0000 (04:26 -0500)]
[LSR][NFC] don't collect chains when isNumRegsMajorCostOfLSR is false.
Reviewed By: samparker
Differential Revision: https://reviews.llvm.org/D92159
Heejin Ahn [Mon, 30 Nov 2020 09:39:13 +0000 (01:39 -0800)]
[WebAssembly] Support select and block for reference types
This adds missing `select` instruction support and block return type
support for reference types. Also refactors WebAssemblyInstrRef.td and
rearranges tests in reference-types.s. Tests don't include `exnref`
types, because we currently don't support `exnref` for `ref.null` and
the type will be removed soon anyway.
Reviewed By: tlively, sbc100, wingo
Differential Revision: https://reviews.llvm.org/D92359
Fangrui Song [Wed, 2 Dec 2020 03:14:34 +0000 (19:14 -0800)]
[lldb] Fix build after found_decls was removed by
1f40d60a3b7f310ff3f77bb8643a27d979a703cb
Arthur O'Dwyer [Wed, 2 Dec 2020 01:02:46 +0000 (20:02 -0500)]
s/instantate/instantiate/ throughout. NFCI.
The static_assert in "libcxx/include/memory" was the main offender here,
but then I figured I might as well `git grep -i instantat` and fix all
the instances I found. One was in user-facing HTML documentation;
the rest were in comments or tests.
Arthur O'Dwyer [Fri, 27 Nov 2020 16:02:06 +0000 (11:02 -0500)]
[libc++] Consistently replace `std::` qualification with `_VSTD::` or nothing. NFCI.
I used a lot of `git grep` to find places where `std::` was being used
outside of comments and assert-messages. There were three outcomes:
- Qualified function calls, e.g. `std::move` becomes `_VSTD::move`.
This is the most common case.
- Typenames that don't need qualification, e.g. `std::allocator` becomes `allocator`.
Leaving these as `_VSTD::allocator` would also be fine, but I decided
that removing the qualification is more consistent with existing practice.
- Names that specifically need un-versioned `std::` qualification,
or that I wasn't sure about. For example, I didn't touch any code in
<atomic>, <math.h>, <new>, or any ext/ or experimental/ headers;
and I didn't touch any instances of `std::type_info`.
In some deduction guides, we were accidentally using `class Alloc = typename std::allocator<T>`,
despite `std::allocator<T>`'s type-ness not being template-dependent.
Because `std::allocator` is a qualified name, this did parse as we intended;
but what we meant was simply `class Alloc = allocator<T>`.
Differential Revision: https://reviews.llvm.org/D92250
Arthur O'Dwyer [Fri, 27 Nov 2020 19:44:53 +0000 (14:44 -0500)]
[libc++] ADL-proof <thread>, and eliminate `using namespace chrono`.
Since we know exactly which identifiers we expect to find in `chrono`,
a using-directive seems like massive overkill. Remove the directives
and qualify the names as needed.
One subtle trick here: In two places I replaced `*__p` with `*__p.get()`.
The former is an unqualified call to `operator*` on a class type, which
triggers ADL and breaks the new test. The latter is a call to the
built-in `operator*` on pointers, which specifically
does NOT trigger ADL thanks to [over.match.oper]/1.
Differential Revision: https://reviews.llvm.org/D92243
Arthur O'Dwyer [Fri, 27 Nov 2020 18:48:44 +0000 (13:48 -0500)]
[libc++] Support simply `std::iterator_traits` in the iterator_traits test.
This follows on from D56698. I copied this fix (simpler than D92142's)
from commit
66e6e37447b183b1c8bac9330a4658530d2d49e6.
Differential Revision: https://reviews.llvm.org/D92239
Heejin Ahn [Wed, 2 Dec 2020 03:00:46 +0000 (19:00 -0800)]
[lld-macho] Add dependency to DebugInfoDWARF
Without this `-DBUILD_SHARED_LIBS=ON` doesn't work.
Tony [Wed, 2 Dec 2020 03:04:28 +0000 (03:04 +0000)]
[NFC][AMDGPU] Fix broken link to ClangOffloadBundler in AMDGPUUsage
Tony [Wed, 2 Dec 2020 02:07:07 +0000 (02:07 +0000)]
[NFC] Add CLangOffloadBundler documentation to Clang index
Differential Revision: https://reviews.llvm.org/D92441
Muhammad Omair Javaid [Wed, 2 Dec 2020 02:30:51 +0000 (07:30 +0500)]
[LLDB] Rename duplicate TestAlignAsBaseClass.py
lldb-dotest breaks due to duplicate TestAlignAsBaseClass.py. I have
renamed later version to TestAlignAsBaseClassNonTemplateParam.py.
Chen Zheng [Wed, 25 Nov 2020 02:50:39 +0000 (21:50 -0500)]
[NFC][PowerPC] code refactor: split IsReassociable to fma and add.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D92070
Kazushi (Jam) Marukawa [Tue, 1 Dec 2020 11:12:25 +0000 (20:12 +0900)]
[VE] Add vcmp, vmax, and vmin intrinsic instructions
Add vcmp, vmax, and vmin intrinsic instructions and regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D92387
River Riddle [Wed, 2 Dec 2020 02:13:27 +0000 (18:13 -0800)]
[mlir][PDL] Use .getOperation() when construction SuccessorRange to avoid ambiguous constructor in GCC5
Vitaly Buka [Wed, 2 Dec 2020 01:56:45 +0000 (17:56 -0800)]
[NFC][sanitizer] Fix ppc -> powerpc64 in XFAIL
Nico Weber [Wed, 2 Dec 2020 01:36:31 +0000 (20:36 -0500)]
[mac/lld] fix typo in
07ab597bb0356c that broke test on Windows
zhanghb97 [Sun, 29 Nov 2020 09:37:36 +0000 (17:37 +0800)]
[mlir][Python] Check numpy in Python bindings configuration.
The test process of the ir_array_attributes.py depends on numpy. This patch checks numpy in Python bindings configuration.
- Add NumPy in find_package as a required component to check numpy.
- If numpy is found, print the version and include directory.
Differential Revision: https://reviews.llvm.org/D92276
Nico Weber [Wed, 2 Dec 2020 01:27:33 +0000 (20:27 -0500)]
fix typos to cycle bots
River Riddle [Wed, 2 Dec 2020 01:08:38 +0000 (17:08 -0800)]
[mlir][PDL] Add append specialization for ByteCode OpCode to fix GCC5 build
Jianzhou Zhao [Mon, 23 Nov 2020 05:53:03 +0000 (05:53 +0000)]
[msan] Replace 8 by kShadowTLSAlignment
Reviewed-by: eugenis
Differential Revision: https://reviews.llvm.org/D92275
Eric Leese [Wed, 2 Dec 2020 00:01:33 +0000 (16:01 -0800)]
[lld] Use -1 as tombstone value for discarded code ranges
Under existing behavior discarded functions are relocated to have the start pc
0. This causes problems when debugging as they typically overlap the first
function and lldb symbol resolution frequently chooses a discarded function
instead of the correct one. Using the value -1 or -2 (depending on which DWARF
section we are writing) is sufficient to prevent lldb from resolving to these
symbols.
Reviewed By: MaskRay, yurydelendik, sbc100
Differential Revision: https://reviews.llvm.org/D91803
Leonard Chan [Wed, 2 Dec 2020 00:59:04 +0000 (16:59 -0800)]
Recommit "[clang][Fuchsia] Add relative-vtables multilib"
This recommits
fdbd84c6c819d4462546961f6086c1524d5d5ae8 whose initial
build issues were fixed in
19bdc8e5a307f6eb209d4f91620d70bd2f80219e.
Jessica Paquette [Wed, 2 Dec 2020 00:55:25 +0000 (16:55 -0800)]
Fix typo in testcase runline that got there because I have very bad hands
llvm/test/CodeGen/AArch64/GlobalISel/speculative-hardening-brcond.mir had a
slash in its runline.
Vitaly Buka [Wed, 2 Dec 2020 00:53:18 +0000 (16:53 -0800)]
[NFC] Disable new test from D92428 on PPC TSAN
Fangrui Song [Wed, 2 Dec 2020 00:52:37 +0000 (16:52 -0800)]
[WebAssembly] Rename --lto-no-new-pass-manager to --no-lto-new-pass-manager
In addition, disallow `-lto-new-pass-manager` (see D79371).
Note: the ELF port has also adopted --no-lto-new-pass-manager
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D92422
Jessica Paquette [Mon, 2 Nov 2020 17:47:51 +0000 (09:47 -0800)]
[AArch64][GlobalISel] Don't write to WZR in non-flag-setting G_BRCOND case
We are avoiding writing to WZR just about everywhere else.
Also update the code to use MachineIRBuilder for the sake of consistency.
We also didn't have a GlobalISel testcase for this path, so add a simple one
now.
Differential Revision: https://reviews.llvm.org/D90626
Richard Smith [Wed, 2 Dec 2020 00:28:46 +0000 (16:28 -0800)]
Remove CXXBasePaths::found_decls and simplify and modernize its only
caller.
This function did not satisfy its documented contract: it only
considered the first lookup result on each base path, not all lookup
results. It also performed unnecessary memory allocations.
This change results in a minor change to our representation: we now
include overridden methods that are found by any derived-to-base path
(not involving another override) in the list of overridden methods for a
function, rather than filtering out functions from bases that are both
direct virtual bases and indirect virtual bases for which the indirect
virtual base path contains another override for the function. (That
filtering rule is part of the class-scope name lookup rules, and doesn't
really have much to do with enumerating overridden methods.) The users
of the list of overridden methods do not appear to rely on this
filtering having happened, and it's simpler to not do it.
Tom Stellard [Wed, 2 Dec 2020 00:22:30 +0000 (16:22 -0800)]
github actions: Update branch_sync to push to main
Vitaly Buka [Tue, 1 Dec 2020 21:14:18 +0000 (13:14 -0800)]
[sanitizer] Make DTLS_on_tls_get_addr signal safer
Avoid relocating DTV table and use linked list of mmap-ed pages.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D92428
Vitaly Buka [Tue, 1 Dec 2020 05:04:04 +0000 (21:04 -0800)]
[NFC] Extract ForEachDVT
Fangrui Song [Wed, 2 Dec 2020 00:08:09 +0000 (16:08 -0800)]
[RISCVAsmParser] Allow a SymbolRef operand to be a complex expression
So that instructions like `lla a5, (0xFF + end) - 4` (supported by GNU as) can
be parsed.
Add a missing test that an operand like `foo + foo` is not allowed.
Reviewed By: jrtc27
Differential Revision: https://reviews.llvm.org/D92293
Nico Weber [Fri, 20 Nov 2020 15:14:57 +0000 (10:14 -0500)]
[lld/mac] Fix issues around thin archives
- most importantly, fix a use-after-free when using thin archives,
by putting the archive unique_ptr to the arena allocator. This
ports D65565 to MachO
- correctly demangle symbol namess from archives in diagnostics
- add a test for thin archives -- it finds this UaF, but only when
running it under asan (it also finds the demangling fix)
- make forceLoadArchive() use addFile() with a bool to have the archive
loading code in fewer places. no behavior change; matches COFF port a
bit better
Differential Revision: https://reviews.llvm.org/D92360
Leonard Chan [Tue, 1 Dec 2020 23:45:07 +0000 (15:45 -0800)]
[llvm] Fix for failing test from
fdbd84c6c819d4462546961f6086c1524d5d5ae8
When handling a DSOLocalEquivalent operand change:
- Remove assertion checking that the `To` type and current type are the
same type. This is not always a requirement.
- Add a missing bitcast from an old DSOLocalEquivalent to the type of
the new one.
Jessica Paquette [Tue, 1 Dec 2020 01:21:21 +0000 (17:21 -0800)]
[AArch64][GlobalISel] Select Bcc when it's better than TB(N)Z
Instead of falling back to selecting TB(N)Z when we fail to select an
optimized compare against 0, select Bcc instead.
Also simplify selectCompareBranch a little while we're here, because the logic
was kind of hard to follow.
At -O0, this is a 0.1% geomean code size improvement for CTMark.
A simple example of where this can kick in is here:
https://godbolt.org/z/4rra6P
In the example above, GlobalISel currently produces a subs, cset, and tbnz.
SelectionDAG, on the other hand, just emits a compare and b.le.
Differential Revision: https://reviews.llvm.org/D92358
Tony [Tue, 1 Dec 2020 04:12:04 +0000 (04:12 +0000)]
[NFC][AMDGPU] AMDGPU code object V4 ABI documentation
- Documantation for AMDGPU code object V4.
- Documentation clarification for code object V2 and V3.
- Documentation for the clang-offload-bundler.
- Numerous other documentation clarifications.
Change-Id: I338b327cc9e75da6c987b7e081b496402a5a020e
Differential Revision: https://reviews.llvm.org/D92434
LLVM GN Syncbot [Tue, 1 Dec 2020 23:11:06 +0000 (23:11 +0000)]
[gn build] Port
3fcb0eeb152
Arthur Eubanks [Tue, 1 Dec 2020 23:07:16 +0000 (15:07 -0800)]
[gn build] Format all gn files
$ git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
Arthur Eubanks [Tue, 1 Dec 2020 23:02:50 +0000 (15:02 -0800)]
[gn build] Manually port
8fee2ee9
Eric Astor [Tue, 1 Dec 2020 22:48:49 +0000 (17:48 -0500)]
[ms] [llvm-ml] Support command-line defines
Enable command-line defines as textmacros
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D90059
River Riddle [Tue, 1 Dec 2020 22:30:18 +0000 (14:30 -0800)]
[mlir][PDL] Add support for PDL bytecode and expose PDL support to OwningRewritePatternList
PDL patterns are now supported via a new `PDLPatternModule` class. This class contains a ModuleOp with the pdl::PatternOp operations representing the patterns, as well as a collection of registered C++ functions for native constraints/creations/rewrites/etc. that may be invoked via the pdl patterns. Instances of this class are added to an OwningRewritePatternList in the same fashion as C++ RewritePatterns, i.e. via the `insert` method.
The PDL bytecode is an in-memory representation of the PDL interpreter dialect that can be efficiently interpreted/executed. The representation of the bytecode boils down to a code array(for opcodes/memory locations/etc) and a memory buffer(for storing attributes/operations/values/any other data necessary). The bytecode operations are effectively a 1-1 mapping to the PDLInterp dialect operations, with a few exceptions in cases where the in-memory representation of the bytecode can be more efficient than the MLIR representation. For example, a generic `AreEqual` bytecode op can be used to represent AreEqualOp, CheckAttributeOp, and CheckTypeOp.
The execution of the bytecode is split into two phases: matching and rewriting. When matching, all of the matched patterns are collected to avoid the overhead of re-running parts of the matcher. These matched patterns are then considered alongside the native C++ patterns, which rewrite immediately in-place via `RewritePattern::matchAndRewrite`, for the given root operation. When a PDL pattern is matched and has the highest benefit, it is passed back to the bytecode to execute its rewriter.
Differential Revision: https://reviews.llvm.org/D89107
Jez Ng [Tue, 1 Dec 2020 22:45:13 +0000 (14:45 -0800)]
[lld-macho] Add isCodeSection()
This is the same logic that ld64 uses to determine which sections
contain functions. This was added so that we could determine which
STABS entries should be N_FUN.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D92430
Jez Ng [Tue, 1 Dec 2020 22:45:12 +0000 (14:45 -0800)]
[lld-macho] Flesh out STABS implementation
This addresses a lot of the comments in {D89257}. Ideally it'd have been
done in the same diff, but the commits in between make that difficult.
This diff implements:
* N_GSYM and N_STSYM, the STABS for global and static symbols
* Has the STABS reflect the section IDs of their referent symbols
* Ensures we don't fail when encountering absolute symbols or files with
no debug info
* Sorts STABS symbols by file to minimize the number of N_OSO entries
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D92366
Jez Ng [Tue, 1 Dec 2020 22:45:11 +0000 (14:45 -0800)]
[lld-macho] Add archive name and file modtime to STABS output
We should also set the modtime when running LTO. That will be done in a
future diff, together with support for the `-object_path_lto` flag.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D91318
Jez Ng [Tue, 1 Dec 2020 22:45:10 +0000 (14:45 -0800)]
[lld-macho] Emit empty string as first entry of string table
ld64 emits string tables which start with a space and a zero byte. We
match its behavior here since some tools depend on it.
Similar rationale as {D89561}.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D89639
Jez Ng [Tue, 1 Dec 2020 22:45:09 +0000 (14:45 -0800)]
[lld-macho] Emit local symbols in symtab; record metadata in LC_DYSYMTAB
Symbols of the same type must be laid out contiguously: following ld64's
lead, we choose to emit all local symbols first, then external symbols,
and finally undefined symbols. For each symbol type, the LC_DYSYMTAB
load command will record the range (start index and total number) of
those symbols in the symbol table.
This work was motivated by the fact that LLDB won't search for debug
info if LC_DYSYMTAB says there are no local symbols (since STABS symbols
are all local symbols). With this change, LLDB is now able to display
the source lines at a given breakpoint when debugging our binaries.
Some tests had to be updated due to local symbol names now appearing in
`llvm-objdump`'s output.
Reviewed By: #lld-macho, smeenai, clayborg
Differential Revision: https://reviews.llvm.org/D89285
Jez Ng [Tue, 1 Dec 2020 22:45:01 +0000 (14:45 -0800)]
[lld-macho] Emit STABS symbols for debugging, and drop debug sections
Debug sections contain a large amount of data. In order not to bloat the size
of the final binary, we remove them and instead emit STABS symbols for
`dsymutil` and the debugger to locate their contents in the object files.
With this diff, `dsymutil` is able to locate the debug info. However, we need
a few more features before `lldb` is able to work well with our binaries --
e.g. having `LC_DYSYMTAB` accurately reflect the number of local symbols,
emitting `LC_UUID`, and more. Those will be handled in follow-up diffs.
Note also that the STABS we emit differ slightly from what ld64 does. First, we
emit the path to the source file as one `N_SO` symbol instead of two. (`ld64`
emits one `N_SO` for the dirname and one of the basename.) Second, we do not
emit `N_BNSYM` and `N_ENSYM` STABS to mark the start and end of functions,
because the `N_FUN` STABS already serve that purpose. @clayborg recommended
these changes based on his knowledge of what the debugging tools look for.
Additionally, this current implementation doesn't accurately reflect the size
of function symbols. It uses the size of their containing sectioins as a proxy,
but that is only accurate if `.subsections_with_symbols` is set, and if there
isn't an `N_ALT_ENTRY` in that particular subsection. I think we have two
options to solve this:
1. We can split up subsections by symbol even if `.subsections_with_symbols`
is not set, but include constraints to ensure those subsections retain
their order in the final output. This is `ld64`'s approach.
2. We could just add a `size` field to our `Symbol` class. This seems simpler,
and I'm more inclined toward it, but I'm not sure if there are use cases
that it doesn't handle well. As such I'm punting on the decision for now.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D89257
Nico Weber [Tue, 1 Dec 2020 23:02:18 +0000 (18:02 -0500)]
[gn build] (manually) port
8fee2ee9a68
Mark Nauwelaerts [Sat, 31 Oct 2020 13:15:38 +0000 (14:15 +0100)]
[clang-format] Add new option PenaltyIndentedWhitespace
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D90534
Sam Clegg [Tue, 1 Dec 2020 22:04:21 +0000 (14:04 -0800)]
[lld][WebAssembly] Feedback from D92038. NFC
Differential Revision: https://reviews.llvm.org/D92429
Louis Dionne [Tue, 1 Dec 2020 22:43:33 +0000 (17:43 -0500)]
[libc++abi] Don't try calling __libcpp_aligned_free when aligned allocation is disabled
See https://reviews.llvm.org/rGa78aaa1ad512#962077 for details.
Eric Astor [Mon, 30 Nov 2020 20:15:18 +0000 (15:15 -0500)]
[ms] [llvm-ml] Introduce command-line compatibility for ml.exe and ml64.exe
Switch to OptParser for command-line handling
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D90058
James Park [Tue, 1 Dec 2020 22:28:46 +0000 (14:28 -0800)]
Avoid redundant inline with LLVM_ATTRIBUTE_ALWAYS_INLINE
Fix MSVC warning when __forceinline is paired with inline.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D85264
Jez Ng [Tue, 1 Dec 2020 05:07:16 +0000 (21:07 -0800)]
[lld-macho] Extend PIE option handling
* Enable PIE by default if targeting 10.6 or above on x86-64. (The
manpage says 10.7, but that actually applies only to i386, and in
general varies based on the target platform. I didn't update the
manpage because listing all the different behaviors would make for a
pretty long description.)
* Add support for `-no_pie`
* Remove `HelpHidden` from `-pie`
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D92362
David Blaikie [Tue, 1 Dec 2020 21:23:30 +0000 (13:23 -0800)]
Revert "[FastISel] Flush local value map on ever instruction" and dependent patches
This reverts commit
cf1c774d6ace59c5adc9ab71b31e762c1be695b1.
This change caused several regressions in the gdb test suite - at least
a sample of which was due to line zero instructions making breakpoints
un-lined. I think they're worth investigating/understanding more (&
possibly addressing) before moving forward with this change.
Revert "[FastISel] NFC: Clean up unnecessary bookkeeping"
This reverts commit
3fd39d3694d32efa44242c099e923a7f4d982095.
Revert "[FastISel] NFC: Remove obsolete -fast-isel-sink-local-values option"
This reverts commit
a474657e30edccd9e175d92bddeefcfa544751b2.
Revert "Remove static function unused after cf1c774."
This reverts commit
dc35368ccf17a7dca0874ace7490cc3836fb063f.
Revert "[lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction""
This reverts commit
53a14a47ee89dadb8798ca8ed19848f33f4551d5.
Michał Górny [Tue, 1 Dec 2020 22:00:54 +0000 (23:00 +0100)]
[lldb] [test] Reenable two passing tests on FreeBSD
[Reenable TestReproducerAttach and TestThreadSpecificBpPlusCondition
on FreeBSD -- both seem to pass correctly now.
Muhammad Omair Javaid [Tue, 1 Dec 2020 22:09:14 +0000 (03:09 +0500)]
Make offset field optional in RegisterInfo packet for Arm64
This patch carries forward our aim to remove offset field from qRegisterInfo
packets and XML register description. I have created a new function which
returns if offset fields are dynamic meaning client can calculate offset on
its own based on register number sequence and register size. For now this
function only returns true for NativeRegisterContextLinux_arm64 but we can
test this for other architectures and make it standard later.
As a consequence we do not send offset field from lldb-server (arm64 for now)
while other stubs dont have an offset field so it wont effect them for now.
On the client side we have replaced previous offset calculation algorithm
with a new scheme, where we sort all primary registers in increasing
order of remote regnum and then calculate offset incrementally.
This committ also includes a test to verify all of above functionality
on Arm64.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D91241
Muhammad Omair Javaid [Tue, 1 Dec 2020 22:09:14 +0000 (03:09 +0500)]
RegisterInfoPOSIX_arm64 remove unused bytes from g/G packet
This came up while putting together our new strategy to create g/G packets
in compliance with GDB RSP protocol where register offsets are calculated in
increasing order of register numbers without any unused spacing.
RegisterInfoPOSIX_arm64::GPR size was being calculated after alignment
correction to 8 bytes which meant there was a 4 bytes unused space between
last gpr (cpsr) and first vector register V. We have put LLVM_PACKED_START
decorator on RegisterInfoPOSIX_arm64::GPR to make sure single byte
alignment is enforced. Moreover we are now doing to use arm64 user_pt_regs
struct defined in ptrace.h for accessing ptrace user registers.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D92063
cchen [Tue, 1 Dec 2020 22:07:00 +0000 (16:07 -0600)]
[OpenMP51][DOCS] Claim "add present modifier in defaultmap clause", NFC.
Arthur Eubanks [Wed, 25 Nov 2020 04:40:47 +0000 (20:40 -0800)]
Reland [CMake][NewPM] Move ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER into llvm/
This allows us to use its value everywhere, rather than just clang. Some
other places, like opt and lld, will use its value soon.
Rename it internally to LLVM_ENABLE_NEW_PASS_MANAGER.
The #define for it is now in llvm-config.h.
The initial land accidentally set the value of
LLVM_ENABLE_NEW_PASS_MANAGER to the string
ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER instead of its value.
Reviewed By: rnk, hans
Differential Revision: https://reviews.llvm.org/D92072