Commit Graph

93602 Commits

Author SHA1 Message Date
David Majnemer
2982845bcc [ValueTracking] Teach computeKnownBits about [su]min/max
Reasoning about a select in terms of a min or max allows us to derive a
tigher bound on the result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277914 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 08:16:00 +00:00
David Majnemer
470962f413 [CallGraphSCCPass] Use an ArrayRef instead of a pair of iterators
No functional change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277913 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 06:21:02 +00:00
Sanjoy Das
9da24c7e7f [InstCombine] Don't coerce non-integral pointers to integers
Reviewers: majnemer

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:58:48 +00:00
Matthias Braun
3f4f33680b Revert "(refs/bisect/bad) GVN-hoist: enable by default"
GVN-Hoist appears to miscompile llvm-testsuite
SingleSource/Benchmarks/Misc/fbench.c at the moment.

I filed http://llvm.org/PR28880

This reverts commit r277786.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:23:15 +00:00
Gor Nishanov
fa2883261f Part 4c: Coroutine Devirtualization: Devirtualize coro.resume and coro.destroy.
Summary:
This is the 4c patch of the coroutine series. CoroElide pass now checks if PostSplit coro.begin
is referenced by coro.subfn.addr intrinsics. If so replace coro.subfn.addrs with an appropriate coroutine
subfunction associated with that coro.begin.

Documentation and overview is here: http://llvm.org/docs/Coroutines.html.

