133996 Commits

Author SHA1 Message Date
Marcin Koscielnicki
e2e9cee0d7 [SelectionDAG] Don't treat library calls specially if marked with nobuiltin.
To be used by D19781.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273039 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 20:24:07 +00:00
Michael Kuperstein
987a5dc3a7 [X86] Add missing AVX512 anyext patterns.
Add AVX512 anyext patterns for i16 and i64, modeled on the existing i8 and
i32 patterns.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 20:21:17 +00:00
Adrian McCarthy
e299441893 Revert "Properly handle short file names on the command line in Windows"
This reverts commit 3e5651782cfc985fca9d94595cad63059e587e2f.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273033 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 19:45:59 +00:00
Davide Italiano
e92bed3b5e [PM] Port MergedLoadStoreMotion to the new pass manager, take two.
This is indeed a much cleaner approach (thanks to Daniel Berlin
for pointing out), and also David/Sean for review.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273032 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 19:10:09 +00:00
Benjamin Kramer
c22fa67ab0 Avoid duplicated map lookups. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 18:59:41 +00:00
Tim Northover
d476afda38 ARM: take account of possible bundle when erasing an instruction.
Fortunately this appears to be the only ARM-specific pass that runs while
bundles might be in play, so no other cases need modifying.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273029 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 18:40:46 +00:00
Davide Italiano
f57147f09b [IRObjectFile] Handle .weak in RecordStreamer.
Differential Revision:  http://reviews.llvm.org/D21476

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 18:20:14 +00:00
James Y Knight
8d30502e60 Support expanding partial-word cmpxchg to full-word cmpxchg in AtomicExpandPass.
Many CPUs only have the ability to do a 4-byte cmpxchg (or ll/sc), not 1
or 2-byte. For those, you need to mask and shift the 1 or 2 byte values
appropriately to use the 4-byte instruction.

This change adds support for cmpxchg-based instruction sets (only SPARC,
in LLVM). The support can be extended for LL/SC-based PPC and MIPS in
the future, supplanting the ISel expansions those architectures
currently use.

Tests added for the IR transform and SPARCv9.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273025 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 18:11:48 +00:00
Davide Italiano
d2e7196d0a [Codegen] Change PICLevel.
We convert `Default` to `NotPIC` so that target independent code
can reason about this correctly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273024 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 18:07:14 +00:00
Justin Bogner
de71999c85 LoopSimplifyCFG: Prefer const auto & to auto &, for clarity. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273023 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 17:59:48 +00:00
Rafael Espindola
870227d3f8 Don't use the new x86 relax relocations on the gold plugin.
Should bring back the bots with old versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273022 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 17:53:57 +00:00
Rafael Espindola
bef5612dfd Change RelaxELFRelocations for llc.
As a developer tool it makes sense for it to use the new relocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273019 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 17:43:41 +00:00
Rafael Espindola
0bd8e59529 Change RelaxELFRelocations' default.
NFC to the existing clients since they all set it already.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273017 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 17:26:07 +00:00
Rafael Espindola
3be11e69ac Change the default of -relax-relocations.
llvm-mc is a developer tool, as such it make sense for it to use new
features by default.

This doesn't change the user facing clang, which still defaults to non
relaxable relocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273014 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 17:04:56 +00:00
Sanjay Patel
4316ebd34d [InstCombine] allow more than one use for vector bitcast folding with selects
The motivating example for this transform is similar to D20774 where bitcasts interfere
with a single cmp/select sequence, but in this case we have 2 uses of each bitcast to 
produce min and max ops:

define void @minmax_bc_store(<4 x float> %a, <4 x float> %b, <4 x float>* %ptr1, <4 x float>* %ptr2) {
  %cmp = fcmp olt <4 x float> %a, %b
  %bc1 = bitcast <4 x float> %a to <4 x i32>
  %bc2 = bitcast <4 x float> %b to <4 x i32>
  %sel1 = select <4 x i1> %cmp, <4 x i32> %bc1, <4 x i32> %bc2
  %sel2 = select <4 x i1> %cmp, <4 x i32> %bc2, <4 x i32> %bc1
  %bc3 = bitcast <4 x float>* %ptr1 to <4 x i32>*
  store <4 x i32> %sel1, <4 x i32>* %bc3
  %bc4 = bitcast <4 x float>* %ptr2 to <4 x i32>*
  store <4 x i32> %sel2, <4 x i32>* %bc4
  ret void
}

