OSDN Git Service

android-x86/external-llvm.git
6 years ago[dsymutil] Emit valid debug locations when no symbol flags are set
Francis Ricci [Mon, 9 Oct 2017 17:27:47 +0000 (17:27 +0000)]
[dsymutil] Emit valid debug locations when no symbol flags are set

Summary:
swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.

Reviewers: aprantl, friss, JDevlieghere

Subscribers: llvm-commits

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

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

6 years ago[SLP] Test for wrongly vectorized set of extractelements, NFC.
Alexey Bataev [Mon, 9 Oct 2017 17:14:03 +0000 (17:14 +0000)]
[SLP] Test for wrongly vectorized set of extractelements, NFC.

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

6 years ago[TableGen] remove make_range where not necessary
Javed Absar [Mon, 9 Oct 2017 16:21:25 +0000 (16:21 +0000)]
[TableGen] remove make_range where not necessary

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

6 years ago[llvm-rc] Have the tokenizer discard single & block comments.
Zachary Turner [Mon, 9 Oct 2017 15:46:13 +0000 (15:46 +0000)]
[llvm-rc] Have the tokenizer discard single & block comments.

This allows rc files to have comments.  Eventually we should
just use clang's c preprocessor, but that's a bit larger
effort for minimal gain, and this is straightforward.

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

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

6 years ago[DAG] combine assertsexts around a trunc
Sanjay Patel [Mon, 9 Oct 2017 15:22:20 +0000 (15:22 +0000)]
[DAG] combine assertsexts around a trunc

This was a suggested follow-up to:
D37017 / https://reviews.llvm.org/rL313577

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

6 years ago[AArch64] Improve codegen for inverted overflow checking intrinsics
Amara Emerson [Mon, 9 Oct 2017 15:15:09 +0000 (15:15 +0000)]
[AArch64] Improve codegen for inverted overflow checking intrinsics

E.g. if we have a (xor(overflow-bit), 1) where overflow-bit comes from an
intrinsic like llvm.sadd.with.overflow then we can kill the xor and use the
inverted condition code for the CSEL.

rdar://28495949

Reviewed By: kristof.beyls

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

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

6 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Mon, 9 Oct 2017 15:01:58 +0000 (15:01 +0000)]
[x86] regenerate test checks; NFC

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

6 years ago[AArch64] fix typos in test assertions
Sanjay Patel [Mon, 9 Oct 2017 01:29:54 +0000 (01:29 +0000)]
[AArch64] fix typos in test assertions

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

6 years ago[X86] Remove a setLoadExtAction from the AVX512 section that uses an AVX512BW type...
Craig Topper [Mon, 9 Oct 2017 01:05:16 +0000 (01:05 +0000)]
[X86] Remove a setLoadExtAction from the AVX512 section that uses an AVX512BW type and is alraedy present in the AVX512BW section.

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

6 years ago[X86] Enable extended comparison predicate support for SETUEQ/SETONE when targeting...
Craig Topper [Mon, 9 Oct 2017 01:05:15 +0000 (01:05 +0000)]
[X86] Enable extended comparison predicate support for SETUEQ/SETONE when targeting AVX instructions.

We believe that despite AMD's documentation, that they really do support all 32 comparision predicates under AVX.

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

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

6 years agoRemove unused variables. No functionality change.
Benjamin Kramer [Sun, 8 Oct 2017 21:23:02 +0000 (21:23 +0000)]
Remove unused variables. No functionality change.

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

6 years ago[X86][SSE] Don't call combineTo inside combineX86ShufflesRecursively. NFCI.
Simon Pilgrim [Sun, 8 Oct 2017 20:58:14 +0000 (20:58 +0000)]
[X86][SSE] Don't call combineTo inside combineX86ShufflesRecursively. NFCI.

Return the combined shuffle from combineX86ShufflesRecursively and perform the combineTo in the caller.

Makes it easier for future patches to use this in functions that aren't actually shuffles themselves.

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

6 years agoTidyup with clang-format. NFCI.
Simon Pilgrim [Sun, 8 Oct 2017 19:24:30 +0000 (19:24 +0000)]
Tidyup with clang-format. NFCI.

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

6 years ago[X86][SSE] Add test case for PR27708
Simon Pilgrim [Sun, 8 Oct 2017 19:18:10 +0000 (19:18 +0000)]
[X86][SSE] Add test case for PR27708

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

6 years agoRemove unused variables. No functionality change.
Benjamin Kramer [Sun, 8 Oct 2017 19:11:02 +0000 (19:11 +0000)]
Remove unused variables. No functionality change.

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

6 years ago[X86] Regenerate fast-isel-select-pseudo-cmov.ll to prepare for D38609.
Craig Topper [Sun, 8 Oct 2017 17:54:50 +0000 (17:54 +0000)]
[X86] Regenerate fast-isel-select-pseudo-cmov.ll to prepare for D38609.

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

6 years ago[TableGen] Simplify, add range_loop in CodeGenSchedule
Javed Absar [Sun, 8 Oct 2017 17:23:30 +0000 (17:23 +0000)]
[TableGen] Simplify, add range_loop in CodeGenSchedule

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

6 years ago[X86] getTargetConstantBitsFromNode - add support for decoding scalar constants
Simon Pilgrim [Sun, 8 Oct 2017 17:21:18 +0000 (17:21 +0000)]
[X86] getTargetConstantBitsFromNode - add support for decoding scalar constants

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

6 years ago[X86] Prefer MOVSS/SD over BLENDI during legalization. Remove BLENDI versions of...
Craig Topper [Sun, 8 Oct 2017 16:57:23 +0000 (16:57 +0000)]
[X86] Prefer MOVSS/SD over BLENDI during legalization. Remove BLENDI versions of scalar arithmetic patterns