Upstreaming sequence (rough plan)
1.Add documentation. (https://reviews.llvm.org/D22603)
2.Add coroutine intrinsics. (https://reviews.llvm.org/D22659)
3.Add empty coroutine passes. (https://reviews.llvm.org/D22847)
4.Add coroutine devirtualization + tests.
ab) Lower coro.resume and coro.destroy (https://reviews.llvm.org/D22998)
c) Do devirtualization <= we are here
5.Add CGSCC restart trigger + tests.
6.Add coroutine heap elision + tests.
7.Add the rest of the logic (split into more patches)

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277908 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:16:35 +00:00
Nico Weber
84f6a48c0d Revert r277896.
It breaks ExecutionEngine/OrcLazy/weak-function.ll on most bots.

Script:
--
...
--
Exit Code: 1

Command Output (stderr):
--
Could not find main function.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:00:45 +00:00
Kyle Butt
d9a9f7d3ac CodeGen: If Convert blocks that would form a diamond when tail-merged.
The following function currently relies on tail-merging for if
conversion to succeed. The common tail of cond_true and cond_false is
extracted, and this then forms a diamond pattern that can be
successfully if converted.

If this block does not get extracted, either because tail-merging is
disabled or the threshold is higher, we should still recognize this
pattern and if-convert it.
define i32 @t2(i32 %a, i32 %b) nounwind {
entry:
	%tmp1434 = icmp eq i32 %a, %b		; <i1> [#uses=1]
	br i1 %tmp1434, label %bb17, label %bb.outer

bb.outer:		; preds = %cond_false, %entry
	%b_addr.021.0.ph = phi i32 [ %b, %entry ], [ %tmp10, %cond_false ]
	%a_addr.026.0.ph = phi i32 [ %a, %entry ], [ %a_addr.026.0, %cond_false ]
	br label %bb

bb:		; preds = %cond_true, %bb.outer
	%indvar = phi i32 [ 0, %bb.outer ], [ %indvar.next, %cond_true ]
	%tmp. = sub i32 0, %b_addr.021.0.ph
	%tmp.40 = mul i32 %indvar, %tmp.
	%a_addr.026.0 = add i32 %tmp.40, %a_addr.026.0.ph
	%tmp3 = icmp sgt i32 %a_addr.026.0, %b_addr.021.0.ph
	br i1 %tmp3, label %cond_true, label %cond_false

cond_true:		; preds = %bb
	%tmp7 = sub i32 %a_addr.026.0, %b_addr.021.0.ph
	%tmp1437 = icmp eq i32 %tmp7, %b_addr.021.0.ph
	%indvar.next = add i32 %indvar, 1
	br i1 %tmp1437, label %bb17, label %bb

cond_false:		; preds = %bb
	%tmp10 = sub i32 %b_addr.021.0.ph, %a_addr.026.0
	%tmp14 = icmp eq i32 %a_addr.026.0, %tmp10
	br i1 %tmp14, label %bb17, label %bb.outer

bb17:		; preds = %cond_false, %cond_true, %entry
	%a_addr.026.1 = phi i32 [ %a, %entry ], [ %tmp7, %cond_true ], [ %a_addr.026.0, %cond_false ]
	ret i32 %a_addr.026.1
}

Without tail-merging or diamond-tail if conversion:
LBB1_1:                                 @ %bb
                                        @ =>This Inner Loop Header: Depth=1
        cmp     r0, r1
        ble     LBB1_3
@ BB#2:                                 @ %cond_true
                                        @   in Loop: Header=BB1_1 Depth=1
        subs    r0, r0, r1
        cmp     r1, r0
        it      ne
        cmpne   r0, r1
        bgt     LBB1_4
LBB1_3:                                 @ %cond_false
                                        @   in Loop: Header=BB1_1 Depth=1
        subs    r1, r1, r0
        cmp     r1, r0
        bne     LBB1_1
LBB1_4:                                 @ %bb17
        bx      lr

With diamond-tail if conversion, but without tail-merging:
@ BB#0:                                 @ %entry
        cmp     r0, r1
        it      eq
        bxeq    lr
LBB1_1:                                 @ %bb
                                        @ =>This Inner Loop Header: Depth=1
        cmp     r0, r1
        ite     le
        suble   r1, r1, r0
        subgt   r0, r0, r1
        cmp     r1, r0
        bne     LBB1_1
@ BB#2:                                 @ %bb17
        bx      lr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277905 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 01:52:37 +00:00
Kyle Butt
e0b41b59f3 IfConverter: Split ScanInstructions into 2 functions.
ScanInstructions is now 2 functions:
AnalyzeBranches and ScanInstructions. ScanInstructions also now takes a
pair of arguments delimiting the instructions to be scanned. This will
be used for forked diamond support to re-scan only a portion of the
block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277904 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 01:52:34 +00:00
Kyle Butt
792628981a IfConversion: Document countDuplicatedInstructions. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277903 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 01:52:33 +00:00
Kyle Butt
f655859020 IfConversion: factor out 2 functions to skip debug instrs. NFC
Skipping debug instructions occurrs repeatedly, factor it out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 01:52:31 +00:00
Michael Zolotukhin
392ab3662c Revert "[LoopSimplify] Fix updating LCSSA after separating nested loops."
This reverts commit r277877.
Try to appease clang-x64-ninja-win7 buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277901 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 01:48:51 +00:00
Lang Hames
38365dac94 [ORC] Add (partial) weak symbol support to the CompileOnDemand layer.
This adds partial support for weak functions to the CompileOnDemandLayer by
modifying the addLogicalModule method to check for existing stub definitions
before building a new stub for a weak function. This scheme is sufficient to
support ODR definitions, but fails for general weak definitions if strong
definition is encountered after the first weak definition. (A more extensive
refactor will be required to fully support weak symbols).

This patch does *not* add weak symbol support to RuntimeDyld: I hope to add
that in the near future.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277896 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 00:54:43 +00:00
Sanjoy Das
9c8288602e [IRCE] Remove unused headers; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277892 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 00:02:01 +00:00
Sanjoy Das
265e61ad49 [IRCE] Preserve loop-simplify form
Fixes PR28764.  Right now there is no way to test this, but (as
mentioned on the PR) with Michael Zolotukhin's yet to be checked in
LoopSimplify verfier, 8 of the llvm-lit tests for IRCE crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277891 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 00:01:56 +00:00
Sanjay Patel
4b55580c72 [InstCombine] refactor ctlz/cttz folds (NFCI)
Note that this fold really belongs in InstSimplify.
Refactoring here anyway as an intermediate step because
there's a planned addition to this function in D23134.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 22:42:46 +00:00
Daniel Berlin
466b4f2148 [MSSA] Use depth first iterator instead of custom version.
Summary:
Originally the plan was to use the custom worklist to do some block popping,
and because we don't actually need a visited set. The custom one we have
here is slightly broken, and it's not worth fixing vs using depth_first_iterator since we aren't going to go the route we originally
were.

Fixes PR28874
Reviewers: george.burgess.iv

Subscribers: llvm-commits, gberry

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277880 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 22:09:14 +00:00
Justin Bogner
4aa9fee76d CodeView: Remove an unused variable
It was breaking the -Werror build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277878 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 21:57:10 +00:00
Michael Zolotukhin
41d635e247 [LoopSimplify] Fix updating LCSSA after separating nested loops.
This fixes PR28825. The problem was that we only checked if a value from
a created inner loop is used in the outer loop, and fixed LCSSA for
them. But we missed to fixup LCSSA for values used in exits of the outer
loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277877 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 21:52:58 +00:00
Zachary Turner
d1226bad88 Fix non portable include path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277876 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 21:50:02 +00:00
Daniel Berlin
b081e9c1df [MSSA] Match assert vs llvm_unreachable style in verification functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277873 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 21:47:20 +00:00
Daniel Berlin
f5e11c4209 Rewrite domination verifier to handle local domination as well.
Summary:
Rewrite domination verifier to handle local domination as well.
This catches a bug Geoff Berry noticed.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277872 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 21:46:52 +00:00
Zachary Turner
3483f21bbc [CodeView] Decouple record deserialization from visitor dispatch.
Until now, our use case for the visitor has been to take a stream of bytes
representing a type stream, deserialize the records in sequence, and do
something with them, where "something" is determined by how the user
implements a particular set of callbacks on an abstract class.

For actually writing PDBs, however, we want to do the reverse. We have
some kind of description of the list of records in their in-memory format,
and we want to process each one. Perhaps by serializing them to a byte
stream, or perhaps by converting them from one description format (Yaml)
to another (in-memory representation).

This was difficult in the current model because deserialization and
invoking the callbacks were tightly coupled.

With this patch we change this so that TypeDeserializer is itself an
implementation of the particular set of callbacks. This decouples
deserialization from the iteration over a list of records and invocation
of the callbacks.  TypeDeserializer is initialized with another
implementation of the callback interface, so that upon deserialization it
can pass the deserialized record through to the next set of callbacks. In
a sense this is like an implementation of the Decorator design pattern,
where the Deserializer is a decorator.

This will be useful for writing Pdbs from yaml, where we have a
description of the type records in Yaml format. In this case, the visitor
implementation would have each visitation callback method implemented in
such a way as to extract the proper set of fields from the Yaml, and it
could maintain state that builds up a list of these records. Finally at
the end we can pass this information through to another set of callbacks
which serializes them into a byte stream.

Reviewed By: majnemer, ruiu, rnk
Differential Revision: https://reviews.llvm.org/D23177

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277871 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 21:45:34 +00:00
Marek Olsak
716b378a48 AMDGPU/SI: Increase SGPR limit to 96 on Tonga/Iceland
Summary:
This is the setting of the Vulkan closed source driver.

It decreases the max wave count from 10 to 8.

26010 shaders in 14650 tests
Totals:
VGPRS: 829593 -> 808440 (-2.55 %)
Spilled SGPRs: 81878 -> 42226 (-48.43 %)
Spilled VGPRs: 367 -> 358 (-2.45 %)
Scratch VGPRs: 1764 -> 1748 (-0.91 %) dwords per thread
Code Size: 36677864 -> 35923932 (-2.06 %) bytes

There is a massive decrease in SGPR spilling in general and -7.4% spilled
VGPRs for DiRT Showdown (= SGPRs spilled to scratch?)

Reviewers: arsenm, tstellarAMD, nhaehnle

Subscribers: arsenm, llvm-commits, kzhuravl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277867 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 21:23:29 +00:00
Weiming Zhao
82b9d1c028 [ARM] Constant Materialize: imms with specific value can be encoded into mov.w
Summary: Thumb2 supports encoding immediates with specific patterns into mov.w by splatting the low 8 bits into other bytes.

I'm resubmitting this patch. The test case in the original commit
r277610 does not specify triple, so builds with differnt default triple
will have different output.

This patch fixed trile as thumb-darwin-apple.

Reviewers: john.brawn, jmolloy, bruno

Subscribers: jmolloy, aemerson, rengolin, samparker, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277865 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 20:58:29 +00:00
Davide Italiano
927cc57fc9 [FlattenCFG] Simplify + remove unused variable. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 20:53:35 +00:00
Dehao Chen
f77a198b62 Remove cold callsite heuristic that is not necessary because of cold callee heuristic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 20:49:04 +00:00
Dehao Chen
ffccedb490 Replace hot-callsite based heuristic to use its own threshold parameter instead of share inline-hint parameter
Summary: Hot callsites should have higher threshold than inline hints. This patch uses separate threshold parameter for hot callsites.

Reviewers: davidxl, eraman

Subscribers: Prazek, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277860 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 20:28:41 +00:00
Mike Aizatsky
4613003000 [sanitizers] trace buffer API to use user-allocated buffer.
Differential Revision: https://reviews.llvm.org/D23185

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277859 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 20:09:53 +00:00
Ivan Krasin
51ae50fd08 WholeProgramDevirt: print remarks with devirtualized method names.
Summary:
Chrome on Linux uses WholeProgramDevirt for speed ups, and it's
important to detect regressions on both sides: the toolchain,
if fewer methods get devirtualized after an update, and Chrome,
if an innocently looking change caused many hot methods become
virtual again.

The need to track devirtualized methods is not Chrome-specific,
but it's probably the only user of the pass at this time.

Reviewers: kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277856 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 19:45:16 +00:00
David Callahan
853b86f80a [ADCE] Refactoring for new functionality (NFC)
Summary:
This is another refactoring to break up the one function into three logical components functions.
Another non-functional change before we start added in features.

Reviewers: nadav, mehdi_amini, majnemer

Subscribers: twoh, freik, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277855 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 19:38:11 +00:00
Sanjoy Das
c5201e348e [ConstantFolding] Don't create illegal (non-integral) inttoptrs
Reviewers: majnemer, arsenm

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 19:23:29 +00:00
David Callahan
fcb7a4a31d [AutoFDO] Fix handling of empty profiles
Summary:
If a profile has no samples for a function, then the function "entry count" is set to the value 0. Several places in the code test that if the Function::getEntryCount is defined at all. Here we change to treat a 0 entry count the same as undefined.

In particular, this fixes a problem in getLayoutSuccessorProbThreshold in MachineBlockPlacement.cpp where we use a different and inferior heuristic for laying out basic blocks.

Reviewers: danielcdh, dnovillo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277849 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 18:38:19 +00:00
Sanjoy Das
a2ef5492ed [SCEV] Don't infinitely recurse on unreachable code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277848 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 18:34:14 +00:00
Kevin Enderby
cedb0b6b7e Add the first of what will be a long line of additional error checks for invalid Mach-O files.
This is where an LC_SEGMENT load command has a fileoff field that
extends past the end of the file.

Also fix llvm-nm and llvm-size to remove the errorToErrorCode() call so error messages are printed.
And needed to update a few test cases now that they do print the error messages just a
bit differently.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277845 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 18:19:40 +00:00
Dehao Chen
9fb630e4f0 Do not assign new discriminator for all intrinsics.
Summary: We do not care about intrinsic calls when assigning discriminators.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277843 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 17:56:49 +00:00
Tim Northover
47dc780f20 GlobalISel: clear pending phis after MachineFunction translated
Test is just reordering the existing functions (it would trigger for any
function after one with a phi).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 17:50:36 +00:00
Simon Pilgrim
bdea192076 [X86][SSE] Add initial support for 2 input target shuffle combining.
At the moment only the INSERTPS matching can actually use 2 inputs but the plumbing is now in place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 17:36:14 +00:00
Tim Northover
1249b27b0e GlobalISel: IRTranslate PHI instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277835 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 17:16:40 +00:00
Ulrich Weigand
1025a61506 [PowerPC] Wrong fast-isel codegen for VSX floating-point loads
There were two locations where fast-isel would generate a LFD instruction
with a target register class VSFRC instead of F8RC when VSX was enabled.
This can ccause invalid registers to be used in certain cases, like:
   lfd 36, ...
instead of using a VSX load instruction.  The wrong register number gets
silently truncated, causing invalid code to be generated.


The first place is PPCFastISel::PPCEmitLoad, which had multiple problems:

1.) The IsVSSRC and IsVSFRC flags are not initialized correctly, since they
are computed from resultReg, which is still zero at this point in many cases.
Fixed by changing the helper routines to operate on a register class instead
of a register and passing in UseRC.
 
2.) Even with this fixed, Is64VSXLoad is still wrong due to a typo:

bool Is32VSXLoad = IsVSSRC && Opc == PPC::LFS;
bool Is64VSXLoad = IsVSSRC && Opc == PPC::LFD;

The second line needs to use isVSFRC (like PPCEmitStore does).

3.) Once both the above are fixed, we're now generating a VSX instruction --
but an incorrect one, since generation of an indexed instruction with null
index is wrong. Fixed by copying the code handling the same issue in
PPCEmitStore.