With this patch, we move the selects up to use the input args which allows getting rid of
all of the bitcasts:

define void @minmax_bc_store(<4 x float> %a, <4 x float> %b, <4 x float>* %ptr1, <4 x float>* %ptr2) {
  %cmp = fcmp olt <4 x float> %a, %b
  %sel1.v = select <4 x i1> %cmp, <4 x float> %a, <4 x float> %b
  %sel2.v = select <4 x i1> %cmp, <4 x float> %b, <4 x float> %a
  store <4 x float> %sel1.v, <4 x float>* %ptr1, align 16
  store <4 x float> %sel2.v, <4 x float>* %ptr2, align 16
  ret void
}

The asm for x86 SSE then improves from:

movaps  %xmm0, %xmm2
cmpltps %xmm1, %xmm2
movaps  %xmm2, %xmm3
andnps  %xmm1, %xmm3
movaps  %xmm2, %xmm4
andnps  %xmm0, %xmm4
andps %xmm2, %xmm0
orps  %xmm3, %xmm0
andps %xmm1, %xmm2
orps  %xmm4, %xmm2
movaps  %xmm0, (%rdi)
movaps  %xmm2, (%rsi)

To:

movaps  %xmm0, %xmm2
minps %xmm1, %xmm2
maxps %xmm0, %xmm1
movaps  %xmm2, (%rdi)
movaps  %xmm1, (%rsi)

The TODO comments show that we're limiting this transform only to vectors and only to bitcasts
because we need to improve other transforms or risk creating worse codegen.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273011 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 16:46:50 +00:00
David Majnemer
3891af66b3 [CodeView] Refactor enumerator emission
This addresses Amjad's review comments on D21442.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273010 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 16:13:21 +00:00
Reid Kleckner
58ee02e322 [codeview] Make function names more consistent with MSVC
Names in function id records don't include nested name specifiers or
template arguments, but names in the symbol stream include both.

For the symbol stream, instead of having Clang put the fully qualified
name in the subprogram display name, recreate it from the subprogram
scope chain. For the type stream, take the unqualified name and chop of
any template arguments.

This makes it so that CodeView DI metadata is more similar to DWARF DI
metadata.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273009 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 16:11:20 +00:00
Nirav Dave
e9d4816026 Refactor and cleanup Assembly Parsing / Lexing
Recommiting after fixing non-atomic insert to front of SmallVector in
MCAsmLexer.h

Add explicit Comment Token in Assembly Lexing for future support for
outputting explicit comments from inline assembly. As part of this,
CPPHash Directives are now explicitly distinguished from Hash line
comments in Lexer.

Line comments are recorded as EndOfStatement tokens, not Comment tokens
to simplify compatibility with current TargetParsers. This slightly
complicates comment output.

This remove all lexing tasks out of the parser, does minor cleanup
to remove extraneous newlines Asm Output, and some improvements white
space handling.

Reviewers: rtrieu, dwmw2, rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 16:06:17 +00:00
Igor Laevsky
afaddb4d86 [MCContext] Don't use getenv inside class constructor
Differential Revision: http://reviews.llvm.org/D21471



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273005 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 15:19:41 +00:00
Simon Pilgrim
649d92ad2f [X86][SSE4A] Remove the GCCBuiltins from the movntsd/movntss intrinsic defs so we can emit native IR from clang.
Clang-side sibling commit to follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273002 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 14:27:38 +00:00
Benjamin Kramer
5bd9b03645 [ARM] Strength reduce vectors to arrays.
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273001 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 14:14:29 +00:00
Benjamin Kramer
db2bf1e6f9 [PPC] Strength-reduce SmallVectors into arrays.
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 13:15:10 +00:00
Kostya Serebryany
ee71b6abb0 [libFuzzer] make the single-run output more reliable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272998 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 13:07:06 +00:00
Craig Topper
95f474f922 [X86] Pre-size several SmallVectors instead of calling push_back in a loop. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 12:20:50 +00:00
Craig Topper
27e2482790 [X86] Fix formatting. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272996 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 12:20:48 +00:00
Adam Nemet
2554aeaa7d [LLE] Don't hard-code the name of the preheader in test
Turns out a didn't get this right because symbolic stride versioning
changes the name.  Relax the matching.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 09:13:15 +00:00
Chandler Carruth
bd6882c677 [PM] Run clang-format over various parts of the new pass manager code
prior to some very substantial patches to isolate any formatting-only
changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272991 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 07:15:29 +00:00
Matt Arsenault
12e9f5cf93 Revert "InstCombine: Reduce trunc (shl x, K) width."
This reverts commit r272987.

