Commit Graph

114074 Commits

Author SHA1 Message Date
Sanjoy Das
edf1700d33 Fix bug 22641
The bug was a result of getPreStartForExtend interpreting nsw/nuw
flags on an add recurrence more strongly than is legal.  {S,+,X}<nsw>
implies S+X is nsw only if the backedge of the loop is taken at least
once.

NOTE: I had accidentally committed an unrelated change with the commit
message of this change in r230275 (r230275 was reverted in r230279).
This is the correct change for this commit message.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230291 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 01:02:42 +00:00
Manman Ren
bd26e6a006 [LTO API] add lto_codegen_set_module to set the destination module.
When debugging LTO issues with ld64, we use -save-temps to save the merged
optimized bitcode file, then invoke ld64 again on the single bitcode file to
speed up debugging code generation passes and ld64 stuff after code generation.

llvm linking a single bitcode file via lto_codegen_add_module will generate a
different bitcode file from the single input. With the newly-added
lto_codegen_set_module, we can make sure the destination module is the same as
the input.

lto_codegen_set_module will transfer the ownship of the module to code
generator.

rdar://19024554


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230290 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 00:45:56 +00:00
Adam Nemet
989a0200c2 [LoopAccesses] LAA::getInfo to use const reference for stride parameter
And other required const-correctness fixes to make this work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230289 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 00:41:59 +00:00
David Majnemer
fbdee9f0c0 X86: Only use 'lea' in Win64 epilogues if a frame pointer exists
We can only use 'add' in epilogues, 'lea' is not permitted unless we've
established a frame pointer in the prologue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230286 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 00:11:32 +00:00
Sanjoy Das
f922d9cfe4 New instcombine rule: max(~a,~b) -> ~min(a, b)
This case is interesting because ScalarEvolutionExpander lowers min(a,
b) as ~max(~a,~b).  I think the profitability heuristics can be made
more clever/aggressive, but this is a start.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230285 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 00:08:41 +00:00
Sanjoy Das
8d16a81c33 Bugfix: SCEVExpander incorrectly marks increment operations as no-wrap
When emitting the increment operation, SCEVExpander marks the
operation as nuw or nsw based on the flags on the preincrement SCEV.
This is incorrect because, for instance, it is possible that {-6,+,1}
is <nuw> while {-6,+,1}+1 = {-5,+,1} is not.

This change teaches SCEV to mark the increment as nuw/nsw only if it
can explicitly prove that the increment operation won't overflow.

Apart from the attached test case, another (more realistic) manifestation
of the bug can be seen in Transforms/IndVarSimplify/pr20680.ll.

NOTE: this change was landed with an incorrect commit message in
rL230275 and was reverted for that reason in rL230279.  This commit
message is the correct one.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230280 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 23:22:58 +00:00
Sanjoy Das
69048edf8a Revert 230275.
230275 got committed with an incorrect commit message due to a mixup
on my side.  Will re-land in a few moments with the correct commit
message.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230279 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 23:13:22 +00:00
Simon Pilgrim
a631cd85ca Fix based on post-commit comment on D7816 & rL230177 - BUILD_VECTOR operand truncation was using the the BV's output scalar type instead of the input type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230278 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 23:04:28 +00:00
Andrea Di Biagio
770e106ed6 [X86] Teach how to custom lower double-to-half conversions under fast-math.
This patch teaches the backend how to expand a double-half conversion into
a double-float conversion immediately followed by a float-half conversion.
We do this only under fast-math, and if float-half conversions are legal
for the target.

Added test CodeGen/X86/fastmath-float-half-conversion.ll

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230276 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 22:59:02 +00:00
Sanjoy Das
7ebbc8de2f Fix bug 22641
The bug was a result of getPreStartForExtend interpreting nsw/nuw
flags on an add recurrence more strongly than is legal.  {S,+,X}<nsw>
implies S+X is nsw only if the backedge of the loop is taken at least
once.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230275 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 22:55:13 +00:00
Rafael Espindola
38ce6c7c1c Fix invalid cast.
Fixes PR22525.

