platform/upstream/llvm.git
4 years ago[Mips] Remove immarg test for intrinsics that no longer have an immarg after r372409.
Craig Topper [Fri, 20 Sep 2019 18:52:49 +0000 (18:52 +0000)]
[Mips] Remove immarg test for intrinsics that no longer have an immarg after r372409.

llvm-svn: 372420

4 years agoFix a documentation error
Kristof Umann [Fri, 20 Sep 2019 18:28:04 +0000 (18:28 +0000)]
Fix a documentation error

llvm-svn: 372419

4 years agoFix -Wdocumentation warning. NFCI.
Simon Pilgrim [Fri, 20 Sep 2019 18:21:31 +0000 (18:21 +0000)]
Fix -Wdocumentation warning. NFCI.

llvm-svn: 372418

4 years ago[NFC][PowerPC] Refactor classifyGlobalReference
Jinsong Ji [Fri, 20 Sep 2019 18:21:07 +0000 (18:21 +0000)]
[NFC][PowerPC] Refactor classifyGlobalReference

We always(and only) check the NLP flag after calling
classifyGlobalReference to see whether it is accessed
indirectly.

Refactor to code to use isGVIndirectSym instead.

llvm-svn: 372417

4 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Fri, 20 Sep 2019 18:10:17 +0000 (18:10 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

llvm-svn: 372416

4 years ago[www] Turn 'Clang 9' boxes green in C++ status pages now Clang 9 is
Richard Smith [Fri, 20 Sep 2019 18:09:05 +0000 (18:09 +0000)]
[www] Turn 'Clang 9' boxes green in C++ status pages now Clang 9 is
released.

llvm-svn: 372415

4 years agoReland '[analyzer][MallocChecker][NFC] Document and reorganize some functions'
Kristof Umann [Fri, 20 Sep 2019 17:59:20 +0000 (17:59 +0000)]
Reland '[analyzer][MallocChecker][NFC] Document and reorganize some functions'

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

llvm-svn: 372414

4 years ago[NFC][InstCombine] Fixup newly-added tests
Roman Lebedev [Fri, 20 Sep 2019 17:43:46 +0000 (17:43 +0000)]
[NFC][InstCombine] Fixup newly-added tests

llvm-svn: 372413

4 years ago[MTE] Handle MTE instructions in AArch64LoadStoreOptimizer.
Evgeniy Stepanov [Fri, 20 Sep 2019 17:36:27 +0000 (17:36 +0000)]
[MTE] Handle MTE instructions in AArch64LoadStoreOptimizer.

Summary: Generate pre- and post-indexed forms of ST*G and STGP when possible.

Reviewers: ostannard, vitalybuka

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 372412

4 years agoDoxygenify comments.
Adrian Prantl [Fri, 20 Sep 2019 17:15:57 +0000 (17:15 +0000)]
Doxygenify comments.

llvm-svn: 372411

4 years ago[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.
Yitzhak Mandelbaum [Fri, 20 Sep 2019 17:11:03 +0000 (17:11 +0000)]
[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.

Summary:
Adds two new combinators and corresponding tests to the RangeSelector library.
* `ifBound` -- conditional evaluation of range-selectors, based on whether a
   given node id is bound in the match.
* `elseBranch` -- selects the source range of the else and its statement.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 372410

4 years ago[SelectionDAG][Mips][Sparc] Don't allow SimplifyDemandedBits to constant fold TargetC...
Craig Topper [Fri, 20 Sep 2019 16:49:51 +0000 (16:49 +0000)]
[SelectionDAG][Mips][Sparc] Don't allow SimplifyDemandedBits to constant fold TargetConstant nodes to a Constant.

Summary:
After the switch in SimplifyDemandedBits, it tries to create a
constant when possible. If the original node is a TargetConstant
the default in the switch will call computeKnownBits on the
TargetConstant which will succeed. This results in the
TargetConstant becoming a Constant. But TargetConstant exists to
avoid being changed.

I've fixed the two cases that relied on this in tree by explicitly
making the nodes constant instead of target constant. The Sparc
case is an old bug. The Mips case was recently introduced now that
ImmArg on intrinsics gets turned into a TargetConstant when the
SelectionDAG is created. I've removed the ImmArg since it lowers
to generic code.

Reviewers: arsenm, RKSimon, spatel

Subscribers: jyknight, sdardis, wdng, arichardson, hiraditya, fedor.sergeev, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

llvm-svn: 372409

4 years ago[aarch64] add def-pats for dot product
Sebastian Pop [Fri, 20 Sep 2019 16:33:33 +0000 (16:33 +0000)]
[aarch64] add def-pats for dot product

This patch adds the patterns to select the dot product instructions.
Tested on aarch64-linux with make check-all.

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

llvm-svn: 372408

4 years agoUnwind: prevent unw_get_proc_info from returning stale data
Saleem Abdulrasool [Fri, 20 Sep 2019 15:53:42 +0000 (15:53 +0000)]
Unwind: prevent unw_get_proc_info from returning stale data

If unwind info is not available at the current IP, unw_get_proc_info should
return a zero-filled structure rather than the info of the previous IP.

This change also makes unw_get_proc_info return UNW_ENOINFO instead of
UNW_ESUCCESS.

Patch by Amanieu d'Antras!

llvm-svn: 372407

4 years agoRemove assert from MachineLoop::getLoopPredecessor()
Stanislav Mekhanoshin [Fri, 20 Sep 2019 15:26:10 +0000 (15:26 +0000)]
Remove assert from MachineLoop::getLoopPredecessor()

According to the documentation method returns predecessor
if the given loop's header has exactly one unique predecessor
outside the loop. Otherwise return null.

In reality it asserts if there is no predecessor outside of
the loop.

The testcase has the loop where predecessors outside of the
loop were not identified as analyzeBranch() was unable to
process the mask branch and returned true. That is also not
correct to assert for the truly dead loops.

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

llvm-svn: 372405

4 years ago[MVT] Add v256i1 to MachineValueType
Krzysztof Parzyszek [Fri, 20 Sep 2019 15:19:20 +0000 (15:19 +0000)]
[MVT] Add v256i1 to MachineValueType

This type can show up when lowering some HVX vector code on Hexagon.

llvm-svn: 372403

4 years ago[InstCombine] Tests for (a+b)<=a && (a+b)!=0 fold (PR43259)
Roman Lebedev [Fri, 20 Sep 2019 15:06:47 +0000 (15:06 +0000)]
[InstCombine] Tests for (a+b)<=a && (a+b)!=0 fold (PR43259)

https://rise4fun.com/Alive/knp
https://rise4fun.com/Alive/ALap

llvm-svn: 372402

4 years ago[ARM] Fix CTTZ not generating correct instructions MVE
Oliver Cruickshank [Fri, 20 Sep 2019 15:03:44 +0000 (15:03 +0000)]
[ARM] Fix CTTZ not generating correct instructions MVE

CTTZ intrinsic should have been set to Custom, not Expand

llvm-svn: 372401

4 years ago[ELF] Error if the linked-to section of a SHF_LINK_ORDER section is discarded
Fangrui Song [Fri, 20 Sep 2019 15:03:21 +0000 (15:03 +0000)]
[ELF] Error if the linked-to section of a SHF_LINK_ORDER section is discarded

Summary:
If st_link(A)=B, and A has the SHF_LINK_ORDER flag, we may dereference
a null pointer if B is garbage collected (PR43147):

1. In Wrter.cpp:compareByFilePosition, `aOut->sectionIndex` or `bOut->sectionIndex`
2. In OutputSections::finalize, `d->getParent()->sectionIndex`

Simply error and bail out to avoid null pointer dereferences. ld.bfd has
a similar error:

    sh_link of section `.bar' points to discarded section `.foo0' of `a.o'

ld.bfd is more permissive in that it just checks whether the linked-to
section of the first input section is discarded. This is likely because
it sets sh_link of the output section according to the first input
section.

Reviewed By: grimar

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

llvm-svn: 372400

4 years ago[docs] Remove training whitespaces. NFC
Francesco Petrogalli [Fri, 20 Sep 2019 15:02:32 +0000 (15:02 +0000)]
[docs] Remove training whitespaces. NFC

Subscribers: jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 372399

4 years agoAdd a missing space in a MIR parser error message
David Stenberg [Fri, 20 Sep 2019 14:41:41 +0000 (14:41 +0000)]
Add a missing space in a MIR parser error message

llvm-svn: 372398

4 years agogn build: Merge r372396
GN Sync Bot [Fri, 20 Sep 2019 14:39:52 +0000 (14:39 +0000)]
gn build: Merge r372396

llvm-svn: 372397

4 years ago[TextAPI] Arch&Platform to Target
Cyndy Ishida [Fri, 20 Sep 2019 14:32:34 +0000 (14:32 +0000)]
[TextAPI] Arch&Platform to Target

Summary:
This is a patch for updating TextAPI/Macho to read in targets as opposed to arch/platform.
This is because in previous versions tbd files only supported a single platform but that is no longer the case,
so, now its tracked by unique triples.
This precedes a seperate patch that will add  the TBD-v4 format

Reviewers: ributzka, steven_wu, plotfi, compnerd, smeenai

Reviewed By: ributzka

Subscribers: mgorny, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 372396

4 years agoUse llvm::StringLiteral instead of StringRef in few places
Fangrui Song [Fri, 20 Sep 2019 14:31:42 +0000 (14:31 +0000)]
Use llvm::StringLiteral instead of StringRef in few places

llvm-svn: 372395

4 years ago[CUDA][HIP] Fix hostness of defaulted constructor
Yaxun Liu [Fri, 20 Sep 2019 14:28:09 +0000 (14:28 +0000)]
[CUDA][HIP] Fix hostness of defaulted constructor
Clang does not respect the explicit device host attributes of defaulted special members.
Also clang does not respect the hostness of special members determined by their
first declarations.
Clang also adds duplicate implicit device or host attributes in certain cases.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D67509

llvm-svn: 372394

4 years ago[SLPVectorizer] add tests for bogus reductions; NFC
Sanjay Patel [Fri, 20 Sep 2019 14:17:00 +0000 (14:17 +0000)]
[SLPVectorizer] add tests for bogus reductions; NFC

https://bugs.llvm.org/show_bug.cgi?id=42708
https://bugs.llvm.org/show_bug.cgi?id=43146

llvm-svn: 372393

4 years ago[Testing] Python 3 requires `print` to use parens
David Zarzycki [Fri, 20 Sep 2019 13:52:47 +0000 (13:52 +0000)]
[Testing] Python 3 requires `print` to use parens

llvm-svn: 372392

4 years ago[RISCV] Fix static analysis issues
Luis Marques [Fri, 20 Sep 2019 13:48:02 +0000 (13:48 +0000)]
[RISCV] Fix static analysis issues

Unlikely to be problematic but still worth fixing.

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

llvm-svn: 372391

4 years ago[Alignment][NFC] migrate DataLayout internal struct to llvm::Align
Guillaume Chatelet [Fri, 20 Sep 2019 13:40:31 +0000 (13:40 +0000)]
[Alignment][NFC] migrate DataLayout internal struct to llvm::Align

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

With this patch the PointerAlignElem struct goes from 20B to 16B.

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 372390

4 years ago[FastISel] Fix insertion of unconditional branches during FastISel
David Tellenbach [Fri, 20 Sep 2019 13:22:59 +0000 (13:22 +0000)]
[FastISel] Fix insertion of unconditional branches during FastISel

The insertion of an unconditional branch during FastISel can differ depending on
building with or without debug information. This happens because FastISel::fastEmitBranch
emits an unconditional branch depending on the size of the current basic block
without distinguishing between debug and non-debug instructions.

This patch fixes this issue by ignoring debug instructions when getting the size
of the basic block.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: ormris, aprantl, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 372389

4 years ago[clang-tidy] Fix relative path in header-filter.
Dmitri Gribenko [Fri, 20 Sep 2019 13:19:32 +0000 (13:19 +0000)]
[clang-tidy] Fix relative path in header-filter.

Summary:
Clang-tidy supports output diagnostics from header files if user
specifies --header-filter. But it can't handle relative path well.
For example, the folder structure of a project is:

```
// a.h is in /src/a/a.h

// b.h is in /src/b/b.h
...

// c.cpp is in /src/c.cpp

```

Now, we set --header-filter as --header-filter=/a/. That means we only
want to check header files under /src/a/ path, and ignore header files
uder /src/b/ path, but in current implementation, clang-tidy will check
/src/b/b.h also, because the name of b.h used in clang-tidy is
/src/a/../b/b.h.

This change tries to fix this issue.

Reviewers: alexfh, hokein, aaron.ballman, gribozavr

Reviewed By: gribozavr

Subscribers: MyDeveloperDay, xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

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

Patch by Yubo Xie.

llvm-svn: 372388

4 years ago[SystemZ] Add SystemZ as supporting target in help text for -mfentry.
Jonas Paulsson [Fri, 20 Sep 2019 13:13:50 +0000 (13:13 +0000)]
[SystemZ]  Add SystemZ as supporting target in help text for -mfentry.

=> "Insert calls to fentry at function entry (x86/SystemZ only)"

Review: Ulrich Weigand
llvm-svn: 372387

4 years ago[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places
Benjamin Kramer [Fri, 20 Sep 2019 12:59:29 +0000 (12:59 +0000)]
[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places

StringRef's constexpr constructor seems to be extremely slow in MSVC
2017, so don't use it for generated tables. Should make PR43369 a bit
better, no functionality change.

llvm-svn: 372386

4 years agoMove decl completion out of the ASTImporterDelegate and document it [NFC]
Raphael Isemann [Fri, 20 Sep 2019 12:52:55 +0000 (12:52 +0000)]
Move decl completion out of the ASTImporterDelegate and document it [NFC]

Summary:
The ASTImporterDelegate is currently responsible for both recording and also completing
types. This patch moves the actual completion and recording code outside the ASTImporterDelegate
to reduce the amount of responsibilities the ASTImporterDelegate has to fulfill.

As I anyway had to touch the code when moving I also documented and refactored most of it
(e.g. no more asserts that we call the deporting start/end function always as a pair).

Note that I had to make the ASTImporterDelegate and it's related functions public now so that
I can move out the functionality in another class (that doesn't need to be in the header).

Reviewers: shafik, aprantl, martong, a.sidorin

Reviewed By: martong

Subscribers: rnkovacs, lldb-commits

Tags: #lldb

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

llvm-svn: 372385

4 years ago[AMDGPU] Use std::make_tuple to make some toolchains happy again
Bjorn Pettersson [Fri, 20 Sep 2019 12:13:12 +0000 (12:13 +0000)]
[AMDGPU] Use std::make_tuple to make some toolchains happy again

My toolchain stopped working (LLVM 8.0 , libstdc++ 5.4.0) after
r372338.

The same problem was seen in clang-cuda-build buildbots:

clang-cuda-build/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp:763:12:
error: chosen constructor is explicit in copy-initialization
    return {Reg, 0, nullptr};
           ^~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/tuple:479:19:
note: explicit constructor declared here
        constexpr tuple(_UElements&&... __elements)
                  ^

This commit adds explicit calls to std::make_tuple to work around
the problem.

llvm-svn: 372384

4 years agoRevert r372366 "Use getTargetConstant for BLENDI, and add a test to catch it."
Nico Weber [Fri, 20 Sep 2019 12:05:29 +0000 (12:05 +0000)]
Revert r372366 "Use getTargetConstant for BLENDI, and add a test to catch it."

This reverts commit 52621307bcab2013e8833f3317cebd63a6db3885.

Tests have been failing all night with

    [0/2] ACTION //llvm/test:check-llvm(//llvm/utils/gn/build/toolchain:unix)
    -- Testing: 33647 tests, 64 threads --
    Testing: 0 .. 10..
    UNRESOLVED: LLVM :: CodeGen/AMDGPU/GlobalISel/isel-blendi-gettargetconstant.ll (6943 of 33647)
    ******************** TEST 'LLVM :: CodeGen/AMDGPU/GlobalISel/isel-blendi-gettargetconstant.ll' FAILED ********************
    Test has no run line!
    ********************

Since there were other concerns on https://reviews.llvm.org/D67785,
I'm just reverting for now.

llvm-svn: 372383

4 years ago[lldb][NFC] Remove unused include in TestLineEntry.cpp
Raphael Isemann [Fri, 20 Sep 2019 10:30:38 +0000 (10:30 +0000)]
[lldb][NFC] Remove unused include in TestLineEntry.cpp

llvm-svn: 372381

4 years ago[IntrinsicEmitter] Add overloaded types for SVE intrinsics (Subdivide2 & Subdivide4)
Kerry McLaughlin [Fri, 20 Sep 2019 09:48:21 +0000 (09:48 +0000)]
[IntrinsicEmitter] Add overloaded types for SVE intrinsics (Subdivide2 & Subdivide4)

Summary:
Both match the type of another intrinsic parameter of a vector type, but where each element is subdivided to form a vector with more elements of a smaller type.

Subdivide2Argument allows intrinsics such as the following to be defined:
 - declare <vscale x 4 x i32> @llvm.something.nxv4i32(<vscale x 8 x i16>)

Subdivide4Argument allows intrinsics such as:
 - declare <vscale x 4 x i32> @llvm.something.nxv4i32(<vscale x 16 x i8>)

Tests are included in follow up patches which add intrinsics using these types.

Reviewers: sdesmalen, SjoerdMeijer, greened, rovka

Reviewed By: sdesmalen

Subscribers: rovka, tschuett, jdoerfert, cfe-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 372380

4 years ago[NFC] Test commit, deleting some whitespace
David Tellenbach [Fri, 20 Sep 2019 09:43:31 +0000 (09:43 +0000)]
[NFC] Test commit, deleting some whitespace

llvm-svn: 372379

4 years ago[llvm-dwarfdump] Adjust Windows path to be acceptable by JSON
Djordje Todorovic [Fri, 20 Sep 2019 09:25:11 +0000 (09:25 +0000)]
[llvm-dwarfdump] Adjust Windows path to be acceptable by JSON

Backslash is a special character according to JSON specification,
so we should avoid that when printing a file path with the
--statistics option.

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

llvm-svn: 372378

4 years ago[yaml2obj/obj2yaml] - Do not trigger llvm_unreachable when dumping/parsing relocation...
George Rimar [Fri, 20 Sep 2019 09:15:36 +0000 (09:15 +0000)]
[yaml2obj/obj2yaml] - Do not trigger llvm_unreachable when dumping/parsing relocations and e_machine is unsupported.

Currently when e_machine is set to something that is not supported by YAML lib,
then tools fail with llvm_unreachable.

In this patch I allow them to handle relocations in this case.
It can be used to dump and create objects for broken or unsupported targets.

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

llvm-svn: 372377

4 years ago[MachinePipeliner] Improve the TargetInstrInfo API analyzeLoop/reduceLoopCount
James Molloy [Fri, 20 Sep 2019 08:57:46 +0000 (08:57 +0000)]
[MachinePipeliner] Improve the TargetInstrInfo API analyzeLoop/reduceLoopCount

The way MachinePipeliner uses these target hooks is stateful - we reduce trip
count by one per call to reduceLoopCount. It's a little overfit for hardware
loops, where we don't have to worry about stitching a loop induction variable
across prologs and epilogs (the induction variable is implicit).

This patch introduces a new API:

  /// Analyze loop L, which must be a single-basic-block loop, and if the
  /// conditions can be understood enough produce a PipelinerLoopInfo object.
  virtual std::unique_ptr<PipelinerLoopInfo>
  analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const;

The return value is expected to be an implementation of the abstract class:

  /// Object returned by analyzeLoopForPipelining. Allows software pipelining
  /// implementations to query attributes of the loop being pipelined.
  class PipelinerLoopInfo {
  public:
    virtual ~PipelinerLoopInfo();
    /// Return true if the given instruction should not be pipelined and should
    /// be ignored. An example could be a loop comparison, or induction variable
    /// update with no users being pipelined.
    virtual bool shouldIgnoreForPipelining(const MachineInstr *MI) const = 0;

    /// Create a condition to determine if the trip count of the loop is greater
    /// than TC.
    ///
    /// If the trip count is statically known to be greater than TC, return
    /// true. If the trip count is statically known to be not greater than TC,
    /// return false. Otherwise return nullopt and fill out Cond with the test
    /// condition.
    virtual Optional<bool>
    createTripCountGreaterCondition(int TC, MachineBasicBlock &MBB,
                                 SmallVectorImpl<MachineOperand> &Cond) = 0;

    /// Modify the loop such that the trip count is
    /// OriginalTC + TripCountAdjust.
    virtual void adjustTripCount(int TripCountAdjust) = 0;

    /// Called when the loop's preheader has been modified to NewPreheader.
    virtual void setPreheader(MachineBasicBlock *NewPreheader) = 0;

    /// Called when the loop is being removed.
    virtual void disposed() = 0;
  };

The Pipeliner (ModuloSchedule.cpp) can use this object to modify the loop while
allowing the target to hold its own state across all calls. This API, in
particular the disjunction of creating a trip count check condition and
adjusting the loop, improves the code quality in ModuloSchedule.cpp.

llvm-svn: 372376

4 years ago[CallSiteSplitting] Remove unused includes (NFC).
Florian Hahn [Fri, 20 Sep 2019 08:33:11 +0000 (08:33 +0000)]
[CallSiteSplitting] Remove unused includes (NFC).

llvm-svn: 372375

4 years agoReapply [llvm-ar] Include a line number when failing to parse an MRI script
Owen Reynolds [Fri, 20 Sep 2019 08:10:14 +0000 (08:10 +0000)]
Reapply [llvm-ar] Include a line number when failing to parse an MRI script

Reapply r372309

Errors that occur when reading an MRI script now include a corresponding
line number.

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

llvm-svn: 372374

4 years ago[X86] Convert tbm_bextri_u32/tbm_bextri_u64 intrinsics TargetConstant argument to...
Craig Topper [Fri, 20 Sep 2019 07:00:22 +0000 (07:00 +0000)]
[X86] Convert tbm_bextri_u32/tbm_bextri_u64 intrinsics TargetConstant argument to a regular Constant during lowering.

We reuse an ISD opcode here that can be reached from BMI that
doesn't require it to be an immediate. Our isel patterns to match
the TBM immediate form require a Constant and not a TargetConstant.

We were accidentally getting the Constant due to a quirk of
combineBEXTR calling SimplifyDemandedBits. The call to
SimplifyDemandedBits ended up constant folding the TargetConstant
to a regular Constant. But we should probably instead be asserting
if SimplifyDemandedBits on a TargetConstant so we shouldn't rely
on this behavior.

llvm-svn: 372373

4 years ago[llvm-readobj] flush output before crash
Yuanfang Chen [Fri, 20 Sep 2019 06:33:03 +0000 (06:33 +0000)]
[llvm-readobj] flush output before crash

Otherwise the output could be lost.

llvm-svn: 372372

4 years ago[X86] Use timm in MMX pinsrw/pextrw isel patterns. Add missing test cases.
Craig Topper [Fri, 20 Sep 2019 06:00:35 +0000 (06:00 +0000)]
[X86] Use timm in MMX pinsrw/pextrw isel patterns. Add missing test cases.

This fixes an isel failure after r372338.

llvm-svn: 372371

4 years ago[llvm-ar] Removes repetition in the error message
Fangrui Song [Fri, 20 Sep 2019 04:40:44 +0000 (04:40 +0000)]
[llvm-ar] Removes repetition in the error message

As per bug 40244, fixed an error where the error message was repeated.

Differential Revision: https://reviews.llvm.org/D67038
Patch by Yu Jian (wyjw)

llvm-svn: 372370

4 years ago[Object] Uncapitalize an error message
Fangrui Song [Fri, 20 Sep 2019 04:40:38 +0000 (04:40 +0000)]
[Object] Uncapitalize an error message

Test case will be added by my next commit.

llvm-svn: 372369

4 years agoFinish building the full-expression for a static_assert expression
Richard Smith [Fri, 20 Sep 2019 03:29:19 +0000 (03:29 +0000)]
Finish building the full-expression for a static_assert expression
before evaluating it rather than afterwards.

This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.

No significant functionality change intended (though this fixes a bug
only visible through libclang / -ast-dump / tooling: we now store the
converted condition on the StaticAssertDecl rather than the original).

llvm-svn: 372368

4 years agollvm-undname: Delete an empty, unused method.
Nico Weber [Fri, 20 Sep 2019 03:13:16 +0000 (03:13 +0000)]
llvm-undname: Delete an empty, unused method.

llvm-svn: 372367

4 years agoUse getTargetConstant for BLENDI, and add a test to catch it.
Sterling Augustine [Fri, 20 Sep 2019 02:29:16 +0000 (02:29 +0000)]
Use getTargetConstant for BLENDI, and add a test to catch it.

Summary: This fixes a crasher introduced by r372338.

Reviewers: echristo, arsenm

Subscribers: jvesely, wdng, nhaehnle, hiraditya, llvm-commits

Tags: #llvm

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

Tighten up the test case.

llvm-svn: 372366

4 years ago[X86] Remove the special isBuildVectorOfConstantSDNodes handling from LowerBUILD_VECT...
Craig Topper [Fri, 20 Sep 2019 01:49:46 +0000 (01:49 +0000)]
[X86] Remove the special isBuildVectorOfConstantSDNodes handling from LowerBUILD_VECTORvXi1.

The later code that generates a constant when there are
some non-const elements works basically the same and doesn't
require there to be any non-const elements.

llvm-svn: 372365

4 years agoRevert "Fix swig python package path"
Haibo Huang [Fri, 20 Sep 2019 00:45:26 +0000 (00:45 +0000)]
Revert "Fix swig python package path"

Summary: This reverts commit 5a115e81cdd40c758b10c382aeffc0c8de6930e2.

Reviewers: JDevlieghere, ZeGentzy

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 372364

4 years ago[NFCI] Always initialize const members of AttributeCommonInfo
Alex Langford [Fri, 20 Sep 2019 00:16:32 +0000 (00:16 +0000)]
[NFCI] Always initialize const members of AttributeCommonInfo

Some compilers require that const fields of an object must be explicitly
initialized by the constructor. I ran into this issue building with
clang 3.8 on Ubuntu 16.04.

llvm-svn: 372363

4 years agoMachineScheduler: Fix missing dependency with multiple subreg defs
Matt Arsenault [Fri, 20 Sep 2019 00:09:15 +0000 (00:09 +0000)]
MachineScheduler: Fix missing dependency with multiple subreg defs

If an instruction had multiple subregister defs, and one of them was
undef, this would improperly conclude all other lanes are
killed. There could still be other defs of those read-undef lanes in
other operands. This would improperly remove register uses from
CurrentVRegUses, so the visitation of later operands would not find
the necessary register dependency. This would also mean this would
fail or not depending on how different subregister def operands were
ordered.

On an undef subregister def, scan the instruction for other
subregister defs and avoid killing those.

This possibly should be deferring removing anything from
CurrentVRegUses until the entire instruction has been processed
instead.

llvm-svn: 372362

4 years ago[Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.
Nicholas Allegra [Thu, 19 Sep 2019 23:00:31 +0000 (23:00 +0000)]
[Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.

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

llvm-svn: 372361

4 years agoFix for stringized function-macro args continued across lines
Alex Lorenz [Thu, 19 Sep 2019 22:39:24 +0000 (22:39 +0000)]
Fix for stringized function-macro args continued across lines

In case of certain #define'd macros, there's a space just before line continuation
that the minimized-source lexer was missing to include, resulting in invalid stringize.

Patch by: kousikk (Kousik Kumar)

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

llvm-svn: 372360

4 years agoModel converted constant expressions as full-expressions.
Richard Smith [Thu, 19 Sep 2019 22:00:16 +0000 (22:00 +0000)]
Model converted constant expressions as full-expressions.

This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.

No functionality change intended.

llvm-svn: 372359

4 years ago[WebAssembly][NFC] Remove unnecessary braces
Thomas Lively [Thu, 19 Sep 2019 21:51:52 +0000 (21:51 +0000)]
[WebAssembly][NFC] Remove unnecessary braces

llvm-svn: 372358

4 years ago[AArch64] Fix formatting (NFC)
Evandro Menezes [Thu, 19 Sep 2019 21:48:22 +0000 (21:48 +0000)]
[AArch64] Fix formatting (NFC)

llvm-svn: 372357

4 years ago[CUDA][HIP] Re-apply part of r372318.
Michael Liao [Thu, 19 Sep 2019 21:26:18 +0000 (21:26 +0000)]
[CUDA][HIP] Re-apply part of r372318.

- r372318 causes violation of `use-of-uninitialized-value` detected by
  MemorySanitizer. Once `Viable` field is set to false, `FailureKind`
  needs setting as well as it will be checked during destruction if
  `Viable` is not true.
- Revert the part trying to skip `std::vector` erasing.

llvm-svn: 372356

4 years agoRevert "[CUDA][HIP] Fix typo in `BestViableFunction`"
Mitch Phillips [Thu, 19 Sep 2019 21:11:28 +0000 (21:11 +0000)]
Revert "[CUDA][HIP] Fix typo in `BestViableFunction`"

Broke the msan buildbots (see comments on rL372318 for more details).

This reverts commit eb231d15825ac345b546f4c99372d1cac8f14f02.

llvm-svn: 372353

4 years ago[ObjC][ARC] Skip debug instructions when computing the insert point of
Akira Hatanaka [Thu, 19 Sep 2019 20:58:51 +0000 (20:58 +0000)]
[ObjC][ARC] Skip debug instructions when computing the insert point of
objc_release calls

This fixes a bug where the presence of debug instructions would cause
ARC optimizer to change the order of retain and release calls.

rdar://problem/55319419

llvm-svn: 372352

4 years agoDon't false-positive match against binary path.
Mitch Phillips [Thu, 19 Sep 2019 20:44:12 +0000 (20:44 +0000)]
Don't false-positive match against binary path.

copy-rel-abs.s uses llvm-objdump to generate output that's then run
through FileCheck. llvm-objdump prints the file path at the top of the
file, which means that any build path that contains 'zed' will get
false-matched. Ensure that 'zed' is only matched after the 'SYMBOL
TABLE:' output, preventing this from failing if your build directory is
~/build/sanitized-xxx/, or similar.

llvm-svn: 372351

4 years ago[AMDGPU] fixed underflow in getOccupancyWithNumVGPRs
Stanislav Mekhanoshin [Thu, 19 Sep 2019 20:09:04 +0000 (20:09 +0000)]
[AMDGPU] fixed underflow in getOccupancyWithNumVGPRs

The function could return zero if an extreme number or
registers were used. Minimal possible occupancy is 1.

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

llvm-svn: 372350

4 years agollvm-reduce: Follow-up to 372280, now with more-better msan fixing
David Blaikie [Thu, 19 Sep 2019 20:04:04 +0000 (20:04 +0000)]
llvm-reduce: Follow-up to 372280, now with more-better msan fixing

llvm-svn: 372349

4 years ago[lsan] Fix deadlock in dl_iterate_phdr.
Evgeniy Stepanov [Thu, 19 Sep 2019 19:52:57 +0000 (19:52 +0000)]
[lsan] Fix deadlock in dl_iterate_phdr.

Summary:
Do not grab the allocator lock before calling dl_iterate_phdr. This may
cause a lock order inversion with (valid) user code that uses malloc
inside a dl_iterate_phdr callback.

Reviewers: vitalybuka, hctim

Subscribers: jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 372348

4 years agoDon't use invalidated iterators in FlattenCFGPass
Jakub Kuderski [Thu, 19 Sep 2019 19:39:42 +0000 (19:39 +0000)]
Don't use invalidated iterators in FlattenCFGPass

Summary:
FlattenCFG may erase unnecessary blocks, which also invalidates iterators to those erased blocks.
Before this patch, `iterativelyFlattenCFG` could try to increment a BB iterator after that BB has been removed and crash.

This patch makes FlattenCFGPass use `WeakVH` to skip over erased blocks.

Reviewers: dblaikie, tstellar, davide, sanjoy, asbirlea, grosser

Reviewed By: asbirlea

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 372347

4 years ago[Analysis] Allow -scalar-evolution-max-iterations more than once
Shoaib Meenai [Thu, 19 Sep 2019 18:21:32 +0000 (18:21 +0000)]
[Analysis] Allow -scalar-evolution-max-iterations more than once

At present, `-scalar-evolution-max-iterations` is a `cl::Optional`
option, which means it demands to be passed exactly zero or one times.
Our build system makes it pretty tricky to guarantee this. We often
accidentally pass the flag more than once (but always with the same
value) which results in an error, after which compilation fails:

```
clang (LLVM option parsing): for the -scalar-evolution-max-iterations option: may only occur zero or one times!
```

It seems reasonable to allow -scalar-evolution-max-iterations to be
passed more than once. Quoting the [[ http://llvm.org/docs/CommandLine.html#controlling-the-number-of-occurrences-required-and-allowed | documentation ]]:

> The cl::ZeroOrMore modifier ... indicates that your program will allow the option to be specified zero or more times.
> ...
> If an option is specified multiple times for an option of the cl::opt class, only the last value will be retained.

Original patch by: Enrico Bern Hardy Tanuwidjaja <etanuwid@fb.com>

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

llvm-svn: 372346

4 years ago[NFC][PowerPC] Fast-isel VSX support test
Jinsong Ji [Thu, 19 Sep 2019 18:18:18 +0000 (18:18 +0000)]
[NFC][PowerPC] Fast-isel VSX support test

We have fixed most of the VSX limitation in Fast-isel,
so we can remove the -mattr=-vsx for most testcases now.

llvm-svn: 372345

4 years agogn build: Merge r372343
GN Sync Bot [Thu, 19 Sep 2019 17:53:03 +0000 (17:53 +0000)]
gn build: Merge r372343

llvm-svn: 372344

4 years ago[SVFS] Vector Function ABI demangling.
Francesco Petrogalli [Thu, 19 Sep 2019 17:47:32 +0000 (17:47 +0000)]
[SVFS] Vector Function ABI demangling.

This patch implements the demangling functionality as described in the
Vector Function ABI. This patch will be used to implement the
SearchVectorFunctionSystem (SVFS) as described in the RFC:

http://lists.llvm.org/pipermail/llvm-dev/2019-June/133484.html

A fuzzer is added to test the demangling utility.

Patch by Sumedh Arani <sumedh.arani@arm.com>

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

llvm-svn: 372343

4 years ago[InstCombine] Simplify @llvm.usub.with.overflow+non-zero check (PR43251)
Roman Lebedev [Thu, 19 Sep 2019 17:25:19 +0000 (17:25 +0000)]
[InstCombine] Simplify @llvm.usub.with.overflow+non-zero check (PR43251)

Summary:
This is again motivated by D67122 sanitizer check enhancement.
That patch seemingly worsens `-fsanitize=pointer-overflow`
overhead from 25% to 50%, which strongly implies missing folds.

In this particular case, given
```
char* test(char& base, unsigned long offset) {
  return &base - offset;
}
```
it will end up producing something like
https://godbolt.org/z/luGEju
which after optimizations reduces down to roughly
```
declare void @use64(i64)
define i1 @test(i8* dereferenceable(1) %base, i64 %offset) {
  %base_int = ptrtoint i8* %base to i64
  %adjusted = sub i64 %base_int, %offset
  call void @use64(i64 %adjusted)
  %not_null = icmp ne i64 %adjusted, 0
  %no_underflow = icmp ule i64 %adjusted, %base_int
  %no_underflow_and_not_null = and i1 %not_null, %no_underflow
  ret i1 %no_underflow_and_not_null
}
```
Without D67122 there was no `%not_null`,
and in this particular case we can "get rid of it", by merging two checks:
Here we are checking: `Base u>= Offset && (Base u- Offset) != 0`, but that is simply `Base u> Offset`

Alive proofs:
https://rise4fun.com/Alive/QOs

The `@llvm.usub.with.overflow` pattern itself is not handled here
because this is the main pattern, that we currently consider canonical.

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

Reviewers: spatel, nikic, xbolva00, majnemer

Reviewed By: xbolva00, majnemer

Subscribers: vsk, majnemer, xbolva00, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 372341

4 years ago[AMDGPU] Unnecessary -amdgpu-scalarize-global-loads=false flag removed from min/max...
Alexander Timofeev [Thu, 19 Sep 2019 16:44:38 +0000 (16:44 +0000)]
[AMDGPU] Unnecessary -amdgpu-scalarize-global-loads=false flag removed from min/max lit tests.

Reviewers: arsenm

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

llvm-svn: 372340

4 years ago[Float2Int] avoid crashing on unreachable code (PR38502)
Sanjay Patel [Thu, 19 Sep 2019 16:31:17 +0000 (16:31 +0000)]
[Float2Int] avoid crashing on unreachable code (PR38502)

In the example from:
https://bugs.llvm.org/show_bug.cgi?id=38502
...we hit infinite looping/crashing because we have non-standard IR -
an instruction operand is used before defined.
This and other unusual constructs are allowed in unreachable blocks,
so avoid the problem by using DominatorTree to step around landmines.

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

llvm-svn: 372339

4 years agoReapply r372285 "GlobalISel: Don't materialize immarg arguments to intrinsics"
Matt Arsenault [Thu, 19 Sep 2019 16:26:14 +0000 (16:26 +0000)]
Reapply r372285 "GlobalISel: Don't materialize immarg arguments to intrinsics"

This reverts r372314, reapplying r372285 and the commits which depend
on it (r372286-r372293, and r372296-r372297)

This was missing one switch to getTargetConstant in an untested case.

llvm-svn: 372338

4 years ago[MCA] Improved cost computation for loop carried dependencies in the bottleneck analysis.
Andrea Di Biagio [Thu, 19 Sep 2019 16:05:11 +0000 (16:05 +0000)]
[MCA] Improved cost computation for loop carried dependencies in the bottleneck analysis.

This patch introduces a cut-off threshold for dependency edge frequences with
the goal of simplifying the critical sequence computation.  This patch also
removes the cost normalization for loop carried dependencies.  We didn't really
need to artificially amplify the cost of loop-carried dependencies since it is
already computed as the integral over time of the delay (in cycle).

In the absence of backend stalls there is no need for computing a critical
sequence. With this patch we early exit from the critical sequence computation
if no bottleneck was reported during the simulation.

llvm-svn: 372337

4 years agoMake appendCallNB lambda mutable
Chris Bieneman [Thu, 19 Sep 2019 15:45:12 +0000 (15:45 +0000)]
Make appendCallNB lambda mutable

Lambdas are by deafult const so that they produce the same output every time they are run. This lambda needs to set the value on a captured promise which is a mutating operation, so it must be mutable.

llvm-svn: 372336

4 years agoX86: Add missing test for vshli SimplifyDemandedBitsForTargetNode
Matt Arsenault [Thu, 19 Sep 2019 15:44:00 +0000 (15:44 +0000)]
X86: Add missing test for vshli SimplifyDemandedBitsForTargetNode

This would have caught this regression which triggered the revert of
r372285: https://bugs.chromium.org/p/chromium/issues/detail?id=1005750

llvm-svn: 372335

4 years agoRevert r372325 - Reverting r372323 because it broke color tests on Linux.
Aaron Ballman [Thu, 19 Sep 2019 15:10:51 +0000 (15:10 +0000)]
Revert r372325 - Reverting r372323 because it broke color tests on Linux.

This corrects the testing issues.

llvm-svn: 372334

4 years ago[DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a target hook (PR42863)
Simon Pilgrim [Thu, 19 Sep 2019 15:02:47 +0000 (15:02 +0000)]
[DAG][X86] Convert isNegatibleForFree/GetNegatedExpression to a target hook (PR42863)

This patch converts the DAGCombine isNegatibleForFree/GetNegatedExpression into overridable TLI hooks and includes a demonstration X86 implementation.

The intention is to let us extend existing FNEG combines to work more generally with negatible float ops, allowing it work with target specific combines and opcodes (e.g. X86's FMA variants).

Unlike the SimplifyDemandedBits, we can't just handle target nodes through a Target callback, we need to do this as an override to allow targets to handle generic opcodes as well. This does mean that the target implementations has to duplicate some checks (recursion depth etc.).

I've only begun to replace X86's FNEG handling here, handling FMADDSUB/FMSUBADD negation and some low impact codegen changes (some FMA negatation propagation). We can build on this in future patches.

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

llvm-svn: 372333

4 years ago[DAGCombiner] Add node to the worklist in topological order in scalarizeExtractedVect...
Amaury Sechet [Thu, 19 Sep 2019 14:22:11 +0000 (14:22 +0000)]
[DAGCombiner] Add node to the worklist in topological order in scalarizeExtractedVectorLoad

Summary: As per title.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 372327

4 years ago[docs] Break long (>80) line. NFC
Francesco Petrogalli [Thu, 19 Sep 2019 14:19:32 +0000 (14:19 +0000)]
[docs] Break long (>80) line. NFC

llvm-svn: 372326

4 years agoReverting r372323 because it broke color tests on Linux.
Aaron Ballman [Thu, 19 Sep 2019 13:59:53 +0000 (13:59 +0000)]
Reverting r372323 because it broke color tests on Linux.

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/17919

llvm-svn: 372325

4 years ago[Float2Int] auto-generate complete test checks; NFC
Sanjay Patel [Thu, 19 Sep 2019 13:58:15 +0000 (13:58 +0000)]
[Float2Int] auto-generate complete test checks; NFC

llvm-svn: 372324

4 years agoRemove an unsafe member variable that wasn't needed; NFC.
Aaron Ballman [Thu, 19 Sep 2019 13:51:50 +0000 (13:51 +0000)]
Remove an unsafe member variable that wasn't needed; NFC.

People use the AST dumping interface while debugging, so it's not safe to assume that a declaration will be dumped before a constant expression is dumped. This means the Context member may not get set properly and problems would happen. Rather than rely on the interface that requires the ASTContext, call the generic dump() interface instead; this allows us to remove the Context member variable.

llvm-svn: 372323

4 years ago[OpenCL] Add version handling and add vector ld/st builtins
Sven van Haastregt [Thu, 19 Sep 2019 13:41:51 +0000 (13:41 +0000)]
[OpenCL] Add version handling and add vector ld/st builtins

Allow setting a MinVersion, stating from which OpenCL version a
builtin function is available, and a MaxVersion, stating from which
OpenCL version a builtin function should not be available anymore.

Guard some definitions of the "work-item" builtin functions according
to the OpenCL versions from which they are available.

Add the "vector data load and store" builtin functions (e.g.
vload/vstore), whose signatures differ before and after OpenCL 2.0 in
the pointer argument address spaces.

Patch by Pierre Gondois and Sven van Haastregt.

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

llvm-svn: 372321

4 years ago[TableGen] Support encoding per-HwMode
James Molloy [Thu, 19 Sep 2019 13:39:54 +0000 (13:39 +0000)]
[TableGen] Support encoding per-HwMode

Much like ValueTypeByHwMode/RegInfoByHwMode, this patch allows targets
to modify an instruction's encoding based on HwMode. When the
EncodingInfos field is non-empty the Inst and Size fields of the Instruction
are ignored and taken from EncodingInfos instead.

As part of this promote getHwMode() from TargetSubtargetInfo to MCSubtargetInfo.

This is NFC for all existing targets - new code is generated only if targets
use EncodingByHwMode.

llvm-svn: 372320

4 years agoClean out unused diagnostics. NFC.
Benjamin Kramer [Thu, 19 Sep 2019 13:35:27 +0000 (13:35 +0000)]
Clean out unused diagnostics. NFC.

llvm-svn: 372319

4 years ago[CUDA][HIP] Fix typo in `BestViableFunction`
Michael Liao [Thu, 19 Sep 2019 13:14:03 +0000 (13:14 +0000)]
[CUDA][HIP] Fix typo in `BestViableFunction`

Summary:
- Should consider viable ones only when checking SameSide candidates.
- Replace erasing with clearing viable flag to reduce data
  moving/copying.
- Add one and revise another one as the diagnostic message are more
  relevant compared to previous one.

Reviewers: tra

Subscribers: cfe-commits, yaxunl

Tags: #clang

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

llvm-svn: 372318

4 years ago[clang-tidy] Fix bugprone-argument-comment-check to correctly ignore implicit constru...
Yitzhak Mandelbaum [Thu, 19 Sep 2019 13:12:05 +0000 (13:12 +0000)]
[clang-tidy] Fix bugprone-argument-comment-check to correctly ignore implicit constructors.

Summary:
After revision 370919, this check incorrectly flags certain cases of implicit
constructors. Specifically, if an argument is annotated with an
argument-comment and the argument expression triggers an implicit constructor,
then the argument comment is associated with argument of the implicit
constructor.

However, this only happens when the constructor has more than one argument.
This revision fixes the check for implicit constructors and adds a regression
test for this case.

Note: r370919 didn't cause this bug, it simply uncovered it by fixing another
bug that was masking the behavior.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 372317

4 years ago[DAG] Add SelectionDAG::MaxRecursionDepth constant
Simon Pilgrim [Thu, 19 Sep 2019 12:58:43 +0000 (12:58 +0000)]
[DAG] Add SelectionDAG::MaxRecursionDepth constant

As commented on D67557 we have a lot of uses of depth checks all using magic numbers.

This patch adds the SelectionDAG::MaxRecursionDepth constant and moves over some general cases to use this explicitly.

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

llvm-svn: 372315

4 years agoRevert r372285 "GlobalISel: Don't materialize immarg arguments to intrinsics"
Hans Wennborg [Thu, 19 Sep 2019 12:33:07 +0000 (12:33 +0000)]
Revert r372285 "GlobalISel: Don't materialize immarg arguments to intrinsics"

This broke the Chromium build, causing it to fail with e.g.

  fatal error: error in backend: Cannot select: t362: v4i32 = X86ISD::VSHLI t392, Constant:i8<15>

See llvm-commits thread of r372285 for details.

This also reverts r372286, r372287, r372288, r372289, r372290, r372291,
r372292, r372293, r372296, and r372297, which seemed to depend on the
main commit.

> Encode them directly as an imm argument to G_INTRINSIC*.
>
> Since now intrinsics can now define what parameters are required to be
> immediates, avoid using registers for them. Intrinsics could
> potentially want a constant that isn't a legal register type. Also,
> since G_CONSTANT is subject to CSE and legalization, transforms could
> potentially obscure the value (and create extra work for the
> selector). The register bank of a G_CONSTANT is also meaningful, so
> this could throw off future folding and legalization logic for AMDGPU.
>
> This will be much more convenient to work with than needing to call
> getConstantVRegVal and checking if it may have failed for every
> constant intrinsic parameter. AMDGPU has quite a lot of intrinsics wth
> immarg operands, many of which need inspection during lowering. Having
> to find the value in a register is going to add a lot of boilerplate
> and waste compile time.
>
> SelectionDAG has always provided TargetConstant for constants which
> should not be legalized or materialized in a register. The distinction
> between Constant and TargetConstant was somewhat fuzzy, and there was
> no automatic way to force usage of TargetConstant for certain
> intrinsic parameters. They were both ultimately ConstantSDNode, and it
> was inconsistently used. It was quite easy to mis-select an
> instruction requiring an immediate. For SelectionDAG, start emitting
> TargetConstant for these arguments, and using timm to match them.
>
> Most of the work here is to cleanup target handling of constants. Some
> targets process intrinsics through intermediate custom nodes, which
> need to preserve TargetConstant usage to match the intrinsic
> expectation. Pattern inputs now need to distinguish whether a constant
> is merely compatible with an operand or whether it is mandatory.
>
> The GlobalISelEmitter needs to treat timm as a special case of a leaf
> node, simlar to MachineBasicBlock operands. This should also enable
> handling of patterns for some G_* instructions with immediates, like
> G_FENCE or G_EXTRACT.
>
> This does include a workaround for a crash in GlobalISelEmitter when
> ARM tries to uses "imm" in an output with a "timm" pattern source.

llvm-svn: 372314

4 years ago[ARM] MVE i1 splat
David Green [Thu, 19 Sep 2019 12:17:41 +0000 (12:17 +0000)]
[ARM] MVE i1 splat

We needn't BFI each lane individually into a predicate register when each lane
in the same. A simple sign extend and a vmsr will do.

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

llvm-svn: 372313

4 years ago[cmake] Strip quotes in try_compile_only
Hans Wennborg [Thu, 19 Sep 2019 11:28:32 +0000 (11:28 +0000)]
[cmake] Strip quotes in try_compile_only

After r372209, the compile command can end up including an argument with
quotes in it, e.g.

  -fprofile-instr-use="/foo/bar.profdata"

when invoking the compiler with execute_process, the compiler ends up
getting that argument with quotes and all, and fails to open the file.

This all seems horribly broken, but one way of working around it is to
simply strip the quotes from the string here. If they were there to
protect a path that's got spaces in it, that wasn't going to work
anyway because the string is later split by spaces.

llvm-svn: 372312

4 years agoRevert [llvm-ar] Include a line number when failing to parse an MRI script
Owen Reynolds [Thu, 19 Sep 2019 11:22:59 +0000 (11:22 +0000)]
Revert [llvm-ar] Include a line number when failing to parse an MRI script

Revert r372309 due to buildbot failures

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

llvm-svn: 372311

4 years agoFix -Wdocumentation "@returns in a void function" warning. NFCI.
Simon Pilgrim [Thu, 19 Sep 2019 11:12:04 +0000 (11:12 +0000)]
Fix -Wdocumentation "@returns in a void function" warning. NFCI.

llvm-svn: 372310

4 years ago[llvm-ar] Include a line number when failing to parse an MRI script
Owen Reynolds [Thu, 19 Sep 2019 10:51:43 +0000 (10:51 +0000)]
[llvm-ar] Include a line number when failing to parse an MRI script

Errors that occur when reading an MRI script now include a corresponding
line number.

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

llvm-svn: 372309

4 years agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
Simon Pilgrim [Thu, 19 Sep 2019 10:47:12 +0000 (10:47 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

llvm-svn: 372308