platform/upstream/llvm.git
4 years agoRevert "[CodeGen] Add support for multiple memory operands in MachineInstr::mayAlias"
Jean-Michel Gorius [Fri, 22 May 2020 19:26:46 +0000 (21:26 +0200)]
Revert "[CodeGen] Add support for multiple memory operands in MachineInstr::mayAlias"

This temporarily reverts commit 7019cea26dfef5882c96f278c32d0f9c49a5e516.

It seems that, for some targets, there are instructions with a lot of memory operands (probably more than would be expected). This causes a lot of buildbots to timeout and notify failed builds. While investigations are ongoing to find out why this happens, revert the changes.

4 years agoRevert "[lldb] Enable C++14 when evaluating expressions in a C++14 frame"
Raphael Isemann [Fri, 22 May 2020 19:23:03 +0000 (21:23 +0200)]
Revert "[lldb] Enable C++14 when evaluating expressions in a C++14 frame"

This reverts commit 5f88f39ab8154682c3b1eb9d7050a9412a55d9e7. It broke these
three tests on the Window bot:
  lldb-api :: commands/expression/completion/TestExprCompletion.py
  lldb-api :: lang/cpp/scope/TestCppScope.py
  lldb-api :: lang/cpp/standards/cpp11/TestCPP11Standard.py

4 years ago[libc++] Make MoveOnly constexpr-friendly
Louis Dionne [Fri, 22 May 2020 15:20:27 +0000 (11:20 -0400)]
[libc++] Make MoveOnly constexpr-friendly

This is necessary when writing constexpr tests.

4 years agoRevert "[analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend...
Kirstóf Umann [Fri, 22 May 2020 18:18:16 +0000 (20:18 +0200)]
Revert "[analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend, error if an output loc is missing for PathDiagConsumers that need it"

This reverts commit fe1a3a7e8c8be33968b9a768666489823dabab10.

4 years ago[DSE,MSSA] Add additional multiblock tests.
Florian Hahn [Mon, 27 Apr 2020 14:46:12 +0000 (15:46 +0100)]
[DSE,MSSA] Add additional multiblock tests.

4 years ago[clang-tidy] Expand the list of functions in bugprone-unused-return-value
Joe Ranieri [Fri, 22 May 2020 16:57:58 +0000 (12:57 -0400)]
[clang-tidy] Expand the list of functions in bugprone-unused-return-value

This change adds common C, C++, and POSIX functions to the clang-tidy unused return value checker.

Differential Revision: https://reviews.llvm.org/D76083

4 years ago[lldb/Test] Remove issue_verification subdirectory
Jonas Devlieghere [Fri, 22 May 2020 16:22:53 +0000 (09:22 -0700)]
[lldb/Test] Remove issue_verification subdirectory

These files haven't been touched since 2015. According to Pavel these
were intended to be test for the test framework which never really took
of and are mostly irrelevant by now.

Differential revision: https://reviews.llvm.org/D80408

4 years ago[VectorCombine] position pass after SLP in the optimization pipeline rather than...
Sanjay Patel [Fri, 22 May 2020 16:13:18 +0000 (12:13 -0400)]
[VectorCombine] position pass after SLP in the optimization pipeline rather than before

There are 2 known problem patterns shown in the test diffs here:
vector horizontal ops (an x86 specialization) and vector reductions.

SLP has greater ability to match and fold those than vector-combine,
so let SLP have first chance at that.

This is a quick fix while we continue to improve vector-combine and
possibly canonicalize to reduction intrinsics.

In the longer term, we should improve matching of these patterns
because if they were created in the "bad" forms shown here, then we
would miss optimizing them.

I'm not sure what is happening with alias analysis on the addsub test.
The old pass manager now shows an extra line for that, and we see an
improvement that comes from SLP vectorizing a store. I don't know
what's missing with the new pass manager to make that happen.
Strangely, I can't reproduce the behavior if I compile from C++ with
clang and invoke the new PM with "-fexperimental-new-pass-manager".

Differential Revision: https://reviews.llvm.org/D80236

4 years ago[RISCV] Register null target streamer for RISC-V
Pengxuan Zheng [Thu, 21 May 2020 02:12:36 +0000 (19:12 -0700)]
[RISCV] Register null target streamer for RISC-V

Summary:
This fixes two llc crashes with the following tests when RISC-V is the default
target.

LLVM :: DebugInfo/Generic/global.ll
LLVM :: DebugInfo/Generic/inlined-strings.ll

Reviewers: HsiangKai

Reviewed By: HsiangKai

Subscribers: hiraditya, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, sameer.abuasal, apazos, luismarques, evandro, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80352

4 years ago[analyzer] SATestBuild.py: Fix hang when one of the tasks fails
Valeriy Savchenko [Fri, 22 May 2020 15:47:04 +0000 (18:47 +0300)]
[analyzer] SATestBuild.py: Fix hang when one of the tasks fails

Summary:
Tasks can crash with many different exceptions including SystemExit.
Bare except still causes a warning, so let's use BaseException instead.

Differential Revision: https://reviews.llvm.org/D80443

4 years ago[CGP] Ensure address offset is representable as int64_t
Simon Pilgrim [Fri, 22 May 2020 15:59:05 +0000 (16:59 +0100)]
[CGP] Ensure address offset is representable as int64_t

AddressingModeMatcher::matchAddr was calling getSExtValue for a constant before ensuring that we can actually represent the value as int64_t

Fixes PR46004 / OSSFuzz#22357

4 years ago[InstCombine] (A + B) + B --> A + (B << 1)
Sanjay Patel [Fri, 22 May 2020 15:37:58 +0000 (11:37 -0400)]
[InstCombine] (A + B) + B --> A + (B << 1)

