Commit Graph

124248 Commits

Author SHA1 Message Date
Daniel Sanders
0a3cc8fdf5 Revert 253497 and 253539 to try to fix clang-cmake-mips buildbot.
It caused link errors of the form:
InstrProfiling.c:(.text.__llvm_profile_instrument_target+0x1c0): undefined reference to `__sync_fetch_and_add_8'

We had a network outage at the time of the commit so the first build to show a
problem is http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/10827



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253656 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 10:07:11 +00:00
Owen Anderson
3f9c2909a5 Fix a pair of issues that caused an infinite loop in reassociate.
Terrifyingly, one of them is a mishandling of floating point vectors
in Constant::isZero().  How exactly this issue survived this long
is beyond me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253655 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 08:16:13 +00:00
Craig Topper
6be7f00207 Use range-based for loops. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253652 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 07:18:48 +00:00
Hrvoje Varga
63e0cbed94 [mips][microMIPS] Implement MUL[_S].PH, MULEQ_S.W.PHL, MULEQ_S.W.PHR, MULEU_S.PH.QBL, MULEU_S.PH.QBR, MULQ_RS.PH, MULQ_RS.W, MULQ_S.PH and MULQ_S.W instructions
Differential Revision: http://reviews.llvm.org/D14280


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253651 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 07:14:52 +00:00
Dan Gohman
697df03545 [WebAssembly] Remove the AsmPrinter code for printing physical registers.
WebAssembly does not have physical registers, so even if LLVM uses physical
registers like SP, they'll need to be lowered to virtual registers before
AsmPrinter time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253644 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 03:13:31 +00:00
Dan Gohman
4088342d21 [WebAssembly] Add a few open tasks to the target README.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253643 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 03:08:27 +00:00
Dan Gohman
b2e21a25bd [WebAssembly] Rename SWITCH to TABLESWITCH to match the current wording in the spec.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253642 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 03:02:49 +00:00
Dan Gohman
a90cea254c [WebAssembly] Remove done items from the README.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253640 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 02:51:38 +00:00
Dan Gohman
74a34413f8 [WebAssembly] Add asserts that the expression stack is used in stack order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253638 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 02:33:24 +00:00
Dan Gohman
8300bfce73 [WebAssemby] Enforce FIFO ordering for instructions using stackified registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253634 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 02:19:12 +00:00
Peter Collingbourne
5178bc957a ScalarEvolution: do not set nuw when creating exprs of form <expr> + <all-ones>.
The nuw constraint will not be satisfied unless <expr> == 0.

This bug has been around since r102234 (in 2010!), but was uncovered by
r251052, which introduced more aggressive optimization of nuw scev expressions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253627 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 01:26:13 +00:00
Eric Christopher
77072b3170 Split the argument unscheduling loop in the WebAssembly register
coloring pass. Turn the logic into "look for an insert point and
then move things past the insert point".

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253626 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 00:34:54 +00:00
Tobias Edler von Koch
cbf870d3b1 [LTO] Add options to llvm-lto to select output format and dump merged module
This introduces two new options:
- "llvm-lto -save-merged-module -o outfile" dumps the LTO Module to
  outfile.merged.bc prior to CodeGen and after LTO optimizations have been run.
- "llvm-lto -filetype=asm -o outfile" makes llvm-lto emit assembly instead of
  object code in outfile.

Both are intended for use in lit tests.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253624 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 00:13:05 +00:00
Tobias Edler von Koch
5b01c01496 [LTO] Add option to emit assembly from LTOCodeGenerator
This adds a new API, LTOCodeGenerator::setFileType, to choose the output file
format for LTO CodeGen. A corresponding change to use this new API from
llvm-lto and a test case is coming in a separate commit.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253622 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 23:59:24 +00:00
Eric Christopher
a0734793bf Fix a [-Werror,-Wcovered-switch-default] warning by removing the
unnecessary default case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253621 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 23:45:42 +00:00
Reid Kleckner
d1d6f53a8b [WinEH] Disable most forms of demotion
Now that the register allocator knows about the barriers on funclet
entry and exit, testing has shown that this is unnecessary.

We still demote PHIs on unsplittable blocks due to the differences
between the IR CFG and the Machine CFG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 23:23:33 +00:00
Dan Gohman
0426ad40b5 [WebAssembly] Implement isCheapToSpeculateCtlz and isCheapToSpeculateCttz.
This unbreaks test/CodeGen/WebAssembly/i32.ll and
test/CodeGen/WebAssembly/i64.ll after r224899.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 23:04:59 +00:00
Arch D. Robison
ab9499328c Cleanup some -Wundef warnings in include/llvm/Support/MathExtras.h
Fix avoids gratuitous warnings from gcc for "_MSC_VER" not being defined.

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

Patch by Tony Kelman <tony@kelman.net>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253614 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 22:37:26 +00:00
Diego Novillo
8003b38f27 SamplePGO - Tweak debugging output for function samples. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253612 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 22:18:30 +00:00
Simon Pilgrim
3f1dbfd35d [X86][SSE4A] Fix issue with EXTRQI shuffles not starting at the correct start index.
Found during stress testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 22:13:56 +00:00
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