Patch by Ben Longbons with testcase by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230271 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:51:06 +00:00
David Majnemer
ad6622575c X86: Use a smaller 'mov' instruction for stack probe calls
Prologue emission, in some cases, requires calls to a stack probe helper
function.  The amount of stack to probe is passed as a register
argument in the Win64 ABI but the instruction sequence used is
pessimistic: it assumes that the number of bytes to probe is greater
than 4 GB.

Instead, select a more appropriate opcode depending on the number of
bytes we are going to probe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:50:30 +00:00
David Majnemer
d71e4c6218 X86: Use 'mov' instead of 'lea' in Win64 SEH prologues when possible
'mov' and 'lea' are equivalent when the displacement applied with 'lea'
is zero.  However, 'mov' should encode smaller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230269 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:50:27 +00:00
David Majnemer
16ae406776 X86: Explain why we cannot use a 'mov' in a Win64 epilogue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230268 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:50:25 +00:00
David Majnemer
10c4458d7d X86: Consistently use 'epilogue' instead of 'epilog'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230267 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:50:18 +00:00
Sanjay Patel
4aef46411f add newline for easier reading; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230265 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:32:09 +00:00
Bruno Cardoso Lopes
6bf5b2b094 [AsmPrinter] Access pointers to globals via pcrel GOT entries
Front-ends could use global unnamed_addr to hold pointers to other
symbols, like @gotequivalent below:

@foo = global i32 42
@gotequivalent = private unnamed_addr constant i32* @foo

@delta = global i32 trunc (i64 sub (i64 ptrtoint (i32** @gotequivalent to i64),
                                    i64 ptrtoint (i32* @delta to i64))
                           to i32)

The global @delta holds a data "PC"-relative offset to @gotequivalent,
an unnamed pointer to @foo. The darwin/x86-64 assembly output for this follows:

 .globl  _foo
_foo:
 .long   42

 .globl  _gotequivalent
_gotequivalent:
 .quad   _foo

 .globl  _delta
_delta:
 .long   _gotequivalent-_delta

Since unnamed_addr indicates that the address is not significant, only
the content, we can optimize the case above by replacing pc-relative
accesses to "GOT equivalent" globals, by a PC relative access to the GOT
entry of the final symbol instead. Therefore, "delta" can contain a pc
relative relocation to foo's GOT entry and we avoid the emission of
"gotequivalent", yielding the assembly code below:

 .globl  _foo
_foo:
 .long   42

 .globl  _delta
_delta:
 .long   _foo@GOTPCREL+4

There are a couple of advantages of doing this: (1) Front-ends that need
to emit a great deal of data to store pointers to external symbols could
save space by not emitting such "got equivalent" globals and (2) IR
constructs combined with this opt opens a way to represent GOT pcrel
relocations by using the LLVM IR, which is something we previously had
no way to express.

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

rdar://problem/18534217

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:26:18 +00:00
Justin Bogner
90c4e8b70c InstrProf: Teach llvm-cov to show the max count instead of the last
When multiple regions start on the same line, llvm-cov was just
showing the count of the last one as the line count. This can be
confusing and misleading for things like one-liner loops, where the
count at the end isn't very interesting, or even "if" statements with
an opening brace at the end of the line.