This might be causing crashes on some bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272990 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 06:28:53 +00:00
Qin Zhao
4e01f2cc2f [esan|cfrag] Add the struct field size array in StructInfo
Summary:
Adds the struct field size array in struct StructInfo.

Updates test struct_field_count_basic.ll.

Reviewers: aizatsky

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, bruening, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272989 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 04:50:20 +00:00
Matt Arsenault
28ae6d84be InstCombine: Reduce trunc (shl x, K) width.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 04:43:22 +00:00
Ranjeet Singh
e5b666f4cf [ARM] Add support for mrrc/mrrc2 intrinsics.
Reapplying patch as it was reverted when it was first
committed because of an assertion failure when the
mrrc2 intrinsic was called in ARM mode. The failure
was happening because the instruction was being built
in ARMISelDAGToDAG.cpp and the tablegen description for
mrrc2 instruction doesn't allow you to use a predicate.

The ARM architecture manuals do say that mrrc2 in ARM
mode can be predicated with AL in assembly but this has
no effect on the encoding of the instruction as the top
4 bits will always be 1111 not 1110 which is the encoding
for the condition AL.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 00:52:41 +00:00
Sanjoy Das
78628d1ea7 [RS4GC] Pass CallSite by value instead of const ref; NFC
That's the idiomatic LLVM pattern.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 00:45:00 +00:00
Chandler Carruth
04d0fe9c10 [PM] Remove support for omitting the AnalysisManager argument to new
pass manager passes' `run` methods.

This removes a bunch of SFINAE goop from the pass manager and just
requires pass authors to accept `AnalysisManager<IRUnitT> &` as a dead
argument. This is a small price to pay for the simplicity of the system
as a whole, despite the noise that changing it causes at this stage.

This will also helpfull allow us to make the signature of the run
methods much more flexible for different kinds af passes to support
things like intelligently updating the pass's progression over IR units.

While this touches many, many, files, the changes are really boring.
Mostly made with the help of my trusty perl one liners.

Thanks to Sean and Hal for bouncing ideas for this with me in IRC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272978 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 00:11:01 +00:00
Chuang-Yu Cheng
5e71c1e0a7 Use m_APInt in SimplifyCFG
Switch from m_Constant to m_APInt per David's request. NFC.

Author: Thomas Jablin (tjablin)
Reviewers: majnemer cycheng

http://reviews.llvm.org/D21440

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 00:04:39 +00:00
Adam Nemet
d448b5e945 [LV] Move management of symbolic strides to LAA. NFCI
This is still NFCI, so the list of clients that allow symbolic stride
speculation does not change (yes: LV and LoopVersioningLICM, no: LLE,
LDist).  However since the symbolic strides are now managed by LAA
rather than passed by client a new bool parameter is used to enable
symbolic stride speculation.

The existing test Transforms/LoopVectorize/version-mem-access.ll checks
that stride speculation is performed for LV.

The previously added test Transforms/LoopLoadElim/symbolic-stride.ll
ensures that no speculation is performed for LLE.

The next patch will change the functionality and turn on symbolic stride
speculation in all of LAA's clients and remove the bool parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272970 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 22:57:55 +00:00
Evgeniy Stepanov
f268616d77 [safestack] Sink unsafe address computation to each use.
This is a fix for PR27844.
When replacing uses of unsafe allocas, emit the new location
immediately after each use. Without this, the pointer stays live from
the function entry to the last use, while it's usually cheaper to
recalculate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272969 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 22:34:04 +00:00
Evgeniy Stepanov
fd0154041b [safestack] Fixup llvm.dbg.value when rewriting unsafe allocas.
When moving unsafe allocas to the unsafe stack, dbg.declare intrinsics are
updated to refer to the new location.

