Commit Graph

80778 Commits

Author SHA1 Message Date
Alexey Samsonov
a9a3bc268b Let llvm::ReplaceInstWithInst copy debug location from old to new instruction.
Currently some users of this function do this explicitly, and all the
rest forget to do this.

ThreadSanitizer was one of such users, and had missing debug
locations for calls into TSan runtime handling atomic operations,
eventually leading to poorly symbolized stack traces and malfunctioning
suppressions.

This is another change relevant to PR23837.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240460 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 21:00:08 +00:00
Sanjoy Das
ef42e1115f Revert "[FaultMaps] Move FaultMapParser to Object/"
This reverts commit r240364 (git c49542e5bb).  The issue r240364 was
trying to fix was fixed independently in r240362.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240448 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 20:09:03 +00:00
Mark Heffernan
fbd746614d This change fixes three bugs in loop unswitching. This change causes an 81% speed-up on a benchmark that is based on EigenConvolutionKernel2D from Eigen3, where the lack of loop unswitching blocks hoisting of loads out of a nested loop (see bug 23816 for how loop unswitching and load hoisting are related).
Change 1: Unswitching on trivial conditions should always happen regardless of the computed unswitching cost, as really the cost is zero. While there is code to make that happen, the logic that checks the unswitching cost against a threshold was moved to an earlier point (revision 147935) than the point where trivial unswitching is detected, so trivial unswitching is currently blocked by the cost threshold. This change fixes that.

Change 2: Before revision 147935 (from 2012-01-11), the threshold parameter was a per-loop threshold. So an unswitching happened only if the cost of the unswitching was less than the threshold. In an indirect way (and I believe unintentionally), the logic for this since then has been that the threshold is an over-all budget across all loops for all loop unswitching done by a given LoopUnswitch loop pass object. So if an unswitching with cost 100 happens in one function, that in effect reduces the threshold from 100 to 0 for the loops even in another function. This persists for the lifetime of that loop pass object. This makes no difference for most small examples but it is important for large examples. This revision fixes that.

Change 3: The cost is currently calculated as std::min(NumInstructions, 5 * NumBlocks). So a loop with 2 blocks and a million instructions will have an unswitching cost of 10. I changed this to just NumInstructions, as it were before revision 147935, though I'm open to e.g. instead replacing std::min with std::max.

I've tried to make the change minimally invasive while staying with what I think was the original intent of the code.
Submitted on behalf of broune@.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240438 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 18:26:50 +00:00
Alex Lorenz
1c5cf241af ADT: Add a string APSInt constructor.
This commit moves the APSInt initialization code that's used by
the LLLexer class into a new APSInt constructor that constructs
APSInts from strings.

This change is useful for MIR Serialization, as it would allow
the MILexer class to use the same APSInt initialization as 
LLexer when parsing immediate machine operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240436 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 18:22:10 +00:00
Alex Lorenz
d31dc69aa1 AsmParser: Extend the API to make the global value and metadata node slot mappings publicly accessible.
This commit creates a new structure called 'SlotMapping' in the AsmParser library.
This structure can be passed into the public parsing APIs from the AsmParser library
in order to extract the data structures that map from slot numbers to unnamed global
values and metadata nodes.

This change is useful for MIR Serialization, as the MIR Parser has to lookup the
unnamed global values and metadata nodes by their slot numbers.

Reviewers: Duncan P. N. Exon Smith

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 17:10:10 +00:00
Alex Lorenz
9982d6f7ee MIR Serialization: Serialize physical register machine operands.
This commit introduces functionality that's used to serialize machine operands.
Only the physical register operands are serialized by this commit.