The second place is PPCFastISel::PPCMaterializeFP, where we would emit an
LFD to load a constant from the literal pool, and use the wrong result
register class. Fixed by hardcoding a F8RC class even on systems
supporting VSX.


Fixes: https://llvm.org/bugs/show_bug.cgi?id=28630

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277823 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 15:22:05 +00:00
Zhan Jun Liau
348f66dd36 [SystemZ] Add missing classes and instructions
Summary:
Add instruction formats E, RSI, SSd, SSE, and SSF.

Added BRXH, BRXLE, PR, MVCK, STRAG, and ECTG instructions to test out
those formats.

Reviewers: uweigand

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277822 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 15:14:34 +00:00
Benjamin Kramer
904a5364dd [SimplifyCFG] Make range reduction code deterministic.
This generated IR based on the order of evaluation, which is different
between GCC and Clang. With that in mind you get bootstrap miscompares
if you compare a Clang built with GCC-built Clang vs. Clang built with
Clang-built Clang. Diagnosing that made my head hurt.

This also reverts commit r277337, which "fixed" the test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 14:55:02 +00:00
Simon Pilgrim
4a1befb048 [X86][SSE] Update the the target shuffle matches to use the effective mask's value type directly instead of via the input value type.
Preparation for adding 2 input support so we want to avoid unnecessary references to the input value type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277817 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 14:33:11 +00:00
Simon Pilgrim
0d58c98b16 [X86][SSE] Consistently use the target shuffle root value type for vector size calculations. NFCI.
Preparation for adding 2 input support so we want to avoid unnecessary references to the input value type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277814 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 13:02:53 +00:00
NAKAMURA Takumi
d55759c8bc LLLexer.cpp: Avoid using BitsToDouble() to preserve SNaN like "double 0x7FF4000000000000".
We should not use double (or float) in the LLVM, unless it is really needed. x87 FP register doesn't preserve SNaN to move the value.