This eliminates a use of 'B', so it can enable follow-on transforms
as well as improve analysis/codegen.

The PhaseOrdering test was added for D61726, and that shows
the limits of instcombine vs. real reassociation. We would
need to run some form of CSE to collapse that further.

The intermediate variable naming here is intentional because
there's a test at llvm/test/Bitcode/value-with-long-name.ll
that would break with the usual nameless value. I'm not sure
how to improve that test to be more robust.

The naming may also be helpful to debug regressions if this
change exposes weaknesses in the reassociation pass for example.

4 years ago[InstCombine] add tests for adds with common operand; NFC
Sanjay Patel [Fri, 22 May 2020 14:20:43 +0000 (10:20 -0400)]
[InstCombine] add tests for adds with common operand; NFC

4 years ago[SCEV] Constant fold MultExpr before applying depth limit.
Denis Antrushin [Wed, 13 May 2020 17:55:07 +0000 (20:55 +0300)]
[SCEV] Constant fold MultExpr before applying depth limit.

Summary:
Users of SCEV reasonably assume that multiplication of two constant
SCEVs will in turn be constant.
However, that is not always the case:
First, we can get here with reached depth limit, and will create
MultExpr SCEV `C1 * C2` and cache it.
Then, we can get here with the same operands, but with small depth
level. But this time we will find existing MultExpr SCEV and return
it, instead of expected constant SCEV.

This patch changes getMultExpr to not apply depth limit to all constant
operands expression, allowing them to be folded.

Reviewers: reames, mkazantsev

Subscribers: hiraditya, javed.absar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79893

4 years ago[NFC][AIX] Remove spaces after the comma for '.csect' directive
Xiangling_Liao [Fri, 22 May 2020 12:20:35 +0000 (08:20 -0400)]
[NFC][AIX] Remove spaces after the comma for '.csect' directive

To be consistent with other directives like '.comm', '.lcomm', we remove
the spaces after the comma for '.csect' on AIX.

Differential Revision: https://reviews.llvm.org/D80247

4 years agoAMDGPU/GlobalISel: Fix masked control flow with fallthrough blocks
Matt Arsenault [Sun, 17 May 2020 14:51:22 +0000 (10:51 -0400)]
AMDGPU/GlobalISel: Fix masked control flow with fallthrough blocks

Unlike SelectionDAGBuilder, IRTranslator omits the unconditional
branch in fallthrough cases. Confusingly, the control flow pseudos
function in the opposite way the intrinsics are used, and the branch
targets always need to be swapped. We're inverting the target blocks,
so we need to figure out the old fallthrough block and insert a branch
to the original unconditional branch target.

4 years ago[PhaseOrdering] regenerate test checks; NFC
Sanjay Patel [Fri, 22 May 2020 13:54:00 +0000 (09:54 -0400)]
[PhaseOrdering] regenerate test checks; NFC

Remove some redundant/unnecessary bits too.

4 years agoTitle: [LV] Handle Fold-Tail of loops with vectorizarion factor equal to 1
Anh Tuyen Tran [Fri, 22 May 2020 13:30:56 +0000 (13:30 +0000)]
Title: [LV] Handle Fold-Tail of loops with vectorizarion factor equal to 1

Summary:
When handling loops whose VF is 1, fold-tail vectorization sets the
backedge taken count of the original loop with a vector of a single
element. This causes type-mismatch during instruction generartion.

The purpose of this patch is toto address the case of VF==1.

Reviewer: Ayal (Ayal Zaks), bmahjour (Bardia Mahjour), fhahn (Florian Hahn), gilr (Gil Rapaport), rengolin (Renato Golin)

Reviewed By: Ayal (Ayal Zaks), bmahjour (Bardia Mahjour), fhahn (Florian Hahn)

Subscribers: Ayal (Ayal Zaks), rkruppe (Hanna Kruppe), bmahjour (Bardia Mahjour), rogfer01 (Roger Ferrer Ibanez), vkmr (Vineet Kumar), bollu (Siddharth Bhat), hiraditya (Aditya Kumar), llvm-commits (Mailing List llvm-commits)

Tag: LLVM

Differential Revision: https://reviews.llvm.org/D79976

4 years agoTargetLowering.h - remove unnecessary includes. NFC.
Simon Pilgrim [Fri, 22 May 2020 13:22:56 +0000 (14:22 +0100)]
TargetLowering.h - remove unnecessary includes. NFC.

Replace with forward declarations and move SizeOpts.h down to TargetLoweringBase.cpp

4 years ago[TargetLowering] Move TargetLoweringBase::isJumpTableRelative() implementation into...
Simon Pilgrim [Fri, 22 May 2020 12:18:06 +0000 (13:18 +0100)]
[TargetLowering] Move TargetLoweringBase::isJumpTableRelative() implementation into TargetLoweringBase.cpp. NFC.

This will help with reducing header dependencies in TargetLowering.h in a future patch.

4 years ago[libc++] NFC: Inline array<T,N>::at methods inside the class
Louis Dionne [Fri, 22 May 2020 13:23:32 +0000 (09:23 -0400)]
[libc++] NFC: Inline array<T,N>::at methods inside the class

All other methods are defined in the class, so this increases consistency.

4 years ago[SLP] fix verification check for valid IR
Sanjay Patel [Fri, 22 May 2020 13:12:06 +0000 (09:12 -0400)]
[SLP] fix verification check for valid IR

This is a fix for PR45965 - https://bugs.llvm.org/show_bug.cgi?id=45965 -
which was left out of D80106 because of a test failure.