Instead, use the maximum of all of the region start counts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230263 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:21:34 +00:00
Andrew Kaylor
5b7c499806 Removing unused private field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230259 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 21:03:30 +00:00
Bruno Cardoso Lopes
a7db376a63 [X86][MMX] Fix test to reflect current codegen
This test failed in several buildbots, a bit unclear how that happen
since this was the previous behavior before r230248.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230258 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 20:57:46 +00:00
Andrew Kaylor
338d982b83 Second attempt to fix WinEHCatchDirector build failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230257 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 20:44:34 +00:00
Andrew Kaylor
df9618c51f Attempting to fix WinEHCatchDirector destructor related build failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230252 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 20:19:15 +00:00
Andrew Kaylor
595050a793 Adding test for Windows EH frame variable remapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230250 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 20:04:51 +00:00
Andrew Kaylor
1d10231766 Remap frame variables for native Windows exception handling.
Differential Revision: http://reviews.llvm.org/D7770



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230249 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 20:01:56 +00:00
Bruno Cardoso Lopes
ee7b509aa3 Revert "[X86][MMX] Add MMX instructions to foldable tables"
This reverts commit r230226 since it breaks win buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230248 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 19:53:37 +00:00
Chad Rosier
9659f43f10 Revert "Revert "Raising minimum required CMake version to 2.8.12.2.""
This reverts commit r230240, which was an accidental commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230246 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 19:34:04 +00:00
Eric Christopher
308458a98b Rewrite the global merge pass to be subprogram agnostic for now.
It was previously using the subtarget to get values for the global
offset without actually checking each function as it was generating
code. Go ahead and solidify the current behavior and make the
existing FIXMEs more prominent.

As a note the ARM backend previously had a thumb1 and non-thumb1
set of defaults. Only the former was tested so I've changed the
behavior to only use that for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230245 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 19:28:45 +00:00
Chad Rosier
6229219f7e Prevent hoisting fmul from THEN/ELSE to IF if there is fmsub/fmadd opportunity.
This patch adds the isProfitableToHoist API.  For AArch64, we want to prevent a
fmul from being hoisted in cases where it is more profitable to form a
fmsub/fmadd.

Phabricator Review: http://reviews.llvm.org/D7299
Patch by Lawrence Hu <lawrence@codeaurora.org>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230241 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 19:15:16 +00:00
Chad Rosier
3986322604 Revert "Raising minimum required CMake version to 2.8.12.2."
This reverts commit 247aed4710.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230240 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 19:15:08 +00:00
Reid Kleckner
c38816e9d8 cmake: Don't do the libstdc++ version check when clang simulates MSVC
If we're using clang-cl, that's a pretty good indication that we're
going to use MSVC's STL.

This simplifies the clang-cl ninja self-host configuration down to:
CC=clang-cl CXX=clang-cl cmake .. -GNinja

Modified version of zturner's patch:
Differential Revision: http://reviews.llvm.org/D7824

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 19:07:25 +00:00
Mehdi Amini
2bd4b63e7a InstSimplify: simplify 0 / X if nnan and nsz
From: Fiona Glaser <fglaser@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230238 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 18:30:25 +00:00
Daniel Sanders
b50b4e2d36 [mips] Honour -mno-odd-spreg for vector insert/extract when MSA is enabled.
Summary:
-mno-odd-spreg prohibits the use of odd-numbered single-precision floating
point registers. However, vector insert/extract was still using them when
manipulating the subregisters of an MSA register. Fixed this by ensuring
that insertion/extraction is only performed on even-numbered vector
registers when -mno-odd-spreg is given.

Reviewers: vmedic, sstankovic

Reviewed By: sstankovic

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230235 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 17:22:16 +00:00
Bob Wilson
5820b51546 Fix incorrect immediate size for AddrModeT2_i8s4 in rewriteT2FrameIndex.
The natural way to handle this addressing mode would be to say that it has
8 bits and gets scaled by 4, but since the MC layer is expecting the scaling
to be already reflected in the immediate value, we have been setting the
Scale to 1. That's fine, but then NumBits needs to be adjusted to reflect
the effective increase in the range of the immediate. That adjustment was
missing.

The consequence is that the register scavenger can fail.
The estimateRSStackSizeLimit() function in ARMFrameLowering.cpp correctly
assumes that the AddrModeT2_i8s4 address mode can handle scaled offsets up to
1020. Under just the right circumstances, we fail to reserve space for the
scavenger because it thinks that nothing will be needed. However, the overly
pessimistic behavior in rewriteT2FrameIndex causes some frame indexes to be
out of range and require scavenged registers, and so the scavenger asserts.