Summary:
We currently disable some converting of shuffles to MOVSS/MOVSD during legalization if SSE41 is enabled. But later during shuffle combining we go back to prefering MOVSS/MOVSD.

Additionally we have patterns that look for BLENDIs to detect scalar arithmetic operations. I believe due to the combining using MOVSS/MOVSD these are unnecessary.

Interestingly, we still codegen blend instructions even though lowering/isel emit movss/movsd instructions. Turns out machine CSE commutes them to blend, and then commuting those blends back into blends that are equivalent to the original movss/movsd.

This patch fixes the inconsistency in legalization to prefer MOVSS/MOVSD. The one test change was caused by this change. The problem is that we have integer types and are mostly selecting integer instructions except for the shufps. This shufps forced the execution domain, but the vpblendw couldn't have its domain changed with a naive instruction swap. We could fix this by special casing VPBLENDW based on the immediate to widen the element type.

The rest of the patch is removing all the excess scalar patterns.

Long term we should probably add isel patterns to make MOVSS/MOVSD emit blends directly instead of relying on the double commute. We may also want to consider emitting movss/movsd for optsize. I also wonder if we should still use the VEX encoded blendi instructions even with AVX512. Blends have better throughput, and that may outweigh the register constraint.

Reviewers: RKSimon, zvi

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years agoMake more constructors constexpr or use =default.
Benjamin Kramer [Sun, 8 Oct 2017 15:59:35 +0000 (15:59 +0000)]
Make more constructors constexpr or use =default.

This lets the compiler reason about the type more easily. No
functionality change intended.

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

6 years ago[AArch64][GlobalISel] Add a test case for G_PHI of p0 instruction selection.
Amara Emerson [Sun, 8 Oct 2017 15:29:35 +0000 (15:29 +0000)]
[AArch64][GlobalISel] Add a test case for G_PHI of p0 instruction selection.

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

6 years ago[AArch64][GlobalISel] Add a test case for G_PHI of p0 regbank selection.
Amara Emerson [Sun, 8 Oct 2017 15:29:31 +0000 (15:29 +0000)]
[AArch64][GlobalISel] Add a test case for G_PHI of p0 regbank selection.

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

6 years ago[AArch64][GlobalISel] Make G_PHI of p0 types legal.
Amara Emerson [Sun, 8 Oct 2017 15:29:11 +0000 (15:29 +0000)]
[AArch64][GlobalISel] Make G_PHI of p0 types legal.

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

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

6 years ago[X86][XOP] Add XOP oddshuffles tests
Simon Pilgrim [Sun, 8 Oct 2017 12:58:15 +0000 (12:58 +0000)]
[X86][XOP] Add XOP oddshuffles tests

XOP codegen is often different to generic AVX - thank you vpperm!

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

6 years ago[X86][SKX] Adding the scheduling information for the SKX target.
Gadi Haber [Sun, 8 Oct 2017 12:52:54 +0000 (12:52 +0000)]
[X86][SKX] Adding the scheduling information for the SKX target.

Adding the scheduling information for the SkylakeServer (SKX) target.

This patch adds the instruction scheduling information for the SkylakeServer (SKX) architecture target by adding the file X86SchedSkylakeServer.td located under the X86 Target.
We used the scheduling information retrieved from the Skylake architects in order to create the file.
The scheduling information includes latency, number of micro-Ops and used ports by each SKL instruction.

The patch continues the scheduling replacement and insertion effort started with the SNB target in r310792, the HSW target in r311879 and the SkylakeClient (SKL) target in rL313613.

Please expect some performance fluctuations due to code alignment effects.

Reviewers: zvi, RKSimon, craig.topper, chandlerc, aymanmu
Differential Revision: https://reviews.llvm.org/D38443

Change-Id: I5c228fcc09e9e5a99b6116e62b356c4f9b971185

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

6 years ago[X86] Add missing entries in 'MemoryFoldTable2Addr' to get complete form of the table.
Ayman Musa [Sun, 8 Oct 2017 09:46:50 +0000 (09:46 +0000)]
[X86] Add missing entries in 'MemoryFoldTable2Addr' to get complete form of the table.

Get the folding table 'MemoryFoldTable2Addr' to a complete state as part of the process explained in https://reviews.llvm.org/D38028

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

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

6 years ago[X86][TableGen] Recommitting the X86 memory folding tables TableGen backend while...
Ayman Musa [Sun, 8 Oct 2017 09:20:32 +0000 (09:20 +0000)]
[X86][TableGen] Recommitting the X86 memory folding tables TableGen backend while disabling it by default.

