1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

111355 Commits

Author SHA1 Message Date
Ahmed Bougacha
4f552ed040 [CodeGen] Add MVT::FIRST_VALUETYPE to avoid explicit 0. NFC.
Many places reference MVT::LAST_VALUETYPE when iterating over all
valid MVTs, but they usually start with 0.
With FIRST_VALUETYPE, we can avoid explicit constants when we really
should be using MVT::SimpleValueType.

llvm-svn: 225362
2015-01-07 18:39:00 +00:00
David Majnemer
84c4bd1a4c X86: Allow the stack probe size to be configurable per function
LLVM emits stack probes on Windows targets to ensure that the stack is
correctly accessed.  However, the amount of stack allocated before
emitting such a probe is hardcoded to 4096.

It is desirable to have this be configurable so that a function might
opt-out of stack probes.  Our level of granularity is at the function
level instead of, say, the module level to permit proper generation of
code after LTO.

Patch by Andrew H!

N.B.  The inliner needs to be updated to properly consider what happens
after inlining a function with a specific stack-probe-size into another
function with a different stack-probe-size.

llvm-svn: 225360
2015-01-07 18:14:07 +00:00
Tom Stellard
4de2685a87 R600/SI: Refactor SIFoldOperands to simplify immediate folding
This will make a future patch much less intrusive.

llvm-svn: 225358
2015-01-07 17:42:16 +00:00
Ahmed Bougacha
cb2ee2e772 [X86] Teach FCOPYSIGN lowering to recognize constant magnitudes.
For code like:
    float foo(float x) { return copysign(1.0, x); }
We used to generate:
    andps  <-0.000000e+00,0,0,0>, %xmm0
    movss  <1.000000e+00>, %xmm1
    andps  <nan>, %xmm1
    orps   %xmm0, %xmm1
Basically doing an abs(1.0f) in the two middle instructions.

We now generate:
    andps  <-0.000000e+00,0,0,0>, %xmm0
    orps   <1.000000e+00,0,0,0>, %xmm0

Builds on cleanups r223415, r223542.
rdar://19049548
Differential Revision: http://reviews.llvm.org/D6555