SLP does its own mini-CSE after potentially creating redundant instructions,
so we need to wait for that to complete before running the verifier.
Otherwise, we will see a test failure for
test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll (not changed here)
because a phi temporarily has identical but different incoming values for
the same incoming block.

A related, but independent, test that would have been altered here was
fixed with:
rG880df55

The test was escaping verification in SLP without this change because we
were not running verifyFunction() unless SLP actually changed the IR.

Differential Revision: https://reviews.llvm.org/D80401

4 years ago[analyzer] LoopUnrolling: fix crash when a parameter is a loop counter.
Artem Dergachev [Fri, 22 May 2020 11:53:59 +0000 (14:53 +0300)]
[analyzer] LoopUnrolling: fix crash when a parameter is a loop counter.

When loop counter is a function parameter "isPossiblyEscaped" will not find
the variable declaration which lead to hitting "llvm_unreachable".
Parameters of reference type should be escaped like global variables;
otherwise treat them as unescaped.

Patch by Abbas Sabra!

Differential Revision: https://reviews.llvm.org/D80171

4 years ago[SLP] fix test to have valid IR; NFC
Sanjay Patel [Fri, 22 May 2020 12:39:22 +0000 (08:39 -0400)]
[SLP] fix test to have valid IR; NFC

This test was failing verification because the
metadata is ill-formed. This commit is split
from D80401 because it is an independent fix
(although the test would break with that change).

4 years ago[PowerPC] Treat 'Z' inline asm constraint as a true memory constraint
Nemanja Ivanovic [Fri, 22 May 2020 12:59:12 +0000 (07:59 -0500)]
[PowerPC] Treat 'Z' inline asm constraint as a true memory constraint

We currently emit incorrect codegen for this constraint because we set it as a
constraint that allows registers. This will cause the value to be copied to the
stack and that address to be passed as the address. This is not what we want.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=42762

Differential revision: https://reviews.llvm.org/D77542

4 years ago[PowerPC] Add missing handling for half precision
Nemanja Ivanovic [Fri, 22 May 2020 12:48:09 +0000 (07:48 -0500)]
[PowerPC] Add missing handling for half precision

The fix for PR39865 took care of some of the handling for half precision
but it missed a number of issues that still exist. This patch fixes the
remaining issues that cause crashes in the PPC back end.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=45776

Differential revision: https://reviews.llvm.org/D79283

4 years ago[CMake] Fix typos. NFC
Marek Kurdej [Fri, 22 May 2020 12:33:16 +0000 (14:33 +0200)]
[CMake] Fix typos. NFC

4 years ago[Target] Fix typos. NFC
Marek Kurdej [Fri, 22 May 2020 12:32:39 +0000 (14:32 +0200)]
[Target] Fix typos. NFC

4 years agoInstCombine: Add constant folding/simplify for amdgcn.ldexp intrinsic
Matt Arsenault [Thu, 21 May 2020 16:31:28 +0000 (12:31 -0400)]
InstCombine: Add constant folding/simplify for amdgcn.ldexp intrinsic

This really belongs in InstructionSimplify since it doesn't introduce
new instructions. Put it in instcombine to avoid increasing the number
of passes considering target intrinsics.

I also noticed that we seem to now be interpreting strictfp attributes
on call sites, so try to handle that.

4 years agoRevert "[llvm][test] Add COM: directives before colon-less non-CHECKs in comments...
Jon Roelofs [Fri, 22 May 2020 11:36:15 +0000 (05:36 -0600)]
Revert "[llvm][test] Add COM: directives before colon-less non-CHECKs in comments. NFC"

This reverts commit 183d6af081899973f00fc24aeafcfc32de732f02.

Revert pending further consensus building: https://reviews.llvm.org/D79963#2050521

4 years ago[AVR] Remove unsigned <= 0 checks. NFCI.
Simon Pilgrim [Fri, 22 May 2020 11:28:26 +0000 (12:28 +0100)]
[AVR] Remove unsigned <= 0 checks. NFCI.

D77207 changed the bounds checks resulting in tests for positive unsigned values - dropping the superfluous check to fix gcc+Werror "error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]" warning.

4 years ago[AMDGPU][MC][GFX8+] Enabled clamp for v_mul_i32_i24_e64 and v_mul_u32_u24_e64
Dmitry Preobrazhensky [Fri, 22 May 2020 10:54:59 +0000 (13:54 +0300)]
[AMDGPU][MC][GFX8+] Enabled clamp for v_mul_i32_i24_e64 and v_mul_u32_u24_e64

See bug 45925: https://bugs.llvm.org/show_bug.cgi?id=45925

Reviewers: arsenm, rampitec

Differential Revision: https://reviews.llvm.org/D80287

4 years agoRemove superfluous semicolon to stop Wpedantic warning. NFCI.
Simon Pilgrim [Fri, 22 May 2020 11:04:59 +0000 (12:04 +0100)]
Remove superfluous semicolon to stop Wpedantic warning. NFCI.

4 years agoReplace dyn_cast<> with isa<> to fix unused variable warning. NFCI.
Simon Pilgrim [Fri, 22 May 2020 10:59:19 +0000 (11:59 +0100)]
Replace dyn_cast<> with isa<> to fix unused variable warning. NFCI.

4 years ago[NFC][Test] Add test coverage for fsqrt on PowerPC
QingShan Zhang [Fri, 22 May 2020 10:56:46 +0000 (10:56 +0000)]
[NFC][Test] Add test coverage for fsqrt on PowerPC

