Commit Graph

124378 Commits

Author SHA1 Message Date
Sanjay Patel
272898a425 [InstCombine] add tests to show missing trunc optimizations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253609 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 22:11:52 +00:00
Reid Kleckner
eaaa0ed96c Fix UMRs in Mips disassembler on invalid instruction streams
The Insn and Size local variables were used without initialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253607 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 21:51:55 +00:00
Simon Pilgrim
aebdd5bcdf [X86] Use existing MachineInstrBuilder::addDisp to create offseted pointer. NFC.
Minor code duplication tidyup to D13988

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253606 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 21:50:57 +00:00
Davide Italiano
38e5db618a Follow up to r253591. Turn into an assertion.
Reported by: David Blaikie.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253605 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 21:50:08 +00:00
Chad Rosier
cdbb6a49e2 [LIR] Update some comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253603 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 21:33:07 +00:00
Sanjay Patel
634e1cb482 [InstCombine] add tests to show missing bitcast optimizations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 21:32:25 +00:00
Krzysztof Parzyszek
cff5fabfc9 Expand subregisters in MachineFrameInfo::getPristineRegs
http://reviews.llvm.org/D14719



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253600 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 21:18:52 +00:00
Dehao Chen
564e87c060 Fix the debug build breakage that getDiscriminator is called by mistake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 20:29:27 +00:00
Michael Zolotukhin
ffe3b434e5 Revert r253253 and r253126: "Don't recompute LCSSA after loop-unrolling when possible."
The change exposed a bug in IndVarSimplify (PR25578), which led to a
failure (PR25538). When the bug is fixed, this patch can be reapplied.

The tests are kept in tree, as they're useful anyway, and will not break
with this revert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253596 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 20:28:32 +00:00
Dehao Chen
0a7baafe64 Reimplement discriminator assignment algorithm.
Summary: The new algorithm is more efficient (O(n), n is number of basic blocks). And it is guaranteed to cover all cases of multiple BB mapped to same line.

Reviewers: dblaikie, davidxl, dnovillo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253594 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 19:53:05 +00:00
Davide Italiano
248c59499b [AddressSanitizer] assert(false) -> llvm_unreachable and remove return.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253591 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 19:28:23 +00:00
Jun Bum Lim
0b669e1aec [AArch64] Refactoring aarch64-ldst-opt. NCF.
Summary :
 * Rename isSmallTypeLdMerge() to isNarrowLoad().
 * Rename NumSmallTypeMerged to NumNarrowTypePromoted.
 * Use Subtarget defined as a member variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253587 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 18:41:27 +00:00
