185399 Commits

Author SHA1 Message Date
Craig Topper
483a636ee0 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372409 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 16:49:51 +00:00
Sebastian Pop
d3eb1f30d5 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372408 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 16:33:33 +00:00
Stanislav Mekhanoshin
2e8ee4b459 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372405 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 15:26:10 +00:00
Krzysztof Parzyszek
392a95b5fe [MVT] Add v256i1 to MachineValueType
This type can show up when lowering some HVX vector code on Hexagon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372403 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 15:19:20 +00:00
Roman Lebedev
24b7308f7a [InstCombine] Tests for (a+b)<=a && (a+b)!=0 fold (PR43259)
https://rise4fun.com/Alive/knp
https://rise4fun.com/Alive/ALap

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372402 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 15:06:47 +00:00
Oliver Cruickshank
c1b1ba2da8 [ARM] Fix CTTZ not generating correct instructions MVE
CTTZ intrinsic should have been set to Custom, not Expand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372401 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 15:03:44 +00:00
Francesco Petrogalli
8de00d5b2d [docs] Remove training whitespaces. NFC
Subscribers: jfb, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372399 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 15:02:32 +00:00
David Stenberg
22b465abb4 Add a missing space in a MIR parser error message
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372398 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 14:41:41 +00:00
GN Sync Bot
8adad6363b gn build: Merge r372396
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372397 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 14:39:52 +00:00
Cyndy Ishida
5496a24d4c [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372396 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 14:32:34 +00:00
Fangrui Song
0402afb4c1 Use llvm::StringLiteral instead of StringRef in few places
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372395 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 14:31:42 +00:00
Sanjay Patel
f5b29ad677 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372393 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 14:17:00 +00:00
David Zarzycki
251014ce79 [Testing] Python 3 requires print to use parens
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372392 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 13:52:47 +00:00
Luis Marques
4d04769912 [RISCV] Fix static analysis issues
Unlikely to be problematic but still worth fixing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372391 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 13:48:02 +00:00
Guillaume Chatelet
080ee770b9 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372390 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 13:40:31 +00:00
David Tellenbach
0b85459856 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372389 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 13:22:59 +00:00
Bjorn Pettersson
c58d98437f [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372384 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 12:13:12 +00:00
Nico Weber
7622f82bde 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372383 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 12:05:29 +00:00
Kerry McLaughlin
ee9acd3900 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372380 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 09:48:21 +00:00
David Tellenbach
61ae041759 [NFC] Test commit, deleting some whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372379 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 09:43:31 +00:00
Djordje Todorovic
e6e74eaf95 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372378 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 09:25:11 +00:00
George Rimar
6a5d9ef0f4 [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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372377 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 09:15:36 +00:00
James Molloy
d2ee0056e8 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372376 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 08:57:46 +00:00
Florian Hahn
be86a5616d [CallSiteSplitting] Remove unused includes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372375 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 08:33:11 +00:00
Owen Reynolds
86279ff0c0 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372374 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 08:10:14 +00:00
Craig Topper
8958b8beb5 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372373 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 07:00:22 +00:00
Yuanfang Chen
bb41d69931 [llvm-readobj] flush output before crash
Otherwise the output could be lost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372372 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 06:33:03 +00:00
Craig Topper
a01099f226 [X86] Use timm in MMX pinsrw/pextrw isel patterns. Add missing test cases.
This fixes an isel failure after r372338.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372371 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 06:00:35 +00:00
Fangrui Song
a6465b89db [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)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372370 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 04:40:44 +00:00
Fangrui Song
ad1310e435 [Object] Uncapitalize an error message
Test case will be added by my next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372369 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 04:40:38 +00:00
Nico Weber
04ed1c54f4 llvm-undname: Delete an empty, unused method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372367 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 03:13:16 +00:00
Sterling Augustine
6decfde0bb 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372366 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 02:29:16 +00:00
Craig Topper
35d3e1d861 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372365 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 01:49:46 +00:00
Matt Arsenault
c62b24f070 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372362 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 00:09:15 +00:00
Evandro Menezes
1c8e56e4a9 [AArch64] Fix formatting (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372357 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 21:48:22 +00:00
Akira Hatanaka
4c35a69162 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372352 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 20:58:51 +00:00
Stanislav Mekhanoshin
a36690edb4 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372350 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 20:09:04 +00:00
David Blaikie
72bcb2596e llvm-reduce: Follow-up to 372280, now with more-better msan fixing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372349 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 20:04:04 +00:00
Jakub Kuderski
a9cd579599 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372347 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 19:39:42 +00:00
Shoaib Meenai
fffd837fe1 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372346 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 18:21:32 +00:00
Jinsong Ji
c5e7309ce7 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372345 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 18:18:18 +00:00
GN Sync Bot
cafe9b27e9 gn build: Merge r372343
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372344 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 17:53:03 +00:00
Francesco Petrogalli
6e2c7c7033 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372343 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 17:47:32 +00:00
Roman Lebedev
1bee20881f [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372341 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 17:25:19 +00:00
Alexander Timofeev
0df3165d2b [AMDGPU] Unnecessary -amdgpu-scalarize-global-loads=false flag removed from min/max lit tests.
Reviewers: arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372340 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 16:44:38 +00:00
Sanjay Patel
09626b4e35 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372339 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 16:31:17 +00:00
Matt Arsenault
db7d9c2217 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372338 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 16:26:14 +00:00
Andrea Di Biagio
9fa92ef02a [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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372337 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 16:05:11 +00:00
Chris Bieneman
614fe859a8 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372336 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 15:45:12 +00:00
Matt Arsenault
d57b1704dc 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372335 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-19 15:44:00 +00:00