FIXME: APFloat() may have the constructor by raw bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277813 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 11:59:49 +00:00
NAKAMURA Takumi
eb34f4453f Reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277812 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 11:59:45 +00:00
Simon Pilgrim
319f67f4cc [X86][SSE] Added target shuffle combine binary compute matching function. NFCI.
Added matchBinaryPermuteVectorShuffle and moved the blend+zero and insertps matching code into it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277808 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 11:16:53 +00:00
John Brawn
eca7f4535b Reapply r276973 "Adjust Registry interface to not require plugins to export a registry"
This differs from the previous version by being more careful about template
instantiation/specialization in order to prevent errors when building with
clang -Werror. Specifically:
 * begin is not defined in the template and is instead instantiated when Head
   is. I think the warning when we don't do that is wrong (PR28815) but for now
   at least do it this way to avoid the warning.
 * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY
   instead provide a template definition then do explicit instantiation. No
   compiler I've tried has problems with doing it the other way, but strictly
   speaking it's not permitted by the C++ standard so better safe than sorry.

Original commit message:

Currently the Registry class contains the vestiges of a previous attempt to
allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a
plugin would have its own copy of a registry and export it to be imported by
the tool that's loading the plugin. This only works if the plugin is entirely
self-contained with the only interface between the plugin and tool being the
registry, and in particular this conflicts with how IR pass plugins work.

