Commit Graph

30265 Commits

Author SHA1 Message Date
Omair Javaid
367ed08f22 Fix LLDB Android AArch64 GCC debug info build
Committing after fixing suggested changes and tested release/debug builds on 
x86_64-linux and arm/aarch64 builds.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 01:17:49 +00:00
Rui Ueyama
57b15082cd Re-submit r293820: Return Error instead of bool from mergeTypeStreams().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293847 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 00:47:10 +00:00
Dehao Chen
fe46230d58 Change debug-info-for-profiling from a TargetOption to a function attribute.
Summary: LTO requires the debug-info-for-profiling to be a function attribute.

Reviewers: echristo, mehdi_amini, dblaikie, probinson, aprantl

Reviewed By: mehdi_amini, dblaikie, aprantl

Subscribers: aprantl, probinson, ahatanak, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 22:45:09 +00:00
Rui Ueyama
153a261a82 Revert r293820: Return Error instead of bool from mergeTypeStreams().
It broke buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293824 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 22:28:43 +00:00
Rui Ueyama
7aa802198b Return Error instead of bool from mergeTypeStreams().
Previously, mergeTypeStreams returns only true or false, so it was
impossible to know the reason if it failed. This patch changes the
function signature so that it returns an Error object.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293820 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 22:09:34 +00:00
Zachary Turner
8d4b01ecc0 [pdb] Add a new command for analyzing hash collisions.
This introduces the `analyze` subcommand.  For now there is only
one option, to analyze hash collisions in the type streams.  In
the future, however, we could add many more things here, such
as performing size analyses, compacting, and statistics about
the type of records etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 18:30:22 +00:00
Matthew Simpson
aa96bc9c68 [LV] Move interleaved access helper functions to VectorUtils (NFC)
This patch moves some helper functions related to interleaved access
vectorization out of LoopVectorize.cpp and into VectorUtils.cpp. We would like
to use these functions in a follow-on patch that improves interleaved load and
store lowering in (ARM/AArch64)ISelLowering.cpp. One of the functions was
already duplicated there and has been removed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293788 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 17:45:46 +00:00
Javed Absar
bddaeb4ffb [ARM] Enable Cortex-M23 and Cortex-M33 support.
Add both cores to the target parser and TableGen. Test that eabi
attributes are set correctly for both cores. Additionally, test the
absence and presence of MOVT in Cortex-M23 and Cortex-M33, respectively.

Committed on behalf of Sanne Wouda.
Reviewers : rengolin, olista01.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293761 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 11:55:03 +00:00
Evandro Menezes
20de1ea345 [CodeGen] Move MacroFusion to the target
This patch moves the class for scheduling adjacent instructions,
MacroFusion, to the target.

In AArch64, it also expands the fusion to all instructions pairs in a
scheduling block, beyond just among the predecessors of the branch at the
end.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293737 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 02:54:34 +00:00
Dean Michael Berris
93789c8851 [XRay] Define the InstrumentationMap type
Summary:
This change implements the instrumentation map loading library which can
understand both YAML-defined instrumentation maps, and ELF 64-bit object
files that have the XRay instrumentation map section. We break it out
into a library on its own to allow for other applications to deal with
the XRay instrumentation map defined in XRay-instrumented binaries.

This type provides both raw access to the logical representation of the
instrumentation map entries as well as higher level functions for
converting a function ID into a function address.

At this point we only support ELF64 binaries and YAML-defined XRay
instrumentation maps. Future changes should extend this to support
32-bit ELF binaries, as well as other binary formats (like MachO).

As part of this change we also migrate all uses of the extraction logic
that used to be defined in tools/llvm-xray/ to use this new type and
interface for loading from files. We also remove the flag from the
`llvm-xray` tool that required users to specify the type of the
instrumentation map file being provided to instead make the library
auto-detect the file type.

Reviewers: dblaikie

