Nico Weber [Fri, 2 May 2014 18:35:25 +0000 (18:35 +0000)]
Teach GlobalDCE how to remove empty global_ctor entries.
This moves most of GlobalOpt's constructor optimization
code out of GlobalOpt into Transforms/Utils/CDtorUtils.{h,cpp}. The
public interface is a single function OptimizeGlobalCtorsList() that
takes a predicate returning which constructors to remove.
GlobalOpt calls this with a function that statically evaluates all
constructors, just like it did before. This part of the change is
behavior-preserving.
Also add a call to this from GlobalDCE with a filter that removes global
constructors that contain a "ret" instruction and nothing else – this
fixes PR19590.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207856
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 2 May 2014 17:59:17 +0000 (17:59 +0000)]
[GVN] Pass the phi-translated address of a load instead of the untranslated
address to AnalyzeLoadFromClobberingLoad. This fixes a bug in load-PRE where
PRE is applied to a load that is not partially redundant.
<rdar://problem/
16638765>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207853
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Fri, 2 May 2014 17:45:24 +0000 (17:45 +0000)]
MC: place .file records into the correct section
.file records are supposed to have a section identifier of 65534
(IMAGE_SCN_DEBUG) rather than 0. This is spelt out clearly within the PE/COFF
specification. Fix this minor oversight with the implementation for support for
.file records.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207851
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 2 May 2014 17:25:02 +0000 (17:25 +0000)]
DAGCombine: prevent formation of illegal ConstantFP nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207850
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 2 May 2014 15:47:07 +0000 (15:47 +0000)]
Add a description for AMD's bdver4 (aka Excavator).
This is just bdver3 + AVX2 + BMI2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207847
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 2 May 2014 15:41:49 +0000 (15:41 +0000)]
R600/SI: Add processor type for Mullins.
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Samuel Li <samuel.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207846
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 2 May 2014 15:41:47 +0000 (15:41 +0000)]
R600: Expand vector sin and cos.
v2: move code to AMDGPUISelLowering.cpp
squash with tests (both EG and SI)
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207845
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 2 May 2014 15:41:46 +0000 (15:41 +0000)]
R600: Expand TruncStore i64 -> {i16,i8}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207844
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Fri, 2 May 2014 15:41:42 +0000 (15:41 +0000)]
R600/SI: Only create one instruction when spilling/restoring register v3
The register spiller assumes that only one new instruction is created
when spilling and restoring registers, so we need to emit pseudo
instructions for vector register spills and lower them after
register allocation.
v2:
- Fix calculation of lane index
- Extend VGPR liveness to end of program.
v3:
- Use SIMM16 field of S_NOP to specify multiple NOPs.
https://bugs.freedesktop.org/show_bug.cgi?id=75005
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207843
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 2 May 2014 14:54:27 +0000 (14:54 +0000)]
AArch64/ARM64: add patterns for post-indexed ST1 ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207840
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 2 May 2014 14:54:21 +0000 (14:54 +0000)]
ARM64: refactor NEON post-indexed loads & stores (MC).
Previously, LLVM had no knowledge that these instructions actually
modified their address register: fine if they never end up in CodeGen,
but when I'd rather like to write some patterns for them it becomes a
disaster.
The change is mostly straightforward, I think the most significant
design decision was to *always* put the address write-back first. This
allows loads and stores to be accessed more uniformly, for example
permitting the continued sharing of the InstAlias definitions.
I also discovered that the custom Decode logic is no longer needed, so
I removed it.
No tests, because there should be no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207839
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 2 May 2014 14:54:15 +0000 (14:54 +0000)]
AArch64/ARM64: support indexed loads/stores on vector types.
While post-indexed LD1/ST1 instructions do exist for vector loads,
this patch makes use of the more flexible addressing-modes in LDR/STR
instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207838
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 2 May 2014 12:35:22 +0000 (12:35 +0000)]
Allow SelectionDAG::FoldConstantArithmetic to work when it's called with a vector VT but scalar values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207835
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Fri, 2 May 2014 08:26:30 +0000 (08:26 +0000)]
Code style fix from Duncan P. N. Exon Smith.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207831
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Lewycky [Fri, 2 May 2014 04:11:45 +0000 (04:11 +0000)]
Fold strlen(expr ? "str1" : "str2") to x ? len1 : len2. This fires about 330 times in a bootstrap of clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207828
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Thu, 1 May 2014 22:39:26 +0000 (22:39 +0000)]
[Stackmaps] Pacify windows buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207807
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Thu, 1 May 2014 22:21:30 +0000 (22:21 +0000)]
[Stackmaps] Add command line option to specify the stackmap version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207805
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Thu, 1 May 2014 22:21:27 +0000 (22:21 +0000)]
[Stackmaps] Refactor serialization code. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207804
91177308-0d34-0410-b5e6-
96231b3b80d8
Juergen Ributzka [Thu, 1 May 2014 22:21:24 +0000 (22:21 +0000)]
[Stackmaps] Replace the custom ConstantPool class with a MapVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207803
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Thu, 1 May 2014 22:12:39 +0000 (22:12 +0000)]
[IR] Make {extract,insert}element accept an index of any integer type.
Given the following C code llvm currently generates suboptimal code for
x86-64:
__m128 bss4( const __m128 *ptr, size_t i, size_t j )
{
float f = ptr[i][j];
return (__m128) { f, f, f, f };
}
=================================================
define <4 x float> @_Z4bss4PKDv4_fmm(<4 x float>* nocapture readonly %ptr, i64 %i, i64 %j) #0 {
%a1 = getelementptr inbounds <4 x float>* %ptr, i64 %i
%a2 = load <4 x float>* %a1, align 16, !tbaa !1
%a3 = trunc i64 %j to i32
%a4 = extractelement <4 x float> %a2, i32 %a3
%a5 = insertelement <4 x float> undef, float %a4, i32 0
%a6 = insertelement <4 x float> %a5, float %a4, i32 1
%a7 = insertelement <4 x float> %a6, float %a4, i32 2
%a8 = insertelement <4 x float> %a7, float %a4, i32 3
ret <4 x float> %a8
}
=================================================
shlq $4, %rsi
addq %rdi, %rsi
movslq %edx, %rax
vbroadcastss (%rsi,%rax,4), %xmm0
retq
=================================================
The movslq is uneeded, but is present because of the trunc to i32 and then
sext back to i64 that the backend adds for vbroadcastss.
We can't remove it because it changes the meaning. The IR that clang
generates is already suboptimal. What clang really should emit is:
%a4 = extractelement <4 x float> %a2, i64 %j
This patch makes that legal. A separate patch will teach clang to do it.
Differential Revision: http://reviews.llvm.org/D3519
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207801
91177308-0d34-0410-b5e6-
96231b3b80d8
Pranav Bhandarkar [Thu, 1 May 2014 22:10:59 +0000 (22:10 +0000)]
Remove HexagonTargetMachine::addPassesForOptimizations; it is not needed any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207800
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Zotov [Thu, 1 May 2014 21:00:52 +0000 (21:00 +0000)]
[OCaml] Add an ocamlfind package llvm.all_backends.
This package is useful for architecture-independent tools like llc.
Patch by Jacques-Pascal Deplaix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207793
91177308-0d34-0410-b5e6-
96231b3b80d8
Reed Kotler [Thu, 1 May 2014 20:39:21 +0000 (20:39 +0000)]
Add basic functionality for assignment of ints.
This creates a lot of core infrastructure in which to add, with little
effort, quite a bit more to mips fast-isel
Test Plan: simplestore.ll
Reviewers: dsanders
Reviewed By: dsanders
Differential Revision: http://reviews.llvm.org/D3527
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207790
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 1 May 2014 19:55:34 +0000 (19:55 +0000)]
Fix uninitialized variable introduced in r207739.
This was initialized by llvm-mc (calling setDwarfVersion) but other
clients (such as clang, llc, etc) aren't necessarily initializing this
so we were getting garbage DWARF version values in the output.
Initialize it to a reasonable default (the same default used in llvm-mc,
though this is higher than it was (2) previously).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207788
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 1 May 2014 19:02:03 +0000 (19:02 +0000)]
Don't propagate StorageClass and ComplexType to aliases.
This matches gas' behaviour on COFF.
I think that this yak is now sufficiently shaved for aliases with offset
to work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207786
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 1 May 2014 18:59:11 +0000 (18:59 +0000)]
Update and sort CMakeLists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207785
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Bendersky [Thu, 1 May 2014 18:38:36 +0000 (18:38 +0000)]
Add an optimization that does CSE in a group of similar GEPs.
This optimization merges the common part of a group of GEPs, so we can compute
each pointer address by adding a simple offset to the common part.
The optimization is currently only enabled for the NVPTX backend, where it has
a large payoff on some benchmarks.
Review: http://reviews.llvm.org/D3462
Patch by Jingyue Wu.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207783
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 1 May 2014 18:31:21 +0000 (18:31 +0000)]
DebugInfo: Correct the attribute type kind.
Post commit review feedback from Paul Robinson regarding r207777.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207782
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 1 May 2014 17:56:13 +0000 (17:56 +0000)]
PR19623: Implement typedefs of void.
This the LLVM portion that will allow Clang and other frontends to emit
typedefs of void by providing a null type for the typedef's underlying
type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207777
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Thu, 1 May 2014 17:16:24 +0000 (17:16 +0000)]
Fixing a cast-qual warning. getBufferStart() and getBufferEnd() both return a const char *, so casting to non-const was triggering a warning (even though the assignment and usage was always const anyway).
No functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207774
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Thu, 1 May 2014 16:37:52 +0000 (16:37 +0000)]
R600/SI: Fix verifier error with pseudo store instructions.
Use i32 instead of specifying SReg_32. When this is
the pseudo INDIRECT_BASE_ADDR, this would give a bogus
verifier error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207770
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 1 May 2014 13:37:57 +0000 (13:37 +0000)]
Compute the correct section for zed = foo + 1 in COFF.
This fixes pr19147.
There are a few more related issues to fix, but the testcase in the bug now
passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207763
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 1 May 2014 13:24:25 +0000 (13:24 +0000)]
Move getBaseSymbol somewhere the COFF writer can use.
I will use it there in a second.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207761
91177308-0d34-0410-b5e6-
96231b3b80d8
Bradley Smith [Thu, 1 May 2014 13:11:59 +0000 (13:11 +0000)]
[ARM64] Prefer generation of bzero on Darwin only
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207760
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 1 May 2014 13:09:42 +0000 (13:09 +0000)]
Make getBaseSymbol non recursive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207759
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 1 May 2014 12:45:43 +0000 (12:45 +0000)]
Don't force symbols to be globals in .thumb_set.
We currently force symbols to be globals in .thumb_set. The intent
seems to be that given
.thumb_set foo, bar
we emit an undefined symbol to bar if it is never defined. The side
effect is that we mark bar as global, even if it is defined, which gas
does not.
Producing an undefined reference to bar is a general difference from MC and gas.
For example, given
a = b
gas will produce an undefined reference to b, MC will not. I would be surprised
if any code depends on this, but it it does, we should fix the general
difference, not special case .thumb_set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207757
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Thu, 1 May 2014 12:33:26 +0000 (12:33 +0000)]
Update post-r203364 lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-
20140303/207915.html
and ranged for loops.
http://reviews.llvm.org/D3582
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207755
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Thu, 1 May 2014 12:30:01 +0000 (12:30 +0000)]
AArch64/ARM64: rewrite test to use FileCheck & add ARM64 lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207754
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Thu, 1 May 2014 12:29:56 +0000 (12:29 +0000)]
AArch64/ARM64: port basic disassembly tests to ARM64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207753
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Thu, 1 May 2014 12:29:38 +0000 (12:29 +0000)]
AArch64/ARM64: print BFM instructions as BFI or BFXIL
The canonical form of the BFM instruction is always one of the more explicit
extract or insert operations, which makes reading output much easier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207752
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 1 May 2014 12:18:20 +0000 (12:18 +0000)]
[LCG] Add the other simple edge insertion API to the call graph. This
just connects an SCC to one of its descendants directly. Not much of an
impact. The last one is the hard one -- connecting an SCC to one of its
ancestors, and thereby forming a cycle such that we have to merge all
the SCCs participating in the cycle.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207751
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 1 May 2014 12:16:31 +0000 (12:16 +0000)]
[LCG] Don't lookup the child SCC twice. Spotted this by inspection, and
no functionality changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207750
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 1 May 2014 12:12:42 +0000 (12:12 +0000)]
[LCG] Add some basic methods for querying the parent/child relationships
of SCCs in the SCC DAG. Exercise them in the big graph test case. These
will be especially useful for establishing invariants in insertion
logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207749
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Atanasyan [Thu, 1 May 2014 11:57:40 +0000 (11:57 +0000)]
[llvm-readobj] Transform 'switch' with the only 'case' statement
to 'if' statement.
No functional changes,
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207748
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Barton [Thu, 1 May 2014 11:37:44 +0000 (11:37 +0000)]
Correction to assert statemtent to allow 32-bit unsigned numbers with the top bit set.
This fixes an ARM assembler crash - regression test added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207747
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 1 May 2014 11:24:11 +0000 (11:24 +0000)]
Revert r205965, which essentially reverts r205018 for the second time.
=[
Turns out that this was the root cause of PR19621. We found a crasher
only recently (likely due to improvements elsewhere in the SLP
vectorizer) but the reduced test case failed all the way back to here.
I've confirmed that reverting this patch both fixes the reduced test
case in PR19621 and the actual source file that led to it, so it seems
to really be rooted here. I've replied to the commit thread with
discussion of my (feeble) attempts to debug this. Didn't make it very
far, so reverting now that we have a good test case so that things can
get back to healthy while the debugging carries on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207746
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Atanasyan [Thu, 1 May 2014 11:07:19 +0000 (11:07 +0000)]
[llvm-readobj] Add support for Mips specific ELF header e_flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207744
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Thu, 1 May 2014 10:41:51 +0000 (10:41 +0000)]
[LCG] Fix a bad bug in the new fancy iterator scheme I added to support
removal. We can't just blindly increment (or decrement) the adapted
iterator when the value is null because doing so can walk past the end
(or beginning) and keep inspecting the value. The fix I've implemented
is to restrict this further to a forward iterator and add an end
iterator to the members (replacing a member that had become dead when
I switched to the adaptor base!) and using that to stop the iteration.
I'm not entirely pleased with this solution. I feel like forward
iteration is too restrictive. I wasn't even happy about bidirectional
iteration. It also makes the iterator objects larger and the iteration
loops more complex. However, I also don't really like the other
alternative that seems obvious: a sentinel node. I'm still hoping to
come up with a more elegant solution here, but this at least fixes the
MSan and Valgrind errors on this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207743
91177308-0d34-0410-b5e6-
96231b3b80d8
Bradley Smith [Thu, 1 May 2014 10:25:36 +0000 (10:25 +0000)]
[ARM64] Conditionalize CPU specific system registers on subtarget features
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207742
91177308-0d34-0410-b5e6-
96231b3b80d8
Matheus Almeida [Thu, 1 May 2014 10:24:46 +0000 (10:24 +0000)]
[mips] Move expansion of .cpsetup to target streamer.
Summary:
There are two functional changes:
1) The directive is not expanded for the ASM->ASM code path.
2) If PIC is not set, there's no expansion for the ASM->OBJ code path (same behaviour as GAS).
Reviewers: dsanders
Reviewed By: dsanders
Differential Revision: http://reviews.llvm.org/D3482
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207741
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Sanders [Thu, 1 May 2014 10:08:36 +0000 (10:08 +0000)]
[mips] Removed two-operand alias for sllv, sr[al]v, rotrv, dsllv, dsr[al]v, and drotrv
GAS doesn't actually accept these particular cases.
The mnemonic without the trailing 'v' still supports two-operand aliases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207740
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Thu, 1 May 2014 08:46:02 +0000 (08:46 +0000)]
Record the DWARF version in MCContext
Record the DWARF version in MCContext, and use it when
emitting the dwarf version into the debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207739
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Thu, 1 May 2014 04:19:59 +0000 (04:19 +0000)]
ARM: fix memory leak, simplify WoA stack probing
This fixes the memory leak introduced with the initial addition of support for
WoA stack probing. Now that the pseudo-instruction expansion can handle an
external symbol, use that to generate the load which simplifies the logic as
well as avoids the memory leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207737
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Thu, 1 May 2014 04:19:56 +0000 (04:19 +0000)]
ARM: support expanding external symbols in 32-bit moves
This enhances the expansion of the mov32imm pseudo-instruction to support an
external symbol reference. This is motivated by a simplification of the stack
probe emission for Windows on ARM (and fixing a leak).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207736
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 1 May 2014 00:46:58 +0000 (00:46 +0000)]
Speculatively roll back r207724-r207726, which are code cleanup changes and
appear to be breaking a bootstrapped build of compiler-rt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207732
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Thu, 1 May 2014 00:25:15 +0000 (00:25 +0000)]
If necessary for indirect encodings, emit stubs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207730
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 1 May 2014 00:10:17 +0000 (00:10 +0000)]
Start fixing pr19147.
This makes the coff writer compute the correct symbol value for the test in
pr19147. The section is still incorrect, that will be fixed in a followup patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207728
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 30 Apr 2014 23:46:27 +0000 (23:46 +0000)]
LexicalScopes: Use unique_ptr to manage ownership of abstract LexicalScopes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207726
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 30 Apr 2014 23:42:04 +0000 (23:42 +0000)]
Forgotten reformatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207725
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 30 Apr 2014 23:40:59 +0000 (23:40 +0000)]
LexicalScopes: use unique_ptr to own LexicalScope objects.
Ownership of abstract scopes coming soon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207724
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Wed, 30 Apr 2014 23:36:24 +0000 (23:36 +0000)]
Add missing breaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207723
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Wed, 30 Apr 2014 23:23:14 +0000 (23:23 +0000)]
Switch over getArch()'s result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207721
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 30 Apr 2014 23:02:40 +0000 (23:02 +0000)]
Use a single data structure to store all user variables in DwarfDebug
Summary:
Get rid of UserVariables set, and turn DbgValues into MapVector
to get a fixed ordering, as suggested in review for http://reviews.llvm.org/D3573.
Test Plan: llvm regression tests
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D3579
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207720
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 30 Apr 2014 22:58:19 +0000 (22:58 +0000)]
Revert "Emit DW_AT_object_pointer once, on the declaration, for each function."
Breaks GDB buildbot
(http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/14517)
GCC emits DW_AT_object_pointer /everywhere/ (declaration, abstract
definition, inlined subroutine), but it looks like GCC relies on it
being somewhere other than the declaration, at least. I'll experiment
further & can hopefully still remove it from the inlined_subroutine.
This reverts commit r207705.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207719
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Wed, 30 Apr 2014 22:43:13 +0000 (22:43 +0000)]
Prepare support of Itanium ABI on ARM as opposed to EHABI by
conditionally emitting .fnstart and friends only for EHABI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207718
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 30 Apr 2014 22:41:33 +0000 (22:41 +0000)]
DebugInfo: Omit DW_AT_artificial on DW_TAG_formal_parameters in DW_TAG_inlined_subroutines.
They just don't need to be there - they're inherited from the abstract
definition. In theory I would like them to be inherited from the
declaration, but the DWARF standard doesn't quite say that... we can
probably do it anyway but I'm less confident about that so I'll leave it
for a separate commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207717
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Wed, 30 Apr 2014 22:40:27 +0000 (22:40 +0000)]
Restore condition incorrectly changed in r96289 to the older state.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207716
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 30 Apr 2014 22:17:38 +0000 (22:17 +0000)]
Convert more loops to range-based equivalents
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207714
91177308-0d34-0410-b5e6-
96231b3b80d8
Gerolf Hoflehner [Wed, 30 Apr 2014 22:05:02 +0000 (22:05 +0000)]
Patch for function cloning to inline all blocks whose address is taken
Not all address taken blocks get inlined. The reason is
that a blocks new address is known only when it is cloned. But e.g.
a branch instruction in a different block could need that address earlier
while it gets cloned. The solution is to collect the set of all
blocks that can potentially get inlined and compute a new block address
up front. Then clone and cleanup.
rdar://
16427209
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207713
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 30 Apr 2014 21:51:13 +0000 (21:51 +0000)]
Provide a version of getSymbolOffset that returns false on error.
This simplifies ELFObjectWriter::SymbolValue a bit more. This new version
will also be used in the COFF writer to fix pr19147.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207711
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 30 Apr 2014 21:44:17 +0000 (21:44 +0000)]
Slightly simplify code in DwarfDebug::beginFunction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207710
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 30 Apr 2014 21:34:11 +0000 (21:34 +0000)]
Move logic for calculating DBG_VALUE history map into separate file/class.
Summary: No functionality change.
Test Plan: llvm regression test suite.
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: echristo, llvm-commits
Differential Revision: http://reviews.llvm.org/D3573
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207708
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Wed, 30 Apr 2014 21:31:11 +0000 (21:31 +0000)]
Move a testcase from ELF to ARM64, incorrectly placed in r207627.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207706
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 30 Apr 2014 21:29:41 +0000 (21:29 +0000)]
Emit DW_AT_object_pointer once, on the declaration, for each function.
This effectively reverts r164326, but adds some comments and
justification and ensures we /don't/ emit the DW_AT_object_pointer on
the (abstract and concrete) definitions. (while still preserving it on
standalone definitions involving ObjC Blocks)
This does increase the size of member function declarations from 7 to 11
bytes, unfortunately, but still seems like the Right Thing to do so that
callers that see only the declaration still have the information about
the object pointer. That said, I don't know what, if any, DWARF
consumers don't have a heuristic to guess this in the case of normal
C++ member functions - perhaps we can remove it entirely.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207705
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 30 Apr 2014 21:26:35 +0000 (21:26 +0000)]
Don't expect to find fpcmp and PerfectShuffle when running lit tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207704
91177308-0d34-0410-b5e6-
96231b3b80d8
Jay Foad [Wed, 30 Apr 2014 21:12:17 +0000 (21:12 +0000)]
Remove unused field hash_state::seed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207703
91177308-0d34-0410-b5e6-
96231b3b80d8
Weiming Zhao [Wed, 30 Apr 2014 21:07:24 +0000 (21:07 +0000)]
[ARM64] Prevent bit extraction to be adjusted by following shift
For pattern like ((x >> C1) & Mask) << C2, DAG combiner may convert it
into (x >> (C1-C2)) & (Mask << C2), which makes pattern matching of ubfx
more difficult.
For example:
Given
%shr = lshr i64 %x, 4
%and = and i64 %shr, 15
%arrayidx = getelementptr inbounds [8 x [64 x i64]]* @arr, i64 0, %i64 2, i64 %and
%0 = load i64* %arrayidx
With current shift folding, it takes 3 instrs to compute base address:
lsr x8, x0, #1
and x8, x8, #0x78
add x8, x9, x8
If using ubfx, it only needs 2 instrs:
ubfx x8, x0, #4, #4
add x8, x9, x8, lsl #3
This fixes bug 19589
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207702
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 30 Apr 2014 20:34:31 +0000 (20:34 +0000)]
Fix the clang-cl self-host build by defining ~DwarfDebug out of line
DwarfDebug.h has a SmallVector member containing a unique_ptr of an
incomplete type. MSVC doesn't have key functions, so the vtable and
dtor are emitted in AsmPrinter.cpp, where DwarfDebug's ctor is called.
AsmPrinter.cpp include DwarfUnit.h and doesn't get a complete definition
of DwarfTypeUnit. We could fix the problem by including DwarfUnit.h in
DwarfDebug.h, but that would increase header bloat. Instead, define
~DwarfDebug out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207701
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Wed, 30 Apr 2014 20:06:26 +0000 (20:06 +0000)]
Add a testcase for r207627.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207697
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Wed, 30 Apr 2014 19:38:09 +0000 (19:38 +0000)]
Use the new StringTableBuilder in yaml2elf
http://reviews.llvm.org/D3574
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207694
91177308-0d34-0410-b5e6-
96231b3b80d8
Yi Jiang [Wed, 30 Apr 2014 19:27:24 +0000 (19:27 +0000)]
Revert r207571 - Add slp vectorization to LTO passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207693
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Zolotukhin [Wed, 30 Apr 2014 19:17:32 +0000 (19:17 +0000)]
[X86] Never hoist the shift value of a shift instruction.
There is no need to check if we want to hoist the immediate value of an
shift instruction. Simply return TCC_Free right away.
This change is like r206101, but for X86.
rdar://problem/
16190769
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207692
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 30 Apr 2014 18:29:51 +0000 (18:29 +0000)]
Convert several loops over MachineFunction basic blocks to range-based loops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207683
91177308-0d34-0410-b5e6-
96231b3b80d8
Carlo Kok [Wed, 30 Apr 2014 17:53:04 +0000 (17:53 +0000)]
[IPO/MergeFunctions] changes so it doesn't try to bitcast a struct return type but instead recreates it with insert/extract value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207679
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 30 Apr 2014 17:22:00 +0000 (17:22 +0000)]
IR: Conservatively verify inalloca arguments
Summary: Try to spot obvious mismatches with inalloca use.
Reviewers: rnk
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D3572
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207676
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 30 Apr 2014 16:59:35 +0000 (16:59 +0000)]
Simplify ELFObjectWriter::SymbolValue.
It now defers all offset computation to getSymbolOffset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207674
91177308-0d34-0410-b5e6-
96231b3b80d8
Matheus Almeida [Wed, 30 Apr 2014 16:53:49 +0000 (16:53 +0000)]
[mips] Add instruction alias (negu).
Summary: negu $reg is equivalent to negu $reg, $reg.
Reviewers: dsanders
Reviewed By: dsanders
Differential Revision: http://reviews.llvm.org/D3510
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207673
91177308-0d34-0410-b5e6-
96231b3b80d8
Matheus Almeida [Wed, 30 Apr 2014 16:29:56 +0000 (16:29 +0000)]
[mips] Add instruction alias (sltu).
Summary:
The pattern sltu $r1, $r2, $imm is found in handwritten assembly which
is just a shorthand version of sltui $r1, $r2, $imm.
Reviewers: dsanders
Reviewed By: dsanders
Differential Revision: http://reviews.llvm.org/D3508
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207671
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Wed, 30 Apr 2014 16:25:02 +0000 (16:25 +0000)]
ELFObjectWriter: deduplicate suffices in strtab
We already do this for shstrtab, so might as well do it for strtab. This
extracts the string table building code into a separate class. The idea
is to use it for other object formats too.
I mostly wanted to do this for the general principle, but it does save a
little bit on object file size. I tried this on a clang bootstrap and
saved 0.54% on the sum of object file sizes (1.14 MB out of 212 MB for
a release build).
Differential Revision: http://reviews.llvm.org/D3533
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207670
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Wed, 30 Apr 2014 16:13:34 +0000 (16:13 +0000)]
ARM64: print fp immediates without using scientific notation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207669
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Wed, 30 Apr 2014 16:13:26 +0000 (16:13 +0000)]
AArch64/ARM64: implement remaining TLS relocations (purely MC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207668
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Wed, 30 Apr 2014 16:13:20 +0000 (16:13 +0000)]
AArch64/ARM64: add specific diagnostic for MRS/MSR and enable tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207667
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Wed, 30 Apr 2014 16:13:07 +0000 (16:13 +0000)]
AArch64/ARM64: accept and print floating-point immediate 0 as "#0.0"
It's been decided that in the future, the floating-point immediate in
instructions like "fcmeq v0.2s, v1.2s, #0.0" will be canonically "0.0", which
has been implemented on AArch64 already but not ARM64.
This fixes that issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207666
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 30 Apr 2014 16:12:21 +0000 (16:12 +0000)]
IR: Alloca clones should remember inalloca state
Pretty straightforward, we weren't propagating whether or not an
AllocaInst had 'inalloca' marked on it when it came time to clone it.
The inliner exposed this bug. A reduced testcase is forthcoming.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207665
91177308-0d34-0410-b5e6-
96231b3b80d8
Matheus Almeida [Wed, 30 Apr 2014 16:00:49 +0000 (16:00 +0000)]
[mips] Add instruction alias (dsll and dsrl).
Summary:
The pattern dsll/dsrl $rd, $rt, $rs is found in handwritten assembly which
is just a shorthand version of dsllv/dsrlv $rd, $rt, $rs.
Reviewers: dsanders
Reviewed By: dsanders
Differential Revision: http://reviews.llvm.org/D3486
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207664
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Gregor [Wed, 30 Apr 2014 15:49:06 +0000 (15:49 +0000)]
Fix a use of uninitialized memory in SmallVector's move-assignment operator.
When we were moving from a larger vector to a smaller one but didn't
need to re-allocate, we would move-assign over uninitialized memory in
the target, then move-construct that same data again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207663
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 30 Apr 2014 15:32:21 +0000 (15:32 +0000)]
Relax the test a bit.
It is not relevant where the symbol and section names are stored, just their
values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207662
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 30 Apr 2014 15:31:33 +0000 (15:31 +0000)]
R600/SI: Use VALU instructions for copying i1 values
We can't use SALU instructions for this since they ignore the EXEC mask
and are always executed.
This fixes several OpenCV tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207661
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 30 Apr 2014 15:31:29 +0000 (15:31 +0000)]
R600/SI: Teach moveToVALU how to handle some SMRD instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207660
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Wed, 30 Apr 2014 15:29:57 +0000 (15:29 +0000)]
[ARM64][fast-isel] Fast-isel doesn't know how to handle f128.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207659
91177308-0d34-0410-b5e6-
96231b3b80d8