OSDN Git Service

android-x86/external-llvm.git
5 years agoReapply "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"
Duncan P. N. Exon Smith [Fri, 20 Jul 2018 00:44:58 +0000 (00:44 +0000)]
Reapply "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"

I'm optimistically reverting commit r337511, effectively reapplying
r337504 *without* changes.

The failing bots that had `SmallVector` in the backtrace recovered after
the unrelated commit r337508.  The backtraces looked bogus anyway, with
`SmallVector::size()` calling (e.g.) `ConstantArray::get()`.

Here's the original commit message:

    ADT: Shrink size of SmallVector by 8B on 64-bit platforms

    Represent size and capacity directly as unsigned and calculate
    `end()` using `begin() + size()`.

    This limits the maximum size/capacity of a vector to UINT32_MAX.

    https://reviews.llvm.org/D48518

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337514 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[docs] Add support for Markdown documentation in Sphinx"
Michael J. Spencer [Fri, 20 Jul 2018 00:24:36 +0000 (00:24 +0000)]
Revert "[docs] Add support for Markdown documentation in Sphinx"

The buildbots have an old version of Sphinx (need at least 1.3).  Revert until they are upgraded.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337513 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Disable a test that violates DR1696
Heejin Ahn [Fri, 20 Jul 2018 00:13:42 +0000 (00:13 +0000)]
[WebAssembly] Disable a test that violates DR1696

Summary:
lifetime2.C violates DR1696, which prevents reference members from being
initialized to temporaries, whose lifetime would end at the end of ctor.

Reviewers: sbc100

Subscribers: dschuff, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337512 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"
Duncan P. N. Exon Smith [Fri, 20 Jul 2018 00:09:56 +0000 (00:09 +0000)]
Revert "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"

This reverts commit r337504 while I investigate a TSan bot failure that
seems related:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/26526

    #8 0x000055581f2895d8 (/b/sanitizer-x86_64-linux-autoconf/build/tsan_debug_build/bin/clang-7+0x1eb45d8)
    #9 0x000055581f294323 llvm::ConstantAggrKeyType<llvm::ConstantArray>::create(llvm::ArrayType*) const /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:409:0
    #10 0x000055581f294323 llvm::ConstantUniqueMap<llvm::ConstantArray>::create(llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray>, std::pair<unsigned int, std::pair<llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray> > >&) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:635:0
    #11 0x000055581f294323 llvm::ConstantUniqueMap<llvm::ConstantArray>::getOrCreate(llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray>) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:654:0
    #12 0x000055581f2944cb llvm::ConstantArray::get(llvm::ArrayType*, llvm::ArrayRef<llvm::Constant*>) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/Constants.cpp:964:0
    #13 0x000055581fa27e19 llvm::SmallVectorBase::size() const /b/sanitizer-x86_64-linux-autoconf/build/llvm/include/llvm/ADT/SmallVector.h:53:0
    #14 0x000055581fa27e19 llvm::SmallVectorImpl<llvm::Constant*>::resize(unsigned long) /b/sanitizer-x86_64-linux-autoconf/build/llvm/include/llvm/ADT/SmallVector.h:347:0
    #15 0x000055581fa27e19 (anonymous namespace)::EmitArrayConstant(clang::CodeGen::CodeGenModule&, clang::ConstantArrayType const*, llvm::Type*, unsigned int, llvm::SmallVectorImpl<llvm::Constant*>&, llvm::Constant*) /b/sanitizer-x86_64-linux-autoconf/build/llvm/tools/clang/lib/CodeGen/CGExprConstant.cpp:669:0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337511 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86/SLH] Clean up helper naming for return instruction handling and
Chandler Carruth [Thu, 19 Jul 2018 23:46:24 +0000 (23:46 +0000)]
[x86/SLH] Clean up helper naming for return instruction handling and
remove dead declaration of a call instruction handling helper.

This moves to the 'harden' terminology that I've been trying to settle
on for returns. It also adds a really detailed comment explaining what
all we're trying to accomplish with return instructions and why.
Hopefully this makes it much more clear what exactly is being
"hardened".

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337510 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs] Add support for Markdown documentation in Sphinx
Michael J. Spencer [Thu, 19 Jul 2018 23:40:58 +0000 (23:40 +0000)]
[docs] Add support for Markdown documentation in Sphinx

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337509 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SCCP] Don't use markForcedConstant on branch conditions.
Eli Friedman [Thu, 19 Jul 2018 23:02:07 +0000 (23:02 +0000)]
[SCCP] Don't use markForcedConstant on branch conditions.

It's more aggressive than we need to be, and leads to strange
workarounds in other places like call return value inference. Instead,
just directly mark an edge viable.

Tests by Florian Hahn.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337507 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSkip out of SimplifyDemandedBits for BITCAST of f16 to i16
Stephen Canon [Thu, 19 Jul 2018 22:46:42 +0000 (22:46 +0000)]
Skip out of SimplifyDemandedBits for BITCAST of f16 to i16

Mirrors the existing exit path for f128, avoiding a crash later on.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337506 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoADT: Shrink size of SmallVector by 8B on 64-bit platforms
Duncan P. N. Exon Smith [Thu, 19 Jul 2018 22:29:47 +0000 (22:29 +0000)]
ADT: Shrink size of SmallVector by 8B on 64-bit platforms

Representing size and capacity directly as unsigned and calculate
`end()` using `begin() + size()`.

This limits the maximum size/capacity of a vector to UINT32_MAX.

https://reviews.llvm.org/D48518

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337504 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Only emit referenced type id records in index files
Teresa Johnson [Thu, 19 Jul 2018 22:25:56 +0000 (22:25 +0000)]
[ThinLTO] Only emit referenced type id records in index files

Summary:
Currently all type ids are emitted into the index file when it is
written. For distributed ThinLTO, that meant that all type ids were
being duplicated into every single distributed index file, regardless of
whether they were referenced, leading to huge amounts of unnecessary
duplication and size bloat.

Keep track of the type id GUIDs actually referenced by the GV summary
records being emitted, and only emit those type IDs.