4 years ago[analyzer] SumTimerInfo.py: Partially modernize
Valeriy Savchenko [Fri, 22 May 2020 09:51:25 +0000 (12:51 +0300)]
[analyzer] SumTimerInfo.py: Partially modernize

Differential Revision: https://reviews.llvm.org/D80427

4 years ago[analyzer] SATestUpdateDiffs.py: Refactor and add type annotations
Valeriy Savchenko [Fri, 22 May 2020 09:38:03 +0000 (12:38 +0300)]
[analyzer] SATestUpdateDiffs.py: Refactor and add type annotations

Differential Revision: https://reviews.llvm.org/D80426

4 years ago[analyzer] SATestUtils.py: Refactor and add type annotations
Valeriy Savchenko [Fri, 22 May 2020 08:59:39 +0000 (11:59 +0300)]
[analyzer] SATestUtils.py: Refactor and add type annotations

Differential Revision: https://reviews.llvm.org/D80424

4 years ago[analyzer] SATestBuild.py: Refactor and add type annotations
Valeriy Savchenko [Thu, 21 May 2020 15:28:36 +0000 (18:28 +0300)]
[analyzer] SATestBuild.py: Refactor and add type annotations

Summary:
SATest scripts should be more python-style than they are now.
This includes better architecture, type annotations, naming
convesions, and up-to-date language features.  This commit starts
with two scripts SATestBuild and SATestAdd.

Differential Revision: https://reviews.llvm.org/D80423

4 years ago[lldb] Increase timeout in TestExitDuringExpression
Pavel Labath [Fri, 22 May 2020 10:41:46 +0000 (12:41 +0200)]
[lldb] Increase timeout in TestExitDuringExpression

200 microseconds is not enough time for any expression to execute
reliably. On linux, calling pthread_exit can result in call to dlopen,
which cannot complete in that time, particularly when running under a
debugger.

On linux, this test failed all the time, on macos, about two thirds of
runs were failing.  This patch increases the timeout to 100ms, which is
enough to get it passing reliably on linux, though I wouldn't be
surprised if an even bigger timeout would be needed for remote test
runs.

4 years ago[SYCL] Prohibit arithmetic operations for incompatible pointers
Alexey Bader [Wed, 20 May 2020 19:22:30 +0000 (22:22 +0300)]
[SYCL] Prohibit arithmetic operations for incompatible pointers

Summary:
This change enables OpenCL diagnostics for the pointers annotated with
address space attribute SYCL mode.

Move `isAddressSpaceOverlapping` method from PointerType to QualType.

Reviewers: Anastasia, rjmccall

Reviewed By: rjmccall

Subscribers: rjmccall, jeroen.dobbelaere, Fznamznon, yaxunl, ebevhan, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80317

4 years agoRevert "[ARM] Improve codegen of volatile load/store of i64"
Victor Campos [Fri, 22 May 2020 09:03:18 +0000 (10:03 +0100)]
Revert "[ARM] Improve codegen of volatile load/store of i64"

This reverts commit 8a12553223180246eeafaa0fa7bfa11e834d34b6.

A bug has been found when generating code for Thumb2. In some very
specific cases, the prologue/epilogue emitter generates erroneous stack
offsets for the new LDRD instructions that access the stack.

This bug does not seem to be caused by the reverted patch though. Likely
the latter has made an undiscovered issue emerge in the
prologue/epilogue emission pass. Nevertheless, this reversion is
necessary since it is blocking users of the ARM backend.

4 years agoStatepointLowering.h - remove unused includes. NFC.
Simon Pilgrim [Fri, 22 May 2020 09:48:21 +0000 (10:48 +0100)]
StatepointLowering.h - remove unused includes. NFC.

4 years agoFix msvc "switch statement contains 'default' but no 'case' labels" warning. NFC.
Simon Pilgrim [Fri, 22 May 2020 09:47:12 +0000 (10:47 +0100)]
Fix msvc "switch statement contains 'default' but no 'case' labels" warning. NFC.

Stripped out the switch statement, but kept case labels as comments for future reference.

4 years agoMILexer.h/cpp - remove unused includes. NFC.
Simon Pilgrim [Thu, 21 May 2020 16:12:15 +0000 (17:12 +0100)]
MILexer.h/cpp - remove unused includes. NFC.

Remove duplicates in MILexer.cpp that are already included in MILexer.h.

4 years ago[lldb] Enable C++14 when evaluating expressions in a C++14 frame
Raphael Isemann [Fri, 22 May 2020 09:42:32 +0000 (11:42 +0200)]
[lldb] Enable C++14 when evaluating expressions in a C++14 frame

Summary:
Currently we never enable C++14 in the expression evaluator. This enables it when the language of the program is C++14.

It seems C++17 and so on isn't yet in any of the language enums (and the DWARF standard it seems), so C++17 support will be a follow up patch.

Reviewers: labath, JDevlieghere

Reviewed By: labath, JDevlieghere

Subscribers: aprantl

Differential Revision: https://reviews.llvm.org/D80308

4 years ago[lldb][NFC] Overload raw_ostream operator << for ConstString
Raphael Isemann [Fri, 22 May 2020 07:36:37 +0000 (09:36 +0200)]
[lldb][NFC] Overload raw_ostream operator << for ConstString

Summary: We are not doing this very often, but sometimes it's convenient when I can just << ConstStrings into llvm::errs() during testing.

Reviewers: labath, JDevlieghere

Reviewed By: labath, JDevlieghere

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D80310

4 years ago[NFC] InstCombineNegator: use auto where type is obvious from the cast
Roman Lebedev [Thu, 21 May 2020 15:11:03 +0000 (18:11 +0300)]
[NFC] InstCombineNegator: use auto where type is obvious from the cast