This patch changes things so that instead the add_node function of the registry
is exported by the tool and then imported by the plugin, which solves this
problem and also means that instead of every plugin having to export every
registry they use instead LLVM only has to export the add_node functions. This
allows plugins that use a registry to work on Windows if
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277806 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 11:01:08 +00:00
Strahinja Petrovic
632e6aa28c [PowerPC] fix passing long double arguments to function (soft-float)
This patch fixes passing long double type arguments to function in 
soft float mode. If there is less than 4 argument registers free 
(long double type is mapped in 4 gpr registers in soft float mode) 
long double type argument must be passed through stack.
Differential Revision: https://reviews.llvm.org/D20114.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277804 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 08:47:26 +00:00
Nicolai Haehnle
fd14e4374d [InstCombine] try to fold (select C, (sext A), B) into logical ops
Summary:
Turn (select C, (sext A), B) into (sext (select C, A, B')) when A is i1 and
B is a compatible constant, also for zext instead of sext. This will then be
further folded into logical operations.

The transformation would be valid for non-i1 types as well, but other parts of
InstCombine prefer to have sext from non-i1 as an operand of select.

Motivated by the shader compiler frontend in Mesa for AMDGPU, which emits i32
for boolean operations. With this change, the boolean logic is fully
recovered.

Reviewers: majnemer, spatel, tstellarAMD

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277801 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 08:22:29 +00:00
Justin Bogner
784afcbf37 InstCombine: Clean up some trailing whitespace. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277793 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 01:09:48 +00:00