Add a new test, and fix test/Assembler/thinlto-summary.ll so that all
type ids are referenced to prevent deletion in that test.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, vitalybuka, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337503 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] Teach DAGCombiner that A-(-B) is A+B.
Craig Topper [Thu, 19 Jul 2018 22:24:43 +0000 (22:24 +0000)]
[DAGCombiner] Teach DAGCombiner that A-(-B) is A+B.

We already knew A+(-B) is A-B in visitAdd. This does the opposite for visitSub.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337502 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AVX] Use extract_subvector to reduce vector op widths (PR36761)
Simon Pilgrim [Thu, 19 Jul 2018 21:52:06 +0000 (21:52 +0000)]
[X86][AVX] Use extract_subvector to reduce vector op widths (PR36761)

We have a number of cases where we fail to reduce vector op widths, performing the op in a larger vector and then extracting a subvector. This is often because by default it would create illegal types.

This peephole patch attempts to handle a few common cases detailed in PR36761, which typically involved extension+conversion to vX2f64 types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337500 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mca][docs] Add Timeline and How MCA works.
Matt Davis [Thu, 19 Jul 2018 20:33:59 +0000 (20:33 +0000)]
[llvm-mca][docs] Add Timeline and How MCA works.

For the most part, these changes were from the RFC.  I made a few minor
word/structure changes, but nothing significant.  I also regenerated the
example output, and adjusted the text accordingly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337496 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoWork around bug in mingw-w64 GCC 8.1.0
Reid Kleckner [Thu, 19 Jul 2018 20:32:45 +0000 (20:32 +0000)]
Work around bug in mingw-w64 GCC 8.1.0

This particular version of GCC seems to break bitfields when a method
appears between two bitfield members.

Personally, I think it's nice to keep bitfields close together so that
it's easy to check how things are packed, so I moved the method after
SubClassData.

Fixes PR38168.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337495 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDisable GCC's -Wclass-memaccess warning
Reid Kleckner [Thu, 19 Jul 2018 20:14:46 +0000 (20:14 +0000)]
Disable GCC's -Wclass-memaccess warning

It fires on things like SmallVector<std::pair<int, int>>, where we
intentionally use memcpy instead of calling the assignment operator.
This warning fires in practically every LLVM TU, so we have to do
something about it, even if we aren't interested in being 100% warning
clean with GCC.

Reported as PR37337

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337492 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Fix some 'return SDValue()' after DCI.CombineTo instead return the output of...
Craig Topper [Thu, 19 Jul 2018 20:10:44 +0000 (20:10 +0000)]
[X86] Fix some 'return SDValue()' after DCI.CombineTo instead return the output of CombineTo

Returning SDValue() means nothing was changed. Returning the result of CombineTo returns the first argument of CombineTo. This is specially detected by DAGCombiner as meaning that something changed, but worklist management was already taken care of.

I think the only real effect of this change is that we now properly update the Statistic the counts the number of combines performed. That's the only thing between the check for null and the check for N in the DAGCombiner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337491 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix -Wsign-compare in llvm-readobj
Reid Kleckner [Thu, 19 Jul 2018 19:58:22 +0000 (19:58 +0000)]
Fix -Wsign-compare in llvm-readobj

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337490 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LSV] Refactoring + supporting bitcasts to a type of different size
Roman Tereshin [Thu, 19 Jul 2018 19:42:43 +0000 (19:42 +0000)]
[LSV] Refactoring + supporting bitcasts to a type of different size

This is mostly a preparation work for adding a limited support for
select instructions. It proved to be difficult to do due to size and
irregularity of Vectorizer::isConsecutiveAccess, this is fixed here I
believe.

It also turned out that these changes make it simpler to finish one of
the TODOs and fix a number of other small issues, namely:

1. Looking through bitcasts to a type of a different size (requires
careful tracking of the original load/store size and some math
converting sizes in bytes to expected differences in indices of GEPs).

2. Reusing partial analysis of pointers done by first attempt in proving
them consecutive instead of starting from scratch. This added limited
support for nested GEPs co-existing with difficult sext/zext
instructions. This also required a careful handling of negative
differences between constant parts of offsets.

3. Handing a case where the first pointer index is not an add, but
something else (a function parameter for instance).

I observe an increased number of successful vectorizations on a large
set of shader programs. Only few shaders are affected, but those that
are affected sport >5% less loads and stores than before the patch.

Reviewed By: rampitec

Differential-Revision: https://reviews.llvm.org/D49342

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337489 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Power9] Code Cleanup - Remove needsAggressiveScheduling()
Stefan Pintilie [Thu, 19 Jul 2018 19:34:18 +0000 (19:34 +0000)]
[Power9] Code Cleanup - Remove needsAggressiveScheduling()

As we already return true from needsAggressiveScheduling() for the most recent
hardware it would be cleaner to just return true for all PowerPC hardware.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337488 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Analysis] Fix typo in assert. NFC
Shoaib Meenai [Thu, 19 Jul 2018 19:11:29 +0000 (19:11 +0000)]
[Analysis] Fix typo in assert. NFC

Test commit to see if my mailing list woes have been resolved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337485 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenEmbedded] Add a unittest for aarch64-oe-linux
Mandeep Singh Grang [Thu, 19 Jul 2018 18:10:03 +0000 (18:10 +0000)]
[OpenEmbedded] Add a unittest for aarch64-oe-linux

Summary: Added a unittest for aarch64-oe-linux which was missed in D48861.

Reviewers: compnerd, rengolin, javed.absar

Reviewed By: compnerd

Subscribers: kristof.beyls, dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337479 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[APInt] Keep the original bit width in quotient and remainder
Krzysztof Parzyszek [Thu, 19 Jul 2018 18:07:56 +0000 (18:07 +0000)]
[APInt] Keep the original bit width in quotient and remainder

Some trivial cases in udivrem were handled by directly assigning 0 or 1
to APInt objects. This would set the bit width to 1, instead of the bit
width of the inputs. A potentially undesirable side effect of that is
that with the bit width of 1, 1 equals -1.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337478 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libFuzzer] Update documentation regarding MSan.
Matt Morehouse [Thu, 19 Jul 2018 17:59:11 +0000 (17:59 +0000)]
[libFuzzer] Update documentation regarding MSan.

