oota-llvm.git
9 years ago[InstCombine] Replace an and+icmp with a trunc+icmp
David Majnemer [Sun, 16 Aug 2015 07:09:17 +0000 (07:09 +0000)]
[InstCombine] Replace an and+icmp with a trunc+icmp

Bitwise arithmetic can obscure a simple sign-test.  If replacing the
mask with a truncate is preferable if the type is legal because it
permits us to rephrase the comparison more explicitly.

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

9 years agoRevert r244127: [PM] Remove a failed attempt to port the CallGraph
Chandler Carruth [Sun, 16 Aug 2015 06:35:19 +0000 (06:35 +0000)]
Revert r244127: [PM] Remove a failed attempt to port the CallGraph
analysis ...

It turns out that we *do* need the old CallGraph ported to the new pass
manager. There are times where this model of a call graph is really
superior to the one provided by the LazyCallGraph. For example,
GlobalsModRef very specifically needs the model provided by CallGraph.

While here, I've tried to make the move semantics actually work. =]

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

9 years ago[X86] Widen the 'AND' mask if doing so shrinks the encoding size
David Majnemer [Sun, 16 Aug 2015 04:52:11 +0000 (04:52 +0000)]
[X86] Widen the 'AND' mask if doing so shrinks the encoding size

We can set additional bits in a mask given that we know the other
operand of an AND already has some bits set to zero.  This can be more
efficient if doing so allows us to use an instruction which implicitly
sign extends the immediate.

This fixes PR24085.

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

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

9 years agoMergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.
NAKAMURA Takumi [Sun, 16 Aug 2015 02:41:23 +0000 (02:41 +0000)]
MergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.

Don't assume second would be ordered in the module.

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

9 years agoTry to appease VS 2015 warnings from http://reviews.llvm.org/D11890
Yaron Keren [Sat, 15 Aug 2015 19:06:14 +0000 (19:06 +0000)]
Try to appease VS 2015 warnings from reviews.llvm.org/D11890
ByteSize and BitSize should not be size_t but unsigned, considering

1) They are at most 2^16 and 2^19, respectively.
2) BitSize is an argument to Type::getIntNTy which takes unsigned.

Also, use the correct utostr instead itostr and cache the string result.

Thanks to James Touton for reporting this!

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

9 years ago[x86] enable machine combiner reassociations for scalar single-precision minimums
Sanjay Patel [Sat, 15 Aug 2015 17:01:54 +0000 (17:01 +0000)]
[x86] enable machine combiner reassociations for scalar single-precision minimums

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

9 years agoUpdated broadcast stack folding test to avoid use of broadcast intrinsics.
Simon Pilgrim [Sat, 15 Aug 2015 16:54:18 +0000 (16:54 +0000)]
Updated broadcast stack folding test to avoid use of broadcast intrinsics.

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

9 years agofix typos; NFC
Sanjay Patel [Sat, 15 Aug 2015 16:53:08 +0000 (16:53 +0000)]
fix typos; NFC

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

9 years agoadd test case to show current codegen
Sanjay Patel [Sat, 15 Aug 2015 16:49:50 +0000 (16:49 +0000)]
add test case to show current codegen

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

9 years agoSilence VS2015 warning.
Yaron Keren [Sat, 15 Aug 2015 14:54:43 +0000 (14:54 +0000)]
Silence VS2015 warning.
Patch by James Touton!

http://reviews.llvm.org/D11890

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

9 years ago[DAGCombiner] Attempt to mask vectors before zero extension instead of after.
Simon Pilgrim [Sat, 15 Aug 2015 13:27:30 +0000 (13:27 +0000)]
[DAGCombiner] Attempt to mask vectors before zero extension instead of after.

For cases where we TRUNCATE and then ZERO_EXTEND to a larger size (often from vector legalization), see if we can mask the source data and then ZERO_EXTEND (instead of after a ANY_EXTEND). This can help avoid having to generate a larger mask, and possibly applying it to several sub-vectors.