Subscribers: mgorny, varno, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293721 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 00:05:29 +00:00
David Blaikie
fbad5bd691 Add a verbose/human readable mode to llvm-symbolizer to investigate discriminators and other line table/backtrace features
Patch by Simon Que!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293697 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 22:19:38 +00:00
Daniel Berlin
c2913cb380 ScopedHashTable lookup should be const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293695 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 22:01:08 +00:00
Matthew Simpson
91af052212 Fix VectorUtils include guard name (NFC)
VectorUtils was moved to Analysis from Transforms/Utils, but some comments and
the include guard name still reflect its old location.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293684 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 20:29:10 +00:00
Tim Northover
a90703d224 GlobalISel: merge invoke and call translation paths.
Well, sort of. But the lower-level code that invoke used to be using completely
botched the handling of varargs functions, which hopefully won't be possible if
they're using the same code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293670 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 18:36:11 +00:00
Peter Collingbourne
043d1a96c9 MC: Introduce the ABS8 symbol modifier.
@ABS8 can be applied to symbols which appear as immediate operands to
instructions that have a 8-bit immediate form for that operand. It causes
the assembler to use the 8-bit form and an 8-bit relocation (e.g. R_386_8
or R_X86_64_8) for the symbol.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293667 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 18:28:44 +00:00
Nirav Dave
53d52e9e2b [X86] Implement -mfentry
Summary: Insert calls to __fentry__ at function entry.

Reviewers: hfinkel, craig.topper

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293648 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 17:00:27 +00:00
Sam Parker
d9605fec4b [ARM] Avoid using ARM instructions in Thumb mode
The Requires class overrides the target requirements of an instruction,
rather than adding to them, so all ARM instructions need to include the
IsARM predicate when they have overwitten requirements.

This caused the swp and swpb instructions to be allowed in thumb mode
assembly, and the ARM encoding of CDP to be selected in codegen (which
is different for conditional instructions).

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293634 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 14:35:01 +00:00
Matt Arsenault
3b595d2304 AMDGPU: Generalize matching of v_med3_f32
I think this is safe as long as no inputs are known to ever
be nans.

Also add an intrinsic for fmed3 to be able to handle all safe
math cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293598 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 03:07:46 +00:00
Matt Arsenault
9be098398c NVPTX: Move InferAddressSpaces to generic code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293579 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 01:10:58 +00:00
Reid Kleckner
fa35d5c251 Remove LLVM_CONFIG from config headers
It appears to be dead, and it needlessly caused me to rebuild all of
LLVM when I changed CMAKE_INSTALL_PREFIX.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293574 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 00:34:23 +00:00
Derek Schuff
c20099fa53 [WebAssembly] Add wasm support for llvm-readobj
Create a WasmDumper subclass of ObjDumper to support Webassembly binary
files.

Patch by Sam Clegg

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293569 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 23:30:52 +00:00
Matt Arsenault
4aff9df5c8 NVPTX: Refactor NVPTXInferAddressSpaces to check TTI
Add a new TTI hook for getting the generic address space value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293563 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 23:02:12 +00:00
Dehao Chen
7bac4378dd Expose isLegalToPromot as a global helper function so that SamplePGO pass can call it for legality check.
Summary: SamplePGO needs to check if it is legal to promote a target before it actually promotes it.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293559 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 22:46:37 +00:00
Tim Northover
1ae1b9397e GlobalISel: translate memset & memmove.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293541 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 19:33:07 +00:00
Justin Bogner
247041ef05 SDAG: Update ChainNodesMatched during UpdateChains if a node is replaced
Previously, we would hit UB (or the ISD::DELETED_NODE assert) if we
happened to replace a node during UpdateChains, because it would be
left in the list we were iterating over. This nulls out the pointer
when that happens so that we can avoid the issue.

Fixes llvm.org/PR31710

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293522 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 18:29:46 +00:00
Benjamin Kramer
11be2d20e4 [Orc] Add missing include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293511 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 17:54:57 +00:00
David Blaikie
ea0aa0fa59 unique_ptrify some containers in GlobalISel::RegisterBankInfo
To simplify/clarify memory ownership, make leaks (as one was found/fixed
recently) harder to write, etc.

(also, while I was there - removed a duplicate lookup in a container)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293506 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 17:13:56 +00:00
Rafael Espindola
0f1ef541e4 Bring back r293480. It is safe now.
Original message:

    Fix the values of two xcore ELF flags.

    The values in llvm grew from a pre-MC day when they would not show up
    in .o files and are outside of the SHF_MASKPROC.

    Fortunately the MC output is not currently used as xcore has its own
    assemble and that assembler uses valid values. This updates llvm to
    use the same values as the xmos assembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293486 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 15:49:20 +00:00