Summary: -fsanitize=fuzzer,memory now works out-of-the-box.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337476 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoadStoreVectorizer] Use getMinusScev() to compute the distance between two pointers.
Farhana Aleen [Thu, 19 Jul 2018 16:50:27 +0000 (16:50 +0000)]
[LoadStoreVectorizer] Use getMinusScev() to compute the distance between two pointers.

Summary: Currently, isConsecutiveAccess() detects two pointers(PtrA and PtrB) as consecutive by
         comparing PtrB with BaseDelta+PtrA. This works when both pointers are factorized or
         both of them are not factorized. But isConsecutiveAccess() fails if one of the
         pointers is factorized but the other one is not.

         Here is an example:
         PtrA = 4 * (A + B)
         PtrB = 4 + 4A + 4B

         This patch uses getMinusSCEV() to compute the distance between two pointers.
         getMinusSCEV() allows combining the expressions and computing the simplified distance.

Author: FarhanaAleen

Reviewed By: rampitec

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337471 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][BtVer2] correctly model the latency/throughput of LEA instructions.
Andrea Di Biagio [Thu, 19 Jul 2018 16:42:15 +0000 (16:42 +0000)]
[X86][BtVer2] correctly model the latency/throughput of LEA instructions.

This patch fixes the latency/throughput of LEA instructions in the BtVer2
scheduling model.

On Jaguar, A 3-operands LEA has a latency of 2cy, and a reciprocal throughput of
1. That is because it uses one cycle of SAGU followed by 1cy of ALU1.  An LEA
with a "Scale" operand is also slow, and it has the same latency profile as the
3-operands LEA. An LEA16r has a latency of 3cy, and a throughput of 0.5 (i.e.
RThrouhgput of 2.0).

This patch adds a new TIIPredicate named IsThreeOperandsLEAFn to X86Schedule.td.
The tablegen backend (for instruction-info) expands that definition into this
(file X86GenInstrInfo.inc):
```
static bool isThreeOperandsLEA(const MachineInstr &MI) {
  return (
    (
      MI.getOpcode() == X86::LEA32r
      || MI.getOpcode() == X86::LEA64r
      || MI.getOpcode() == X86::LEA64_32r
      || MI.getOpcode() == X86::LEA16r
    )
    && MI.getOperand(1).isReg()
    && MI.getOperand(1).getReg() != 0
    && MI.getOperand(3).isReg()
    && MI.getOperand(3).getReg() != 0
    && (
      (
        MI.getOperand(4).isImm()
        && MI.getOperand(4).getImm() != 0
      )
      || (MI.getOperand(4).isGlobal())
    )
  );
}
```

A similar method is generated in the X86_MC namespace, and included into
X86MCTargetDesc.cpp (the declaration lives in X86MCTargetDesc.h).

Back to the BtVer2 scheduling model:
A new scheduling predicate named JSlowLEAPredicate now checks if either the
instruction is a three-operands LEA, or it is an LEA with a Scale value
different than 1.
A variant scheduling class uses that new predicate to correctly select the
appropriate latency profile.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337469 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add FPEXT vXf32 - vXf64 tests
Simon Pilgrim [Thu, 19 Jul 2018 15:32:45 +0000 (15:32 +0000)]
[X86][SSE] Add FPEXT vXf32 - vXf64 tests

Some basic subvector special cases based on PR36761

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337464 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj] - Do not report invalid amount of sections.
George Rimar [Thu, 19 Jul 2018 14:52:57 +0000 (14:52 +0000)]
[llvm-readobj] - Do not report invalid amount of sections.

When output style is GNU and amount of sections is >= SHN_LORESERVE,
llvm-readobj reports zero number of sections instead of actual value.

The patch fixes that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337462 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Enable ThinLTO WholeProgramDevirt and LowerTypeTests in new PM
Teresa Johnson [Thu, 19 Jul 2018 14:51:32 +0000 (14:51 +0000)]
[ThinLTO] Enable ThinLTO WholeProgramDevirt and LowerTypeTests in new PM

Summary:
Enable these passes for CFI and WPD in ThinLTO and LTO with the new pass
manager. Add a couple of tests for both PMs based on the clang tests
tools/clang/test/CodeGen/thinlto-distributed-cfi*.ll, but just test
through llvm-lto2 and not with distributed ThinLTO.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337461 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Docs] Testing Debug Info Preservation in Optimizations
Anastasis Grammenos [Thu, 19 Jul 2018 14:08:54 +0000 (14:08 +0000)]
[Docs] Testing Debug Info Preservation in Optimizations

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337457 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoARM: switch armv7em MachO triple to hard-float defaults and libcalls.
Tim Northover [Thu, 19 Jul 2018 12:44:51 +0000 (12:44 +0000)]
ARM: switch armv7em MachO triple to hard-float defaults and libcalls.

We were emitting incorrect calls to libm functions that LLVM had decided it
knew about because the default is soft-float.

Recommitted without breaking ELF this time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337450 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[UnJ] Document unroll and jam pass and loop metadata
David Green [Thu, 19 Jul 2018 12:37:00 +0000 (12:37 +0000)]
[UnJ] Document unroll and jam pass and loop metadata

Add some quick words for unroll and jam to the list of passes and add
unroll_and_jam metadata to the language ref.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337448 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86/SLH] Major refactoring of SLH implementaiton. There are two big
Chandler Carruth [Thu, 19 Jul 2018 11:13:58 +0000 (11:13 +0000)]
[x86/SLH] Major refactoring of SLH implementaiton. There are two big
changes that are intertwined here:

1) Extracting the tracing of predicate state through the CFG to its own
   function.
2) Creating a struct to manage the predicate state used throughout the
   pass.

Doing #1 necessitates and motivates the particular approach for #2 as
now the predicate management is spread across different functions
focused on different aspects of it. A number of simplifications then
fell out as a direct consequence.

I went with an Optional to make it more natural to construct the
MachineSSAUpdater object.

This is probably the single largest outstanding refactoring step I have.
Things get a bit more surgical from here. My current goal, beyond
generally making this maintainable long-term, is to implement several
improvements to how we do interprocedural tracking of predicate state.
But I don't want to do that until the predicate state management and
tracing is in reasonably clear state.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337446 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] Add rotate-extract tests
Simon Pilgrim [Thu, 19 Jul 2018 09:27:34 +0000 (09:27 +0000)]
[DAGCombiner] Add rotate-extract tests