4 years ago[InstCombine] Sink pure instructions down to return and unreachable blocks
Max Kazantsev [Fri, 22 May 2020 07:32:21 +0000 (14:32 +0700)]
[InstCombine] Sink pure instructions down to return and unreachable blocks

If the only user of `Instr` is in a return or unreachable block, we can
sink `Instr` to the`User` safely (unless it reads/writes memory).
Return or unreachable blocks are guaranteed to execute zero
or one time, and `Instr` always dominates `User`, so they either will
be executed together (execution of `User` always implies execution
of `Instr`) or not executed at all.

Differential Revision: https://reviews.llvm.org/D80120
Reviewed By: asbirlea, jdoerfert

4 years ago[lldb/REPL] Fix unhandled switch case
Jonas Devlieghere [Fri, 22 May 2020 06:22:16 +0000 (23:22 -0700)]
[lldb/REPL] Fix unhandled switch case

Fix warning: enumeration value 'eExpressionThreadVanished' not handled
in switch [-Wswitch]

4 years ago[gn build] Port 2e40cf06df0
LLVM GN Syncbot [Fri, 22 May 2020 04:58:19 +0000 (04:58 +0000)]
[gn build] Port 2e40cf06df0

4 years ago[X86] Allow avx512vp2intersect to be used with __builtin_cpu_supports.
Craig Topper [Fri, 22 May 2020 01:16:02 +0000 (18:16 -0700)]
[X86] Allow avx512vp2intersect to be used with __builtin_cpu_supports.

compiler-rt and trunk libgcc support this now.

4 years ago[X86] Add avx512vp2intersect feature to compiler-rt's feature detection to match...
Craig Topper [Fri, 22 May 2020 01:12:21 +0000 (18:12 -0700)]
[X86] Add avx512vp2intersect feature to compiler-rt's feature detection to match libgcc.

4 years ago[JITLink] Initial implementation of ELF / x86-64 support for JITLink.
Lang Hames [Fri, 22 May 2020 04:44:00 +0000 (21:44 -0700)]
[JITLink] Initial implementation of ELF / x86-64 support for JITLink.

This initial implementation supports section and symbol parsing, but no
relocation support. It enables JITLink to link and execute ELF relocatable
objects that do not require relocations.

Patch by Jared Wyles. Thanks Jared!

Differential Revision: https://reviews.llvm.org/D79832

4 years ago[OPENMP] Fix mixture of omp and clang pragmas
ISHIGURO, Hiroshi [Fri, 22 May 2020 02:34:49 +0000 (11:34 +0900)]
[OPENMP] Fix mixture of omp and clang pragmas

Fixes PR45753

When a program that contains a loop to which both `omp parallel for`
pragma and `clang loop` pragma are associated is compiled with the
-fopenmp option, `clang loop` pragma did not take effect. The example
below should not be vectorized by the `clang loop` pragma but it was
actually vectorized. The cause is that `llvm.loop.vectorize.width`
was not output to the IR when -fopenmp is specified.

The fix attaches attributes if they exist for the loop.

[example.c]

```
int a[100], b[100];
void foo() {
  #pragma omp parallel for
  #pragma clang loop vectorize(disable)
  for (int i = 0; i < 100; i++)
    a[i] += b[i] * i;
}
```

[compile]

```
$ clang -O2 -fopenmp example.c -c -Rpass=vect
example.c:3:11: remark: vectorized loop (vectorization width: 4, interleaved count: 2) [-Rpass=loop-vectorize]
  #pragma omp parallel for
          ^
```

[IR with -fopenmp]

```
$ clang -O2 exmaple.c -S -emit-llvm -mllvm -disable-llvm-optzns -o - -fopenmp | grep 'vectorize\.width'
```

[IR with -fno-openmp]

```
$ clang -O2 example.c -S -emit-llvm -mllvm -disable-llvm-optzns -o - -fno-openmp | grep 'vectorize\.width'
!7 = !{!"llvm.loop.vectorize.width", i32 1}
```

Differential Revision: https://reviews.llvm.org/D79921

4 years ago[docs][llvm-extract] Add missing alias/bb options
Jinsong Ji [Fri, 22 May 2020 03:10:34 +0000 (03:10 +0000)]
[docs][llvm-extract] Add missing alias/bb options

llvm-extract get serveral new options, but we forgot to update doc.
This patch update the doc.

Reviewed By: volkan

Differential Revision: https://reviews.llvm.org/D80413

4 years ago[lldb/Reproducers] Skip test that changes the source file while debugging
Jonas Devlieghere [Fri, 22 May 2020 03:36:39 +0000 (20:36 -0700)]
[lldb/Reproducers] Skip test that changes the source file while debugging

The VFS is a snapshot and cannot capture changes to the file system.

4 years ago[lldb/Test] Fix replay with TestSetWatchpoint.py
Jonas Devlieghere [Fri, 22 May 2020 03:34:39 +0000 (20:34 -0700)]
[lldb/Test] Fix replay with TestSetWatchpoint.py

The reproducers only track the creation of objects and not their
destruction. Therefore it keeps all objects alive indefinitely.

4 years ago[gn build] (manually) port 49a4f3f7d88
Nico Weber [Fri, 22 May 2020 03:04:41 +0000 (23:04 -0400)]
[gn build] (manually) port 49a4f3f7d88

4 years ago[AArch64][GlobalISel] Add a post-legalizer combiner with a very simple combine.
Jessica Paquette [Fri, 22 May 2020 01:05:37 +0000 (18:05 -0700)]
[AArch64][GlobalISel] Add a post-legalizer combiner with a very simple combine.

