Commit Graph

113949 Commits

Author SHA1 Message Date
Chris Bieneman
247aed4710 Raising minimum required CMake version to 2.8.12.2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 21:28:18 +00:00
Eric Christopher
84af8beaee Grab the DataLayout off of the TargetMachine since that's where
it's stored.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 20:56:39 +00:00
Benjamin Kramer
d889ad2ab8 LoopRotate: When reconstructing loop simplify form don't split edges from indirectbrs.
Yet another chapter in the endless story. While this looks like we leave
the loop in a non-canonical state this replicates the logic in
LoopSimplify so it doesn't diverge from the canonical form in any way.

PR21968

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230058 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 20:49:25 +00:00
Duncan P. N. Exon Smith
99f12691dd IR: Change MDFile to directly store the filename/directory
In the old (well, current) schema, there are two types of file
references: untagged and tagged (the latter references the former).

    !0 = !{!"filename", !"/directory"}
    !1 = !{!"0x29", !1} ; DW_TAG_file_type [filename] [/directory]

The interface to `DIBuilder` universally takes the tagged version,
described by `DIFile`.  However, most `file:` references actually use
the untagged version directly.

In the new hierarchy, I'm merging this into a single node: `MDFile`.

Originally I'd planned to keep the old schema unchanged until after I
moved the new hierarchy into place.

However, it turns out to be trivial to make `MDFile` match both nodes at
the same time.

  - Anyone referencing !1 does so through `DIFile`, whose implementation
    I need to gut anyway (as I do the rest of the `DIDescriptor`s).
  - Anyone referencing !0 just references an `MDNode`, and expects a
    node with two `MDString` operands.

This commit achieves that, and updates all the testcases for the parts
of the new hierarchy that used the two-node schema (I've replaced the
untagged nodes with `distinct !{}` to make the diff clear (otherwise the
metadata all gets renumbered); it might be worthwhile to come back and
delete those nodes and renumber the world, not sure).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230057 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 20:35:17 +00:00
Peter Collingbourne
5a81e14385 Introduce bitset metadata format and bitset lowering pass.
This patch introduces a new mechanism that allows IR modules to co-operatively
build pointer sets corresponding to addresses within a given set of
globals. One particular use case for this is to allow a C++ program to
efficiently verify (at each call site) that a vtable pointer is in the set
of valid vtable pointers for the class or its derived classes. One way of
doing this is for a toolchain component to build, for each class, a bit set
that maps to the memory region allocated for the vtables, such that each 1
bit in the bit set maps to a valid vtable for that class, and lay out the
vtables next to each other, to minimize the total size of the bit sets.

The patch introduces a metadata format for representing pointer sets, an
'@llvm.bitset.test' intrinsic and an LTO lowering pass that lays out the globals
and builds the bitsets, and documents the new feature.

Differential Revision: http://reviews.llvm.org/D7288

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230054 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 20:30:47 +00:00
Jozef Kolek
b2e79a8e69 Reversed revision 229706. The reason is regression, which is caused by the
usage of instruction ADDU16 by CodeGen. For this instruction an improper
register is allocated, i.e. the register that is not from register set defined
for the instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230053 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 20:26:52 +00:00
David Majnemer
2e24b7b0d4 Verifier: Unused comdats might not have a corresponding GV
This fixes PR22646.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230051 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 19:58:48 +00:00
Eric Christopher
d53224014d Fix an asan use-after-free bug introduced by the asm printer
changes to remove non-Function based subtargets out of the asm
printer. For module level emission we'll need to construct up
an MCSubtargetInfo so that we can encode instructions for
emission.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230050 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 19:54:07 +00:00
Philip Reames
16422b22bc [GC, RewriteStatepointsForGC] Style cleanup and bug fix
When doing style cleanup, I noticed a minor bug in this code.  If we have a pointer that we think is unused after a statepoint and thus doesn't need relocation, we store a null pointer into the alloca we're about to promote.  This helps turn a mistake in liveness analysis into an easily debuggable crash.  It turned out this code had never been updated to handle invoke statepoints.  