Add new tests from D47681 to current codegen. Also added i686 codegen tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337445 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse std::reference_wrapper instead of llvm::ReferenceStorage
Serge Guelton [Thu, 19 Jul 2018 09:24:34 +0000 (09:24 +0000)]
Use std::reference_wrapper instead of llvm::ReferenceStorage

Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D49298

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337444 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix spelling mistake in comments. NFCI.
Simon Pilgrim [Thu, 19 Jul 2018 09:14:39 +0000 (09:14 +0000)]
Fix spelling mistake in comments. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337442 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SCEV] Fix buggy behavior in getAddExpr with truncs
Max Kazantsev [Thu, 19 Jul 2018 01:46:21 +0000 (01:46 +0000)]
[SCEV] Fix buggy behavior in getAddExpr with truncs

SCEV tries to constant-fold arguments of trunc operands in SCEVAddExpr, and when it does
that, it passes wrong flags into the recursion. It is only valid to pass flags that are proved for
narrow type into a computation in wider type if we can prove that trunc instruction doesn't
actually change the value. If it did lose some meaningful bits, we may end up proving wrong
no-wrap flags for sum of arguments of trunc.

In the provided test we end up with `nuw` where it shouldn't be because of this bug.

The solution is to conservatively pass `SCEV::FlagAnyWrap` which is always a valid thing to do.

Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D49471

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337435 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRename __asan_gen_* symbols to ___asan_gen_*.
Peter Collingbourne [Wed, 18 Jul 2018 22:23:14 +0000 (22:23 +0000)]
Rename __asan_gen_* symbols to ___asan_gen_*.

This prevents gold from printing a warning when trying to export
these symbols via the asan dynamic list after ThinLTO promotes them
from private symbols to external symbols with hidden visibility.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337428 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Add missing -mattr=+exception-handling guards
Heejin Ahn [Wed, 18 Jul 2018 21:42:22 +0000 (21:42 +0000)]
[WebAssembly] Add missing -mattr=+exception-handling guards

Summary:
The use of exception handling instructions should only be enabled with
`-mattr=+exception-handling` option.

Reviewers: jgravelle-google

Subscribers: dschuff, sbc100, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337425 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "ARM: switch armv7em triple to hard-float defaults and libcalls."
Tim Northover [Wed, 18 Jul 2018 21:32:49 +0000 (21:32 +0000)]
Revert "ARM: switch armv7em triple to hard-float defaults and libcalls."

This reverts commit r337385 until it can be targeted at MachO only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337424 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix some tests that had (implied) duplicate mtriple
David Blaikie [Wed, 18 Jul 2018 20:37:01 +0000 (20:37 +0000)]
Fix some tests that had (implied) duplicate mtriple

I 'fixed' one of these to use %llc_dwarf unnecessarily, so switch them
both back to using llc directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337423 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Canonicalize scalar fp arithmetic shuffle patterns
Simon Pilgrim [Wed, 18 Jul 2018 19:55:19 +0000 (19:55 +0000)]
[X86][SSE] Canonicalize scalar fp arithmetic shuffle patterns

As discussed on PR38197, this canonicalizes MOVS*(N0, OP(N0, N1)) --> MOVS*(N0, SCALAR_TO_VECTOR(OP(N0[0], N1[0])))

This returns the scalar-fp codegen lost by rL336971.

Additionally it handles the OP(N1, N0)) case for commutable (FADD/FMUL) ops.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337419 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSkip debuginfo intrinsic in markLiveBlocks.
Xin Tong [Wed, 18 Jul 2018 18:40:45 +0000 (18:40 +0000)]
Skip debuginfo intrinsic in markLiveBlocks.

Summary:
The optimizer is 10%+ slower with vs without debuginfo. I started checking where
the difference is coming from.

I compiled sqlite3.c with and without debug info from CTMark and compare the time difference.

I use Xcode Instrument to find where time is spent. This brings about 20ms, out of ~20s.

Reviewers: davide, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, aprantl, JDevlieghere, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337416 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd (very partial) Kate syntax highlighting definition for TableGen
Roman Lebedev [Wed, 18 Jul 2018 18:35:27 +0000 (18:35 +0000)]
Add (very partial) Kate syntax highlighting definition for TableGen

This is very clearly not very good, and is very partial.
But this is better than nothing at all, and shouldn't
hurt those who don't need it.

If there are others interested in this functionality,
it will be great to further improve this.

{F6253091}

Reviewed By: Bigcheese

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337415 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAG] Add testcase.
Nirav Dave [Wed, 18 Jul 2018 18:34:52 +0000 (18:34 +0000)]
[DAG] Add testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337414 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Dwarfv5: Avoid unnecessary base_address specifiers in rnglists
David Blaikie [Wed, 18 Jul 2018 18:04:42 +0000 (18:04 +0000)]
[DebugInfo] Dwarfv5: Avoid unnecessary base_address specifiers in rnglists

Since DWARFv5 rnglists are self descriptive and have distinct encodings
for base-relative (offset_pair) and absolute (start_length) entries,
there's no need to use a base address specifier when describing a lone
address range in a section.

Use that, and improve the test coverage a bit here to include cases like
this and others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337411 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ScheduleDAG] Fix unfolding of SUnits to already existent nodes.
Nirav Dave [Wed, 18 Jul 2018 18:01:03 +0000 (18:01 +0000)]
[ScheduleDAG] Fix unfolding of SUnits to already existent nodes.

Summary:
If unfolding an SUnit results in both load or the operation using it which
already exist in the DAG, abort the unfold if they are already scheduled.
If not, make sure we don't add duplicate dependencies.

This fixes PR37916.

Reviewers: davide, eli.friedman, fhahn, bogner

Subscribers: MatzeB, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337409 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj] Generic -string-dump option
Paul Semel [Wed, 18 Jul 2018 18:00:41 +0000 (18:00 +0000)]
[llvm-readobj] Generic -string-dump option

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337408 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs] Update GoldPlugin documentation
Teresa Johnson [Wed, 18 Jul 2018 17:10:17 +0000 (17:10 +0000)]
[docs] Update GoldPlugin documentation