Rafael Espindola
d5702b77f0 Only print architecture dependent flags for that architecture.
Different architectures can have different meaning for flags in the
SHF_MASKPROC mask, so we should always check what the architecture use
before checking the flag.

NFC for now, but will allow fixing the value of an xmos flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293484 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 15:38:43 +00:00
Rafael Espindola
3d66fa9327 Revert "Fix the values of two xcore ELF flags."
This reverts commit r293480.

The patch is correct, but found bugs in other areas that need to be fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293481 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 14:39:48 +00:00
Rafael Espindola
4b9ff85e31 Fix the values of two xcore ELF flags.
The values in llvm grew from a pre-MC day when they would not show up
in .o files and are outside of the SHF_MASKPROC.

Fortunately the MC output is not currently used as xcore has its own
assemble and that assembler uses valid values. This updates llvm to
use the same values as the xmos assembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 14:07:43 +00:00
Daniel Berlin
be1b992213 Revert "[MemorySSA] Revert r293361 and r293363, as the tests fail under asan."
This reverts commit r293471, reapplying r293361 and r293363 with a fix
for an out-of-bounds read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 11:35:39 +00:00
Sam McCall
b6af32432c [MemorySSA] Revert r293361 and r293363, as the tests fail under asan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293471 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 09:19:50 +00:00
Kristof Beyls
e9939d4d42 [GlobalISel] Add support for indirectbr
Differential Revision: https://reviews.llvm.org/D28079


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293470 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30 09:13:18 +00:00
Matthias Braun
aaf8acb74e MachineInstr: Remove parameter from dump()
The primary use of the dump() functions in LLVM is for use in a
debugger. Unfortunately lldb does not seem to handle default arguments
so using `p SomeMI.dump()` fails and you have to type the longer `p
SomeMI.dump(nullptr)`. Remove the paramter to make the most common use
easy. (You can always construct something like `p
SomeMI.print(dbgs(),MyTII)` if you need more features).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 18:20:42 +00:00
Craig Topper
544a997a27 [SelectionDAG] Make SDNode::getConstantOperandVal an inline method.
It's operation already exists manually in many places without using the method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293421 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 06:08:02 +00:00
Lang Hames
ca2b1542a0 [Orc][RPC] Have handleOne abandon pending responses upon channel failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293411 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 04:25:16 +00:00
Lang Hames
2535e5c9e1 [Orc][RPC] Remove redundant braces. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293410 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 04:09:01 +00:00
Xinliang David Li
828b398771 Add support to dump dot graph block layout after MBP
Differential Revision: https://reviews.llvm.org/D29141


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293408 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 01:57:02 +00:00
David Majnemer
7bf48fa3f7 [Target] Add NoSignedZerosFPMath to the TargetOptions constructor
Most flags were already initialized by the TargetOptions constructor but
we missed out on one.  Also, simplify the constructor by using field
initializers when possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293406 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 01:27:08 +00:00
Lang Hames
11bb3e46eb [Orc][RPC] Remove a couple of redundant calls to abandonAllPendingResponses.
appendCallAsync, which all RPC call functions ultimately build on, will call
abandonAllPendingResponses on channel error. These extra calls are redundant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-29 00:51:17 +00:00
Mohammad Shahid
13e3a7f7a3 [SLP] Vectorize loads of consecutive memory accesses, accessed in non-consecutive (jumbled) way.
The jumbled scalar loads will be sorted while building the tree and these accesses will be marked to generate shufflevector after the vectorized load with proper mask.

Reviewers: hfinkel, mssimpso, mkuper

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

Change-Id: I9c0c8e6f91a00076a7ee1465440a3f6ae092f7ad

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293386 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 17:59:44 +00:00
Arpith Chacko Jacob
5692e8ecc6 [NVPTX] Add intrinsics to support named barriers.
Support for barrier synchronization between a subset of threads
in a CTA through one of sixteen explicitly specified barriers.
These intrinsics are not directly exposed in CUDA but are
critical for forthcoming support of OpenMP on NVPTX GPUs.