Reviewers: Duncan P. N. Exon Smith

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240425 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 16:35:26 +00:00
John Brawn
a99d1c85a8 [ARM] ARMLoadStoreOpt::UpdateBaseRegUses should stop on def
When UpdateBaseRegUses sees an instruction that defines the base
register it must stop, as the base register value it is updating is no
longer live. Ideally we would already have seen the register be killed
(which is already checked for), but the kill flags may be inaccurate
and we have to account for this.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240424 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 16:02:11 +00:00
Justin Bogner
3800e768a2 SystemZ: Avoid left shifting negative values (it's UB)
Found by ubsan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240420 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 15:38:24 +00:00
Benjamin Kramer
896353d663 [Option] Plug a leak when move-assigning an InputArgList.
The class has a non-trivial dtor so we have to clean up before we move
in new members. Remove misleading comment as a default move assignment
operator will never be synthesized for this class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240417 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 15:28:10 +00:00
Benjamin Kramer
9492ec55bd Make helper functions static. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240416 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:51:40 +00:00
Benjamin Kramer
530a616a9d [BranchFolding] Document why replacing HashMachineInstr with hash_code doesn't work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:47:36 +00:00
Benjamin Kramer
336ead08bd [MachineBasicBlock] Add getFirstNonDebugInstr to complement getLastNonDebugInstr
Use it in CodeGen where applicable. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240414 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:47:29 +00:00
Benjamin Kramer
d18bb88b2e [MachineBasicBlock] Use the const_cast(this) trick to reduce duplication
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240413 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:47:18 +00:00
Rafael Espindola
7376033762 Be sure to set the DataLayout before checking the cache.
This makes sure the same mangling is used.

Should fix the OS X bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240411 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:42:34 +00:00
Toma Tabacu
115be6213d [mips] [IAS] Add partial support for the ULHU pseudo-instruction.
Summary:
This only adds support for ULHU of an immediate address with/without a source register.
It does not include support for ULHU of the address of a symbol.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:39:42 +00:00
Rafael Espindola
0e9288493a Remove unused arguments and move ManglerPrefixTy to the implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240408 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:11:09 +00:00
Toma Tabacu
88278a22cc [mips] [IAS] Add support for generating DADDu to createAddu(). NFC.
Summary: This isn't used right now, but it will be in some upcoming changes.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240407 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 14:00:54 +00:00
Rafael Espindola
9758b4ae95 Simplify the Mangler interface now that DataLayout is mandatory.
We only need to pass in a DataLayout when mangling a raw string, not when
constructing the mangler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240405 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 13:59:29 +00:00
Petar Jovanovic
7c5bf4d38a [mips64] Emit correct addend for some PC-relative relocations
So far, LLVM has not emitted correct addend for N64 and N32 ABI. This patch
fixes that. It also removes fixup from MCJIT for R_MIPS_PC16 relocation.

Patch by Vladimir Radosavljevic.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240404 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 13:54:42 +00:00
Krzysztof Parzyszek
14e438dfb3 [Hexagon] Use MF reference from parent class in HexagonPacketizerList
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240403 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 13:50:23 +00:00
Toma Tabacu
29e004491e [mips] [IAS] Move some function definitions to MipsTargetStreamer.cpp. NFC.
Summary: For the sake of consistency and to make some upcoming changes a little less noisy.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 12:34:19 +00:00
Rafael Espindola
b9ed9af341 Use MCSymbols for FastISel.
The summary is that it moves the mangling earlier and replaces a few
calls to .addExternalSymbol with addSym.

I originally wanted to replace all the uses of addExternalSymbol with
addSym, but noticed it was a lot of work and doesn't need to be done
all at once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240395 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 12:21:54 +00:00
Daniel Jasper
b7f5b8b4b2 Revert r240302 ("Bring r240130 back.").
This causes errors like:

  ld: error: blah.o: requires dynamic R_X86_64_PC32 reloc against '' which
  may overflow at runtime; recompile with -fPIC
  blah.cc:function f(): error: undefined reference to ''
  blah.o:g(): error: undefined reference to ''

I have not yet come up with an appropriate reproduction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240394 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 11:31:32 +00:00
Alexander Kornienko
cd52a7a381 Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Apparently, the style needs to be agreed upon first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240390 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 09:49:53 +00:00
Elena Demikhovsky
d96e362b3f AVX-512: Added all forms of VPABS instruction
Added all intrinsics, tests for encoding, tests for intrinsics.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240386 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 08:19:46 +00:00
Justin Bogner
1e4a7e02f8 MCExpr: Avoid UB by evaluating this shift as unsigned
We hit undefined behaviour in some MCExpr tests when the LHS of a left
shift is -1. Twos-complement semantics are completely reasonable here,
so we should just do the shift in unsigned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 07:32:55 +00:00
Justin Bogner
46a8f93144 [mips] Fix some UB by shifting before sign-extending
Avoid shifting a negative value by sign-extending after the shift.

Fixes a couple of tests that were failing under ubsan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240381 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 07:28:57 +00:00
Weiming Zhao
ab3926f6e4 Fix PR13851: Preserve metadata for the unswitched branch
This patch copies the metadata of the unswitched branch to the newly
crreated branch in loop unswitch pass.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 05:31:09 +00:00
Rafael Espindola
8bfd2e8447 Handle multiple symbols having the same address.
I will add an explicit test in a second, but this fixes the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240372 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 03:36:08 +00:00
David Majnemer
3f2dc2455d [InstCombine] Optimize subtract of selects into a select of a sub
This came up when examining some code generated by clang's IRGen for
certain member pointers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 02:49:24 +00:00
Rafael Espindola
344dd6519e Extract an utility for computing symbol sizes on MachO and COFF.
I will add a second user in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240366 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 02:08:48 +00:00
Matt Arsenault
080d72c9a5 AMDGPU: Use getAsInteger instead of atoi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240365 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 02:05:55 +00:00
Sanjoy Das
c49542e5bb [FaultMaps] Move FaultMapParser to Object/
Summary:
That way llvm-objdump can rely on it without adding an extra dependency
on CodeGen.

This change duplicates the FaultKind enum and the code that serializes
it to a string.  I could not figure out a way to get around this without
adding a new dependency to Object

Reviewers: rafael, ab

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240364 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 01:05:26 +00:00
Sanjay Patel
8bd59f505a [x86] generalize reassociation optimization in machine combiner to 2 instructions
Currently ( D10321, http://reviews.llvm.org/rL239486 ), we can use the machine combiner pass
to reassociate the following sequence to reduce the critical path:

A = ? op ?
B = A op X
C = B op Y
-->
A = ? op ?
B = X op Y
C = A op B

'op' is currently limited to x86 AVX scalar FP adds (with fast-math on), but in theory, it could
be any associative math/logic op (see TODO in code comment).

This patch generalizes the pattern match to ignore the instruction that defines 'A'. So instead of
a sequence of 3 adds, we now only need to find 2 dependent adds and decide if it's worth
reassociating them.

This generalization has a compile-time cost because we can now match more instruction sequences
and we rely more heavily on the machine combiner to discard sequences where reassociation doesn't
improve the critical path.

For example, in the new test case:

A = M div N
B = A add X
C = B add Y

We'll match 2 reassociation patterns, but this transform doesn't reduce the critical path:

A = M div N
B = A add Y
C = B add X

We need the combiner to reject that pattern but select this:

A = M div N
B = X add Y
C = B add A

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240361 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 00:39:40 +00:00
Justin Bogner
b06f3b4a33 Re-apply "InstrProf: When reading, copy the data instead of taking a reference. NFC"
This version fixes a missing include that MSVC noticed and
clarifies the ownership of the counter buffer that's passed to
InstrProfRecord.

This restores r240206, which was reverted in r240208.

Patch by Betul Buyukkurt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240360 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 23:58:05 +00:00
Evgeniy Stepanov
845d1a6a17 Fix PR23914.
r226830 moved the declaration of Buf to a nested scope, resulting
in a dangling reference (in StringRef Name), and a use-after-free.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 23:36:03 +00:00
Logan Chien
3755f9f48c Code cleanup: Remove std::move() around xvalue (NFC)
Remove std::move() around xvalue so that copy elision is eligible.
In case that copy elision is not appliable, the c++ standard also
guarantees the move semantics on xvalue.  Thus, it is not necessary
to wrap Args with std::move.

This also silence a warning since r240345.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240355 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 23:16:02 +00:00
Adam Nemet
08056a49f1 [LoopDist] Improve variable names and comments in LoopVersioning class, NFC
As with the previous patch, the goal is to turn the class into a general
loop-versioning class.  This patch removes any references to loop
distribution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240352 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 22:59:40 +00:00
David Blaikie
0c17f95006 Modify ParseArgs to return the InputArgList by value - there's no need for dynamic allocation/ownership here
The one caller that does anything other than keep this variable on the
stack is the single use of DerivedArgList in Clang, which is a bit more
interesting but can probably be cleaned up/simplified a bit further
(have DerivedArgList take ownership of the InputArgList rather than
needing to reference its Args indirectly) which I'll try to after this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240345 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 22:06:37 +00:00
Pawel Bylica
e903f64b10 Revert r240291: causes problems in self-hosted builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240343 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:54:07 +00:00
Simon Pilgrim
7132523d6a [X86][FMA4] FMA4 ops can perform unaligned folded loads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240342 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:49:41 +00:00
Peter Collingbourne
c2433959db Linker: Do not expect comdat to exist in source module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240341 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:46:51 +00:00
Joseph Tremoulet
864619a387 Fix line endings (NFC)
I inadvertently checked these in with Windows-style line
endings in r240288.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:37:34 +00:00
Frederic Riss
11fcb49922 [Object] Search for architecures by name in MachOUniversalBinary::getObjectForArch()
The reason we need to search by name rather than by Triple::ArchType
is to handle subarchitecture correclty. There is no different ArchType
for the x86_64h architecture (it identifies itself as x86_64), or for
the various ARM subarches. The only way to get to the subarch slice
in an universal binary is to search by name.

This issue led to hard to debug and transient symbolication failures
in Asan tests (it mostly works, because the files are very similar).

This also affects the Profiling infrastucture as it is the other user
of that API.

Reviewers: samsonov, bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:33:24 +00:00
Tom Stellard
9e7f0c8e77 R600/SI: Use ELF64 format instead of ELF32
Reviewers: arsenm, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:03:54 +00:00
Tom Stellard
309f60c15a R600: Use EM_AMDGPU for the ELF Machine type
Reviewers: arsenm, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:03:52 +00:00
Ahmed Bougacha
a3afb70a5d [X86] Teach load folding to accept scalar _Int users of MOVSS/MOVSD.
The _Int instructions are special, in that they operate on the full
VR128 instead of FR32.  The load folding then looks at MOVSS, at the
user, and bails out when it sees a size mismatch.

What we really know is that the rm_Int instructions don't load the
higher lanes, so folding is fine.

This happens for the straightforward intrinsic code, e.g.:

    _mm_add_ss(a, _mm_load_ss(p));

Fixes PR23349.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 20:51:51 +00:00
Alex Lorenz
f654cdae59 MIR Serialization: Introduce a lexer for machine instructions.
This commit adds a function that tokenizes the string containing
the machine instruction. This commit also adds a struct called 
'MIToken' which is used to represent the lexer's tokens.

Reviewers: Sean Silva

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240323 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 20:37:46 +00:00
Peter Collingbourne
47e71da4b3 SafeStack: Create the unsafe stack pointer on demand.
This avoids creating an unnecessary undefined reference on targets such as
NVPTX that require such references to be declared in asm output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240321 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 20:26:54 +00:00
Pete Cooper
8b4b91acd8 Move MCSymbol Value in to the union of Offset and CommonSize.
This is a reapplication of r239440 which was reverted in r239441.
There are no changes to this patch from then, but this had instead exposed
a bug in .thumb_set which was fixed in r240318.  Having fixed that bug, it
is now safe to re-apply this code.

Original commit message below:

It wasn't possible to have a variable Symbol with offset or 'isCommon' so
this just enables better packing of the MCSymbol class.

Reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 19:57:33 +00:00