Summary:
Updated and reorganized. Made the following additions:
1) How to see if ld.gold is installed, and whether it is the current
default.
2) How to install ld.gold as the default or alternatively use
-fuse-ld=gold.
3) Move the part about installing the newly built ld-new as the default
to the prior section and how to use --enable-gold=default to do it
automatically on install.
4) Add a note about ld.bfd supporting plugins but indicate that it is
not tested by the LLVM project and gold is the recommended linker for
use with the gold plugin.

Fixes PR32760.

Reviewers: davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337404 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RegAlloc][NFC] Fix the help string of the option "huge-size-for-split".
Wei Mi [Wed, 18 Jul 2018 16:56:33 +0000 (16:56 +0000)]
[RegAlloc][NFC] Fix the help string of the option "huge-size-for-split".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337402 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] Add -demangle (-C) option
Paul Semel [Wed, 18 Jul 2018 16:39:21 +0000 (16:39 +0000)]
[llvm-objdump] Add -demangle (-C) option

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337401 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][X86][AArch64][DAGCombine] More tests for optimizeSetCCOfSignedTruncationCheck()
Roman Lebedev [Wed, 18 Jul 2018 16:19:06 +0000 (16:19 +0000)]
[NFC][X86][AArch64][DAGCombine] More tests for optimizeSetCCOfSignedTruncationCheck()

At least one of these cases is more canonical,
so we really do have to handle it.
https://godbolt.org/g/pkzP3X
https://rise4fun.com/Alive/pQyh

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337400 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] %python wants to be in quotes, because it might contain spaces
Benjamin Kramer [Wed, 18 Jul 2018 16:17:53 +0000 (16:17 +0000)]
[llvm-objcopy] %python wants to be in quotes, because it might contain spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337399 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MC] Fix nested macro body parsing
Nirav Dave [Wed, 18 Jul 2018 16:17:03 +0000 (16:17 +0000)]
[MC] Fix nested macro body parsing

Add missing .rep case in nestlevel checking for macro body parsing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337398 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Fix predicate for the MipsTruncIntFP pattern
Simon Atanasyan [Wed, 18 Jul 2018 14:11:22 +0000 (14:11 +0000)]
[mips] Fix predicate for the MipsTruncIntFP pattern

This is a follow-up to the rL337171. This patch fixes regression
introduced by the r337171 and enables MipsTruncIntFP pattern.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337392 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86/SLH] Add the design document for Speculative Load Hardening,
Chandler Carruth [Wed, 18 Jul 2018 14:05:14 +0000 (14:05 +0000)]
[x86/SLH] Add the design document for Speculative Load Hardening,
a Spectre v1 mitigation.

This was initially posted w/ the patch implementing this, got some basic
review there. Also, it is generated from a the Google doc that I shared
as part of the Speculative Load Hardening RFC and which has seen pretty
widespread review at this point.

However, as the patches are landing in LLVM, I wanted to land the docs
as well. But it seemed like a bad idea to have them in the same commit
in case of reverts or other things. So the docs are split out here.

Thanks for all the review so far, and further review and improvements to
the documentation here welcome. Please feel free to keep hammering on
the code review or Google document.

Note that this is a markdown document which Sphinx doesn't yet process.
But we can add support for that after and this should get picked up
(and I'm preparing patches for that). Also, this gets the document
itself into a nice shared place where we can iterate on it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337391 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLPVectorizer] Avoid duplicate scalar cost calculations in BoUpSLP::getEntryCost...
Simon Pilgrim [Wed, 18 Jul 2018 13:53:55 +0000 (13:53 +0000)]
[SLPVectorizer] Avoid duplicate scalar cost calculations in BoUpSLP::getEntryCost. NFCI.

Pulled out from D49225, we have a lot of repeated scalar cost calculations, often with arguments that don't look the same but turn out to be.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337390 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] Build fix for Haiku when checking for a local filesystem
Tim Northover [Wed, 18 Jul 2018 13:42:18 +0000 (13:42 +0000)]
[Support] Build fix for Haiku when checking for a local filesystem

Haiku does not expose information about local versus remote mounts, so just
return false, like Cygwin.

Patch by Niels Sascha Reedijk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337389 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Remove BLENDPD canonicalization from combineTargetShuffle
Simon Pilgrim [Wed, 18 Jul 2018 13:01:20 +0000 (13:01 +0000)]
[X86][SSE] Remove BLENDPD canonicalization from combineTargetShuffle

When rL336971 removed the scalar-fp isel patterns, we lost the need for this canonicalization - commutation/folding can handle everything else.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337387 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoARM: stop explicitly marking armv7k libcalls as hard-float. NFC.
Tim Northover [Wed, 18 Jul 2018 12:37:43 +0000 (12:37 +0000)]
ARM: stop explicitly marking armv7k libcalls as hard-float. NFC.

Since the triple's default is hard float, the libcalls will already use VFP
registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337386 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoARM: switch armv7em triple to hard-float defaults and libcalls.
Tim Northover [Wed, 18 Jul 2018 12:37:04 +0000 (12:37 +0000)]
ARM: switch armv7em triple to hard-float defaults and libcalls.

We were emitting incorrect calls to libm functions that LLVM had decided it
knew about because the default is soft-float.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337385 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoARM: deduplicate hard-float detection code. NFC.
Tim Northover [Wed, 18 Jul 2018 12:36:25 +0000 (12:36 +0000)]
ARM: deduplicate hard-float detection code. NFC.

ARMSubtarget had a copy/pasted block to determine whether the target was
hard-float, but it just delegated to triple features anyway so it's better at
the TargetMachine level.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337384 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE] Asm: Support for unpredicated FP operations.
Sander de Smalen [Wed, 18 Jul 2018 11:59:12 +0000 (11:59 +0000)]
[AArch64][SVE] Asm: Support for unpredicated FP operations.

This patch adds support for the following unpredicated
floating-point instructions:

  FADD      Floating point add
  FSUB      Floating point subtract
  FMUL      Floating point multiplication
  FTSMUL    Floating point trigonometric starting value
  FRECPS    Floating point reciprocal step
  FRSQRTS   Floating point reciprocal square root step

The instructions have the following assembly format:
  fadd z0.h, z1.h, z2.h