Unfortunately I have not been able to come up with a testcase for this. I
can only reproduce it on an internal branch where the frame layout and
register allocation is slightly different than trunk. We really need a
way to serialize MachineInstr-level IR to write reasonable tests for things
like this.

rdar://problem/19909005

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230233 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 16:57:19 +00:00
Benjamin Kramer
42f72e2c16 Sync the __builtin_expects for our 3 quadratically probed hash table implementations.
This assumes that
  a) finding the bucket containing the value is LIKELY
  b) finding an empty bucket is LIKELY
  c) growing the table is UNLIKELY

I also switched the a) and b) cases for SmallPtrSet as we seem to use
the set mostly more for insertion than for checking existence.

In a simple benchmark consisting of 2^21 insertions of 2^20 unique
pointers into a DenseMap or SmallPtrSet a few percent speedup on average,
but nothing statistically significant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230232 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 16:41:36 +00:00
Bruno Cardoso Lopes
01312dd0b4 [X86] Add specific mtriple in order to appease builbots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230229 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 15:33:40 +00:00
Bruno Cardoso Lopes
77d2363908 [X86][MMX] Add MMX instructions to foldable tables
Teach the peephole optimizer to work with MMX instructions by adding
entries into the foldable tables. This covers folding opportunities not
handled during isel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230226 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 15:23:22 +00:00
Bruno Cardoso Lopes
c606f3a3cb [X86][MMX] Support folding loads in psll, psrl and psra intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230225 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 15:23:14 +00:00
Bruno Cardoso Lopes
6916c75fba [X86][MMX] Add tests for pslli, psrli and psrai intrinsics
Add tests to cover the RR form of the pslli, psrli and psrai intrinsics.
In the next commit, the loads are going to be folded and the
instructions use the RM form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230224 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 15:23:06 +00:00
Elena Demikhovsky
fdafc8fd5e AVX-512: recommitted 229837 + bugfix + test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230223 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 15:12:31 +00:00
Elena Demikhovsky
d8e5adcd92 restructured X86 scalar unary operation templates
I made the templates general, no need to define pattern separately for each instruction/intrinsic.
Now only need to add r_Int pattern for AVX.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230221 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 14:14:02 +00:00
Benjamin Kramer
84bcaea04a [llvm-pdbdump] Remove unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230216 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 11:33:54 +00:00
NAKAMURA Takumi
1aff188eca Orc/JITSymbol.h requires not "Compiler.h" but "DataTypes.h" due to uint64_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230214 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 11:12:52 +00:00
David Majnemer
749c0292c1 AsmParser: Check ConstantExpr insertvalue operands for type correctness
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 07:13:52 +00:00
Zachary Turner
ad73d54ee0 [llvm-pdbdump] Fix builders again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 06:13:27 +00:00
Zachary Turner
4ad658d8f1 [llvm-pdbdump] Very minor code cleanup.
This just removes some dead enums as well as some debug flushes
of stdout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 05:59:14 +00:00
Zachary Turner
92d755ea65 [llvm-pdbdump] Add an option to dump full class definitions.
This adds the --class-definitions flag.  If specified, when dumping
types, instead of "class Foo" you will see the full class definition,
with member functions, constructors, access specifiers.

NOTE: Using this option can be very slow, as generating a full class
definition requires accessing many different parts of the PDB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230203 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 05:58:34 +00:00
Lang Hames
053ae4ce17 [Orc][Kaleidoscope] Tidy up the lazy_irgen tutorial, touch up a couple of
comments in the fully_lazy tutorial to minimize the diff between the two.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230202 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 04:45:05 +00:00
Lang Hames
88b2e585f3 [Orc][Kaleidoscope] Remove dead AST map in SessionContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 04:34:43 +00:00
Nico Weber
766caabcf1 Try to fix reST markup for an external link.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 03:31:29 +00:00
David Blaikie
173b29a6a5 Fix Makefile build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230197 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23 00:53:35 +00:00