There's no test for this.  Without a bug in liveness, it appears impossible to make this trigger in a way which is visible in the resulting IR.  We might store the null, but when promoting the alloca, there will be no uses and thus nothing to test against.  Suggestions on how to test are very welcome.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 19:51:56 +00:00
Reid Kleckner
a68ce075ba Use unreachable instead of assert(false) to silence MSVC warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230045 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 19:46:02 +00:00
Andrea Di Biagio
3583d23018 [X86][FastIsel] Teach how to select float-half conversion intrinsics.
This patch teaches X86FastISel how to select intrinsic 'convert_from_fp16' and
intrinsic 'convert_to_fp16'.
If the target has F16C, we can select VCVTPS2PHrr for a float-half conversion,
and VCVTPH2PSrr for a half-float conversion.

Differential Revision: http://reviews.llvm.org/D7673


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230043 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 19:37:14 +00:00
Philip Reames
936cf6a3ae [GC] Style cleanup for RewriteStatepointForGC (1 of many) [NFC]
Starting to update variable naming and types to match LLVM style.  This will be an incremental process to minimize the chance of breakage as I work.  Step one, rename member variables to LLVM CamelCase and use llvm's ADT.  Much more to come.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230042 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 19:26:04 +00:00
Chris Bieneman
11947113de Setting up CMake to default to Debug when no build type is specified.
Summary: Turns out if you don't set CMAKE_BUILD_TYPE the default is an empty string. This results in some of the behaviors of debug builds, but not all of them. For example ENABLE_ASSERTIONS is false.

Reviewers: rnk

Reviewed By: rnk

Subscribers: chapuni, llvm-commits