This change does the same to dbg.value intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272968 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 22:34:00 +00:00
Adrian McCarthy
3e5651782c Properly handle short file names on the command line in Windows
Some build systems use the short (8.3) file names on Windows, especially if the path has spaces in it. The shortening made it impossible for clang to distinguish between clang.exe, clang++.exe, and clang-cl.exe.  So this expands short names in the first argument and does wildcard expansion for the rest.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272967 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 22:07:55 +00:00
Adam Nemet
8b651e60d7 [LV] Make getSymbolicStrides return a pointer rather than a reference. NFC
Turns out SymbolicStrides is actually used in canVectorizeWithIfConvert
before it gets set up in canVectorizeMemory.

This works fine as long as SymbolicStrides resides in LV since we just
have an empty map.  Based on this the conclusion is made that there are
no symbolic strides which is conservatively correct.

However once SymbolicStrides becomes part of LAI, LAI is nullptr at this
point so we need to differentiate the uninitialized state by returning a
nullptr for SymbolicStrides.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:55:10 +00:00
Evgeniy Stepanov
57ba611520 Fix BitVector move ctor/assignment.
Current implementation leaves the object in an invalid state.

This reverts commit bf0c389ac683cd6c0e5959b16537e59e5f4589e3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272965 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:45:13 +00:00
Matt Arsenault
6d25c4fea6 TTI: Add hook for memory width to vectorize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272964 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:43:12 +00:00
David Majnemer
5dd02f3333 [CodeView] Implement support for enums
MSVC handles enums differently from structs and classes: a forward
declaration is not emitted unconditionally.  MSVC does not emit an S_UDT
record for the enum.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272960 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:32:16 +00:00
Matt Arsenault
dc9478ac13 AArch64: Fix range loop contradicting comment above it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272959 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:21:49 +00:00
Changpeng Fang
a3e290966a AMDGPU/SI: Propagate the Kill flag in storeRegToStackSlot and eliminateFrameIndex
Reviewers: arsenm, tstellarAMD

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272958 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:20:47 +00:00
Nirav Dave
afacc9421f Revert "Refactor and cleanup Assembly Parsing / Lexing"
Reverting for unexpected crashes on various platforms.

This reverts commit r272953.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:19:23 +00:00
Matt Arsenault
f3108f6961 AMDGPU: Fix maximum instruction size for amdgcn
This was causing the conservative estimate of inline asm
size to be twice as big as expected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272956 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:14:05 +00:00
Sanjoy Das
7d80f210a6 [EarlyCSE] Minor cosmetic NFC changes
- Avoid implicit conversion from pointer to bool
 - Add a comment when passing in a boolean value

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272955 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 21:00:57 +00:00
Sanjoy Das
60eee05a65 [EarlyCSE] Fold invariant loads
Redundant invariant loads can be CSE'ed with very little extra effort
over what early-cse already tracks, so it looks reasonable to make
early-cse handle this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:47:57 +00:00
Nirav Dave
e0348ce1ac Refactor and cleanup Assembly Parsing / Lexing
Add explicit Comment Token in Assembly Lexing for future support for
outputting explicit comments from inline assembly. As part of this,
CPPHash Directives are now explicitly distinguished from Hash line
comments in Lexer.

Line comments are recorded as EndOfStatement tokens, not Comment tokens
to simplify compatibility with current TargetParsers. This slightly
complicates comment output.

This remove all lexing tasks out of the parser, does minor cleanup
to remove extraneous newlines Asm Output, and some improvements white
space handling.

Reviewers: rtrieu, dwmw2, rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272953 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:34:22 +00:00
Kostya Serebryany
c0e47a82c1 [libFuzzer] use the new chainable malloc hooks instead of the old un-chainable ones, use atomic for malloc/free counters instead of a thread local counter in the main thread. This should make on-the-spot leak detection in libFuzzer more reliable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 20:17:41 +00:00