llvm-svn: 225357
2015-01-07 17:33:03 +00:00
Rafael Espindola
53f1be3911 Improvements to emacs packages for llvm and tablegen mode.
* Both files have valid package headers and footers (you can verify
with M-x checkdoc).
* Fixed style warnings generated by checkdoc.
* Fixed a byte-compiler warning in llvm-mode.el.
* Ensure that the modes are autoloaded, so users do not need to
(require 'llvm-mode) to use them.

Patch by Wilfred Hughes.

llvm-svn: 225356
2015-01-07 15:52:51 +00:00
Aaron Ballman
58509c4247 Reverting r225319; since there is a folder named Examples, attempting to add a target of the same name causes problems for IDEs like Visual Studio.
llvm-svn: 225355
2015-01-07 14:47:12 +00:00
Aaron Ballman
a2e327eb27 Manually specify the folder that Kaleidescope should reside in for CMake-produced solutions that care about such things (like MSVC). This takes the Kaleidescope target out of the root solution folder and places it into the Examples folder where it belongs.
llvm-svn: 225354
2015-01-07 14:26:07 +00:00
Aaron Ballman
909ff272a3 Manually specify the folder that llvm-ranlib should reside in for CMake-produced solutions that care about such things (like MSVC). This takes llvm-ranlib out of the root solution folder and places it into the Tools folder where it belongs.
llvm-svn: 225353
2015-01-07 14:19:15 +00:00
Jonas Paulsson
15765716a6 New method SDep::isNormalMemoryOrBarrier() in ScheduleDAGInstrs.cpp.
Used to iterate over previously added memory dependencies in
adjustChainDeps() and iterateChainSucc().

SDep::isCtrl() was previously used in these places, that also gave
anti and output edges. The code may be worse if these are followed,
because MisNeedChainEdge() will conservatively return true since a
non-memory instruction has no memory operands, and a false chain dep
will be added. It is also unnecessary since all memory accesses of
interest will be reached by memory dependencies, and there is a budget
limit for the number of edges traversed.

This problem was found on an out-of-tree target with enabled alias
analysis. No test case for an in-tree target has been found.

Reviewed by Hal Finkel.

llvm-svn: 225351
2015-01-07 13:38:29 +00:00
Jonas Paulsson
d3bd7333a3 Fix typos in comment and option help texts.
For -enable-aa-sched-mi and -use-tbaa-in-sched-mi.

llvm-svn: 225350
2015-01-07 13:20:57 +00:00
Charlie Turner
576ceb22ba [ARM] Add missing Tag_DIV_use tests.
llvm-svn: 225348
2015-01-07 11:37:40 +00:00
Asiri Rathnayake
9f9209efae Fix regression in r225266.
The change in r225266 was reviewed under D6722. But the commit r225266 has a
typo, causing some MCHammer failures. This patch fixes it.

Change-Id: I573efcff25003af7478ac02548ebbe929fc7f5fd
llvm-svn: 225347
2015-01-07 11:22:58 +00:00
Chandler Carruth
8b09c4f3f8 [PM] Give slightly less horrible names to the utility pass templates for
requiring and invalidating specific analyses. Also make their printed
names match their class names. Writing these out as prose really doesn't
make sense to me any more.

llvm-svn: 225346
2015-01-07 11:14:51 +00:00
Craig Topper
610ee6b384 [X86] Merge a switch statement inside a default case of another switch statement on the same variable. There was no additional code in the default so this should be no functional change.
llvm-svn: 225345
2015-01-07 08:10:38 +00:00
Craig Topper
3407b0abf8 [X86] Don't mark the shift by 1 instructions as isConvertibleToThreeAddress. There is no handling for them.
llvm-svn: 225344
2015-01-07 08:10:36 +00:00
Craig Topper
adb8acdc57 [X86] Remove some unused TYPE enums from the disassembler.
llvm-svn: 225343
2015-01-07 07:47:52 +00:00
Karthik Bhat
d463305416 Revert r225165 and r225169
Even thouh gcc produces simialr instructions as Owen pointed out the two patterns aren’t equivalent in the case
where the original subtraction could have caused an overflow.
Reverting the same.

llvm-svn: 225341
2015-01-07 06:34:34 +00:00
Ahmed Bougacha
272872c802 [ADT][SmallVector] Flip an assert comparison to avoid overflows yielding false-negatives. NFC.
r221973 changed SmallVector::operator[] to use size_t instead of unsigned.

Before that, on 64bit platforms, when a large index (say -1) was passed,
truncating it to unsigned avoided an overflow when computing 'begin() + idx',
and failed the range checking assertion, as expected.
With r221973, idx isn't truncated, so the addition wraps to
'(char*)begin() - 1', and doesn't fire anymore when it should have done so.

This commit changes the comparison to instead compute 'end() - begin()'
(i.e., 'size()'), which avoids potentially overflowing additions, and
correctly triggers the assertion when values such as -1 are passed.
Note that the problem already existed before that revision, on platforms
where sizeof(size_t) == sizeof(unsigned).

llvm-svn: 225338
2015-01-07 02:42:01 +00:00
Duncan P. N. Exon Smith
5fde632add IR: Remove MDNode::getWhenValsUnresolved()
Remove dead code.  Use `MDNode::get()` instead.

llvm-svn: 225335
2015-01-07 02:10:42 +00:00
Duncan P. N. Exon Smith
007aa3dcfd Remove invalid TODO
We can't drop support for RAUW entirely in `MDNode`s, since it's
required for graph construction.  This comment was from before I'd done
the math on that (out-of-tree), and never should have been committed.

llvm-svn: 225334
2015-01-07 02:09:51 +00:00
Chandler Carruth
2ca6c65ad5 [PM] Fix a pretty nasty bug where the new pass manager would invalidate
passes too many time.

I think this is actually the issue that someone raised with me at the
developer's meeting and in an email, but that we never really got to the
bottom of. Having all the testing utilities made it much easier to dig
down and uncover the core issue.

When a pass manager is running many passes over a single function, we
need it to invalidate the analyses between each run so that they can be
re-computed as needed. We also need to track the intersection of
preserved higher-level analyses across all the passes that we run (for
example, if there is one module analysis which all the function analyses
preserve, we want to track that and propagate it). Unfortunately, this
interacted poorly with any enclosing pass adaptor between two IR units.
It would see the intersection of preserved analyses, and need to
invalidate any other analyses, but some of the un-preserved analyses
might have already been invalidated *and recomputed*! We would fail to
propagate the fact that the analysis had already been invalidated.

The solution to this struck me as really strange at first, but the more
I thought about it, the more natural it seemed. After a nice discussion
with Duncan about it on IRC, it seemed even nicer. The idea is that
invalidating an analysis *causes* it to be preserved! Preserving the
lack of result is trivial. If it is recomputed, great. Until something
*else* invalidates it again, we're good.

The consequence of this is that the invalidate methods on the analysis
manager which operate over many passes now consume their
PreservedAnalyses object, update it to "preserve" every analysis pass to
which it delivers an invalidation (regardless of whether the pass
chooses to be removed, or handles the invalidation itself by updating
itself). Then we return this augmented set from the invalidate routine,
letting the pass manager take the result and use the intersection of
*that* across each pass run to compute the final preserved set. This
accounts for all the places where the early invalidation of an analysis
has already "preserved" it for a future run.

I've beefed up the testing and adjusted the assertions to show that we
no longer repeatedly invalidate or compute the analyses across nested
pass managers.

llvm-svn: 225333
2015-01-07 01:58:35 +00:00
Tom Stellard
b4786395a0 R600/SI: Add check for amdgcn triple forgotten in r225276.
llvm-svn: 225331
2015-01-07 01:17:37 +00:00
David Majnemer
eb61de555d Analysis: Reformulate WillNotOverflowUnsignedAdd for reusability
WillNotOverflowUnsignedAdd's smarts will live in ValueTracking as
computeOverflowForUnsignedAdd.  It now returns a tri-state result:
never overflows, always overflows and sometimes overflows.

llvm-svn: 225329
2015-01-07 00:39:50 +00:00
David Majnemer
d02481ebf3 InstCombine: Just a small tidy-up
llvm-svn: 225328
2015-01-07 00:39:42 +00:00
Hal Finkel
0392a6e252 [PowerPC] Transform a README.txt entry into a FIXME
Remove the README.txt entry regarding register allocation of CR logical ops,
and replace it with a FIXME in PPCInstrInfo.td. The text in the README.txt was
not really accurate, and thanks goes to Pat Haugen (and Bill Schmidt) from IBM
for clarifying what was intended and highlighting the relevant text in the ISA
specification.

llvm-svn: 225325
2015-01-07 00:15:29 +00:00
Duncan P. N. Exon Smith
cdf2e932b0 cmake: Fix 'examples' target after r225319
Add the missing `DEPENDS` keyword.  r225319 did almost the right thing
(I didn't notice the problem with it because `Kaleidoscope-Ch8` wasn't
building at all).

llvm-svn: 225321
2015-01-06 23:52:35 +00:00
Duncan P. N. Exon Smith
3ba8a9e00e Kaleidoscope: Value => Metadata
llvm-svn: 225320
2015-01-06 23:48:22 +00:00
Duncan P. N. Exon Smith
7d28ae72ac cmake: Add 'examples' target
llvm-svn: 225319
2015-01-06 23:42:49 +00:00
Duncan P. N. Exon Smith
8726c80a5f cmake: Add Kaleidoscope target
llvm-svn: 225318
2015-01-06 23:39:37 +00:00
Eric Christopher
7beeede5da Add a subdirectory in CMake for Chapter 8.
llvm-svn: 225315
2015-01-06 23:23:24 +00:00
Lang Hames
7aa6a77beb Revert r224935 "Refactor duplicated code. No intended functionality change."
This is affecting the behavior of some ObjC++ / AArch64 test cases on Darwin.
Reverting to get the bots green while I track down the source of the changed
behavior.

llvm-svn: 225311
2015-01-06 23:04:36 +00:00
Matt Arsenault
53120c2e9a R600/SI: Add combine for isinfinite pattern
llvm-svn: 225310
2015-01-06 23:00:46 +00:00
Matt Arsenault
e5c13ba97b Add isNegative helper to ConstantFPSDNode
llvm-svn: 225309
2015-01-06 23:00:44 +00:00
Matt Arsenault
63f73f4f48 Add isInfinity helper to ConstantFPSDNode
llvm-svn: 225308
2015-01-06 23:00:43 +00:00
Matt Arsenault
b663657a06 R600/SI: Pattern match isinf to v_cmp_class instructions
llvm-svn: 225307
2015-01-06 23:00:41 +00:00
Matt Arsenault
208e0172ef R600/SI: Add basic DAG combines for fp_class
llvm-svn: 225306
2015-01-06 23:00:39 +00:00
Matt Arsenault
08086327f3 R600/SI: Add class intrinsic
llvm-svn: 225305
2015-01-06 23:00:37 +00:00
Matt Arsenault
0d86cea633 Fix using wrong intrinsic in test
This is a leftover from renaming the intrinsic.
It's surprising the unknown llvm. intrinsic wasn't rejected.

llvm-svn: 225304
2015-01-06 23:00:33 +00:00
Rafael Espindola
20dc6c7571 Change the .ll syntax for comdats and add a syntactic sugar.
In order to make comdats always explicit in the IR, we decided to make
the syntax a bit more compact for the case of a GlobalObject in a
comdat with the same name.

Just dropping the $name causes problems for

@foo = globabl i32 0, comdat
$bar = comdat ...

and

declare void @foo() comdat
$bar = comdat ...

So the syntax is changed to

@g1 = globabl i32 0, comdat($c1)
@g2 = globabl i32 0, comdat

and

declare void @foo() comdat($c1)
declare void @foo() comdat

llvm-svn: 225302
2015-01-06 22:55:16 +00:00
Hal Finkel
930e5f41df [PowerPC] Reuse a load operand in int->fp conversions
int->fp conversions on PPC must be done through memory loads and stores. On a
modern core, this process begins by storing the int value to memory, then
loading it using a (sometimes special) FP load instruction. Unfortunately, we
would do this even when the value to be converted was itself a load, and we can
just use that same memory location instead of copying it to another first.
There is a slight complication when handling int_to_fp(fp_to_int(x)) pairs,
because the fp_to_int operand has not been lowered when the int_to_fp is being
lowered. We handle this specially by invoking fp_to_int's lowering logic
(partially) and getting the necessary memory location (some trivial refactoring
was done to make this possible).

This is all somewhat ugly, and it would be nice if some later CodeGen stage
could just clean this stuff up, but because doing so would involve modifying
target-specific nodes (or instructions), it is not immediately clear how that
would work.

Also, remove a related entry from the README.txt for which we now generate
reasonable code.

llvm-svn: 225301
2015-01-06 22:31:02 +00:00
Mehdi Amini
c87fbe6ada Use a Factory Method for MachineFunctionInfo Creation
The goal is to allows MachineFunctionInfo to override this create
function to customize the creation.
No change intended in existing backend in this patch.

llvm-svn: 225292
2015-01-06 20:05:02 +00:00
Colin LeMahieu
5dbfa1b1a1 [Hexagon] Adding compound jump encodings.
llvm-svn: 225291
2015-01-06 20:03:31 +00:00
Tom Stellard
372a94c88c R600/SI: Insert s_waitcnt before s_barrier instructions.
This ensures that all memory operations are complete when all threads
reach the barrier.

llvm-svn: 225290
2015-01-06 19:52:07 +00:00
Tom Stellard
4a7bb6dba6 R600/SI: Fix dependency calculation for DS writes instructions in SIInsertWaits
In DS write instructions, the address operand comes before the value
operand(s) which is reversed from every other instruction type.

The SIInsertWait assumed that the first use for each instruction
was the value, so for DS write it was protecting the address
operand with s_waitcnt instructions when it should have been
protecting the value operand.

llvm-svn: 225289
2015-01-06 19:52:04 +00:00
Adrian Prantl
72c4811183 Revert "Reapply: Teach SROA how to update debug info for fragmented variables."
because of a tsan buildbot failure.
This reverts commit 225272.

Fix should be coming soon.

llvm-svn: 225288
2015-01-06 19:47:27 +00:00
Colin LeMahieu
e59b0ff43e [Hexagon] Adding encoding for misc v4 instructions: boundscheck, tlbmatch, dcfetch.
llvm-svn: 225283
2015-01-06 19:03:20 +00:00
Sanjoy Das
d42d2637e6 This patch teaches IndVarSimplify to add nuw and nsw to certain kinds
of operations that provably don't overflow. For example, we can prove
%civ.inc below does not sign-overflow. With this change,
IndVarSimplify changes %civ.inc to an add nsw.

  define i32 @foo(i32* %array, i32* %length_ptr, i32 %init) {
   entry:
    %length = load i32* %length_ptr, !range !0
    %len.sub.1 = sub i32 %length, 1
    %upper = icmp slt i32 %init, %len.sub.1
    br i1 %upper, label %loop, label %exit
  
   loop:
    %civ = phi i32 [ %init, %entry ], [ %civ.inc, %latch ]
    %civ.inc = add i32 %civ, 1
    %cmp = icmp slt i32 %civ.inc, %length
    br i1 %cmp, label %latch, label %break
  
   latch:
    store i32 0, i32* %array
    %check = icmp slt i32 %civ.inc, %len.sub.1
    br i1 %check, label %loop, label %break
  
   break:
    ret i32 %civ.inc
  
   exit:
    ret i32 42
  }

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

llvm-svn: 225282
2015-01-06 19:02:56 +00:00
Colin LeMahieu
769b0f293d [Hexagon] Adding encoding information for absolute address loads.
llvm-svn: 225279
2015-01-06 18:38:26 +00:00
Mehdi Amini
a6822a0177 SelectionDAGBuilder: move constant initialization out of loop
No semantic change intended.

Reviewers: resistor

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

llvm-svn: 225278
2015-01-06 18:20:04 +00:00
Tom Stellard
342e72a308 R600/SI: Add a stub GCNTargetMachine
This is equivalent to the AMDGPUTargetMachine now, but it is the
starting point for separating R600 and GCN functionality into separate
targets.

It is recommened that users start using the gcn triple for GCN-based
GPUs, because using the r600 triple for these GPUs will be deprecated in
the future.

llvm-svn: 225277
2015-01-06 18:00:21 +00:00