Differential Revision: http://reviews.llvm.org/D7360

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230041 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 19:02:59 +00:00
Philip Reames
ef6e26ea1f Bugfix for 229954
Before calling Function::getGC to test for enablement, we need to make sure there's actually a GC at all via Function::hasGC.  Otherwise, we'd crash on functions without a GC.  Thankfully, this only mattered if you manually scheduled the pass, but still, oops. :(



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230040 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:56:14 +00:00
Eric Christopher
dd38f4e94d Remove a use of the Subtarget in the darwin ppc asm printer.
EmitFunctionStubs is called from doFinalization and so can't
depend on the Subtarget existing. It's also irrelevant as
we know we're darwin since we're in the darwin asm printer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230039 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:53:42 +00:00
Eric Christopher
0bbf62fce8 Get the function specific subtarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230038 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:44:17 +00:00
Eric Christopher
6de800e056 Get the cached subtarget off the MachineFunction rather than
inquiring for a new one from the TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230037 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 18:44:15 +00:00
Sanjay Patel
74e8bf678a canonicalize a v2f64 blendi of 2 registers
This canonicalization step saves us 3 pattern matching possibilities * 4 math ops
for scalar FP math that uses xmm regs. The backend can re-commute the operands
post-instruction-selection if that makes register allocation better.

The tests in llvm/test/CodeGen/X86/sse-scalar-fp-arith.ll cover this scenario already,
so there are no new tests with this patch.

Differential Revision: http://reviews.llvm.org/D7777


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230024 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 16:55:27 +00:00
Benjamin Kramer
6039d05a22 Put MSVC back into the dumb compiler's corner.
It fails to compile std::trivially_copyable for forward-declared enums.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230023 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 16:35:42 +00:00
Benjamin Kramer
1b740e2667 Base isPodLike on is_trivially_copyable for GCC 5 and MSVC
It would be nice to get rid of the version checks here, but that will
have to wait until libstdc++ is upgraded to 5.0 everywhere ...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230021 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 16:19:28 +00:00
Kit Barton
3e00ca983c I incorrectly marked the VORC instruction as isCommutable when I added it.
This fix removes the VORC instruction definition from the isCommutable block.

Phabricator review: http://reviews.llvm.org/D7772


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230020 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 15:54:58 +00:00
Igor Laevsky
45c732502e Generalize statepoint lowering to use ImmutableStatepoint. Move statepoint lowering into a separate function 'LowerStatepoint' which uses ImmutableStatepoint instead of a CallInst. Also related utility functions are changed to receive ImmutableCallSite.
Differential Revision: http://reviews.llvm.org/D7756 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230017 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 15:28:35 +00:00
Benjamin Kramer
5c251169cd Constants.cpp: Only read 32 bits for float.
Otherwise we'll discard the wrong half of a uint64_t on big-endian systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230016 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 15:11:55 +00:00
NAKAMURA Takumi
bb19cd98c6 Constants.cpp: getElementAsAPFloat(): Don't handle constant value via host's float/double, just handle with APInt/APFloat.
x87 FPU didn't keep SNAN, but demoted to QNAN.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230013 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 14:24:49 +00:00
Benjamin Kramer
defae370b0 RewriteStatepointsForGC: Move details into anonymous namespaces. NFC.
While there reduce the number of duplicated std::map lookups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 14:00:58 +00:00
Benjamin Kramer
fa3b207447 Make the static instance of None just const.
This way there shouldn't be any unused variable warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230010 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 13:16:05 +00:00
Benjamin Kramer
ac075b1ae9 Wrap recursive function only used in assert in #ifndef NDEBUG.
Avoids unused function warnings in Release builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230009 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 13:15:49 +00:00
Chandler Carruth
634fc5f26b [x86] Switching the shuffle equivalence test to a variadic template was
the wrong answer. We also got initializer lists which are *way* cleaner
for this kind of thing. Let's use those and make this a normal, boring
functionn accepting ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 10:47:28 +00:00
Eric Christopher
05e2b94f35 Fix wording and grammar in Mips subtarget options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 08:42:34 +00:00
Eric Christopher
d8210e33d4 Get the cached subtarget off the MachineFunction rather than
inquiring for a new one from the TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230000 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 08:39:06 +00:00
Eric Christopher
f179b3f1d9 Get the cached subtarget off the MachineFunction rather than
inquiring for a new one from the TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229999 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 08:24:37 +00:00
Eric Christopher
3ce9f152e4 Get the cached subtarget off the MachineFunction rather than
inquiring for a new one from the TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229998 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 08:24:34 +00:00
Eric Christopher
b661ab1cbd Save the MachineFunction in startFunction so that we can use it for
lookups of the subtarget later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 08:01:55 +00:00
Eric Christopher
7b0c988b90 Use the cached subtarget from the MachineFunction rather than
doing a lookup on the TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229995 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 08:01:52 +00:00
Eric Christopher
c9d0715997 Make the TargetMachine::getSubtarget that takes a Function argument
take a reference to match the getSubtargetImpl that takes a Function
argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 07:32:59 +00:00
Justin Bogner
a074de6ff4 Disallow implicit conversions from None to integer types
This fixes an error introduced in r228934 where None was converted to
an int instead of the int being converted to an Optional as intended.
We make that sort of mistake a compile error by changing NoneType into
a scoped enum.

Finally, provide a static NoneType called None to avoid forcing all
users to spell it NoneType::None.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229980 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 07:28:28 +00:00
Nick Lewycky
0ba76cd459 Fix build with gcc. This has a -Wsequence-point error on 'MII', which is a good point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229979 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 07:17:40 +00:00
Eric Christopher
3ff22e442d Remove more uses of TargetMachine::getSubtargetImpl from the
AsmPrinter.

getSubtargetInfo now asserts that the MachineFunction exists.
Debug printing of register naming now uses the register info
from MCAsmInfo as that's unchanging.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 07:16:19 +00:00
Nick Lewycky
12cbedbaee Fix build in release mode, -Wunused-variable on this lambda function used only in an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229977 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 07:16:17 +00:00
Nick Lewycky
95fda65f76 Fix build in release mode, four cases of -Wunused-variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229976 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 07:14:02 +00:00
Eric Christopher
02a610a9a9 AsmPrinter::doFinalization is at the module level and so doesn't
have access to a target specific subtarget info. Grab the module
level MCSubtargetInfo for the JumpInstrTable output stubs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 06:59:48 +00:00
Lang Hames
4dedd90c76 [Orc] Add a new JITSymbol constructor to build a symbol from an existing address.
This constructor is more efficient for symbols that have already been emitted,
since it avoids the construction/execution of a std::function.

Update the ObjectLinkingLayer to use this new constructor where possible.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229973 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 06:48:29 +00:00
Eric Christopher
587999319a Remove the MCInstrInfo cached variable as it was only used in a
single place and replace calls to getSubtargetImpl with calls
to get the subtarget from the MachineFunction where valid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229971 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 06:35:21 +00:00
David Blaikie
7be2b85e1e Fix -Wunused-variable warning in non-asserts build, and optimize a little bit while I'm here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229970 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 06:28:38 +00:00
Hal Finkel
2c5f9584ba [PowerPC] Loop Data Prefetching for the BG/Q
The IBM BG/Q supercomputer's A2 cores have a hardware prefetching unit, the
L1P, but it does not prefetch directly into the A2's L1 cache. Instead, it
prefetches into its own L1P buffer, and the latency to access that buffer is
significantly higher than that to the L1 cache (although smaller than the
latency to the L2 cache). As a result, especially when multiple hardware
threads are not actively busy, explicitly prefetching data into the L1 cache is
advantageous.

I've been using this pass out-of-tree for data prefetching on the BG/Q for well
over a year, and it has worked quite well. It is enabled by default only for
the BG/Q, but can be enabled for other cores as well via a command-line option.

Eventually, we might want to add some TTI interfaces and move this into
Transforms/Scalar (there is nothing particularly target dependent about it,
although only machines like the BG/Q will benefit from its simplistic
strategy).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229966 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 05:08:21 +00:00
Chandler Carruth
efbbaefea5 [x86] Remove the old vector shuffle lowering code and its flag.
The new shuffle lowering has been the default for some time. I've
enabled the new legality testing by default with no really blocking
regressions. I've fuzz tested this very heavily (many millions of fuzz
test cases have passed at this point). And this cleans up a ton of code.
=]