The intrinsics allow the synchronization of an arbitrary
(multiple of 32) number of threads in a CTA at one of 16
distinct barriers. The two intrinsics added are as follows:

call void @llvm.nvvm.barrier.n(i32 10)
waits for all threads in a CTA to arrive at named barrier #10.

call void @llvm.nvvm.barrier(i32 15, i32 992)
waits for 992 threads in a CTA to arrive at barrier #15.

Detailed description of these intrinsics are available in the PTX manual.
http://docs.nvidia.com/cuda/parallel-thread-execution/#parallel-synchronization-and-communication-instructions

Reviewers: hfinkel, jlebar
Differential Revision: https://reviews.llvm.org/D17657


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 16:38:15 +00:00
Lang Hames
5a43f49c09 [Orc][RPC] Unlock message send/receive locks on failure.
This fixes some destruction-of-locked-mutex errors in RawByteChannel.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293375 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 10:19:47 +00:00
Daniel Berlin
09e759d8e9 MemorySSA: Allow movement to arbitrary places
Summary: Extend the MemorySSAUpdater API to allow movement to arbitrary places

Reviewers: davide, george.burgess.iv

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293363 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 02:26:39 +00:00
Quentin Colombet
0a5eca7061 [RegisterBankInfo] Emit proper type for remapped registers.
When the OperandsMapper creates virtual registers, it used to just create
plain scalar register with the right size. This may confuse the
instruction selector because we lose the information of the instruction
using those registers what supposed to do. The MachineVerifier complains
about that already.

With this patch, the OperandsMapper still creates plain scalar register,
but the expectation is for the mapping function to remap the type
properly. The default mapping function has been updated to do that.

rdar://problem/30231850

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293362 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 02:23:48 +00:00
Matthias Braun
88d207542b Cleanup dump() functions.
We had various variants of defining dump() functions in LLVM. Normalize
them (this should just consistently implement the things discussed in
http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html

For reference:
- Public headers should just declare the dump() method but not use
  LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
- The definition of a dump method should look like this:
  #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
  LLVM_DUMP_METHOD void MyClass::dump() {
    // print stuff to dbgs()...
  }
  #endif

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 02:02:38 +00:00
Daniel Berlin
92cf58ee36 MemorySSA: Move updater to its own file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 01:35:02 +00:00
Daniel Berlin
f6dfcde86b Introduce a basic MemorySSA updater, that supports insertDef,
insertUse, moveBefore and moveAfter operations.

Summary:
This creates a basic MemorySSA updater that handles arbitrary
insertion of uses and defs into MemorySSA, as well as arbitrary
movement around the CFG. It replaces the current splice API.

It can be made to handle arbitrary control flow changes.
Currently, it uses the same updater algorithm from D28934.

The main difference is because MemorySSA is single variable, we have
the complete def and use list, and don't need anyone to give it to us
as part of the API.  We also have to rename stores below us in some
cases.

If we go that direction in that patch, i will merge all the updater
implementations (using an updater_traits or something to provide the
get* functions we use, called read*/write* in that patch).

Sadly, the current SSAUpdater algorithm is way too slow to use for
what we are doing here.

I have updated the tests we have to basically build memoryssa
incrementally using the updater api, and make sure it still comes out
the same.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 01:23:13 +00:00
Quentin Colombet
f294f578dc [RegisterCoalescing] Recommit the patch "Remove partial redundent copy".
In r292621, the recommit fixes a bug related with live interval update
after the partial redundent copy is moved.

This recommit solves an additional bug related to the lack of update of
subranges.

The original patch is to solve the performance problem described in
PR27827. Register coalescing sometimes cannot remove a copy because of
interference. But if we can find a reverse copy in one of the predecessor
block of the copy, the copy is partially redundent and we may remove the
copy partially by moving it to the predecessor block without the
reverse copy.

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

Re-apply r292621

Revert "Revert rL292621. Caused some internal build bot failures in apple."

This reverts commit r292984.

Original patch: Wei Mi <wmi@google.com>
Subrange fix: Mostly Matthias Braun <matze@braunis.de>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293353 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 01:05:27 +00:00