(This patch is by Jessica, I'm just committing it on her behalf because I need
a post-legalizer combiner for something else).

This supersedes D77250, which did equivalent work in the selector. This can be
done pre-legalization or post-legalization. Post-legalization is more likely to
hit, since G_IMPLICIT_DEFs tend to appear during legalization. There's no reason
to not do it pre-legalization though-- if it can be caught earlier, great.

(I also think that it might be worth reimplementing D78769 using a
target-specific post-legalization combine too after thinking about it for a
while.)

Differential Revision: https://reviews.llvm.org/D78852

4 years ago[libc] Make clang-tidy use host compiler's resource dir.
Paula Toth [Fri, 22 May 2020 00:39:03 +0000 (17:39 -0700)]
[libc] Make clang-tidy use host compiler's resource dir.

Summary: When building llvm-libc with linting enabled, clang-tidy would use the resource dir of the monorepo rather then the host compiler's resource dir. This presented issues when including headers from the host compiler e.g. for sanitizers. Therefore this patch explicitly tells clang-tidy to use the host compiler's resource dir.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D80265

4 years agoMaybe I need ENABLE_THREADS in the Makefile.
Jim Ingham [Fri, 22 May 2020 01:38:49 +0000 (18:38 -0700)]
Maybe I need ENABLE_THREADS in the Makefile.

4 years agoThis very simple .c file is failing on the Debian bot wit the error
Jim Ingham [Fri, 22 May 2020 01:26:01 +0000 (18:26 -0700)]
This very simple .c file is failing on the Debian bot wit the error

undefined reference to pthread_create

I skipped the test till I can figure out why this didn't build.

4 years ago[llvm-extract] Fix basic block extraction by delaying search until the function is...
Dominic Chen [Thu, 21 May 2020 00:05:40 +0000 (20:05 -0400)]
[llvm-extract] Fix basic block extraction by delaying search until the function is materialized

Summary: When I try to extract a basic block using llvm-extract, it erroneously reports that the named basic block doesn't exist. After digging into the code, it appears to be iterating over an unmaterialized function, which will fail to match any basic blocks.

Reviewers: volkan, qcolombet

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80346

4 years agoHandle the case where a thread exits while we are running a function on it.
Jim Ingham [Thu, 21 May 2020 01:00:56 +0000 (18:00 -0700)]
Handle the case where a thread exits while we are running a function on it.

4 years ago[AMDGPU] Correct formatting typos in documentation
Tony [Thu, 21 May 2020 21:20:06 +0000 (17:20 -0400)]
[AMDGPU] Correct formatting typos in documentation

Summary:
- Correct missing space in some "note" and "TODO" directives in
  AMDGPUUsage.rst
- Correct warning for heading underline being too short in
  BitCodeFormat.rst

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80407

4 years ago[lldb/Test] Cleanup TestSymbolContext.py
Jonas Devlieghere [Fri, 22 May 2020 00:31:51 +0000 (17:31 -0700)]
[lldb/Test] Cleanup TestSymbolContext.py

Remove commented out code, fix the indentation and always use the full
path to the executable. The latter is necessary for the test to pass
from reproducer replay.

4 years ago[WebAssembly] Warn on exception spec only when Wasm EH is used
Heejin Ahn [Thu, 21 May 2020 06:02:41 +0000 (23:02 -0700)]
[WebAssembly] Warn on exception spec only when Wasm EH is used

Summary:
In D80061 we added warning for exception specifications with types (such
as `throw(int)`), but it was enabled every time the target was wasm,
which means it warned (and ignored) exception specifications even if
wasm EH was not used. This fixes it and we only have the warning when we
enable `-fwasm-exceptions`.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80362

4 years ago[clang] Add nomerge function attribute to clang
Zequan Wu [Thu, 21 May 2020 23:44:30 +0000 (16:44 -0700)]
[clang] Add nomerge function attribute to clang
Differential Revision: https://reviews.llvm.org/D79121

4 years ago[lldb/Reproducers] Skip lldb-vscode category when lldb-run-with-repro is set.
Jonas Devlieghere [Thu, 21 May 2020 21:52:12 +0000 (14:52 -0700)]
[lldb/Reproducers] Skip lldb-vscode category when lldb-run-with-repro is set.

This skips all the lldb-vscode tests when running the test suite with
reproducers.

4 years ago[gn build] Port 54e91a3c701
LLVM GN Syncbot [Thu, 21 May 2020 23:43:28 +0000 (23:43 +0000)]
[gn build] Port 54e91a3c701

4 years agoReland "[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker"
Jan Korous [Thu, 21 May 2020 21:37:41 +0000 (14:37 -0700)]
Reland "[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker"

This reverts commit 1108f5c737dbdab0277874a7e5b237491839c43a.

4 years agoRename FunctionOptimizationWarning to the more generic FrameSelectedCallback (NFC)
Adrian Prantl [Thu, 21 May 2020 23:22:01 +0000 (16:22 -0700)]
Rename FunctionOptimizationWarning to the more generic FrameSelectedCallback (NFC)

4 years agoRevert "Add nomerge function attribute to clang"
Zequan Wu [Thu, 21 May 2020 23:12:03 +0000 (16:12 -0700)]
Revert "Add nomerge function attribute to clang"

This reverts commit 307e85395485e1eff9533b2d7952b16f33ceae38.

4 years ago[Instruction] Set metadata uses to undef on deletion
Vedant Kumar [Wed, 20 May 2020 01:03:22 +0000 (18:03 -0700)]
[Instruction] Set metadata uses to undef on deletion