and have variants for 16, 32 and 64-bit FP elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337383 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetInstPredicate] Add definition of CheckInvalidRegisterOperand.
Andrea Di Biagio [Wed, 18 Jul 2018 11:16:31 +0000 (11:16 +0000)]
[TargetInstPredicate] Add definition of CheckInvalidRegisterOperand.

This should have been part of r337378. I forgot to svn add it before committing
the change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337380 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Make a test more neat
Max Kazantsev [Wed, 18 Jul 2018 11:03:40 +0000 (11:03 +0000)]
[NFC] Make a test more neat

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337379 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tablegen][PredicateExpander] Add the ability to define checks for invalid registers.
Andrea Di Biagio [Wed, 18 Jul 2018 11:03:22 +0000 (11:03 +0000)]
[Tablegen][PredicateExpander] Add the ability to define checks for invalid registers.

This was discussed in review D49436.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337378 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Re-commit: Fold 'check for [no] signed truncation' pattern
Roman Lebedev [Wed, 18 Jul 2018 10:55:17 +0000 (10:55 +0000)]
[InstCombine] Re-commit: Fold 'check for [no] signed truncation' pattern

Summary:
[[ https://bugs.llvm.org/show_bug.cgi?id=38149 | PR38149 ]]

As discussed in https://reviews.llvm.org/D49179#1158957 and later,
the IR for 'check for [no] signed truncation' pattern can be improved:
https://rise4fun.com/Alive/gBf
^ that pattern will be produced by Implicit Integer Truncation sanitizer,
https://reviews.llvm.org/D48958 https://bugs.llvm.org/show_bug.cgi?id=21530
in signed case, therefore it is probably a good idea to improve it.

The DAGCombine will reverse this transform, see
https://reviews.llvm.org/D49266

This transform is surprisingly frustrating.
This does not deal with non-splat shift amounts, or with undef shift amounts.
I've outlined what i think the solution should be:
```
  // Potential handling of non-splats: for each element:
  //  * if both are undef, replace with constant 0.
  //    Because (1<<0) is OK and is 1, and ((1<<0)>>1) is also OK and is 0.
  //  * if both are not undef, and are different, bailout.
  //  * else, only one is undef, then pick the non-undef one.
```

This is a re-commit, as the original patch, committed in rL337190
was reverted in rL337344 as it broke chromium build:
https://bugs.llvm.org/show_bug.cgi?id=38204 and
https://crbug.com/864832
Proofs that the fixed folds are ok: https://rise4fun.com/Alive/VYM

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337376 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add extra scalar fop + blend tests for commuted inputs
Simon Pilgrim [Wed, 18 Jul 2018 10:54:13 +0000 (10:54 +0000)]
[X86][SSE] Add extra scalar fop + blend tests for commuted inputs

While working on PR38197, I noticed that we don't make use of FADD/FMUL being able to commute the inputs to support the addps+movss -> addss style combine

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337375 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[Sparc] Use the IntPair reg class for r constraints with value type f64"
Daniel Cederman [Wed, 18 Jul 2018 10:05:30 +0000 (10:05 +0000)]
Revert "[Sparc] Use the IntPair reg class for r constraints with value type f64"

This reverts commit 55222c9183c6e07f53a54c4061677734f54feac1.

I missed that this patch has a dependency on https://reviews.llvm.org/D49219
that has not been approved yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337373 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE] Asm: Support for UDOT/SDOT instructions.
Sander de Smalen [Wed, 18 Jul 2018 09:37:51 +0000 (09:37 +0000)]
[AArch64][SVE] Asm: Support for UDOT/SDOT instructions.

The signed/unsigned DOT instructions perform a dot-product on
quadtuplets from two source vectors and accumulate the result in
the destination register. The instructions come in two forms:

Vector form, e.g.
  sdot  z0.s, z1.b, z2.b     - signed dot product on four 8-bit quad-tuplets,
                               accumulating results in 32-bit elements.

  udot  z0.d, z1.h, z2.h     - unsigned dot product on four 16-bit quad-tuplets,
                               accumulating results in 64-bit elements.

Indexed form, e.g.
  sdot  z0.s, z1.b, z2.b[3]  - signed dot product on four 8-bit quad-tuplets
                               with specified quadtuplet from second
                               source vector, accumulating results in 32-bit
                               elements.
  udot  z0.d, z1.h, z2.h[1]  - dot product on four 16-bit quad-tuplets
                               with specified quadtuplet from second
                               source vector, accumulating results in 64-bit
                               elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337372 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] - An attempt to fix BB after r337361.
George Rimar [Wed, 18 Jul 2018 09:25:36 +0000 (09:25 +0000)]
[llvm-objdump] - An attempt to fix BB after r337361.

Seems r337361 is the reason of the following ARM BB failures:
http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick
http://lab.llvm.org:8011/builders/clang-cmake-armv8-full/builds/4633

Reason is unclear to me, other bots are OK.
If this will not help, I'll revert r337361.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337371 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sparc] Use the IntPair reg class for r constraints with value type f64
Daniel Cederman [Wed, 18 Jul 2018 09:25:33 +0000 (09:25 +0000)]
[Sparc] Use the IntPair reg class for r constraints with value type f64

Summary: This is how it appears to be handled in GCC and it prevents a
"Unknown mismatch" error in the SelectionDAGBuilder.

Reviewers: venkatra, jyknight, jrtc27

Reviewed By: jyknight, jrtc27

Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337370 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE] Asm: Integer divide instructions.
Sander de Smalen [Wed, 18 Jul 2018 09:17:29 +0000 (09:17 +0000)]
[AArch64][SVE] Asm: Integer divide instructions.

This patch adds the following predicated instructions:

  UDIV    Unsigned divide active elements
  UDIVR   Unsigned divide active elements, reverse form.
  SDIV    Signed divide active elements
  SDIVR   Signed divide active elements, reverse form.

e.g.
  udiv  z0.s, p0/m, z0.s, z1.s
    (unsigned divide active elements in z0 by z1, store result in z0)

  sdivr z0.s, p0/m, z0.s, z1.s
    (signed divide active elements in z1 by z0, store result in z0)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337369 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix -Wdocumentation warning. NFCI.