(zext (truncate x)) -> (zext (and(x, m))

Includes a minor patch to SystemZ to better recognise 8/16-bit zero extension patterns from RISBG bit-extraction code.

This is the first of a number of minor patches to help improve the conversion of byte masks to clear mask shuffles.

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

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

9 years ago[PM/AA] Delete the LibCallAliasAnalysis and all the associated
Chandler Carruth [Sat, 15 Aug 2015 09:22:21 +0000 (09:22 +0000)]
[PM/AA] Delete the LibCallAliasAnalysis and all the associated
infrastructure.

This AA was never used in tree. It's infrastructure also completely
overlaps that of TargetLibraryInfo which is used heavily by BasicAA to
achieve similar goals to those stated for this analysis.

As has come up in several discussions, the use case here is still really
important, but this code isn't helping move toward that use case. Any
progress on better supporting rich AA information for runtime library
environments would likely be better off starting from scratch or
starting from TargetLibraryInfo than from this base.

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

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

9 years ago[IR] Update CreateCatchRet to take a return value
David Majnemer [Sat, 15 Aug 2015 03:19:29 +0000 (03:19 +0000)]
[IR] Update CreateCatchRet to take a return value

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

9 years agoAMDGPU/SI: Only look at live out SGPR defs
Matt Arsenault [Sat, 15 Aug 2015 02:58:49 +0000 (02:58 +0000)]
AMDGPU/SI: Only look at live out SGPR defs

When trying to fix SGPR live ranges, skip defs that are
killed in the same block as the def. I don't think
we need to worry about these cases as long as the
live ranges of the SGPRs in dominating blocks are
correct.

This reduces the number of elements the second
loop over the function needs to look at, and makes
it generally easier to understand. The second loop
also only considers if the live range is live
in to a block, which logically means it
must have been live out from another.

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

9 years ago[IR] Give catchret an optional 'return value' operand
David Majnemer [Sat, 15 Aug 2015 02:46:08 +0000 (02:46 +0000)]
[IR] Give catchret an optional 'return value' operand

Some personality routines require funclet exit points to be clearly
marked, this is done by producing a token at the funclet pad and
consuming it at the corresponding ret instruction.  CleanupReturnInst
already had a spot for this operand but CatchReturnInst did not.
Other personality routines don't need to use this which is why it has
been made optional.

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

9 years agoRemove redundant TargetFrameLowering::getFrameIndexOffset virtual
James Y Knight [Sat, 15 Aug 2015 02:32:35 +0000 (02:32 +0000)]
Remove redundant TargetFrameLowering::getFrameIndexOffset virtual
function.

This was the same as getFrameIndexReference, but without the FrameReg
output.

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

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

9 years ago[WebAssembly] Add Relooper
JF Bastien [Sat, 15 Aug 2015 01:23:28 +0000 (01:23 +0000)]
[WebAssembly] Add Relooper

This is just an initial checkin of an implementation of the Relooper algorithm, in preparation for WebAssembly codegen to utilize. It doesn't do anything yet by itself.

The Relooper algorithm takes an arbitrary control flow graph and generates structured control flow from that, utilizing a helper variable when necessary to handle irreducibility. The WebAssembly backend will be able to use this in order to generate an AST for its binary format.

Author: azakai

Reviewers: jfb, sunfish

Subscribers: jevinskie, arsenm, jroelofs, llvm-commits

Differential revision: http://reviews.llvm.org/D11691

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

9 years agoAccelerate MergeFunctions with hashing
JF Bastien [Sat, 15 Aug 2015 01:18:18 +0000 (01:18 +0000)]
Accelerate MergeFunctions with hashing

This patch makes the Merge Functions pass faster by calculating and comparing
a hash value which captures the essential structure of a function before
performing a full function comparison.

The hash is calculated by hashing the function signature, then walking the basic
blocks of the function in the same order as the main comparison function. The
opcode of each instruction is hashed in sequence, which means that different
functions according to the existing total order cannot have the same hash, as
the comparison requires the opcodes of the two functions to be the same order.

The hash function is a static member of the FunctionComparator class because it
is tightly coupled to the exact comparison function used. For example, functions
which are equivalent modulo a single variant callsite might be merged by a more
aggressive MergeFunctions, and the hash function would need to be insensitive to
these differences in order to exploit this.

The hashing function uses a utility class which accumulates the values into an
internal state using a standard bit-mixing function. Note that this is a different interface
than a regular hashing routine, because the values to be hashed are scattered
amongst the properties of a llvm::Function, not linear in memory. This scheme is
fast because only one word of state needs to be kept, and the mixing function is
a few instructions.

The main runOnModule function first computes the hash of each function, and only
further processes functions which do not have a unique function hash. The hash
is also used to order the sorted function set. If the hashes differ, their
values are used to order the functions, otherwise the full comparison is done.

Both of these are helpful in speeding up MergeFunctions. Together they result in
speedups of 9% for mysqld (a mostly C application with little redundancy), 46%
for libxul in Firefox, and 117% for Chromium. (These are all LTO builds.) In all
three cases, the new speed of MergeFunctions is about half that of the module
verifier, making it relatively inexpensive even for large LTO builds with
hundreds of thousands of functions. The same functions are merged, so this
change is free performance.

Author: jrkoenig

Reviewers: nlewycky, dschuff, jfb

Subscribers: llvm-commits, aemerson

Differential revision: http://reviews.llvm.org/D11923

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

9 years agoMIRLangRef: Describe the syntax that is used to represent machine basic blocks.
Alex Lorenz [Sat, 15 Aug 2015 01:06:06 +0000 (01:06 +0000)]
MIRLangRef: Describe the syntax that is used to represent machine basic blocks.

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

9 years agoLoopStrengthReduce: Try to pass address space to isLegalAddressingMode
Matt Arsenault [Sat, 15 Aug 2015 00:53:06 +0000 (00:53 +0000)]
LoopStrengthReduce: Try to pass address space to isLegalAddressingMode

This seems to only work some of the time. In some situations,
this seems to use a nonsensical type and isn't actually aware of the
memory being accessed. e.g. if branch condition is an icmp of a pointer,
it checks the addressing mode of i1.

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

9 years agoAMDGPU/SI: Fix printing useless info with amdhsa
Matt Arsenault [Sat, 15 Aug 2015 00:12:39 +0000 (00:12 +0000)]
AMDGPU/SI: Fix printing useless info with amdhsa

The comments at the bottom would all report 0 if
amdhsa was used.

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

9 years agoAMDGPU/SI: Update LiveVariables
Matt Arsenault [Sat, 15 Aug 2015 00:12:37 +0000 (00:12 +0000)]
AMDGPU/SI: Update LiveVariables

This is simple but won't work if/when this pass
is moved to be post-SSA.

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

9 years agoAMDGPU/SI: Update LiveIntervals during SIFixSGPRLiveRanges
Matt Arsenault [Sat, 15 Aug 2015 00:12:35 +0000 (00:12 +0000)]
AMDGPU/SI: Update LiveIntervals during SIFixSGPRLiveRanges

Does not mark SlotIndexes as reserved, although I think
that might be OK.

LiveVariables still need to be handled.

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

9 years agoAMDGPU: Remove unnecessary assert
Matt Arsenault [Sat, 15 Aug 2015 00:12:32 +0000 (00:12 +0000)]
AMDGPU: Remove unnecessary assert

These shouldn't ever be null. The number of successors
was already asserted to be 2.

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

9 years agoAMDGPU/SI: Make comments more precise.
Matt Arsenault [Sat, 15 Aug 2015 00:12:30 +0000 (00:12 +0000)]
AMDGPU/SI: Make comments more precise.

True branch instructions do behave as expected with liveness.

Avoid the phrasing "branch decision is based on a value in an SGPR"
because this could be misleading. A VALU compare instruction's
result is still based on an SGPR, even though that condition
may be divergent.

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

9 years agomake current codegen visible in the checks, so we can decide if it's right
Sanjay Patel [Fri, 14 Aug 2015 23:03:01 +0000 (23:03 +0000)]
make current codegen visible in the checks, so we can decide if it's right

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

9 years agoFix a crash where a utility function wasn't aware of fcmp vectors and created a value...
Nick Lewycky [Fri, 14 Aug 2015 22:46:49 +0000 (22:46 +0000)]
Fix a crash where a utility function wasn't aware of fcmp vectors and created a value with the wrong type. Fixes PR24458!

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

9 years ago[SCEV] Apply NSW and NUW flags via poison value analysis for sub, mul and shl
Bjarke Hammersholt Roune [Fri, 14 Aug 2015 22:45:26 +0000 (22:45 +0000)]
[SCEV] Apply NSW and NUW flags via poison value analysis for sub, mul and shl

Summary:
http://reviews.llvm.org/D11212 made Scalar Evolution able to propagate NSW and NUW flags from instructions to SCEVs for add instructions. This patch expands that to sub, mul and shl instructions.

This change makes LSR able to generate pointer induction variables for loops like these, where the index is 32 bit and the pointer is 64 bit:

  for (int i = 0; i < numIterations; ++i)
    sum += ptr[i - offset];

  for (int i = 0; i < numIterations; ++i)
    sum += ptr[i * stride];

  for (int i = 0; i < numIterations; ++i)
    sum += ptr[3 * (i << 7)];

Reviewers: atrick, sanjoy

Subscribers: sanjoy, majnemer, hfinkel, llvm-commits, meheff, jingyue, eliben

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

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

9 years agoAdd a target environment for CoreCLR.
Pat Gavlin [Fri, 14 Aug 2015 22:41:43 +0000 (22:41 +0000)]
Add a target environment for CoreCLR.

Although targeting CoreCLR is similar to targeting MSVC, there are
certain important differences that the backend must be aware of
(e.g. differences in stack probes, EH, and library calls).

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

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

9 years agomake current codegen visible in the checks, so we can decide if it's right
Sanjay Patel [Fri, 14 Aug 2015 22:10:59 +0000 (22:10 +0000)]
make current codegen visible in the checks, so we can decide if it's right

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

9 years ago[AArch64] Fix FMLS scalar-indexed-from-2s-after-neg patterns.
Ahmed Bougacha [Fri, 14 Aug 2015 22:06:05 +0000 (22:06 +0000)]
[AArch64] Fix FMLS scalar-indexed-from-2s-after-neg patterns.

We canonicalize V64 vectors to V128 through insert_subvector: the other
FMLA/FMLS/FMUL/FMULX patterns match that already, but this one doesn't,
so we'd fail to match fmls and generate fneg+fmla instead.
The vector equivalents are already tested and functional.

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

9 years ago[msan] Fix handling of musttail calls.
Evgeniy Stepanov [Fri, 14 Aug 2015 22:03:50 +0000 (22:03 +0000)]
[msan] Fix handling of musttail calls.

MSan instrumentation for return values of musttail calls is not
allowed by the IR constraints, and not needed at the same time.

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

9 years ago[bpf] add documentation and instruction set description
Alexei Starovoitov [Fri, 14 Aug 2015 22:00:45 +0000 (22:00 +0000)]
[bpf] add documentation and instruction set description

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

9 years agoMIR Serialization: Serialize the '.cfi_same_value' CFI directive.
Alex Lorenz [Fri, 14 Aug 2015 21:55:58 +0000 (21:55 +0000)]
MIR Serialization: Serialize the '.cfi_same_value' CFI directive.

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

9 years agoMIR Serialization: Serialize the external symbol call entry pseudo source
Alex Lorenz [Fri, 14 Aug 2015 21:14:50 +0000 (21:14 +0000)]
MIR Serialization: Serialize the external symbol call entry pseudo source
values.

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

9 years agoMIR Serialization: Serialize the global value call entry pseudo source values.
Alex Lorenz [Fri, 14 Aug 2015 21:08:30 +0000 (21:08 +0000)]
MIR Serialization: Serialize the global value call entry pseudo source values.

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

9 years ago[RegionInfo] Remove unused and broken function splitBlock
Michael Kruse [Fri, 14 Aug 2015 20:20:00 +0000 (20:20 +0000)]
[RegionInfo] Remove unused and broken function splitBlock

Summary:
It always makes NewBB the entry of the region instead of OldBB. This breaks if there are edges from inside the region to OldBB. OldBB is moved out of the region and hence there are exiting edges to OldBB and the region's exit block, contradicting the single-exit condition for regions.

The only use from Polly is going to be removed, hence I propose to remove the function completely.

Reviewers: grosser

Subscribers: llvm-commits

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

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

9 years agoAMDGPU/SI: Add missing spill class
Tom Stellard [Fri, 14 Aug 2015 19:46:05 +0000 (19:46 +0000)]
AMDGPU/SI: Add missing spill class

The compiler was failing to spill for some shaders.

Patch By: Axel Davy

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

9 years agoRevert "[ARM] Fix MachO CPU Subtype selection"
Renato Golin [Fri, 14 Aug 2015 19:35:47 +0000 (19:35 +0000)]
Revert "[ARM] Fix MachO CPU Subtype selection"

This reverts commit r245081, as it breaks many builds.

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

9 years agoMIR Serialization: Serialize the 'internal' register operand flag.
Alex Lorenz [Fri, 14 Aug 2015 19:07:07 +0000 (19:07 +0000)]
MIR Serialization: Serialize the 'internal' register operand flag.

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

9 years agoMIR Serialization: Serialize the bundled machine instructions.
Alex Lorenz [Fri, 14 Aug 2015 18:57:24 +0000 (18:57 +0000)]
MIR Serialization: Serialize the bundled machine instructions.

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

9 years ago[ARM] Fix MachO CPU Subtype selection
Vedant Kumar [Fri, 14 Aug 2015 18:36:47 +0000 (18:36 +0000)]
[ARM] Fix MachO CPU Subtype selection

This patch makes the Darwin ARM backend take advantage of TargetParser.  It
also teaches TargetParser about ARMV7K for the first time. This makes target
triple parsing more consistent across llvm.

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

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

9 years ago[x86] fix allowsMisalignedMemoryAccess() implementation
Sanjay Patel [Fri, 14 Aug 2015 17:53:40 +0000 (17:53 +0000)]
[x86] fix allowsMisalignedMemoryAccess() implementation

This patch fixes the x86 implementation of allowsMisalignedMemoryAccess() to correctly
return the 'Fast' output parameter for 32-byte accesses. To test that, an existing load
merging optimization is changed to use the TLI hook. This exposes a shortcoming in the
current logic and results in the regression test update. Changing other direct users of
the isUnalignedMem32Slow() x86 CPU attribute would be a follow-on patch.

Without the fix in allowsMisalignedMemoryAccesses(), we will infinite loop when targeting
SandyBridge because LowerINSERT_SUBVECTOR() creates 32-byte loads from two 16-byte loads
while PerformLOADCombine() splits them back into 16-byte loads.

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

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

9 years ago[test] Testing write access to llvm
Vedant Kumar [Fri, 14 Aug 2015 17:42:50 +0000 (17:42 +0000)]
[test] Testing write access to llvm

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

9 years ago[sancov] Fix an unused variable warning introduced in r245067
Justin Bogner [Fri, 14 Aug 2015 17:03:45 +0000 (17:03 +0000)]
[sancov] Fix an unused variable warning introduced in r245067

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

9 years agoReverting patch r244235.
Kit Barton [Fri, 14 Aug 2015 16:54:32 +0000 (16:54 +0000)]
Reverting patch r244235.

This patch will be redone in a different way. See
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150810/292978.html
for more details.

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

9 years ago[cmake] Start adding support for LLVM_USE_SANITIZER=Address on Windows
Reid Kleckner [Fri, 14 Aug 2015 16:48:34 +0000 (16:48 +0000)]
[cmake] Start adding support for LLVM_USE_SANITIZER=Address on Windows

Pass "-fsanitize=address" to the compiler and "-debug" to the linker.

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

9 years ago[sancov] Leave llvm.localescape in the entry block
Reid Kleckner [Fri, 14 Aug 2015 16:45:42 +0000 (16:45 +0000)]
[sancov] Leave llvm.localescape in the entry block

Summary: Similar to the change we applied to ASan. The same test case works.

Reviewers: samsonov

Subscribers: llvm-commits

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

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

9 years agoCleanup test whitespace or lack thereof. NFC.
Chad Rosier [Fri, 14 Aug 2015 16:34:15 +0000 (16:34 +0000)]
Cleanup test whitespace or lack thereof. NFC.

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

9 years ago[CMake] Fix PR14200, llvm-config output misses -fno-rtti
Chris Bieneman [Fri, 14 Aug 2015 16:20:31 +0000 (16:20 +0000)]
[CMake] Fix PR14200, llvm-config output misses -fno-rtti

This change adds RTTI and Exception flags to llvm-config's cxxflags. This solution is a minimal patch to solve the issue, and is recommended for the 3.7 release branch. Tom Stellard's outstanding work is the longer term solution.

Patch By: David Wiberg

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

9 years agoRevert "Centralize the information about which object format we are using."
Rafael Espindola [Fri, 14 Aug 2015 15:48:41 +0000 (15:48 +0000)]
Revert "Centralize the information about which object format we are using."

This reverts commit r245047.

It was failing on the darwin bots. The problem was that when running

./bin/llc -march=msp430

llc gets to

  if (TheTriple.getTriple().empty())
    TheTriple.setTriple(sys::getDefaultTargetTriple());

Which means that we go with an arch of msp430 but a triple of
x86_64-apple-darwin14.4.0 which fails badly.

That code has to be updated to select a triple based on the value of
march, but that is not a trivial fix.

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

9 years agoConvert tests under MC/ELF from macho-dump to llvm-readobj.
Davide Italiano [Fri, 14 Aug 2015 15:16:37 +0000 (15:16 +0000)]
Convert tests under MC/ELF from macho-dump to llvm-readobj.

Yet another step towards deprecating macho-dump.

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

9 years agodon't repeaat function names in comments; NFC
Sanjay Patel [Fri, 14 Aug 2015 15:11:42 +0000 (15:11 +0000)]
don't repeaat function names in comments; NFC

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

9 years agoCentralize the information about which object format we are using.
Rafael Espindola [Fri, 14 Aug 2015 13:31:17 +0000 (13:31 +0000)]
Centralize the information about which object format we are using.

Other than some places that were handling unknown as ELF, this should
have no change. The test updates are because we were detecting
arm-coff or x86_64-win64-coff as ELF targets before.

It is not clear if the enum should live on the Triple. At least now it lives
in a single location and should be easier to move somewhere else.

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

9 years agoSeparate out BDCE's analysis into a separate DemandedBits analysis.
James Molloy [Fri, 14 Aug 2015 11:09:09 +0000 (11:09 +0000)]
Separate out BDCE's analysis into a separate DemandedBits analysis.

This allows other areas of the compiler to use BDCE's bit-tracking.
NFCI.

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

9 years agoRenamed min tests (typo)
Simon Pilgrim [Fri, 14 Aug 2015 11:03:31 +0000 (11:03 +0000)]
Renamed min tests (typo)

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

9 years ago[AArch64] FMINNAN/FMAXNAN on f16 is not legal.
James Molloy [Fri, 14 Aug 2015 09:08:50 +0000 (09:08 +0000)]
[AArch64] FMINNAN/FMAXNAN on f16 is not legal.

Spotted by Ahmed - in r244594 I inadvertently marked f16 min/max as legal.

I've reverted it here, and marked min/max on scalar f16's as promote. I've also added a testcase. The test just checks that the compiler doesn't fall over - it doesn't create fmin nodes for f16 yet.

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

9 years ago[PM/AA] Remove two no-op overridden functions that just delegated to the
Chandler Carruth [Fri, 14 Aug 2015 08:39:32 +0000 (08:39 +0000)]
[PM/AA] Remove two no-op overridden functions that just delegated to the
base class anyways.

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

9 years ago[LVer] Remove unused Pass parameter from versionLoop, NFC
Adam Nemet [Fri, 14 Aug 2015 06:30:26 +0000 (06:30 +0000)]
[LVer] Remove unused Pass parameter from versionLoop, NFC

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

9 years ago[RuntimeDyld] Make sure code-sections aren't under-aligned.
Lang Hames [Fri, 14 Aug 2015 06:26:42 +0000 (06:26 +0000)]
[RuntimeDyld] Make sure code-sections aren't under-aligned.

Code-section alignment should be at least as high as the minimum
stub alignment. If the section alignment is lower it can cause
padding to be emitted resulting in alignment errors if the section
is mapped to a higher alignment on the target.

E.g. If a text section with a 4-byte alignment gets 4-bytes of
padding to guarantee 8-byte alignment for stubs but is re-mapped to
an 8-byte alignment on the target, the 4-bytes of padding will push
the stubs to 4-byte alignment causing a crash.

No test case: There is currently no way to control host section
alignment in llvm-rtdyld. This could be made testable by adding
a custom memory manager. I'll look at that in a follow-up patch.

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

9 years ago[IR] Add token types
David Majnemer [Fri, 14 Aug 2015 05:09:07 +0000 (05:09 +0000)]
[IR] Add token types

This introduces the basic functionality to support "token types".
The motivation stems from the need to perform operations on a Value
whose provenance cannot be obscured.

There are several applications for such a type but my immediate
motivation stems from WinEH.  Our personality routine enforces a
single-entry - single-exit regime for cleanups.  After several rounds of
optimizations, we may be left with a terminator whose "cleanup-entry
block" is not entirely clear because control flow has merged two
cleanups together.  We have experimented with using labels as operands
inside of instructions which are not terminators to indicate where we
came from but found that LLVM does not expect such exotic uses of
BasicBlocks.

Instead, we can use this new type to clearly associate the "entry point"
and "exit point" of our cleanup.  This is done by having the cleanuppad
yield a Token and consuming it at the cleanupret.
The token type makes it impossible to obscure or otherwise hide the
Value, making it trivial to track the relationship between the two
points.

What is the burden to the optimizer?  Well, it turns out we have already
paid down this cost by accepting that there are certain calls that we
are not permitted to duplicate, optimizations have to watch out for
such instructions anyway.  There are additional places in the optimizer
that we will probably have to update but early examination has given me
the impression that this will not be heroic.

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

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

9 years agoAdd support for cross block dse.
Karthik Bhat [Fri, 14 Aug 2015 04:17:23 +0000 (04:17 +0000)]
Add support for cross block dse.
This patch enables dead stroe elimination across basicblocks.

Example:
define void @test_02(i32 %N) {
  %1 = alloca i32
  store i32 %N, i32* %1
  store i32 10, i32* @x
  %2 = load i32, i32* %1
  %3 = icmp ne i32 %2, 0
  br i1 %3, label %4, label %5

; <label>:4
  store i32 5, i32* @x
  br label %7

; <label>:5
  %6 = load i32, i32* @x
  store i32 %6, i32* @y
  br label %7

; <label>:7
  store i32 15, i32* @x
  ret void
}
In the above example dead store "store i32 5, i32* @x" is now eliminated.

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

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

9 years ago[PM/AA] Run clang-format over the ObjCARC Alias Analysis code to
Chandler Carruth [Fri, 14 Aug 2015 03:57:00 +0000 (03:57 +0000)]
[PM/AA] Run clang-format over the ObjCARC Alias Analysis code to
normalize its formatting before I make more substantial changes.

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

9 years ago[PM/AA] Don't bother forward declaring Function and Value, just include
Chandler Carruth [Fri, 14 Aug 2015 03:55:36 +0000 (03:55 +0000)]
[PM/AA] Don't bother forward declaring Function and Value, just include
their headers.

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

9 years agoPowerPC: remove dead initialization (NFC)
Saleem Abdulrasool [Fri, 14 Aug 2015 03:48:35 +0000 (03:48 +0000)]
PowerPC: remove dead initialization (NFC)

Identified by the clang static analyzer.  No functional change intended.

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

9 years ago[PM/AA] Extract the interface for GlobalsModRef into a header along with
Chandler Carruth [Fri, 14 Aug 2015 03:48:20 +0000 (03:48 +0000)]
[PM/AA] Extract the interface for GlobalsModRef into a header along with
its creation function.

This required shifting a bunch of method definitions to be out-of-line
so that we could leave most of the implementation guts in the .cpp file.

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

9 years ago[PM/AA] Hoist the interface to TBAA into a dedicated header along with
Chandler Carruth [Fri, 14 Aug 2015 03:33:48 +0000 (03:33 +0000)]
[PM/AA] Hoist the interface to TBAA into a dedicated header along with
its creation function. Update the relevant includes accordingly.

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

9 years ago[PM/AA] Run clang-format over TBAA code to normalize the formatting
Chandler Carruth [Fri, 14 Aug 2015 03:26:15 +0000 (03:26 +0000)]
[PM/AA] Run clang-format over TBAA code to normalize the formatting
before making substantial changes.

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

9 years ago[PM/AA] Remove a stray #include that snuck in via copy/paste when
Chandler Carruth [Fri, 14 Aug 2015 03:16:11 +0000 (03:16 +0000)]
[PM/AA] Remove a stray #include that snuck in via copy/paste when
creating this header.

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

9 years ago[PM/AA] Clean up the SCEV-AA comment formatting and typos.
Chandler Carruth [Fri, 14 Aug 2015 03:14:50 +0000 (03:14 +0000)]
[PM/AA] Clean up the SCEV-AA comment formatting and typos.

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

9 years ago[PM/AA] Run clang-format over the SCEV-AA code to normalize the
Chandler Carruth [Fri, 14 Aug 2015 03:12:16 +0000 (03:12 +0000)]
[PM/AA] Run clang-format over the SCEV-AA code to normalize the
formatting.

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

9 years ago[PM/AA] Hoist the SCEV-AA interface to its own header and pull the
Chandler Carruth [Fri, 14 Aug 2015 03:11:16 +0000 (03:11 +0000)]
[PM/AA] Hoist the SCEV-AA interface to its own header and pull the
creation function into that header.

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

9 years ago[PM/AA] Hoist ScopedNoAliasAA's interface into a header and move the
Chandler Carruth [Fri, 14 Aug 2015 02:55:50 +0000 (02:55 +0000)]
[PM/AA] Hoist ScopedNoAliasAA's interface into a header and move the
creation function there.

Same basic refactoring as the other alias analyses. Nothing special
required this time around.

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

9 years ago[PM/AA] Hoist the value handle definition for CFLAA into the header to
Chandler Carruth [Fri, 14 Aug 2015 02:50:34 +0000 (02:50 +0000)]
[PM/AA] Hoist the value handle definition for CFLAA into the header to
satisfy libc++'s std::forward_list which requires the value type to be
complete.

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

9 years ago[PM/AA] Run clang-format over the ScopedNoAliasAA pass prior to making
Chandler Carruth [Fri, 14 Aug 2015 02:46:07 +0000 (02:46 +0000)]
[PM/AA] Run clang-format over the ScopedNoAliasAA pass prior to making
substantial changes to normalize any formatting.

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

9 years ago[PM/AA] Extract a minimal interface for CFLAA to its own header file.
Chandler Carruth [Fri, 14 Aug 2015 02:42:20 +0000 (02:42 +0000)]
[PM/AA] Extract a minimal interface for CFLAA to its own header file.

I've used forward declarations and reorderd the source code some to make
this reasonably clean and keep as much of the code as possible in the
source file, including all the stratified set details. Just the basic AA
interface and the create function are in the header file, and the header
file is now included into the relevant locations.

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

9 years ago[PM/AA] Delete two pointlessly overridden methods on the AA interface by
Chandler Carruth [Fri, 14 Aug 2015 02:16:12 +0000 (02:16 +0000)]
[PM/AA] Delete two pointlessly overridden methods on the AA interface by
the AA counter pass.

For pointsToConstantMemory, I think this is a "bug fix" as I think the
code as written will actually infloop if ever reached. For the
getModRefInfo, this is a no-op change but with a significantly simpler
form.

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

9 years ago[PM/AA] Sink all the actual code from AliasAnalysisCounter back into the
Chandler Carruth [Fri, 14 Aug 2015 02:12:12 +0000 (02:12 +0000)]
[PM/AA] Sink all the actual code from AliasAnalysisCounter back into the
.cpp file to make the header much less noisy.

Also makes it easy to use a static helper rather than a public method
for printing lines of stats.

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

9 years ago[PM/AA] Run clang-format over this code to establish a clean baseline
Chandler Carruth [Fri, 14 Aug 2015 02:07:05 +0000 (02:07 +0000)]
[PM/AA] Run clang-format over this code to establish a clean baseline
for subsequent changes.

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

9 years ago[PM/AA] Hoist the AA counter pass into a header to match the analysis
Chandler Carruth [Fri, 14 Aug 2015 02:05:41 +0000 (02:05 +0000)]
[PM/AA] Hoist the AA counter pass into a header to match the analysis
pattern.

Also hoist the creation routine out of the generic header and into the
pass header now that we have one.

I've worked to not make any changes, even formatting ones here. I'll
clean up the formatting and other things in a follow-up patch now that
the code is in the right place.

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

9 years ago[SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow.
Jingyue Wu [Fri, 14 Aug 2015 02:02:05 +0000 (02:02 +0000)]
[SeparateConstOffsetFromGEP] sext(a)+sext(b) => sext(a+b) when a+b can't sign-overflow.

Summary:
This patch implements my promised optimization to reunites certain sexts from
operands after we extract the constant offset. See the header comment of
reuniteExts for its motivation.

One key building block that enables this optimization is Bjarke's poison value
analysis (D11212). That helps to prove "a +nsw b" can't overflow.

Reviewers: broune

Subscribers: jholewinski, sanjoy, llvm-commits

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

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

9 years ago[PM/AA] Remove the function names and class names from doxygen comments
Chandler Carruth [Fri, 14 Aug 2015 01:43:46 +0000 (01:43 +0000)]
[PM/AA] Remove the function names and class names from doxygen comments
and generally clean up their formatting.

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

9 years ago[PM/AA] Move the LibCall AA creation routine declaration to that
Chandler Carruth [Fri, 14 Aug 2015 01:43:02 +0000 (01:43 +0000)]
[PM/AA] Move the LibCall AA creation routine declaration to that
analysis's header file to be more consistent with other analyses.

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

9 years ago[PM/AA] Run clang-format over LibCallAliasAnalysis prior to making
Chandler Carruth [Fri, 14 Aug 2015 01:38:25 +0000 (01:38 +0000)]
[PM/AA] Run clang-format over LibCallAliasAnalysis prior to making
substantial changes needed for the new pass manager's AA integration.

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

9 years agoUpdate ExceptionDemo for exception handling API changes (personality function call...
David Blaikie [Fri, 14 Aug 2015 00:37:16 +0000 (00:37 +0000)]
Update ExceptionDemo for exception handling API changes (personality function call->function move)

The ExceptionDemo now compiles, but doesn't link... undefined type
references to various typeinfo.

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

9 years agoUpdate MIRLangRef for MIR syntax change from r244982.
Alex Lorenz [Fri, 14 Aug 2015 00:36:10 +0000 (00:36 +0000)]
Update MIRLangRef for MIR syntax change from r244982.

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

9 years agoFix -Wformat warnings in ExceptionDemo
David Blaikie [Fri, 14 Aug 2015 00:31:49 +0000 (00:31 +0000)]
Fix -Wformat warnings in ExceptionDemo

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

9 years agoFix up the ExceptionDemo for some API changes over the past <time>
David Blaikie [Fri, 14 Aug 2015 00:24:56 +0000 (00:24 +0000)]
Fix up the ExceptionDemo for some API changes over the past <time>

This still doesn't build -Werror clean, but other than that it should at
least build.

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

9 years ago[LIR] Re-instate r244880, reverted in r244884, factoring the handling of
Chandler Carruth [Fri, 14 Aug 2015 00:21:10 +0000 (00:21 +0000)]
[LIR] Re-instate r244880, reverted in r244884, factoring the handling of
AliasAnalysis in LoopIdiomRecognize.

The previous commit to LIR, r244879, exposed some scary bug in the loop
pass pipeline with an assert failure that showed up on several bots.
This patch got reverted as part of getting that revision reverted, but
they're actually independent and unrelated. This patch has no functional
change and should be completely safe. It is also useful for my current
work on the AA infrastructure.

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

9 years agoMIR Serialization: Change MIR syntax - use custom syntax for MBBs.
Alex Lorenz [Thu, 13 Aug 2015 23:10:16 +0000 (23:10 +0000)]
MIR Serialization: Change MIR syntax - use custom syntax for MBBs.

This commit modifies the way the machine basic blocks are serialized - now the
machine basic blocks are serialized using a custom syntax instead of relying on
YAML primitives. Instead of using YAML mappings to represent the individual
machine basic blocks in a machine function's body, the new syntax uses a single
YAML block scalar which contains all of the machine basic blocks and
instructions for that function.

This is an example of a function's body that uses the old syntax:

    body:
      - id: 0
        name: entry
        instructions:
          - '%eax = MOV32r0 implicit-def %eflags'
          - 'RETQ %eax'
    ...

The same body is now written like this:

    body: |
      bb.0.entry:
        %eax = MOV32r0 implicit-def %eflags
        RETQ %eax
    ...

This syntax change is motivated by the fact that the bundled machine
instructions didn't map that well to the old syntax which was using a single
YAML sequence to store all of the machine instructions in a block. The bundled
machine instructions internally use flags like BundledPred and BundledSucc to
determine the bundles, and serializing them as MI flags using the old syntax
would have had a negative impact on the readability and the ease of editing
for MIR files. The new syntax allows me to serialize the bundled machine
instructions using a block construct without relying on the internal flags,
for example:

   BUNDLE implicit-def dead %itstate, implicit-def %s1 ... {
      t2IT 1, 24, implicit-def %itstate
      %s1 = VMOVS killed %s0, 1, killed %cpsr, implicit killed %itstate
   }

This commit also converts the MIR testcases to the new syntax. I developed
a script that can convert from the old syntax to the new one. I will post the
script on the llvm-commits mailing list in the thread for this commit.

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

9 years agodon't repeat function names in comments; NFC
Sanjay Patel [Thu, 13 Aug 2015 22:53:20 +0000 (22:53 +0000)]
don't repeat function names in comments; NFC

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

9 years ago[IR] Cleanup indentation of EH instructions
David Majnemer [Thu, 13 Aug 2015 22:11:40 +0000 (22:11 +0000)]
[IR] Cleanup indentation of EH instructions

No functional change is intended, just tidying up whitespace.

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

9 years ago[AMDGPU] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the AMDGPU...
Simon Pilgrim [Thu, 13 Aug 2015 21:40:02 +0000 (21:40 +0000)]
[AMDGPU] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the AMDGPU implementation

D9746 added general SMAX/SMIN/UMAX/UMIN pattern matching to SelectionDAGBuilder::visitSelect.

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

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

9 years ago[AArch64] Provide "too few operands" diags on short-form NEON also.
Ahmed Bougacha [Thu, 13 Aug 2015 21:09:13 +0000 (21:09 +0000)]
[AArch64] Provide "too few operands" diags on short-form NEON also.

We used to just say "invalid type suffix for instruction", which is
misleading. This is because we fallback to the long-form matcher if the
short-form matcher failed, losing the error information on the way.

Save it, so that we can provide a little better diagnostics when the
long-form matcher thinks a suffix is the cause of the error.

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

9 years agoMIR Parser: Don't allow negative alignments for memory operands.
Alex Lorenz [Thu, 13 Aug 2015 20:55:01 +0000 (20:55 +0000)]
MIR Parser: Don't allow negative alignments for memory operands.

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

9 years ago[X86][SSE] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the X86...
Simon Pilgrim [Thu, 13 Aug 2015 20:45:55 +0000 (20:45 +0000)]
[X86][SSE] Use the general SMAX/SMIN/UMAX/UMIN pattern matching and remove the X86 implementation

Follow up to D10947 - D9746 added general SMAX/SMIN/UMAX/UMIN pattern matching to SelectionDAGBuilder::visitSelect.

This patch removes the X86 implementation and improves the AVX1/AVX2 support to correctly lower 256-bit integer vectors.

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

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

9 years ago[SimplifyLibCalls] Correctly set the is_zero_undef flag for llvm.cttz
Davide Italiano [Thu, 13 Aug 2015 20:34:26 +0000 (20:34 +0000)]
[SimplifyLibCalls] Correctly set the is_zero_undef flag for llvm.cttz

If <src> is non-zero we can safely set the flag to true, and this
results in less code generated for, e.g. ffs(x) + 1 on FreeBSD.
Thanks to majnemer for suggesting the fix and reviewing.

Code generated before the patch was applied:

 0:   0f bc c7                bsf    %edi,%eax
 3:   b9 20 00 00 00          mov    $0x20,%ecx
 8:   0f 45 c8                cmovne %eax,%ecx
 b:   83 c1 02                add    $0x2,%ecx
 e:   b8 01 00 00 00          mov    $0x1,%eax
13:   85 ff                   test   %edi,%edi
15:   0f 45 c1                cmovne %ecx,%eax
18:   c3                      retq

Code generated after the patch was applied:

 0:   0f bc cf                bsf    %edi,%ecx
 3:   83 c1 02                add    $0x2,%ecx
 6:   85 ff                   test   %edi,%edi
 8:   b8 01 00 00 00          mov    $0x1,%eax
 d:   0f 45 c1                cmovne %ecx,%eax
10:   c3                      retq

It seems we can still use cmove and save another 'test' instruction, but
that can be tackled separately.

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

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

9 years agoMIR Parser: Extract the code that parses the alignment into a new method. NFC.
Alex Lorenz [Thu, 13 Aug 2015 20:33:33 +0000 (20:33 +0000)]
MIR Parser: Extract the code that parses the alignment into a new method. NFC.

This commit extracts the code that parses the memory operand's alignment into
a new method named 'parseAlignment' so that it can be reused when parsing the
basic block's alignment attribute.

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

9 years ago[X86][SSE] Tests for SMAX/SMIN/UMAX/UMIN vector instructions
Simon Pilgrim [Thu, 13 Aug 2015 20:31:03 +0000 (20:31 +0000)]
[X86][SSE] Tests for SMAX/SMIN/UMAX/UMIN vector instructions

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

9 years agoMIR Parser: Rename the method 'diagFromLLVMAssemblyDiag'. NFC.
Alex Lorenz [Thu, 13 Aug 2015 20:30:11 +0000 (20:30 +0000)]
MIR Parser: Rename the method 'diagFromLLVMAssemblyDiag'. NFC.

This commit renames the method 'diagFromLLVMAssemblyDiag' to
'diagFromBlockStringDiag'. This method will be used when converting diagnostics
from other YAML block strings, and not just the LLVM module block string, so
the new name should reflect that.

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