Summary:
Replace any extant metadata uses of a dying instruction with undef to
preserve debug info accuracy. Some alternatives include:

- Treat Instruction like any other Value, and point its extant metadata
  uses to an empty ValueAsMetadata node. This makes extant dbg.value uses
  trivially dead (i.e. fair game for deletion in many passes), leading to
  stale dbg.values being in effect for too long.

- Call salvageDebugInfoOrMarkUndef. Not needed to make instruction removal
  correct. OTOH results in wasted work in some common cases (e.g. when all
  instructions in a BasicBlock are deleted).

This came up while discussing some basic cases in
https://reviews.llvm.org/D80052.

Reviewers: jmorse, TWeaver, aprantl, dexonsmith, jdoerfert

Subscribers: jholewinski, qcolombet, hiraditya, jfb, sstefan1, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80264

4 years ago[AARCH64][NEON] Allow to sink operands of aarch64_neon_pmull64.
Alexey Lapshin [Wed, 20 May 2020 18:45:39 +0000 (21:45 +0300)]
[AARCH64][NEON] Allow to sink operands of aarch64_neon_pmull64.

Summary:
This patch fixes a problem when pmull2 instruction is not
generated for vmull_high_p64 intrinsic.

ISel has a pattern for int_aarch64_neon_pmull64 intrinsic to generate
PMULL2 instruction. That pattern assumes that extraction operations
are located in the same basic block. We need to sink them
if they are not. Handle operands of int_aarch64_neon_pmull64
into AArch64TargetLowering::shouldSinkOperands.

Reviewed by: efriedma

Differential Revision: https://reviews.llvm.org/D80320

4 years agoAdd nomerge function attribute to clang
Zequan Wu [Fri, 8 May 2020 18:36:34 +0000 (11:36 -0700)]
Add nomerge function attribute to clang

4 years ago[Target] Use Align in TargetLoweringObjectFile::getSectionForConstant.
Craig Topper [Thu, 21 May 2020 22:23:00 +0000 (15:23 -0700)]
[Target] Use Align in TargetLoweringObjectFile::getSectionForConstant.

Differential Revision: https://reviews.llvm.org/D80363

4 years agoDon't jump to landing pads in Control Flow Optimizer
Arthur Eubanks [Wed, 13 May 2020 23:33:09 +0000 (16:33 -0700)]
Don't jump to landing pads in Control Flow Optimizer

Summary: Likely fixes https://bugs.llvm.org/show_bug.cgi?id=45858.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80047

4 years ago[docs] Fix buildbot failures
Jinsong Ji [Thu, 21 May 2020 22:06:10 +0000 (22:06 +0000)]
[docs] Fix buildbot failures

Buildbot has been failing since
http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/44711

This patch fix the minor issues that cause warnings.

4 years ago[PS4] Enable relaxed relocations by default
Ben Dunbobbin [Wed, 20 May 2020 10:36:10 +0000 (11:36 +0100)]
[PS4] Enable relaxed relocations by default

PS4 supports these relocations types; so, we want to enable them by default.

Differential Revision: https://reviews.llvm.org/D79980

4 years agollvm-diff: Avoid crash with complex expressions
Dominic Chen [Thu, 21 May 2020 01:11:23 +0000 (21:11 -0400)]
llvm-diff: Avoid crash with complex expressions

Summary: With complex IR, the difference engine can enter an inconsistent state where the instruction and block difference engines return different results. Prevent a crash by refusing to pop beyond the end of the vector.

Reviewers: rjmccall

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80351

4 years agoMake the ExprMutationAnalyzer explicit about how it traverses the AST
Stephen Kelly [Fri, 10 Jan 2020 19:19:23 +0000 (19:19 +0000)]
Make the ExprMutationAnalyzer explicit about how it traverses the AST

Reviewers: aaron.ballman

Subscribers: baloghadamsoftware, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72532

4 years agoSet traversal explicitly where needed in tests
Stephen Kelly [Tue, 12 Nov 2019 13:29:40 +0000 (13:29 +0000)]
Set traversal explicitly where needed in tests

Reviewers: aaron.ballman, shafik

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72531

4 years agoSet traversal explicitly where needed in clang-tidy
Stephen Kelly [Tue, 12 Nov 2019 15:15:56 +0000 (15:15 +0000)]
Set traversal explicitly where needed in clang-tidy

Reviewers: aaron.ballman

Subscribers: nemanjai, kbarton, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72530

4 years ago[AMDGPU] Fixed incorrect PAL metadata register naming
Tim Renouf [Sat, 25 Apr 2020 11:14:58 +0000 (12:14 +0100)]
[AMDGPU] Fixed incorrect PAL metadata register naming

This only affects assembly and -filetype=asm codegen of PAL metadata.

Differential Revision: https://reviews.llvm.org/D78860

Change-Id: I7b822e1917bf7b403486820d31afc483be207652

4 years ago[MsgPack] Added convenience assignment to MsgPackDocument
Tim Renouf [Mon, 18 May 2020 13:13:57 +0000 (14:13 +0100)]
[MsgPack] Added convenience assignment to MsgPackDocument

This commit increases the convenience of using the MsgPackDocument API,
especially when creating a document for writing out.

It adds direct assignment of bool, integer and string types to a
DocNode, as long as that DocNode is already inside a document, e.g. the
result of a map lookup. It also adds map lookup given an integer type
(it already had that for string).

So, to assign a string to a map element whose key is an int, you can
now write
  MyMap[42] = "towel";
instead of
  MyMap[MyMap.getDocument()->getNode(42)] =
      MyMap.getDocument()->getNode("towel");