Thanks again to the many folks that helped with this transition. There
was a lot of work by others that went into the new shuffle lowering to
make it really excellent.

In case you aren't using a diff algorithm that can handle this:
  X86ISelLowering.cpp: 22 insertions(+), 2940 deletions(-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229964 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 04:25:04 +00:00
Chandler Carruth
07ef8904ad [x86] Now that the new vector shuffle legality is enabled and everything
is going well, remove the flag and the code for the old legality tests.

This is the first step toward removing the entire old vector shuffle
lowering. *Much* more code to delete coming up next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229963 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 03:59:35 +00:00
Duncan P. N. Exon Smith
ea8cbe9782 Bitcode: Stop assuming non-null fields
When writing the bitcode serialization for the new debug info hierarchy,
I assumed two fields would never be null.

Drop that assumption, since it's brittle (and crashes the
`BitcodeWriter` if wrong), and is a check better left for the verifier
anyway.  (No need for a bitcode upgrade here, since the new hierarchy is
still not in place.)

The fields in question are `MDCompileUnit::getFile()` and
`MDDerivedType::getBaseType()`, the latter of which isn't null in
test/Transforms/Mem2Reg/ConvertDebugInfo2.ll (see !14, a pointer to
nothing).  While the testcase might have bitrotted, there's no reason
for the bitcode format to rely on non-null for metadata operands.

This also fixes a bug in `AsmWriter` where if the `file:` is null it
isn't emitted (caught by the double-round trip in the testcase I'm
adding) -- this is a required field in `LLParser`.

I'll circle back to ConvertDebugInfo2.  Once the specialized nodes are
in place, I'll be trying to turn the debug info verifier back on by
default (in the newer module pass form committed r206300) and throwing
more logic in there.  If the testcase has bitrotted (as opposed to me
not understanding the schema correctly) I'll fix it then.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 03:17:58 +00:00
Hal Finkel
5ecf528fc2 [InstCombine] Remove unnecessary variable indexing into single-element arrays
This change addresses a deficiency pointed out in PR22629. To copy from the bug
report:

[from the bug report]

Consider this code:

int f(int x) {
  int a[] = {12};
  return a[x];
}

GCC knows to optimize this to

movl     $12, %eax
ret

The code generated by recent Clang at -O3 is:

movslq   %edi, %rax
movl     .L_ZZ1fiE1a(,%rax,4), %eax
retq

.L_ZZ1fiE1a:
  .long    12                      # 0xc

[end from the bug report]

This definitely seems worth fixing. I've also seen this kind of code before (as
the base case of generic vector wrapper templates with one element).

The general idea is to look at the GEP feeding a load or a store, which has
some variable as its first non-zero index, and determine if that index must be
zero (or else an out-of-bounds access would occur). We can do this for allocas
and globals with constant initializers where we know the maximum size of the
underlying object. When we find such a GEP, we create a new one for the memory
access with that first variable index replaced with a constant zero.

Even if we can't eliminate the memory access (and sometimes we can't), it is
still useful because it removes unnecessary indexing calculations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229959 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 03:05:53 +00:00
Chandler Carruth
38749b8e07 [x86] Make the new vector shuffle legality test on by default, which
reflects the fact that the x86 backend can in fact lower any shuffle you
want it to with reasonably high code quality.

My recent work on the new vector shuffle has made this regress *very*
little. The diff in the test cases makes me very, very happy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229958 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20 03:05:47 +00:00