Simon Pilgrim [Wed, 18 Jul 2018 09:10:18 +0000 (09:10 +0000)]
Fix -Wdocumentation warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337368 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix -Wdocumentation warning. NFCI.
Simon Pilgrim [Wed, 18 Jul 2018 09:07:54 +0000 (09:07 +0000)]
Fix -Wdocumentation warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337367 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Export the LLVM_LINK_LLVM_DYLIB setting
Philip Pfaffe [Wed, 18 Jul 2018 08:53:31 +0000 (08:53 +0000)]
[CMake] Export the LLVM_LINK_LLVM_DYLIB setting

Summary:
When building out-of-tree tools, there are several macros available to
automate linking against llvm. An examples is `add_llvm_executable`, or
the clang variant of this.

These macros use the LLVM_LINK_LLVM_DYLIB option to decide whether to
link against libraries defined by setting LLVM_LINK_COMPONENTS or to
link against libLLVM instead. Currently this is problematic in
out-of-tree targets, because they cannot identify whether this option is
required or even available. If the option was enabled in LLVM's own
build, the clang libraries are built against libLLVM, so a client
linking against those must link against it too. On the other hand the
client can't just always link against it, because it might not be
available.

This is related to D44391, but that change assumed the client knew
whether they wanted the dylib or not.

Reviewers: mgorny, beanz, labath

Reviewed By: mgorny

Subscribers: bollu, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337366 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][InstCombine] i65 tests for 'check for [no] signed truncation' pattern
Roman Lebedev [Wed, 18 Jul 2018 08:49:51 +0000 (08:49 +0000)]
[NFC][InstCombine] i65 tests for 'check for [no] signed truncation' pattern

Those initially broke chromium build:
https://bugs.llvm.org/show_bug.cgi?id=38204 and
https://crbug.com/864832

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337364 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] - Stop reporting bogus section IDs.
George Rimar [Wed, 18 Jul 2018 08:34:35 +0000 (08:34 +0000)]
[llvm-objdump] - Stop reporting bogus section IDs.

Imagine we have a file with few sections, and one of them is .foo
with index N != 0.

Problem is that when llvm-objdump is given a -section=.foo parameter
it lists .foo as a section at index 0. That makes impossible to write
test cases which needs to find the index of the particular section,
while ignoring dumping of others.

The patch fixes that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337361 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.
George Rimar [Wed, 18 Jul 2018 08:19:58 +0000 (08:19 +0000)]
[llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.

http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html

says that e_shnum and/or e_shstrndx may have special values if
"the number of sections is greater than or equal to SHN_LORESERVE" or
"the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00)"

Previously llvm-readobj was unable to dump such files, patch changes that.

I had to add a precompiled test case because it does not seem possible to
prepare a test using yaml2obj or llvm-mc (not clear how to make .shstrtab
to have index >= SHN_LORESERVE).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337360 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert test changes part of "Revert "[InstCombine] Fold 'check for [no] signed trunca...
Roman Lebedev [Wed, 18 Jul 2018 08:15:13 +0000 (08:15 +0000)]
Revert test changes part of "Revert "[InstCombine] Fold 'check for [no] signed truncation' pattern""

We want the test to remain good anyway.
I think the fix is incoming.

This reverts part of commit rL337344.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337359 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][SVE] Asm: Support for integer MUL instructions.
Sander de Smalen [Wed, 18 Jul 2018 08:10:03 +0000 (08:10 +0000)]
[AArch64][SVE] Asm: Support for integer MUL instructions.

This patch adds the following instructions:
  MUL   - multiply vectors, e.g.
    mul z0.h, p0/m, z0.h, z1.h
        - multiply with immediate, e.g.
    mul z0.h, z0.h, #127

  SMULH - signed multiply returning high half, e.g.
    smulh z0.h, p0/m, z0.h, z1.h

  UMULH - unsigned multiply returning high half, e.g.
    umulh z0.h, p0/m, z0.h, z1.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337358 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Enable commuting of VUNPCKHPD to VMOVLHPS to enable load folding by using VMOVL...
Craig Topper [Wed, 18 Jul 2018 07:31:32 +0000 (07:31 +0000)]
[X86] Enable commuting of VUNPCKHPD to VMOVLHPS to enable load folding by using VMOVLPS with a modified address.

This required an annoying amount of tablegen multiclass changes to make only VUNPCKHPDZ128rr commutable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337357 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test case for missed opportunity to commute vunpckhpd to enable use of...
Craig Topper [Wed, 18 Jul 2018 07:31:30 +0000 (07:31 +0000)]
[X86] Add test case for missed opportunity to commute vunpckhpd to enable use of vmovlps to fold a load.

We do this transform for SSE, but not AVX or AVX512VL.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337356 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Regenerate fma.ll checks using current version of the script which produces...
Craig Topper [Wed, 18 Jul 2018 07:08:28 +0000 (07:08 +0000)]
[X86] Regenerate fma.ll checks using current version of the script which produces different regular expressions on spills and reloads. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337354 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Wed, 18 Jul 2018 06:04:43 +0000 (06:04 +0000)]
[NFC] fix trivial typos in comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337351 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix build failures from r337347, found by clang
Justin Hibbits [Wed, 18 Jul 2018 05:19:25 +0000 (05:19 +0000)]
Fix build failures from r337347, found by clang

* Delete a no-longer-used override, and mark the other
getRegisterTypeForCallingConv() as override.
* SPE only supports i32, not i64, as the internal type, so simply remove
the type check, so that DestReg and Opc are provably always set.

GCC 6.4 did not warn about either of the above.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337350 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove patterns that mix X86ISD::MOVLHPS/MOVHLPS with v2i64/v2f64 types.
Craig Topper [Wed, 18 Jul 2018 05:10:53 +0000 (05:10 +0000)]
[X86] Remove patterns that mix X86ISD::MOVLHPS/MOVHLPS with v2i64/v2f64 types.

The X86ISD::MOVLHPS/MOVHLPS should now only be emitted in SSE1 only. This means that the v2i64/v2f64 types would be illegal thus we don't need these patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337349 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Generate v2f64 X86ISD::UNPCKL/UNPCKH instead of X86ISD::MOVLHPS/MOVHLPS for...
Craig Topper [Wed, 18 Jul 2018 05:10:51 +0000 (05:10 +0000)]
[X86] Generate v2f64 X86ISD::UNPCKL/UNPCKH instead of X86ISD::MOVLHPS/MOVHLPS for unary v2f64 {0,0} and {1,1} shuffles with SSE2.