After the original commit ([[ https://reviews.llvm.org/rL304088 | rL304088 ]]) was reverted, a discussion in llvm-dev was opened on 'how to accomplish this task'.
In the discussion we concluded that the best way to achieve our goal (which is to automate the folding tables and remove the manually maintained tables) is:

 # Commit the tablegen backend disabled by default.

 # Proceed with an incremental updating of the manual tables - while checking the validity of each added entry.

 # Repeat previous step until we reach a state where the generated and the manual tables are identical. Then we can safely remove the manual tables and include the generated tables instead.

 # Schedule periodical (1 week/2 weeks/1 month) runs of the pass:

   - if changes appear (new entries):
      - make sure the entries are legal
      - If they are not, mark them as illegal to folding
   - Commit the changes (if there are any).

CMake flag added for this purpose is "X86_GEN_FOLD_TABLES". Building with this flags will run the pass and emit the X86GenFoldTables.inc file under build/lib/Target/X86/ directory which is a good reference for any developer who wants to take part in the effort of completing the current folding tables.

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

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

6 years ago[X86] Stop LowerSIGN_EXTEND_AVX512 from creating v8i16/v16i16/v16i8 vselects with...
Craig Topper [Sun, 8 Oct 2017 08:50:59 +0000 (08:50 +0000)]
[X86] Stop LowerSIGN_EXTEND_AVX512 from creating v8i16/v16i16/v16i8 vselects with a v8i1/v16i1 condition when BWI is not available.

Some of the tests in vector-shuffle-v1.ll would get into an infinite loop without this.

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

6 years ago[X86] Add new attribute to X86 instructions to enable marking them as "not memory...
Ayman Musa [Sun, 8 Oct 2017 08:32:56 +0000 (08:32 +0000)]
[X86] Add new attribute to X86 instructions to enable marking them as "not memory foldable"

This attribute will be used in a tablegen backend that generated the X86 memory folding tables which will be added in a future pass.
Instructions with this attribute unset will be excluded from the full set of X86 instructions available for the pass.

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

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

6 years ago[X86] Simplify some code in getInsertVINSERTImmediate and getExtractVEXTRACTImmediate...
Craig Topper [Sun, 8 Oct 2017 01:33:42 +0000 (01:33 +0000)]
[X86] Simplify some code in getInsertVINSERTImmediate and getExtractVEXTRACTImmediate. NFC

Replace one of the divides with a multiply.

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

6 years ago[X86] If we see an insert of a bitcast into zero vector, canonicalize it to move...
Craig Topper [Sun, 8 Oct 2017 01:33:41 +0000 (01:33 +0000)]
[X86] If we see an insert of a bitcast into zero vector, canonicalize it to move the bitcast to the other side of the insert.

This improves detection of zeroing of upper bits during isel.

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

6 years ago[X86] Remove ISD::INSERT_SUBVECTOR handling from combineBitcastForMaskedOp. Add isel...
Craig Topper [Sun, 8 Oct 2017 01:33:40 +0000 (01:33 +0000)]
[X86] Remove ISD::INSERT_SUBVECTOR handling from combineBitcastForMaskedOp. Add isel patterns to make up for it.

This will allow for some flexibility in canonicalizing bitcasts around insert_subvector.

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

6 years ago[X86] Use getConstantOperandVal to simplify some code. NFC
Craig Topper [Sun, 8 Oct 2017 01:33:38 +0000 (01:33 +0000)]
[X86] Use getConstantOperandVal to simplify some code. NFC

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

6 years ago[X86][SSE] Match bitcasted BUILD_VECTOR of constants for v2i64 shifts on 64-bit targe...
Simon Pilgrim [Sat, 7 Oct 2017 17:57:22 +0000 (17:57 +0000)]
[X86][SSE] Match bitcasted BUILD_VECTOR of constants for v2i64 shifts on 64-bit targets (PR34855)

Extension to rL315155, generate constant shifts on 64-bits as well as 32-bits.

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

6 years ago[X86][SSE] Match bitcasted v4i32 BUILD_VECTORS for v2i64 shifts on 64-bit targets...
Simon Pilgrim [Sat, 7 Oct 2017 17:42:17 +0000 (17:42 +0000)]
[X86][SSE] Match bitcasted v4i32 BUILD_VECTORS for v2i64 shifts on 64-bit targets (PR34855)

We were already doing this for 32-bit targets, but we can generate these on 64-bits as well.

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

6 years ago[SelectionDAG} Use KnownBits::isUnknown and hasConflict. NFC
Craig Topper [Sat, 7 Oct 2017 17:07:48 +0000 (17:07 +0000)]
[SelectionDAG} Use KnownBits::isUnknown and hasConflict. NFC

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

6 years ago[X86] Add X86ISD::CMOV to computeKnownBitsForTargetNode and ComputeNumSignBitsForTarg...
Craig Topper [Sat, 7 Oct 2017 16:51:19 +0000 (16:51 +0000)]
[X86] Add X86ISD::CMOV to computeKnownBitsForTargetNode and ComputeNumSignBitsForTargetNode.

Summary: Implementations based on ISD::SELECT.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years ago[InstSimplify] add tests to show we can do better at folding poison; NFC
Sanjay Patel [Sat, 7 Oct 2017 15:39:06 +0000 (15:39 +0000)]
[InstSimplify] add tests to show we can do better at folding poison; NFC

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

6 years ago[TableGen] Avoid repeated find calls in CodeGenDAGPatterns getters. NFCI.
Simon Pilgrim [Sat, 7 Oct 2017 14:34:24 +0000 (14:34 +0000)]
[TableGen] Avoid repeated find calls in CodeGenDAGPatterns getters. NFCI.

The assertion tests were using count() instead of testing the find result, resulting in double the number of searches in debug/assert builds.

Instead, call find once (like the release builds do) and assert the result against end().

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

6 years ago[X86][SSE] Improve shuffling combining with horizontal operations
Simon Pilgrim [Sat, 7 Oct 2017 12:42:23 +0000 (12:42 +0000)]
[X86][SSE] Improve shuffling combining with horizontal operations

Recognise cases when we can merge the shuffles with their horizontal (HADD/HSUB/PACK) instruction inputs.

Replaces an older implementation which performed some of this during lowering, expanding an existing target shuffle combine stage instead.

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

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

6 years ago[TableGen] Avoid unnecessary std::string creations
Simon Pilgrim [Sat, 7 Oct 2017 12:08:43 +0000 (12:08 +0000)]
[TableGen] Avoid unnecessary std::string creations

Avoid unnecessary std::string creations in the TreePredicateFn getters and in CodeGenDAGPatterns::getSDNodeNamed

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

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

6 years ago[X86] Update an outdated comment about SjLj
Martin Storsjo [Sat, 7 Oct 2017 06:00:32 +0000 (06:00 +0000)]
[X86] Update an outdated comment about SjLj

The SjLj intrinsics in the X86 backend are intended for use with
SjLj exception handling as well, since SVN r271244.

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

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

6 years ago[X86] Correct result type for the flag result of RDSEED and RDRAND nodes. Correct...
Craig Topper [Sat, 7 Oct 2017 05:11:59 +0000 (05:11 +0000)]
[X86] Correct result type for the flag result of RDSEED and RDRAND nodes. Correct the CC type for the CMOV used with RDSEED/RDRAND.

The flag result was MVT::Glue, but should be MVT::i32. The CC type was MVT::i8, but should be MVT::i32.

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

6 years ago[MachineOutliner] Disable outlining from LinkOnceODRs by default
Jessica Paquette [Sat, 7 Oct 2017 00:16:34 +0000 (00:16 +0000)]
[MachineOutliner] Disable outlining from LinkOnceODRs by default

Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!

To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.

Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.

Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda

Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic

Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb

Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.

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

6 years ago[InstCombine] use correct type when propagating constant condition in simplifyDivRemO...
Sanjay Patel [Fri, 6 Oct 2017 23:43:06 +0000 (23:43 +0000)]
[InstCombine] use correct type when propagating constant condition in simplifyDivRemOfSelectWithZeroOp (PR34856)

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

6 years ago[llvm-rc] Fix some endianness errors.
Zachary Turner [Fri, 6 Oct 2017 23:21:43 +0000 (23:21 +0000)]
[llvm-rc] Fix some endianness errors.

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

6 years ago[InstCombine] rename SimplifyDivRemOfSelect to be clearer, add comments, simplify...
Sanjay Patel [Fri, 6 Oct 2017 23:20:16 +0000 (23:20 +0000)]
[InstCombine] rename SimplifyDivRemOfSelect to be clearer, add comments, simplify code; NFCI

There's at least one bug here - this code can fail with vector types (PR34856).
It's also being called for FREM; I'm still trying to understand how that is valid.

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

6 years ago[AVX512] Fix TERNLOG when folding broadcast
Cameron McInally [Fri, 6 Oct 2017 22:31:29 +0000 (22:31 +0000)]
[AVX512] Fix TERNLOG when folding broadcast

Patch to fix ternlog instructions with a folded
broadcast. The broadcast decorator, e.g. {1toX}, was missing.

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

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

6 years ago[dwarfdump] Verify that unit type matches root DIE
Jonas Devlieghere [Fri, 6 Oct 2017 22:27:31 +0000 (22:27 +0000)]
[dwarfdump] Verify that unit type matches root DIE

This patch adds two new verifiers:

  - It checks that the root DIE of a CU is actually a valid unit DIE.
    (based on its tag)
  - For DWARF5 which contains a unit type int he CU header, it checks that
    this matches the type of the unit DIE.

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

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

6 years ago[llvm-rc] Implement escape sequences in .rc files.
Zachary Turner [Fri, 6 Oct 2017 22:05:15 +0000 (22:05 +0000)]
[llvm-rc] Implement escape sequences in .rc files.

This allows the escape sequences (\a, \n, \r, \t, \\, \x[0-9a-f]*,
\[0-7]*, "") to appear in .rc scripts. These are parsed and output in
the same way as it's done in original MS implementation.

The way these sequences are processed depends on the type of the
resource it resides in, and on whether the user declared the string to
be "wide" or "narrow".

I tried to maintain the maximum compatibility with the original tool
(and fail in some erroneous situations that are accepted by .rc).
However, there are some (extremely rare) cases where Microsoft tool
outputs nonsense. I found it infeasible to detect such casses.

Patch by Marek Sokolowski

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

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

6 years ago[llvm-rc] Serialize user-defined resources to .res files.
Zachary Turner [Fri, 6 Oct 2017 21:52:15 +0000 (21:52 +0000)]
[llvm-rc] Serialize user-defined resources to .res files.

This allows rc to serialize user-defined resources, as
documented at:

msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx

Escape sequences are yet unavailable, and are to be added in one of
child patches.

Patch by: Marek Sokolowski

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

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

6 years ago[llvm-rc] Serialize STRINGTABLE statements to .res file.
Zachary Turner [Fri, 6 Oct 2017 21:30:55 +0000 (21:30 +0000)]
[llvm-rc] Serialize STRINGTABLE statements to .res file.

This allows llvm-rc to serialize STRINGTABLE resources.

These are output in an unusual way: we locate them at the end of the
file, and strings are merged into bundles of max 16 strings, depending
on their IDs, language, and characteristics.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381050.aspx

Patch by: Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38420

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

6 years ago[llvm-rc] Serialize VERSIONINFO resources to .res files.
Zachary Turner [Fri, 6 Oct 2017 21:26:06 +0000 (21:26 +0000)]
[llvm-rc] Serialize VERSIONINFO resources to .res files.

This is now able to dump VERSIONINFO resources.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx

Differential Revision: https://reviews.llvm.org/D38410
Patch by: Marek Sokolowski

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

6 years ago[llvm-rc] Serialize CURSOR and ICON resources to .res
Zachary Turner [Fri, 6 Oct 2017 21:25:44 +0000 (21:25 +0000)]
[llvm-rc] Serialize CURSOR and ICON resources to .res

This is part 6 of llvm-rc serialization.

This adds ability to output cursors and icons as resources.

Unfortunately, we can't just copy .cur or .ico files to output - as each
file might contain multiple images, each of them needs to be unpacked
and stored as a separate resource. This forces us to parse cursor and
icon contents. (Fortunately, these formats are pretty similar and can be
processed by mostly common code).

As test files are binary, here is a short explanation of .cur and .ico
files stored:

cursor.cur, cursor-8.cur, cursor-32.cur are sample correct cursor files,
differing in their bit depth.

icon-old.ico, icon-new.ico are sample correct icon files;

icon-png.ico is a sample correct icon file in PNG format (instead of
usual BMP);

cursor-eof.cur is an incorrect cursor file - this is cursor.cur with
some of its final bytes removed.

cursor-bad-offset.cur is an incorrect cursor file - image header states
that image data begins at offset 0xFFFFFFFF.

Sample correct cursors and icons were created by Nico Weber.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37878

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

6 years agoRevert "Roll forward r314928"
Reid Kleckner [Fri, 6 Oct 2017 21:17:51 +0000 (21:17 +0000)]
Revert "Roll forward r314928"

This appears to be miscompiling Clang, as shown on two Windows bootstrap
bots:
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/7611
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/6870

Nothing else is in the blame list. Both emit errors on this valid code
in the Windows ucrt headers:

C:\...\ucrt\malloc.h:95:32: error: invalid operands to binary expression ('char *' and 'int')
            _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE;
                   ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~

I am attempting to reproduce this now.

This reverts r315044

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

6 years ago[llvm-rc] Add optional serialization support for DIALOG(EX) resources.
Zachary Turner [Fri, 6 Oct 2017 20:51:20 +0000 (20:51 +0000)]
[llvm-rc] Add optional serialization support for DIALOG(EX) resources.

This is part 5 of llvm-rc serialization support.

This allows DIALOG and DIALOGEX to serialize if dialog-specific optional
statements are provided. These are (as of now): CAPTION, FONT, and
STYLE.

Notably, FONT statement can take more than two arguments when describing
DIALOGEX resources (as in
msdn.microsoft.com/en-us/library/windows/desktop/aa381013.aspx). I made
some changes to the parser to reflect this fact.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37864

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

6 years agoUnify spelling.
Adrian Prantl [Fri, 6 Oct 2017 20:24:35 +0000 (20:24 +0000)]
Unify spelling.

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

6 years agollvm-dwarfdump: Add an option to collect debug info quality metrics.
Adrian Prantl [Fri, 6 Oct 2017 20:24:34 +0000 (20:24 +0000)]
llvm-dwarfdump: Add an option to collect debug info quality metrics.

At the last LLVM dev meeting we had a debug info for optimized code
BoF session. In that session I presented some graphs that showed how
the quality of the debug info produced by LLVM changed over the last
couple of years. This is a cleaned up version of the patch I used to
collect the this data. It is implemented as an extension of
llvm-dwarfdump, adding a new --statistics option. The intended
use-case is to automatically run this on the debug info produced by,
e.g., our bots, to identify eyebrow-raising changes or regressions
introduced by new transformations that we could act on.

In the current form, two kinds of data are being collected:

- The number of variables that have a debug location versus the number
  of variables in total (this takes into account inlined instances of
  the same function, so if a variable is completely missing form only
  one instance it will be found).

- The PC range covered by variable location descriptions versus the PC
  range of all variables' containing lexical scopes.

The output format is versioned and extensible, so I'm looking forward
to both bug fixes and ideas for other data that would be interesting
to track.

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

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

6 years ago[GlobalISel] Fix legalizer trying to process a deleted instruction.
Amara Emerson [Fri, 6 Oct 2017 19:24:15 +0000 (19:24 +0000)]
[GlobalISel] Fix legalizer trying to process a deleted instruction.

In some cases an instruction is deleted from the block during combining,
however it can still exist in the legalizer worklist.

This change modifies the combiner routines to add the given MI to the
dead instruction list rather than trying to remove it from the block
themselves. The responsibility is then on the caller to delete the instruction
from the block and any worklists.

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

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

6 years ago[PEI] Remove required properties and use 'if' instead of std::function
Reid Kleckner [Fri, 6 Oct 2017 18:21:19 +0000 (18:21 +0000)]
[PEI] Remove required properties and use 'if' instead of std::function

Summary:
After r303360, we initialize UsesCalleeSaves in runOnMachineFunction,
which runs after getRequiredProperties. UsesCalleeSaves was initialized
to 'false', so getRequiredProperties would always return an empty set.
We don't have a TargetMachine available early anymore after r303360.
Just removing the requirement of NoVRegs seems to make things work, so
let's do that.

Reviewers: thegameg, dschuff, MatzeB

Subscribers: hiraditya, llvm-commits

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

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

6 years agoRevert "[dsymutil] Emit valid debug locations when no symbol flags are set"
Francis Ricci [Fri, 6 Oct 2017 18:19:52 +0000 (18:19 +0000)]
Revert "[dsymutil] Emit valid debug locations when no symbol flags are set"

This reverts commit r315082, which fails on non-darwin buildbots.

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

6 years agoBitcode: add an auto-upgrade for LTO section name
Saleem Abdulrasool [Fri, 6 Oct 2017 18:06:59 +0000 (18:06 +0000)]
Bitcode: add an auto-upgrade for LTO section name

The bitcode reader looks specifically for `__DATA, __objc_catlist` as a
section name.  However, SVN r304661 removed the spaces (the two names
are functionally equivalent but do not compare equally
lexicographically).  This causes compatibility issues.  Add an
auto-upgrade path for removing the spaces as well as use the new name in
the LTO plugin.

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

6 years ago[lit] Improve tool substitution in lit.
Zachary Turner [Fri, 6 Oct 2017 17:54:46 +0000 (17:54 +0000)]
[lit] Improve tool substitution in lit.

This addresses two sources of inconsistency in test configuration
files.

1. Substitution boundaries.  Previously you would specify a
   substitution, such as 'lli', and then additionally a set
   of characters that should fail to match before and after
   the tool.  This was used, for example, so that matches that
   are parts of full paths would not be replaced.  But not all
   tools did this, and those that did would often re-invent
   the set of characters themselves, leading to inconsistency.
   Now, every tool substitution defaults to using a sane set
   of reasonable defaults and you have to explicitly opt out
   of it.  This actually fixed a few latent bugs that were
   never being surfaced, but only on accident.

2. There was no standard way for the system to decide how to
   locate a tool.  Sometimes you have an explicit path, sometimes
   we would search for it and build up a path ourselves, and
   sometimes we would build up a full command line.  Furthermore,
   there was no standardized way to handle missing tools.  Do we
   warn, fail, ignore, etc?  All of this is now encapsulated in
   the ToolSubst class.  You either specify an exact command to
   run, or an instance of FindTool('<tool-name>') and everything
   else just works.  Furthermore, you can specify an action to
   take if the tool cannot be resolved.

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

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

6 years agoRun pyformat on lit code.
Zachary Turner [Fri, 6 Oct 2017 17:54:27 +0000 (17:54 +0000)]
Run pyformat on lit code.

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

6 years ago[ARM] GlobalISel: Make tests less strict
Diana Picus [Fri, 6 Oct 2017 17:47:27 +0000 (17:47 +0000)]
[ARM] GlobalISel: Make tests less strict

These are intended as integration tests, so they shouldn't be too
specific about what they're checking.

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

6 years ago[dsymutil] Emit valid debug locations when no symbol flags are set
Francis Ricci [Fri, 6 Oct 2017 17:43:37 +0000 (17:43 +0000)]
[dsymutil] Emit valid debug locations when no symbol flags are set

Summary:
swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.

Reviewers: aprantl, friss, JDevlieghere

Subscribers: llvm-commits

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

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

6 years ago[AMDGPU] New 64 bit div/rem expansion
Stanislav Mekhanoshin [Fri, 6 Oct 2017 17:24:45 +0000 (17:24 +0000)]
[AMDGPU] New 64 bit div/rem expansion

Old expansion was 20 VGPRs, 78 SGPRs and ~380 instructions.
This expansion is 11 VGPRs, 12 SGPRs and ~120 instructions.

Passes OpenCL conformance test_integer_ops quick_[u]long_math

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

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

6 years ago[MC] Use unique_ptr to manage WinFrameInfos, NFC
Reid Kleckner [Fri, 6 Oct 2017 17:21:49 +0000 (17:21 +0000)]
[MC] Use unique_ptr to manage WinFrameInfos, NFC

The FrameInfo cannot be stored directly in the vector because chained
frames may refer to parent frames, so we need pointers that are stable
across a vector resize.

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

6 years agoSupport: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.
Peter Collingbourne [Fri, 6 Oct 2017 17:14:36 +0000 (17:14 +0000)]
Support: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.

The current implementation of rename uses ReplaceFile if the
destination file already exists. According to the documentation for
ReplaceFile, the source file is opened without a sharing mode. This
means that there is a short interval of time between when ReplaceFile
renames the file and when it closes the file during which the
destination file cannot be opened.

This behaviour is not POSIX compliant because rename is supposed
to be atomic. It was also causing intermittent link failures when
linking with a ThinLTO cache; the ThinLTO cache implementation expects
all cache files to be openable.

This patch addresses that problem by re-implementing rename
using CreateFile and SetFileInformationByHandle. It is roughly a
reimplementation of ReplaceFile with a better sharing policy as well
as support for renaming in the case where the destination file does
not exist.

This implementation is still not fully POSIX. Specifically in the case
where the destination file is open at the point when rename is called,
there will be a short interval of time during which the destination
file will not exist. It isn't clear whether it is possible to avoid
this using the Windows API.

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

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

6 years agoDirectly return promoted direct call instead of rely on stripPointerCast.
Dehao Chen [Fri, 6 Oct 2017 17:04:55 +0000 (17:04 +0000)]
Directly return promoted direct call instead of rely on stripPointerCast.

Summary: stripPointerCast is not reliably returning the value that's being type-casted. Instead it may look further at function attributes to further propagate the value. Instead of relying on stripPOintercast, the more reliable solution is to directly use the pointer to the promoted direct call.

Reviewers: tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: llvm-commits, sanjoy

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

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

6 years agoGuard xar RAII behind HAVE_LIBXAR
Francis Ricci [Fri, 6 Oct 2017 15:54:20 +0000 (15:54 +0000)]
Guard xar RAII behind HAVE_LIBXAR

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

6 years ago[ARM] GlobalISel: Select shifts
Diana Picus [Fri, 6 Oct 2017 15:39:16 +0000 (15:39 +0000)]
[ARM] GlobalISel: Select shifts

Unfortunately TableGen doesn't handle this yet:
Unable to deduce gMIR opcode to handle Src (which is a leaf).

Just add some temporary hand-written code to generate the proper MOVsr.

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

6 years agoStrip trailing whitespace
Simon Pilgrim [Fri, 6 Oct 2017 15:33:55 +0000 (15:33 +0000)]
Strip trailing whitespace

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

6 years ago[llvm-objdump] Add RAII for xar apis
Francis Ricci [Fri, 6 Oct 2017 15:33:28 +0000 (15:33 +0000)]
[llvm-objdump] Add RAII for xar apis

Summary:
xar_open and xar_iter_new require manual calls to close/free functions
to deallocate resources. This makes it easy to introduce memory leaks,
so add RAII struct wrappers for these resources.

Reviewers: enderby, rafael, compnerd, lhames, dblaikie

Subscribers: llvm-commits

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

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

6 years ago[TableGen] Simplify SubtargetEmitter
Javed Absar [Fri, 6 Oct 2017 15:25:04 +0000 (15:25 +0000)]
[TableGen] Simplify SubtargetEmitter

Remove unnecessary duplicate if-condition.

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

6 years ago[ARM] GlobalISel: Map shift operands to GPRs
Diana Picus [Fri, 6 Oct 2017 14:52:43 +0000 (14:52 +0000)]
[ARM] GlobalISel: Map shift operands to GPRs

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

6 years ago[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Francis Ricci [Fri, 6 Oct 2017 14:49:20 +0000 (14:49 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section

Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

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

6 years ago[ARM] GlobalISel: Mark shifts as legal for s32
Diana Picus [Fri, 6 Oct 2017 14:30:05 +0000 (14:30 +0000)]
[ARM] GlobalISel: Mark shifts as legal for s32

The new legalize combiner introduces shifts all over the place, so we
should support them sooner rather than later.

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

6 years ago[SystemZ] Enable machine scheduler.
Jonas Paulsson [Fri, 6 Oct 2017 13:59:28 +0000 (13:59 +0000)]
[SystemZ]  Enable machine scheduler.

The machine scheduler (before register allocation) is enabled by default for
SystemZ.

The SelectionDAG scheduling preference now becomes source order scheduling
(was regpressure).

Review: Ulrich Weigand
https://reviews.llvm.org/D37977

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

6 years ago[MergeICmp][NFC] Make test tuple-four-int8.ll more readable.
Clement Courbet [Fri, 6 Oct 2017 13:45:16 +0000 (13:45 +0000)]
[MergeICmp][NFC] Make test tuple-four-int8.ll more readable.

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

6 years ago[X86][SSE] Add SKX cpu tests to SSE/AVX scheduling tests (D38443)
Simon Pilgrim [Fri, 6 Oct 2017 13:40:29 +0000 (13:40 +0000)]
[X86][SSE] Add SKX cpu tests to SSE/AVX scheduling tests (D38443)

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

6 years agoRevert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Fri, 6 Oct 2017 13:02:24 +0000 (13:02 +0000)]
Revert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."

Still a few stability issues on windows.

This reverts commit 67e3db9bc121ba244e20337aabc7cf341a62b545.

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

6 years agoRe-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Fri, 6 Oct 2017 12:12:35 +0000 (12:12 +0000)]
Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."

(fixed unit tests by making comparisons stable)

This reverts commit 1b2d359ce256fd6737da4e93833346a0bd6d7583.

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

6 years ago[TableGen] : CodeGenInsrtuction modify to range loop. NFC.
Javed Absar [Fri, 6 Oct 2017 09:32:45 +0000 (09:32 +0000)]
[TableGen] : CodeGenInsrtuction modify to range loop. NFC.

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

6 years agoRoll forward r314928
Xinliang David Li [Fri, 6 Oct 2017 05:15:25 +0000 (05:15 +0000)]
Roll forward r314928

Fixed ThinLTO bootstrap failure : track new
bitcast per incomingVal. Added new tests.

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

6 years ago[PM] Retire disable unit-at-a-time switch.
Davide Italiano [Fri, 6 Oct 2017 04:39:40 +0000 (04:39 +0000)]
[PM] Retire disable unit-at-a-time switch.

This is a vestige from the GCC-3 days, which disables IPO passes
when set. I don't think anybody actually uses it as there are
several IPO passes which still run with this flag set and
nobody complained/noticed. This reduces the delta between
current and new pass manager and allows us to easily review
the difference when we decide to flip the switch (or audit
which passes should run, FWIW).

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

6 years ago[CodeExtractor] Fix multiple bugs under certain shape of extracted region
Jakub Kuderski [Fri, 6 Oct 2017 03:37:06 +0000 (03:37 +0000)]
[CodeExtractor] Fix multiple bugs under certain shape of extracted region

Summary:
If the extracted region has multiple exported data flows toward the same BB which is not included in the region, correct resotre instructions and PHI nodes won't be generated inside the exitStub. The solution is simply put the restore instructions right after the definition of output values instead of putting in exitStub.
Unittest for this bug is included.

Author: myhsu

Reviewers: chandlerc, davide, lattner, silvas, davidxl, wmi, kuhar

Subscribers: dberlin, kuhar, mgorny, llvm-commits

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

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

6 years agoNewGVN: Factor out duplicate parts of OpIsSafeForPHIOfOps
Daniel Berlin [Fri, 6 Oct 2017 01:33:06 +0000 (01:33 +0000)]
NewGVN: Factor out duplicate parts of OpIsSafeForPHIOfOps

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

6 years agoRevert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
Francis Ricci [Thu, 5 Oct 2017 23:09:17 +0000 (23:09 +0000)]
Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"

Breaks aarch64 builders

This reverts commit r315014.

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

6 years ago[MBP] Remove an invalid assert.
Xin Tong [Thu, 5 Oct 2017 23:00:04 +0000 (23:00 +0000)]
[MBP] Remove an invalid assert.

The patch that this assert comes with is fixing a bug in MBP. The assert is
invalid however.

Thanks to @sergey.k.okunev for finding this

Currently this fails SPECCPU2006 LTO. I will add a test case when I do more
investigation and have one.

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

6 years agoModuleUtils: Stop using comdat members to generate unique module ids.
Peter Collingbourne [Thu, 5 Oct 2017 21:54:53 +0000 (21:54 +0000)]
ModuleUtils: Stop using comdat members to generate unique module ids.

It is possible for two modules to define the same set of external
symbols without causing a duplicate symbol error at link time,
as long as each of the symbols is a comdat member. So we cannot
use them as part of a unique id for the module.

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

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

6 years ago[X86] Extract CATCHRET handling from emitEpilogue, NFC
Reid Kleckner [Thu, 5 Oct 2017 21:37:39 +0000 (21:37 +0000)]
[X86] Extract CATCHRET handling from emitEpilogue, NFC

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

6 years ago[WebAssembly] Add the rest of the atomic loads
Derek Schuff [Thu, 5 Oct 2017 21:18:42 +0000 (21:18 +0000)]
[WebAssembly] Add the rest of the atomic loads

Add extending loads and constant offset patterns
A bit more refactoring of the tablegen to make the patterns fairly nice and
uniform between the regular and atomic loads.

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

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

6 years ago[InstCombine] improve folds for icmp gt/lt (shr X, C1), C2
Sanjay Patel [Thu, 5 Oct 2017 21:11:49 +0000 (21:11 +0000)]
[InstCombine] improve folds for icmp gt/lt (shr X, C1), C2

We can always eliminate the shift in: icmp gt/lt (shr X, C1), C2 --> icmp gt/lt X, C'
This patch was supposed to just be an efficiency improvement because we were doing this 3-step process to fold:

IC: Visiting:   %c = icmp ugt i4 %s, 1
IC: ADD:   %s = lshr i4 %x, 1
IC: ADD:   %1 = udiv i4 %x, 2
IC: Old =   %c = icmp ugt i4 %1, 1
    New =   <badref> = icmp uge i4 %x, 4
IC: ADD:   %c = icmp uge i4 %x, 4
IC: ERASE   %2 = icmp ugt i4 %1, 1
IC: Visiting:   %c = icmp uge i4 %x, 4
IC: Old =   %c = icmp uge i4 %x, 4
    New =   <badref> = icmp ugt i4 %x, 3
IC: ADD:   %c = icmp ugt i4 %x, 3
IC: ERASE   %2 = icmp uge i4 %x, 4
IC: Visiting:   %c = icmp ugt i4 %x, 3
IC: DCE:   %1 = udiv i4 %x, 2
IC: ERASE   %1 = udiv i4 %x, 2
IC: DCE:   %s = lshr i4 %x, 1
IC: ERASE   %s = lshr i4 %x, 1
IC: Visiting:   ret i1 %c

When we could go directly to canonical icmp form:

IC: Visiting:   %c = icmp ugt i4 %s, 1
IC: Old =   %c = icmp ugt i4 %s, 1
    New =   <badref> = icmp ugt i4 %x, 3
IC: ADD:   %c = icmp ugt i4 %x, 3
IC: ERASE   %1 = icmp ugt i4 %s, 1
IC: ADD:   %s = lshr i4 %x, 1
IC: DCE:   %s = lshr i4 %x, 1
IC: ERASE   %s = lshr i4 %x, 1
IC: Visiting:   %c = icmp ugt i4 %x, 3

...but then I noticed that the folds were incomplete too:
https://godbolt.org/g/aB2hLE

Here are attempts to prove the logic with Alive:
https://rise4fun.com/Alive/92o

Name: lshr_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr i8 %x, C1
%r = icmp ult i8 %sh, C2
  =>
%r = icmp ult i8 %x, (C2 << C1)

Name: ashr_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr i8 %x, C1
%r = icmp slt i8 %sh, C2
  =>
%r = icmp slt i8 %x, (C2 << C1)

Name: lshr_ugt
Pre: (((C2+1) << C1) u>> C1) == (C2+1)
%sh = lshr i8 %x, C1
%r = icmp ugt i8 %sh, C2
  =>
%r = icmp ugt i8 %x, ((C2+1) << C1) - 1

Name: ashr_sgt
Pre: (C2 != 127) && ((C2+1) << C1 != -128) && (((C2+1) << C1) >> C1) == (C2+1)
%sh = ashr i8 %x, C1
%r = icmp sgt i8 %sh, C2
  =>
%r = icmp sgt i8 %x, ((C2+1) << C1) - 1

Name: ashr_exact_sgt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp sgt i8 %sh, C2
  =>
%r = icmp sgt i8 %x, (C2 << C1)

Name: ashr_exact_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp slt i8 %sh, C2
  =>
%r = icmp slt i8 %x, (C2 << C1)

Name: lshr_exact_ugt
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ugt i8 %sh, C2
  =>
%r = icmp ugt i8 %x, (C2 << C1)

Name: lshr_exact_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ult i8 %sh, C2
  =>
%r = icmp ult i8 %x, (C2 << C1)

We did something similar for 'shl' in D28406.

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

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

6 years ago[Hexagon] Make PS_fi and PS_fia extendable (they both expand to A2_addi)
Krzysztof Parzyszek [Thu, 5 Oct 2017 20:20:06 +0000 (20:20 +0000)]
[Hexagon] Make PS_fi and PS_fia extendable (they both expand to A2_addi)

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

6 years ago[dsymutil] Fix typo in swift-ast.test
Francis Ricci [Thu, 5 Oct 2017 20:16:16 +0000 (20:16 +0000)]
[dsymutil] Fix typo in swift-ast.test

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

6 years agoAnnotate VP prof on indirect call if it is ICPed in the profiled binary.
Dehao Chen [Thu, 5 Oct 2017 20:15:29 +0000 (20:15 +0000)]
Annotate VP prof on indirect call if it is ICPed in the profiled binary.

Summary: In SamplePGO, when an indirect call is promoted in the profiled binary, before profile annotation, it will be promoted and inlined. For the original indirect call, the current implementation will not mark VP profile on it. This is an issue when profile becomes stale. This patch annotates VP prof on indirect calls during annotation.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

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

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

6 years ago[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Francis Ricci [Thu, 5 Oct 2017 20:03:01 +0000 (20:03 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section

Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

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

6 years ago[Hexagon] Give uniform names to functions changing addressing modes, NFC
Krzysztof Parzyszek [Thu, 5 Oct 2017 20:01:38 +0000 (20:01 +0000)]
[Hexagon] Give uniform names to functions changing addressing modes, NFC

The new format is changeAddrMode_xx_yy, where xx is the current mode,
and yy is the new one.

Old name:               New name:
getBaseWithImmOffset    changeAddrMode_abs_io
getAbsoluteForm         changeAddrMode_io_abs
getBaseWithRegOffset    changeAddrMode_io_rr
xformRegToImmOffset     changeAddrMode_rr_io
getBaseWithLongOffset   changeAddrMode_rr_ur
getRegShlForm           changeAddrMode_ur_rr

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

6 years agoAdded phdr upper bound checks to ElfObject.
Rafael Espindola [Thu, 5 Oct 2017 20:01:32 +0000 (20:01 +0000)]
Added phdr upper bound checks to ElfObject.

Ensure the program_headers call will fail correctly if the program
headers are larger than the underlying buffer.

Patch by Parker Thompson!

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