Also added MapDocNode::erase methods.

Differential Revision: https://reviews.llvm.org/D80121

Change-Id: I17301fa15bb9802231c52542798af5b54beb583e

4 years ago[CodeGen] Add support for multiple memory operands in MachineInstr::mayAlias
Jean-Michel Gorius [Thu, 21 May 2020 14:30:48 +0000 (16:30 +0200)]
[CodeGen] Add support for multiple memory operands in MachineInstr::mayAlias

Summary:
To support all targets, the mayAlias member function needs to support instructions with multiple operands.

This revision also changes the order of the emitted instructions in some test cases.

Reviewers: efriedma, hfinkel, craig.topper, dmgreen

Reviewed By: efriedma

Subscribers: MatzeB, dmgreen, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80161

4 years ago[AMDGPU] Promote alloca to vector in opt
Stanislav Mekhanoshin [Wed, 20 May 2020 23:24:06 +0000 (16:24 -0700)]
[AMDGPU] Promote alloca to vector in opt

Promote alloca to vector before SROA and loop unroll. If we manage
to eliminate allocas before unroll we may choose to unroll less.

Differential Revision: https://reviews.llvm.org/D80386

4 years ago[NFC] Make assertion more informative.
Sean Silva [Thu, 21 May 2020 20:10:38 +0000 (13:10 -0700)]
[NFC] Make assertion more informative.

This assert just caught me, and this improved message would have saved
me some time.

4 years ago[AArch64][SVE] Fill out missing unpredicated load/store patterns.
Eli Friedman [Thu, 21 May 2020 00:52:36 +0000 (17:52 -0700)]
[AArch64][SVE] Fill out missing unpredicated load/store patterns.

The set of patterns for unpredicated load/store was incomplete: it only
included non-extending stores.  Fill out the remaining patterns for
extending stores, and add the corresponding support to frame offset
lowering.

Differential Revision: https://reviews.llvm.org/D80349

4 years ago[MsgPack] MsgPackDocument::readFromBlob now merges
Tim Renouf [Thu, 21 May 2020 19:31:24 +0000 (20:31 +0100)]
[MsgPack] MsgPackDocument::readFromBlob now merges

The readFromBlob method can now be used to read MsgPack into a Document
that already contains something, merging the two. There is a new Merger
argument to readFromBlob, a callback function to resolve conflicts.

Differential Revision: https://reviews.llvm.org/D79671

Change-Id: Icf3e959217fe33cd907a41516c0386aef2847c0c

4 years ago[ModuloSchedule] Add missing comma.
Hendrik Greving [Thu, 21 May 2020 20:17:18 +0000 (13:17 -0700)]
[ModuloSchedule] Add missing comma.

This is a test commit as per Chris to verify commit access.

Thanks!

4 years ago[libTooling][NFC]Fix typo in comment in RangeSelectors
Yitzhak Mandelbaum [Thu, 21 May 2020 19:49:23 +0000 (15:49 -0400)]
[libTooling][NFC]Fix typo in comment in RangeSelectors
Fixes transposed names in comment.

4 years ago[SelectionDAG] Add the option of disabling generic combines.
Marcello Maggioni [Wed, 29 Apr 2020 01:25:58 +0000 (01:25 +0000)]
[SelectionDAG] Add the option of disabling generic combines.

Summary:
For some targets generic combines don't really do much and they
consume a disproportionate amount of time.
There's not really a mechanism in SDISel to tactically disable
combines, but we can have a switch to disable all of them and
let the targets just implement what they specifically need.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79112

4 years agoReland [libc++] [LWG3321] Mark "year_month_day_last::day() specification does not...
Marek Kurdej [Thu, 21 May 2020 19:48:51 +0000 (21:48 +0200)]
Reland [libc++] [LWG3321] Mark "year_month_day_last::day() specification does not cover !ok() values" issue as "Nothing to do", but add assertion.

Summary:
This LWG issue states that the result of `year_month_day_last::day()` is implementation defined if `ok()` is `false`.
However, from user perspective, calling `day()` in this situation will lead to a (possibly difficult to find) crash.
Hence, I have added an assertion to warn user at least when assertions are enabled.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D70346

4 years agoRevert "[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker"
Nico Weber [Thu, 21 May 2020 19:49:46 +0000 (15:49 -0400)]
Revert "[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker"

This reverts commit f7c7e8a523f56b0ed1b14c0756ba4e5d1ccb48d2.
Breaks build everywhere.

4 years ago[dsymutil] Add llvm_unreachable to silence warning
Jonas Devlieghere [Thu, 21 May 2020 19:27:39 +0000 (12:27 -0700)]
[dsymutil] Add llvm_unreachable to silence warning

Fixes warning: control reaches end of non-void function [-Wreturn-type]

4 years ago[mlir][spirv] Enable composite instructions for cooperative matrix type.
Thomas Raoux [Thu, 21 May 2020 18:59:31 +0000 (11:59 -0700)]
[mlir][spirv] Enable composite instructions for cooperative matrix type.

Enable inset/extract/construct composite ops as well as access chain for
cooperative matrix. ConstantComposite requires more change and will be done in
a separate patch. Also fix the getNumElements function for coopMatrix per
feedback from Jeff Bolz. The number of element is implementation dependent so
it cannot be known at compile time.

Differential Revision: https://reviews.llvm.org/D80321

4 years ago[AMDGPU] Added opt pipeline test. NFC.
Stanislav Mekhanoshin [Thu, 21 May 2020 18:58:35 +0000 (11:58 -0700)]
[AMDGPU] Added opt pipeline test. NFC.