Commit Graph

373650 Commits

Author SHA1 Message Date
Pavel Iliin a4ac434c47 [AArch64] Compiler-rt interface for out-of-line atomics.
Out-of-line helper functions to support LSE deployment added.
This is a port of libgcc implementation:
https://gcc.gnu.org/git/?p=gcc.git;h=33befddcb849235353dc263db1c7d07dc15c9faa

Differential Revision: https://reviews.llvm.org/D91156
2020-12-02 20:07:12 +00:00
jasonliu 2c63e7604c [XCOFF][AIX] Alternative path in EHStreamer for platforms do not have uleb128 support
Summary:
Not all system assembler supports `.uleb128 label2 - label1` form.
When the target do not support this form, we have to take
alternative manual calculation to get the offsets from them.

Reviewed By: hubert.reinterpretcast

Diffierential Revision: https://reviews.llvm.org/D92058
2020-12-02 20:03:15 +00:00
Roland McGrath 70764c02e4 [CMake][Fuchsia] Install llvm-elfabi
The canonical Fuchsia toolchain configuration installs llvm-elfabi.

Reviewed By: haowei

Differential Revision: https://reviews.llvm.org/D92444
2020-12-02 11:59:14 -08:00
Roland McGrath 827e075676 [lsan] Use final on Fuchsia ThreadContext declaration
This is consistent with other platforms' versions and
eliminates a compiler warning.

Reviewed By: leonardchan

Differential Revision: https://reviews.llvm.org/D92442
2020-12-02 11:58:03 -08:00
Siva Chandra Reddy 19c3894f94 [libc] Fix couple of corner cases in remquo.
These two cases are fixed:
1. If numerator is not zero and denominator is infinity, then the
numerator is returned as the remainder.
2. If numerator and denominator are equal in magnitude, then quotient
with the right sign is returned.

The differet tests of remquo, remquof and remquol have been unified
into a single file to avoid duplication.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D92353
2020-12-02 11:48:49 -08:00
Nick Desaulniers bc044a88ee [Inline] prevent inlining on stack protector mismatch
It's common for code that manipulates the stack via inline assembly or
that has to set up its own stack canary (such as the Linux kernel) would
like to avoid stack protectors in certain functions. In this case, we've
been bitten by numerous bugs where a callee with a stack protector is
inlined into an attribute((no_stack_protector)) caller, which
generally breaks the caller's assumptions about not having a stack
protector. LTO exacerbates the issue.

While developers can avoid this by putting all no_stack_protector
functions in one translation unit together and compiling those with
-fno-stack-protector, it's generally not very ergonomic or as
ergonomic as a function attribute, and still doesn't work for LTO. See also:
https://lore.kernel.org/linux-pm/20200915172658.1432732-1-rkir@google.com/
https://lore.kernel.org/lkml/20200918201436.2932360-30-samitolvanen@google.com/T/#u

SSP attributes can be ordered by strength. Weakest to strongest, they
are: ssp, sspstrong, sspreq.  Callees with differing SSP attributes may be
inlined into each other, and the strongest attribute will be applied to the
caller. (No change)

After this change:
* A callee with no SSP attributes will no longer be inlined into a
  caller with SSP attributes.
* The reverse is also true: a callee with an SSP attribute will not be
  inlined into a caller with no SSP attributes.
* The alwaysinline attribute overrides these rules.

Functions that get synthesized by the compiler may not get inlined as a
result if they are not created with the same stack protector function
attribute as their callers.

Alternative approach to https://reviews.llvm.org/D87956.

Fixes pr/47479.

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed By: rnk, MaskRay

Differential Revision: https://reviews.llvm.org/D91816
2020-12-02 11:00:16 -08:00
LLVM GN Syncbot e5085a62d1 [gn build] Port a65d8c5d72 2020-12-02 18:50:30 +00:00
zoecarver 644f68ed4d [libc++] Add slice_array operator= valarray overload.
Add the slice_array::operator=(const std::valarray<T>& val_arr) overload.

Fixes https://llvm.org/PR40792.