Chad Rosier
316a6c1358 [LIR] Fix 80-column from previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 18:25:11 +00:00
Chad Rosier
bd71611f89 [LIR] Sink checks into function to enable future refactoring. NFC.
The purpose of this change is help delineate the memset and memcpy
optimizations with the overall goal of resolving PR25520.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253585 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 18:22:21 +00:00
James Molloy
a6b4079da3 [GlobalOpt] Localize some globals that have non-instruction users
We currently bail out of global localization if the global has non-instruction users. However, often these can be simple bitcasts or constant-GEPs, which we can easily turn into instructions before localizing. Be a bit more aggressive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 18:04:33 +00:00
Sanjay Patel
4105a7b567 update comment and error message; NFC
'notail' was added in:
http://reviews.llvm.org/rL252368



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253580 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 17:35:55 +00:00
Chad Rosier
670e8f39ad [LIR] Use the more appropriate method. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253578 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 17:27:28 +00:00
Jun Bum Lim
575b88edcb [AArch64]Extend merging narrow loads into a wider load
This change extends r251438 to handle more narrow load promotions
including byte type, unscaled, and signed. For example, this change will
convert :
  ldursh w1, [x0, #-2]
  ldurh  w2, [x0, #-4]
into
  ldur  w2, [x0, #-4]
  asr   w1, w2, #16
  and   w2, w2, #0xffff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253577 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 17:21:41 +00:00
Sanjay Patel
02857f7b46 this new test file was accidentally left out of r253573
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253574 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 16:39:00 +00:00
Sanjay Patel
da754b5015 [CGP] despeculate expensive cttz/ctlz intrinsics
This is another step towards allowing SimplifyCFG to speculate harder, but then have 
CGP clean things up if the target doesn't like it.

Previous patches in this series:
http://reviews.llvm.org/D12882
http://reviews.llvm.org/D13297

D13297 should catch most expensive ops, but speculation of cttz/ctlz requires special
handling because of weirdness in the intrinsic definition for handling a zero input 
(that definition can probably be blamed on x86).

For example, if we have the usual speculated-by-select expensive op pattern like this:

  %tobool = icmp eq i64 %A, 0
  %0 = tail call i64 @llvm.cttz.i64(i64 %A, i1 true)   ; is_zero_undef == true
  %cond = select i1 %tobool, i64 64, i64 %0
  ret i64 %cond

There's an instcombine that will turn it into:

  %0 = tail call i64 @llvm.cttz.i64(i64 %A, i1 false)   ; is_zero_undef == false

This CGP patch is looking for that case and despeculating it back into:

  entry:
    %tobool = icmp eq i64 %A, 0
    br i1 %tobool, label %cond.end, label %cond.true

  cond.true:
    %0 = tail call i64 @llvm.cttz.i64(i64 %A, i1 true)    ; is_zero_undef == true
    br label %cond.end

  cond.end:
    %cond = phi i64 [ %0, %cond.true ], [ 64, %entry ]
    ret i64 %cond

This unfortunately may lead to poorer codegen (see the changes in the existing x86 test), 
but if we increase speculation in SimplifyCFG (the next step in this patch series), then
we should avoid those kinds of cases in the first place.

The need for this patch was originally mentioned here:
http://reviews.llvm.org/D7506
with follow-up here:
http://reviews.llvm.org/D7554

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253573 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 16:37:10 +00:00
Hans Wennborg
086b179985 X86: More efficient legalization of wide integer compares
In particular, this makes the code for 64-bit compares on 32-bit targets
much more efficient.

Example:

  define i32 @test_slt(i64 %a, i64 %b) {
  entry:
    %cmp = icmp slt i64 %a, %b
    br i1 %cmp, label %bb1, label %bb2
  bb1:
    ret i32 1
  bb2:
    ret i32 2
  }

Before this patch:

  test_slt:
          movl    4(%esp), %eax
          movl    8(%esp), %ecx
          cmpl    12(%esp), %eax
          setae   %al
          cmpl    16(%esp), %ecx
          setge   %cl
          je      .LBB2_2
          movb    %cl, %al
  .LBB2_2:
          testb   %al, %al
          jne     .LBB2_4
          movl    $1, %eax
          retl
  .LBB2_4:
          movl    $2, %eax
          retl

After this patch:

  test_slt:
          movl    4(%esp), %eax
          movl    8(%esp), %ecx
          cmpl    12(%esp), %eax
          sbbl    16(%esp), %ecx
          jge     .LBB1_2
          movl    $1, %eax
          retl
  .LBB1_2:
          movl    $2, %eax
          retl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253572 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 16:35:08 +00:00
NAKAMURA Takumi
d19cbfed93 TargetParser.cpp: Fixup -- StringRef::startswith() is better here. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253570 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 15:42:52 +00:00
Mehdi Amini
31b8ab0fa6 Remove unused function parameter (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253569 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 15:42:34 +00:00
Diego Novillo
5d8ee1bd0d SamplePGO - Sort samples by source location when emitting as text.
When dumping function samples or writing them out as text format, it
helps if the samples are emitted sorted by source location. The sorting
of the maps is a bit slow, so we only do it on demand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253568 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 15:33:08 +00:00
Zoran Jovanovic
96664db5ff [mips] Add tests for ROL and ROR macros expansion
Author: obucina


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253567 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 15:04:31 +00:00
NAKAMURA Takumi
073829825d llvm/lib/Support/TargetParser.cpp: Rework llvm::ARM::getArchExtFeature() to avoid abuse of Twine in r253470.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253566 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 15:03:11 +00:00
Chad Rosier
33e3b5e479 [LV] Add a helper function, isReductionVariable. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253565 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 14:19:06 +00:00
Zoran Jovanovic
30f544886b [mips] Expansion of ROL and ROR macros
Author: obucina

Reviewers: dsanders

Subscribers: dsanders, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253564 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 14:15:03 +00:00
Elena Demikhovsky
1c8b4f0796 AVX-512: Fixed COPY_TO_REGCLASS for mask registers
Copying one mask register to another under BW should be done with kmovq instruction, otherwise we can loose some bits.
Copying 8 bits under DQ may be done with kmovb.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253563 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 13:13:00 +00:00
Artyom Skrobov
cc1b3e47c0 Removing specific target from the generic test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253562 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 12:24:47 +00:00
Simon Pilgrim
175ea25f68 [X86][AVX] Fix lowering of X86ISD::VZEXT_MOVL for 128-bit -> 256-bit extension
The lowering patterns for X86ISD::VZEXT_MOVL for 128-bit to 256-bit vectors were just copying the lower xmm instead of actually masking off the first scalar using a blend.

Fix for PR25320.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253561 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 12:18:37 +00:00
Alexey Bataev
3e00ff9fdc Alternative to long nops for X86 CPUs, by Andrey Turetsky
Make X86AsmBackend generate smarter nops instead of a bunch of 0x90 for code alignment for CPUs which don't support long nop instructions.
Differential Revision: http://reviews.llvm.org/D14178


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253557 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 11:44:35 +00:00
Dan Liew
23915cf59e [lit] Fix bug when using Python3 where a failing test would not show
the script when running a ShTest with an external or internal shell.

This bug is caused by use of the ``map`` function in Python 3 which
returns an iterable (rather than a list in Python 2). After the iterable
is exhausted it won't return any more output and consequently when
``_runShTest()`` tries to access the ``script`` which has already been
iterated over it is empty. Converting to a list immediatley after
calling ``map()`` fixes this.

This fixes the ``tests/shtest-format.py`` test when running under
Python3 which was previously failing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 11:35:42 +00:00
NAKAMURA Takumi
fed4c6eb16 gold-plugin.cpp: Fix diagnosticHandler corresponding to r253540.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253553 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 10:43:44 +00:00
James Molloy
e30d17a4d7 [FunctionAttrs] Provide a mechanism for adding function attributes from the command line
This provides a way to force a function to have certain attributes from the command line. This can be useful when debugging or doing workload exploration, where manually editing IR is tedious or not possible (due to build systems etc).

The syntax is -force-attribute=function_name:attribute_name

All function attributes are parsed except alignstack as it requires an argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253550 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 08:49:57 +00:00
Igor Breger
e20dfebf87 AVX512: Implemented encoding, intrinsics and DAG lowering for VMOVDDUP instructions.
Differential Revision: http://reviews.llvm.org/D14702

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253548 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 08:26:56 +00:00
Igor Breger
499f1059a5 AVX512: Implemented encoding for the vmovss.s and vmovsd.s instructions.
Differential Revision: http://reviews.llvm.org/D14771

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253547 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 07:58:33 +00:00
Igor Breger
96600b3c15 AVX512: Implemented encoding for the follow instructions.
vmovapd.s, vmovaps.s, vmovdqa32.s, vmovdqa64.s, vmovdqu16.s, vmovdqu32.s, vmovdqu64.s, vmovdqu8.s, vmovupd.s, vmovups.s

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253546 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 07:43:43 +00:00
Elena Demikhovsky
43be5f580c Pointers in Masked Load, Store, Gather, Scatter intrinsics
The masked intrinsics support all integer and floating point data types. I added the pointer type to this list.
Added tests for CodeGen and for Loop Vectorizer.
Updated the Language Reference.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253544 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 07:17:16 +00:00
Pete Cooper
6d024c616a Revert "Change memcpy/memset/memmove to have dest and source alignments."
This reverts commit r253511.

This likely broke the bots in
http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202
http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253543 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 05:56:52 +00:00
Mehdi Amini
0ab4d52b0a Do not require a Context to extract the FunctionIndex from Bitcode (NFC)
The LLVMContext was only used for Diagnostic. Pass a DiagnosticHandler
instead.

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

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253540 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 05:52:29 +00:00
Nathan Slingerland
0171b5136f [Support] Disable SaturatingMultiply() unit test while investigating
Ubsan detected undefined behavior in the MathExtras SaturatingMultiply test.

This change disables the test while it is being investigated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253539 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 05:20:17 +00:00
Weiming Zhao
f9d8b8d2ab Fix bug 25440: GVN assertion after coercing loads
Optimizations like LoadPRE in GVN will insert new instructions.
If the insertion point is in a already processed BB, they should
get a value number explicitly. If the insertion point is after
current instruction, then just leave it. However, current GVN framework
has no support for it.
In this patch, we just bail out if a VN can't be found.

Dfferential Revision: http://reviews.llvm.org/D14670

A    test/Transforms/GVN/pr25440.ll
M    lib/Transforms/Scalar/GVN.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253536 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 02:45:18 +00:00
Reid Kleckner
697477e00c Fix UMR in llvm-nm on IR object files in printDarwinSymbol
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253529 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 00:51:50 +00:00
Quentin Colombet
1fcad31efa [X86] Enable shrink-wrapping by default.
Differential Revision: http://reviews.llvm.org/D14156

rdar://problem/21118279


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253528 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 00:38:00 +00:00
Cong Hou
ce103d4605 Fix several long lines (>80) in LoopVectorize.cpp. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 00:32:30 +00:00
Reid Kleckner
e96fd6deb0 Don't search for third party libraries while using MSan
On the average user's system, those libraries will not be compiled with
MSan. Prior to this change, the LLVM test suite was full of false
positives from calls from third party libraries to MSan interceptors
like strlen.

We can remove this check if MSan ever grows a suppression mechanism
similar to TSan's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253526 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 00:05:21 +00:00
Reid Kleckner
5f2411b750 Disable Go bindings test with MSan, it has tons of linker errors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 00:05:20 +00:00
Reid Kleckner
491e1645d6 Initialize PersistentId for HandleSDNode, as these will never be inserted into the DAG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 00:05:09 +00:00
Davide Italiano
b8dd4a3d67 [SimplifyLibCalls] New trick: pow(x, 0.5) -> sqrt(x) under -ffast-math.
Differential Revision:	http://reviews.llvm.org/D14466


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253521 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 23:21:32 +00:00