I'm trying to restrict the MOVLHPS/MOVHLPS ISD nodes to SSE1 only. With SSE2 we can use unpcks. I believe this will allow some patterns to be cleaned up to require fewer bitcasts.

I've put in an odd isel hack to still select MOVHLPS instruction from the unpckh node to avoid changing tests and because movhlps is a shorter encoding. Ideally we'd do execution domain switching on this, but the operands are in the wrong order and are tied. We might be able to try a commute in the domain switching using custom code.

We already support domain switching for UNPCKLPD and MOVLHPS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337348 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoIntroduce codegen for the Signal Processing Engine
Justin Hibbits [Wed, 18 Jul 2018 04:25:10 +0000 (04:25 +0000)]
Introduce codegen for the Signal Processing Engine

Summary:
The Signal Processing Engine (SPE) is found on NXP/Freescale e500v1,
e500v2, and several e200 cores.  This adds support targeting the e500v2,
as this is more common than the e500v1, and is in SoCs still on the
market.

This patch is very intrusive because the SPE is binary incompatible with
the traditional FPU.  After discussing with others, the cleanest
solution was to make both SPE and FPU features on top of a base PowerPC
subset, so all FPU instructions are now wrapped with HasFPU predicates.

Supported by this are:
* Code generation following the SPE ABI at the LLVM IR level (calling
conventions)
* Single- and Double-precision math at the level supported by the APU.

Still to do:
* Vector operations
* SPE intrinsics

As this changes the Callee-saved register list order, one test, which
tests the precise generated code, was updated to account for the new
register order.

Reviewed by: nemanjai
Differential Revision: https://reviews.llvm.org/D44830

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337347 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoComplete the SPE instruction set patterns
Justin Hibbits [Wed, 18 Jul 2018 04:24:57 +0000 (04:24 +0000)]
Complete the SPE instruction set patterns

This is the lead-up to having SPE codegen.  Add the rest of the
instructions, along with MC tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337346 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd PowerPC e500(v2) core scheduler and directives.
Justin Hibbits [Wed, 18 Jul 2018 04:24:49 +0000 (04:24 +0000)]
Add PowerPC e500(v2) core scheduler and directives.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337345 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[InstCombine] Fold 'check for [no] signed truncation' pattern"
Bob Haarman [Wed, 18 Jul 2018 02:18:28 +0000 (02:18 +0000)]
Revert "[InstCombine] Fold 'check for [no] signed truncation' pattern"

This reverts r337190 (and a few follow-up commits), which caused the
Chromium build to fail. See
https://bugs.llvm.org/show_bug.cgi?id=38204 and
https://crbug.com/864832

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337344 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCodeGen: Don't create address significance table entries for thread-local variables.
Peter Collingbourne [Wed, 18 Jul 2018 00:21:40 +0000 (00:21 +0000)]
CodeGen: Don't create address significance table entries for thread-local variables.

The presence of these symbols in the symbol table can cause symbol type
mismatch errors (or undefined symbol errors on emulated TLS targets)
and they can't be ICF'd anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337338 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][llvm-objcopy] Cleanup namespace usage in llvm-objcopy.
Puyan Lotfi [Wed, 18 Jul 2018 00:10:51 +0000 (00:10 +0000)]
[NFC][llvm-objcopy] Cleanup namespace usage in llvm-objcopy.

Nest any classes not used outside of a file into anon. Nest any classes used
across files in llvm-objcopy into namespace llvm::objcopy.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337337 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove the vector alignment requirement from the patterns added in r337320.
Craig Topper [Tue, 17 Jul 2018 23:26:20 +0000 (23:26 +0000)]
[X86] Remove the vector alignment requirement from the patterns added in r337320.

The resulting instruction will only load 64 bits so alignment isn't required.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337334 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCodeGen: Add a target option for emitting .addrsig directives for all address-signifi...
Peter Collingbourne [Tue, 17 Jul 2018 22:40:08 +0000 (22:40 +0000)]
CodeGen: Add a target option for emitting .addrsig directives for all address-significant symbols.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337331 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMC: Implement support for new .addrsig and .addrsig_sym directives.
Peter Collingbourne [Tue, 17 Jul 2018 22:17:18 +0000 (22:17 +0000)]
MC: Implement support for new .addrsig and .addrsig_sym directives.

Part of the address-significance tables proposal:
http://lists.llvm.org/pipermail/llvm-dev/2018-May/123514.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337328 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LangRef] Clarify semantics of load metadata.
Eli Friedman [Tue, 17 Jul 2018 20:38:11 +0000 (20:38 +0000)]
[LangRef] Clarify semantics of load metadata.

We need to explicitly state what happens when an invariant promised by
load metadata is violated at runtime, since it's come up repeatedly.

It's possible we want to specify that the result of the load is poison
in some cases, rather than undefined behavior, if the constraint is
violated. That would allow preserving the metadata when the load is
hoisted, but doesn't allow propagating metadata based on control flow.
We currently do transforms based on control flow for nonnull metadata
(in PromoteMemToReg).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337325 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LangRef] nnan and ninf produce poison.
Eli Friedman [Tue, 17 Jul 2018 20:31:42 +0000 (20:31 +0000)]
[LangRef] nnan and ninf produce poison.

Clarify that violating nnan and ninf can lead to undefined behavior.
This allows more aggressive optimizations based on those assumptions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337323 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LangRef] Clarify which fast-math flags affect fcmp.
Eli Friedman [Tue, 17 Jul 2018 20:28:31 +0000 (20:28 +0000)]
[LangRef] Clarify which fast-math flags affect fcmp.

nsz has no effect due to the way fcmp is defined; +0 and -0 compare
equal anyway. reassoc could have the obvious effect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337322 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add patterns for folding full vector load into MOVHPS and MOVLPS with SSE1...
Craig Topper [Tue, 17 Jul 2018 20:16:18 +0000 (20:16 +0000)]
[X86] Add patterns for folding full vector load into MOVHPS and MOVLPS with SSE1 only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337320 91177308-0d34-0410-b5e6-96231b3b80d8