Differential Revision: https://reviews.llvm.org/D58735
2020-12-02 10:49:20 -08:00
River Riddle f80b630460 [mlir][PDL] Use explicit loop over llvm::find to fix MSVC breakage 2020-12-02 10:43:16 -08:00
jasonliu a65d8c5d72 [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX
Summary:
AIX uses the existing EH infrastructure in clang and llvm.
The major differences would be
1. AIX do not have CFI instructions.
2. AIX uses a new personality routine, named __xlcxx_personality_v1.
   It doesn't use the GCC personality rountine, because the
   interoperability is not there yet on AIX.
3. AIX do not use eh_frame sections. Instead, it would use a eh_info
section (compat unwind section) to store the information about
personality routine and LSDA data address.

Reviewed By: daltenty, hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D91455
2020-12-02 18:42:44 +00:00
Sanjay Patel 9d6d24c250 [JumpThreading][VectorUtils] avoid infinite loop on unreachable IR
https://llvm.org/PR48362

It's possible that we could stub this out sooner somewhere
within JumpThreading, but I'm not sure how to do that, and
then we would still have potential danger in other callers.

I can't find a way to trigger this using 'instsimplify',
however, because that already has a bailout on unreachable
blocks.
2020-12-02 13:39:33 -05:00
Tim Keith 1f525ece4a [flang][NFC] Add GetTopLevelUnitContaining functions
`GetTopLevelUnitContaining` returns the Scope nested in the global scope
that contains the given Scope or Symbol.

Use "Get" rather than "Find" in the name because "Find" implies it might
not be found, which can't happen. Following that logic, rename
`FindProgramUnitContaining` to `GetProgramUnitContaining` and have it
also return a reference rather that a pointer.

Note that the use of "ProgramUnit" is slightly confusing. In the Fortran
standard, "program-unit" refers to what is called a "TopLevelUnit" here.
What we are calling a "ProgramUnit" (here and in `ProgramTree`) includes
internal subprograms while "TopLevelUnit" does not.

Differential Revision: https://reviews.llvm.org/D92491
2020-12-02 10:28:49 -08:00
Raphael Isemann 291cc1bbea [lldb][NFC] Give class template pack test files unique class names 2020-12-02 19:19:35 +01:00
Simon Pilgrim a8034fc1ad [LoopVectorize] Fix optimal-epilog-vectorization-limitations.ll test on non-debug build bots
Add "REQUIRES: asserts" as the test uses the "--debug-only" switch

Should fix the clang-with-thin-lto-ubuntu buildbot failure
2020-12-02 18:00:42 +00:00
Simon Pilgrim 1f2353734d [Thumb2] Regenerate predicated-liveout-unknown-lanes.ll test
Helps to reduce diff in D90113
2020-12-02 18:00:42 +00:00
Simon Pilgrim 8aa40de5ec [PowerPC] Regenerate cmpb tests
Helps to reduce diff in D90113
2020-12-02 18:00:41 +00:00
Fangrui Song 557b00e0af Delete llvm::is_trivially_copyable and CMake variable HAVE_STD_IS_TRIVIALLY_COPYABLE
GCC<5 did not support std::is_trivially_copyable. Now LLVM builds
require 5.1 we can delete llvm::is_trivially_copyable after the users
have been migrated to std::is_trivially_copyable.
2020-12-02 09:58:08 -08:00
Fangrui Song 4d4bd40b57 Use std::is_trivially_copyable
GCC<5 did not support std::is_trivially_copyable. Now LLVM builds require 5.1
we can migrate to std::is_trivially_copyable.
2020-12-02 09:58:07 -08:00
Arthur Eubanks 92475f698e [test] Make verify-invalid.ll work with legacy and new PMs 2020-12-02 09:56:18 -08:00
Simon Pilgrim f019362329 [X86] EltsFromConsecutiveLoads - remove old FIXME comment. NFC.
Its unlikely an undef element in a zero vector will be any use.
2020-12-02 17:21:41 +00:00
Simon Pilgrim ed09d41c8a [LSR][X86] Replace -march with -mtriples
Fixes build on gnux32 hosts
2020-12-02 17:05:15 +00:00
Kostya Kortchinsky c904c32b9c [GWP-ASan] Fix flaky test on Fuchsia
The LateInit test might be reusing some already initialized thread
specific data if run within the main thread. This means that there
is a chance that the current value will not be enough for the 100
iterations, hence the test flaking.

Fix this by making the test run in its own thread.

Differential Revision: https://reviews.llvm.org/D92415
2020-12-02 09:00:51 -08:00
Gabor Marton b40b3196b3 [analyzer][StdLibraryFunctionsChecker] Add return value constraint to functions with BufferSize
Differential Revision: https://reviews.llvm.org/D92474
2020-12-02 17:54:48 +01:00
Simon Pilgrim 3900ec6f05 [X86] combineX86ShufflesRecursively - remove old FIXME comment. NFC.
Its unlikely an undef element in a zero vector will be any use, and SimplifyDemandedVectorElts now calls combineX86ShufflesRecursively so its unlikely we actually have a dependency on these specific elements.
2020-12-02 16:29:38 +00:00
Simon Pilgrim 793192da7f [X86] Regenerate 32-bit merge-consecutive-loads tests
Avoid use of X32 check prefix - we try to only use that for gnux32 triple tests
2020-12-02 16:29:38 +00:00
Simon Pilgrim 0dab7ecc5d [X86] EltsFromConsecutiveLoads - pull out repeated NumLoadedElts. NFCI. 2020-12-02 16:29:37 +00:00
Michael Liao 21d74172df Remove `-Wunused-result` and `-Wpedantic` warnings from GCC. NFC. 2020-12-02 10:53:59 -05:00
Michael Liao d8949a8ad3 [hip] Fix host object creation from fatbin
- `__hip_fatbin` should a symbol in `.hip_fatbin` section.

Differential Revision: https://reviews.llvm.org/D92418
2020-12-02 10:36:01 -05:00
Vitaly Buka 1f3def16f6 [NFC][sanitizer] Fix test on 32bit platform 2020-12-02 07:32:40 -08:00
Yaxun (Sam) Liu 5c8911d0ba [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
2020-12-02 10:15:56 -05:00
Yaxun (Sam) Liu cd95338ee3 [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
2020-12-02 10:14:46 -05:00
Bardia Mahjour a7e2c26939 [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
2020-12-02 10:09:56 -05:00
Ahsan Saghir 5045b831a3 [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.
2020-12-02 09:03:28 -06:00
Nico Weber ca634393fc [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
2020-12-02 09:48:31 -05:00
Christian Sigg c4a0405902 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
2020-12-02 15:46:20 +01:00
Sanjay Patel 56fd29e93b [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.
2020-12-02 09:04:08 -05:00
Alex Zinenko 240dd92432 [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
2020-12-02 14:59:41 +01:00
Hans Wennborg 437c465385 [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
2020-12-02 14:56:43 +01:00
Hans Wennborg 45d8a78432 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
2020-12-02 14:56:43 +01:00
Kazushi (Jam) Marukawa dd0159bd81 [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
2020-12-02 22:52:54 +09:00
Anirudh Prasad f03c21df7b [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
2020-12-02 08:25:31 -05:00
David Sherwood 71bd59f0cb [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
2020-12-02 13:23:43 +00:00
Abhina Sreeskantharajan f770ec1a4e [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
2020-12-02 08:23:27 -05:00
Cheng Wang 60cef89362 [libc] Add strncpy implementation.
Add libc strncpy implementation.

Reviewed By: sivachandra, gchatelet

Differential Revision: https://reviews.llvm.org/D91399
2020-12-02 20:45:51 +08:00
Pedro Tammela d055e3a0eb [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
2020-12-02 11:25:31 +00:00
Georgii Rymar 137a25f04a [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
2020-12-02 13:51:32 +03:00
Cullen Rhodes 14557cdf94 [InstructionsTest] NFC: Replace VectorType::get(.., .., true) with ScalableVectorType::get
Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D92467
2020-12-02 10:50:05 +00:00
Marek Kurdej 28797e9952 [libc++] [docs] Mark LWG2296 as complete not only on clang.
std::addressof was made constexpr in gcc 7.
libc++ fixed it in ac473034fc (Provide a constexpr addressof with GCC 7.)
2020-12-02 11:39:43 +01:00
Marek Kurdej d82fb6022b [libc++] [docs] Mark P1424 as superseded by P1902. 2020-12-02 11:19:37 +01:00
Jay Foad d28624a209 [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
2020-12-02 10:11:42 +00:00