oota-llvm.git
8 years ago[CMake] Fix build on MSVC in r246156.
NAKAMURA Takumi [Fri, 28 Aug 2015 00:36:58 +0000 (00:36 +0000)]
[CMake] Fix build on MSVC in r246156.

add_windows_version_resource_file() affects ALL_FILES. OBJLIB shouldn't have *.obj as SOURCES.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246241 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix: CFLAA -- Mark no-args returns as unknown
George Burgess IV [Fri, 28 Aug 2015 00:16:18 +0000 (00:16 +0000)]
Fix: CFLAA -- Mark no-args returns as unknown

Prior to this patch, we hadn't been marking StratifiedSets with the
appropriate StratifiedAttrs when handling the result of no-args call
instructions. This caused us to report NoAlias when handed, for
example, an escaped alloca and a result from an opaque function. Now we
properly mark the return value of said functions.

Thanks again to Chandler, Richard, and Nick for pinging me about this.

Differential review: http://reviews.llvm.org/D12408

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246240 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64][CollectLOH] Fix a regression that prevented us to detect chains of
Quentin Colombet [Thu, 27 Aug 2015 23:47:10 +0000 (23:47 +0000)]
[AArch64][CollectLOH] Fix a regression that prevented us to detect chains of
more than 2 instructions.

I introduced this regression a while back and did not noticed it because I
somehow forgot to push the initial test cases for the pass!

Fix that as well!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246239 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoCodeGen: Introduce splitCodeGen and teach LTOCodeGenerator to use it.
Peter Collingbourne [Thu, 27 Aug 2015 23:37:36 +0000 (23:37 +0000)]
CodeGen: Introduce splitCodeGen and teach LTOCodeGenerator to use it.

llvm::splitCodeGen is a function that implements the core of parallel LTO
code generation. It uses llvm::SplitModule to split the module into linkable
partitions and spawning one code generation thread per partition. The function
produces multiple object files which can be linked in the usual way.

This has been threaded through to LTOCodeGenerator (and llvm-lto for testing
purposes). Separate patches will add parallel LTO support to the gold plugin
and lld.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246236 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WinEH] Add some support for code generating catchpad
Reid Kleckner [Thu, 27 Aug 2015 23:27:47 +0000 (23:27 +0000)]
[WinEH] Add some support for code generating catchpad

We can now run 32-bit programs with empty catch bodies.  The next step
is to change PEI so that we get funclet prologues and epilogues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246235 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[yaml2obj] Support numeric indexes to create invalid files. Will be used by lld test.
Michael J. Spencer [Thu, 27 Aug 2015 23:11:20 +0000 (23:11 +0000)]
[yaml2obj] Support numeric indexes to create invalid files. Will be used by lld test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246233 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ValueTracking] readnone CallInsts are fair game for speculation
David Majnemer [Thu, 27 Aug 2015 23:03:01 +0000 (23:03 +0000)]
[ValueTracking] readnone CallInsts are fair game for speculation

Any call which is side effect free is trivially OK to speculate.  We
already had similar logic in EarlyCSE and GVN but we were missing it
from isSafeToSpeculativelyExecute.

This fixes PR24601.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246232 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd a global mapping layer for Orc. Adapted from a patch by Andy Somogyi.
Lang Hames [Thu, 27 Aug 2015 22:20:05 +0000 (22:20 +0000)]
Add a global mapping layer for Orc. Adapted from a patch by Andy Somogyi.

Thanks Andy!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246226 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSupport: Introduce thread.h.
Peter Collingbourne [Thu, 27 Aug 2015 21:52:31 +0000 (21:52 +0000)]
Support: Introduce thread.h.

This header is a wrapper for <thread> that works around problems with the
MSVC headers when exceptions are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246218 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CodeGen] Check FoldConstantArithmetic result before using it.
Ahmed Bougacha [Thu, 27 Aug 2015 21:46:04 +0000 (21:46 +0000)]
[CodeGen] Check FoldConstantArithmetic result before using it.

Fixes PR24602: r245689 introduced an unguarded use of
SelectionDAG::FoldConstantArithmetic, which returns 0 when it fails
because of opaque (hoisted) constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246217 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen][DAGISel] Dedup predicates with same code to run. NFCI.
Ahmed Bougacha [Thu, 27 Aug 2015 20:43:34 +0000 (20:43 +0000)]
[TableGen][DAGISel] Dedup predicates with same code to run. NFCI.

I locally hit the 255 limit, but a lot of these are redundant: each
predicate coming from a different record was allocated a new number,
even when we already emitted the same code for another predicate.

Instead, re-use numbers and emit the predicate code only once.
This reduces the total text size of *DAGISel.cpp.o by ~1%.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246208 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix test introduced in r246187 that failed on some systems.
Tyler Nowicki [Thu, 27 Aug 2015 20:43:29 +0000 (20:43 +0000)]
Fix test introduced in r246187 that failed on some systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246207 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoOops - Re-add the Kaleidoscope regression tests themselves (accidentally left
Lang Hames [Thu, 27 Aug 2015 20:33:22 +0000 (20:33 +0000)]
Oops - Re-add the Kaleidoscope regression tests themselves (accidentally left
out of r246201).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246203 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRecommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure
Lang Hames [Thu, 27 Aug 2015 20:31:44 +0000 (20:31 +0000)]
Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure
the kaleidoscope 'library' functions aren't dead-stripped in release builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246201 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoEnable constant propagation for more math functions
Erik Schnetter [Thu, 27 Aug 2015 19:56:57 +0000 (19:56 +0000)]
Enable constant propagation for more math functions

Constant propagation for single precision math functions (such as
tanf) is already working, but was not enabled. This patch enables
these for many single-precision functions, and adds respective test
cases.

Newly handled functions: acosf asinf atanf atan2f ceilf coshf expf
exp2f fabsf floorf fmodf logf log10f powf sinhf tanf tanhf

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246194 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert 246186; still breaks on some systems
Erik Schnetter [Thu, 27 Aug 2015 19:34:14 +0000 (19:34 +0000)]
Revert 246186; still breaks on some systems

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246191 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoImprove vectorization diagnostic messages and extend vectorize(enable) pragma.
Tyler Nowicki [Thu, 27 Aug 2015 18:56:49 +0000 (18:56 +0000)]
Improve vectorization diagnostic messages and extend vectorize(enable) pragma.

This patch changes the analysis diagnostics produced when loops with
floating-point recurrences or memory operations are identified. The new messages
say "cannot prove it is safe to reorder * operations; allow reordering by
specifying #pragma clang loop vectorize(enable)". Depending on the type of
diagnostic the message will include additional options such as ffast-math or
__restrict__.

This patch also allows the vectorize(enable) pragma to override the low pointer
memory check threshold. When the hint is given a higher threshold is used.

See the clang patch for the options produced for each diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246187 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoEnable constant propagation for more math functions
Erik Schnetter [Thu, 27 Aug 2015 18:56:23 +0000 (18:56 +0000)]
Enable constant propagation for more math functions

Constant propagation for single precision math functions (such as
tanf) is already working, but was not enabled. This patch enables
these for many single-precision functions, and adds respective test
cases.

Newly handled functions: acosf asinf atanf atan2f ceilf coshf expf
exp2f fabsf floorf fmodf logf log10f powf sinhf tanf tanhf

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246186 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert r246175 to get builder green again.
Lang Hames [Thu, 27 Aug 2015 18:54:41 +0000 (18:54 +0000)]
Revert r246175 to get builder green again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246185 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[TableGen] Remove dead code. NFC.
Ahmed Bougacha [Thu, 27 Aug 2015 18:14:21 +0000 (18:14 +0000)]
[TableGen] Remove dead code. NFC.

The only user of this was removed in r129670.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246176 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd Kaleidoscope regression tests.
Lang Hames [Thu, 27 Aug 2015 18:13:34 +0000 (18:13 +0000)]
Add Kaleidoscope regression tests.

These will be run if LLVM_BUILD_EXAMPLES is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246175 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU/SI: Add test for folding constants into operands
Matt Arsenault [Thu, 27 Aug 2015 17:41:27 +0000 (17:41 +0000)]
AMDGPU/SI: Add test for folding constants into operands

Patch by Axel Davy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246167 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert r246158 since it breaks LLVM.Transforms/ConstProp.calls.ll
Erik Schnetter [Thu, 27 Aug 2015 17:24:01 +0000 (17:24 +0000)]
Revert r246158 since it breaks LLVM.Transforms/ConstProp.calls.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246166 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix a case of `CHECK[^:]*$`.
Jonathan Roelofs [Thu, 27 Aug 2015 17:03:14 +0000 (17:03 +0000)]
Fix a case of `CHECK[^:]*$`.

http://reviews.llvm.org/D11917

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246163 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoEnable constant propagation for more math functions
Erik Schnetter [Thu, 27 Aug 2015 16:36:37 +0000 (16:36 +0000)]
Enable constant propagation for more math functions

Constant propagation for single precision math functions (such as
tanf) is already working, but was not enabled. This patch enables
these for many single-precision functions, and adds respective test
cases.

Newly handled functions: acosf asinf atanf atan2f ceilf coshf expf
exp2f fabsf floorf fmodf logf log10f powf sinhf tanf tanhf

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246158 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] OBJLIB-ize *-tblgen.
NAKAMURA Takumi [Thu, 27 Aug 2015 16:10:47 +0000 (16:10 +0000)]
[CMake] OBJLIB-ize *-tblgen.

This improves dependency chain of;

  (LLVMSupport && LLVMTableGen) && (*.cpp in *-tblgen) && (linking *-tblgen)

with;

  (LLVMSupport && LLVMTableGen && *.cpp) && (linking *-tblgen)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246156 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopVectorize] Move test from r246149 into a target-specific folder to appease bots.
Chad Rosier [Thu, 27 Aug 2015 15:24:47 +0000 (15:24 +0000)]
[LoopVectorize] Move test from r246149 into a target-specific folder to appease bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246154 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CMake] Let ExceptionDemo buildable with ENABLE_EH.
NAKAMURA Takumi [Thu, 27 Aug 2015 15:13:14 +0000 (15:13 +0000)]
[CMake] Let ExceptionDemo buildable with ENABLE_EH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246152 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[llvm-readobj] Add support for dumping MachO min version load command.
Davide Italiano [Thu, 27 Aug 2015 15:11:32 +0000 (15:11 +0000)]
[llvm-readobj] Add support for dumping MachO min version load command.

Example output:
File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
MinVersion {
  Cmd: LC_VERSION_MIN_IPHONEOS
  Size: 16
  Version: 99.8.7
  SDK: n/a
}

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246151 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopVectorize] Add Support for Small Size Reductions.
Chad Rosier [Thu, 27 Aug 2015 14:12:17 +0000 (14:12 +0000)]
[LoopVectorize] Add Support for Small Size Reductions.

Unlike scalar operations, we can perform vector operations on element types that
are smaller than the native integer types. We type-promote scalar operations if
they are smaller than a native type (e.g., i8 arithmetic is promoted to i32
arithmetic on Arm targets). This patch detects and removes type-promotions
within the reduction detection framework, enabling the vectorization of small
size reductions.

In the legality phase, we look through the ANDs and extensions that InstCombine
creates during promotion, keeping track of the smaller type. In the
profitability phase, we use the smaller type and ignore the ANDs and extensions
in the cost model. Finally, in the code generation phase, we truncate the result
of the reduction to allow InstCombine to rewrite the entire expression in the
smaller type.

This fixes PR21369.
http://reviews.llvm.org/D12202

Patch by Matt Simpson <mssimpso@codeaurora.org>!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246149 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopVectorize] Extract InductionInfo into a helper class...
James Molloy [Thu, 27 Aug 2015 09:53:00 +0000 (09:53 +0000)]
[LoopVectorize] Extract InductionInfo into a helper class...

... and move it into LoopUtils where it can be used by other passes, just like ReductionDescriptor. The API is very similar to ReductionDescriptor - that is, not very nice at all. Sorting these both out will come in a followup.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246145 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWhoops, remove trailing whitespace.
Alex Rosenberg [Thu, 27 Aug 2015 05:37:12 +0000 (05:37 +0000)]
Whoops, remove trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246141 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoisKnownNonNull needs to consider globals in non-zero address spaces.
Pete Cooper [Thu, 27 Aug 2015 03:16:29 +0000 (03:16 +0000)]
isKnownNonNull needs to consider globals in non-zero address spaces.

Globals in address spaces other than one may have 0 as a valid address,
so we should not assume that they can be null.

Reviewed by Philip Reames.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246137 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAllow value forwarding past release fences in EarlyCSE
Philip Reames [Thu, 27 Aug 2015 01:32:33 +0000 (01:32 +0000)]
Allow value forwarding past release fences in EarlyCSE

A release fence acts as a publication barrier for stores within the current thread to become visible to other threads which might observe the release fence. It does not require the current thread to observe stores performed on other threads. As a result, we can allow store-load and load-store forwarding across a release fence.

We do need to make sure that stores before the fence can't be eliminated even if there's another store to the same location after the fence. In theory, we could reorder the second store above the fence and *then* eliminate the former, but we can't do this if the stores are on opposite sides of the fence.

Note: While more aggressive then what's there, this patch is still implementing a really conservative ordering.  In particular, I'm not trying to exploit undefined behavior via races, or the fact that the LangRef says only 'atomic' accesses are ordered w.r.t. fences.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246134 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[RewriteStatepointsForGC] Reduce the number of new instructions for base pointers
Philip Reames [Thu, 27 Aug 2015 01:02:28 +0000 (01:02 +0000)]
[RewriteStatepointsForGC] Reduce the number of new instructions for base pointers

When computing base pointers, we introduce new instructions to propagate the base of existing instructions which might not be bases. However, the algorithm doesn't make any effort to recognize when the new instruction to be inserted is the same as an existing one already in the IR. Since this is happening immediately before rewriting, we don't really have a chance to fix it after the pass runs without teaching loop passes about statepoints.

I'm really not thrilled with this patch. I've rewritten it 4 different ways now, but this is the best I've come up with. The case where the new instruction is just the original base defining value could be merged into the existing algorithm with some complexity. The problem is that we might have something like an extractelement from a phi of two vectors. It may be trivially obvious that the base of the 0th element is an existing instruction, but I can't see how to make the algorithm itself figure that out. Thus, I resort to the call to SimplifyInstruction instead.

Note that we can only adjust the instructions we've inserted ourselves. The live sets are still being tracked in side structures at this point in the code. We can't easily muck with instructions which might be in them. Long term, I'm really thinking we need to materialize the live pointer sets explicitly in the IR somehow rather than using side structures to track them.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246133 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoImproved printing of analysis diagnostics in the loop vectorizer.
Tyler Nowicki [Thu, 27 Aug 2015 01:02:04 +0000 (01:02 +0000)]
Improved printing of analysis diagnostics in the loop vectorizer.

This patch ensures that every analysis diagnostic produced by the vectorizer
will be printed if the loop has a vectorization hint on it. The condition has
also been improved to prevent printing when a disabling hint is specified.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246132 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFixed a bug that edge weights are not assigned correctly when lowering switch statement.
Cong Hou [Thu, 27 Aug 2015 00:37:40 +0000 (00:37 +0000)]
Fixed a bug that edge weights are not assigned correctly when lowering switch statement.

This is a one-line-change patch that moves the update to UnhandledWeights to the correct position: it should be updated for all clusters instead of just range clusters.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246129 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoKaleidoscope: Prune unused libdeps.
NAKAMURA Takumi [Thu, 27 Aug 2015 00:04:24 +0000 (00:04 +0000)]
Kaleidoscope: Prune unused libdeps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246126 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SimplifyCFG] Prune code from a provably unreachable switch default
Philip Reames [Wed, 26 Aug 2015 23:56:46 +0000 (23:56 +0000)]
[SimplifyCFG] Prune code from a provably unreachable switch default

As Sanjoy pointed out over in http://reviews.llvm.org/D11819, a switch on an icmp should always be able to become a branch instruction. This patch generalizes that notion slightly to prove that the default case of a switch is unreachable if the cases completely cover all possible bit patterns in the condition. Once that's done, the switch to branch conversion kicks in just fine.

Note: Duplicate case values are disallowed by the LangRef and verifier.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246125 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PowerPC] Remove unnecessary braces in PPCVSXFMAMutate
Hal Finkel [Wed, 26 Aug 2015 23:41:53 +0000 (23:41 +0000)]
[PowerPC] Remove unnecessary braces in PPCVSXFMAMutate

Address Eric's post-commit review of r245741. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246121 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[NVPTX] Let NVPTX backend detect integer min and max patterns.
Bjarke Hammersholt Roune [Wed, 26 Aug 2015 23:22:02 +0000 (23:22 +0000)]
[NVPTX] Let NVPTX backend detect integer min and max patterns.

Summary:
Let NVPTX backend detect integer min and max patterns during isel and emit intrinsics that enable hardware support.

Reviewers: jholewinski, meheff, jingyue

Subscribers: arsenm, llvm-commits, meheff, jingyue, eliben, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246107 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ARM] Use BranchProbability::scale() to scale an integer with a probability in ARMBas...
Cong Hou [Wed, 26 Aug 2015 23:17:52 +0000 (23:17 +0000)]
[ARM] Use BranchProbability::scale() to scale an integer with a probability in ARMBaseInstrInfo.cpp,

Previously in isProfitableToIfCvt() in ARMBaseInstrInfo.cpp, the multiplication between an integer and a branch probability is done manually in an unsafe way that may lead to overflow. This patch corrects those cases by using BranchProbability's member function scale() to avoid overflow (which stores the intermediate result in int64).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246106 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAssign weights to edges to jump table / bit test header when lowering switch statement.
Cong Hou [Wed, 26 Aug 2015 23:15:32 +0000 (23:15 +0000)]
Assign weights to edges to jump table / bit test header when lowering switch statement.

Currently, when lowering switch statement and a new basic block is built for jump table / bit test header, the edge to this new block is not assigned with a correct weight. This patch collects the edge weight from all its successors and assign this sum of weights to the edge (and also the other fall-through edge). Test cases are adjusted accordingly.

Differential Revision: http://reviews.llvm.org/D12166#fae6eca7

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246104 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[docs][Statepoints] More on base pointers
Philip Reames [Wed, 26 Aug 2015 23:13:35 +0000 (23:13 +0000)]
[docs][Statepoints] More on base pointers

Expand the information on base pointers to include an example, the assumptions a collector is allowed to make, legal optimizations over gc.relocates, and the assumptions made by RewriteStatepointsForGC.  This is the result of a recent conversation with folks from LLIC and the confusions that came to light therein.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246103 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWebAssembly: NFC comment update
JF Bastien [Wed, 26 Aug 2015 23:03:07 +0000 (23:03 +0000)]
WebAssembly: NFC comment update

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246101 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDI: Make Subprogram definitions 'distinct'
Duncan P. N. Exon Smith [Wed, 26 Aug 2015 22:50:16 +0000 (22:50 +0000)]
DI: Make Subprogram definitions 'distinct'

Change `DIBuilder` always to produce 'distinct' nodes when creating
`DISubprogram` definitions.  I measured a ~5% memory improvement in the
link step (of ld64) when using `-flto -g`.

`DISubprogram`s are used in two ways in the debug info graph.

Some are definitions, point at actual functions, and can't really be
shared between compile units.  With full debug info, these point down at
their variables, forming uniquing cycles.  These uniquing cycles are
expensive to link between modules, since all unique nodes that reference
them transitively need to be duplicated (see commit message for r244181
for more details).

Others are declarations, primarily used for member functions in the type
hierarchy.  Definitions never show up there; instead, a definition
points at its corresponding declaration node.

I started by making all subprograms 'distinct'.  However, that was too
big a hammer: memory usage *increased* ~5% (net increase vs. this patch
of ~10%) because the 'distinct' declarations undermine LTO type
uniquing.  This is a targeted fix for the definitions (where uniquing is
an observable problem).

A couple of notes:

  - There's an accompanying commit to update IRGen testcases in clang.
  - ^ That's what I'm using to test this commit.
  - In a follow-up, I'll change the verifier to require 'distinct' on
    definitions and add an upgrade to `BitcodeReader`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246098 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWebAssembly: handle private/internal globals.
JF Bastien [Wed, 26 Aug 2015 22:09:54 +0000 (22:09 +0000)]
WebAssembly: handle private/internal globals.

Things of note:
 - Other linkage types aren't handled yet. We'll figure it out with dynamic linking.
 - Special LLVM globals are either ignored, or error out for now.
 - TLS isn't supported yet (WebAssembly will have threads later).
 - There currently isn't a syntax for alignment, I left it in a comment so it's easy to hook up.
 - Undef is convereted to whatever the type's appropriate null value is.
 - assert versus report_fatal_error: follow what other AsmPrinters do, and assert only on what should have been caught elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246092 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ms-inline-asm] Relax assertion around funky identifiers slightly
Reid Kleckner [Wed, 26 Aug 2015 21:57:25 +0000 (21:57 +0000)]
[ms-inline-asm] Relax assertion around funky identifiers slightly

A corresponding clang change will make it so that clang can consume part
of an assembler token. The assembler treats '.' as an identifier
character while clang does not, so it's view of the token stream is a
little different.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246089 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libFuzzer] fix minor inefficiency, PR24584
Kostya Serebryany [Wed, 26 Aug 2015 21:55:19 +0000 (21:55 +0000)]
[libFuzzer] fix minor inefficiency, PR24584

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246087 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix LLVM C API for DataLayout
Mehdi Amini [Wed, 26 Aug 2015 21:16:29 +0000 (21:16 +0000)]
Fix LLVM C API for DataLayout

We removed access to the DataLayout on the TargetMachine and
deprecated the C API function LLVMGetTargetMachineData() in r243114.
However the way I tried to be backward compatible was broken: I
changed the wrapper of the TargetMachine to be a structure that
includes the DataLayout as well. However the TargetMachine is also
wrapped by the ExecutionEngine, in the more classic way. A client
using the TargetMachine wrapped by the ExecutionEngine and trying
to get the DataLayout would break.

It seems tricky to solve the problem completely in the C API
implementation. This patch tries to address this backward
compatibility in a more lighter way in the C++ API. The C API is
restored in its original state and the removed C++ API is
reintroduced, but privately. The C API is friended to the
TargetMachine and should be the only consumer for this API.

Reviewers: ributzka

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246082 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Kaleidoscope] Fix a typo in Chapter 5.
Lang Hames [Wed, 26 Aug 2015 20:57:03 +0000 (20:57 +0000)]
[Kaleidoscope] Fix a typo in Chapter 5.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246081 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Delete dead code
Matt Arsenault [Wed, 26 Aug 2015 20:48:08 +0000 (20:48 +0000)]
AMDGPU: Delete dead code

There is no context where s_mov_b64 is emitted
and could potentially be moved to the VALU.
It is currently only emitted for materializing
immediates, which can't be dependent on vector sources.

The immediate splitting is already done when selecting
constants. I'm not sure what contexts if any the register
splitting would have been used before.

Also clean up using s_mov_b64 in place of v_mov_b64_pseudo,
although this isn't required and just skips the extra step
of eliminating the copy from the SReg_64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246080 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Don't reprocess instructions when splitting i64 bcnt
Matt Arsenault [Wed, 26 Aug 2015 20:48:04 +0000 (20:48 +0000)]
AMDGPU: Don't reprocess instructions when splitting i64 bcnt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246079 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Fix not moving users of s_bfe_i64 to VALU
Matt Arsenault [Wed, 26 Aug 2015 20:47:58 +0000 (20:47 +0000)]
AMDGPU: Fix not moving users of s_bfe_i64 to VALU

This wouldn't propagate to users of the original BFE
and would hit a verifier error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246078 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Don't create intermediate SALU instructions
Matt Arsenault [Wed, 26 Aug 2015 20:47:50 +0000 (20:47 +0000)]
AMDGPU: Don't create intermediate SALU instructions

When splitting 64-bit operations, create the correct
VALU instructions immediately.

This was splitting things like s_or_b64 into the two
s_or_b32s and then pushing the new instructions
onto the worklist. There's no reason we need
to do this intermediate step.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246077 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSelectionDAGBuilder: Fix SPDescriptor not resetting GuardReg
Matthias Braun [Wed, 26 Aug 2015 20:46:52 +0000 (20:46 +0000)]
SelectionDAGBuilder: Fix SPDescriptor not resetting GuardReg

This was causing problems when some functions use a GuardReg and some
don't as can happen when mixing SelectionDAG and FastISel generated
functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246075 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFastISel: Avoid adding a successor block twice for degenerate IR.
Matthias Braun [Wed, 26 Aug 2015 20:46:49 +0000 (20:46 +0000)]
FastISel: Avoid adding a successor block twice for degenerate IR.

This fixes http://llvm.org/PR24581

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246074 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoExpose hasLiveCondCodeDef as a member function of the X86InstrInfo class. NFC
Andrew Kaylor [Wed, 26 Aug 2015 20:36:52 +0000 (20:36 +0000)]
Expose hasLiveCondCodeDef as a member function of the X86InstrInfo class. NFC

This takes the existing static function hasLiveCondCodeDef and makes it a member function of the X86InstrInfo class. This is a useful utility function that an upcoming change would like to use. NFC.

Patch by: Kevin B. Smith
Differential Revision: http://reviews.llvm.org/D12371

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246073 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix memory leak in sample profile pass.
Diego Novillo [Wed, 26 Aug 2015 20:00:27 +0000 (20:00 +0000)]
Fix memory leak in sample profile pass.

The problem here were the function analyses invoked by the function pass
manager from the new IPO pass. I looked at other IPO passes needing
dominance information and the only one that requires it (partial
inliner) does not use the standard dependency mechanism.

This patch mimics what the partial inliner does to compute dominance,
post-dominance and loop info. One thing I like about this approach is
that I can delay the computation of all this until I actually need it.

This should bring the ASAN buildbot back to green. If there's a better
way to fix this, I'll do it in a follow-up patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246066 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Fix LLVM C API for DataLayout"
Mehdi Amini [Wed, 26 Aug 2015 19:24:59 +0000 (19:24 +0000)]
Revert "Fix LLVM C API for DataLayout"

This reverts commit r246052.
Third attempt, still unpleasant for some bots.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246057 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU/SI: Report SIFixSGPRLiveRanges changed function
Matt Arsenault [Wed, 26 Aug 2015 19:12:03 +0000 (19:12 +0000)]
AMDGPU/SI: Report SIFixSGPRLiveRanges changed function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246056 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix LLVM C API for DataLayout
Mehdi Amini [Wed, 26 Aug 2015 18:56:01 +0000 (18:56 +0000)]
Fix LLVM C API for DataLayout

We removed access to the DataLayout on the TargetMachine and
deprecated the C API function LLVMGetTargetMachineData() in r243114.
However the way I tried to be backward compatible was broken: I
changed the wrapper of the TargetMachine to be a structure that
includes the DataLayout as well. However the TargetMachine is also
wrapped by the ExecutionEngine, in the more classic way. A client
using the TargetMachine wrapped by the ExecutionEngine and trying
to get the DataLayout would break.

It seems tricky to solve the problem completely in the C API
implementation. This patch tries to address this backward
compatibility in a more lighter way in the C++ API. The C API is
restored in its original state and the removed C++ API is
reintroduced, but privately. The C API is friended to the
TargetMachine and should be the only consumer for this API.

Reviewers: ributzka

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246052 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Make sure to reserve super registers
Matt Arsenault [Wed, 26 Aug 2015 18:54:50 +0000 (18:54 +0000)]
AMDGPU: Make sure to reserve super registers

I think this could potentially have broken if
one of the super registers were allocated
that contain v254/v255.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246051 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Fix LLVM C API for DataLayout"
Mehdi Amini [Wed, 26 Aug 2015 18:37:59 +0000 (18:37 +0000)]
Revert "Fix LLVM C API for DataLayout"

This reverts commit r246044.
Build broken, still. It builds for me...

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246049 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Produce error on dynamic_stackalloc
Matt Arsenault [Wed, 26 Aug 2015 18:37:13 +0000 (18:37 +0000)]
AMDGPU: Produce error on dynamic_stackalloc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246048 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SimplifyLibCalls] Fix a typo
David Majnemer [Wed, 26 Aug 2015 18:30:16 +0000 (18:30 +0000)]
[SimplifyLibCalls] Fix a typo

cbrt(sqrt(x)) calculates the sixth root, not the ninth root.
cbrt(cbrt(x)) calculates the ninth root.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246046 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix LLVM C API for DataLayout
Mehdi Amini [Wed, 26 Aug 2015 18:22:34 +0000 (18:22 +0000)]
Fix LLVM C API for DataLayout

We removed access to the DataLayout on the TargetMachine and
deprecated the C API function LLVMGetTargetMachineData() in r243114.
However the way I tried to be backward compatible was broken: I
changed the wrapper of the TargetMachine to be a structure that
includes the DataLayout as well. However the TargetMachine is also
wrapped by the ExecutionEngine, in the more classic way. A client
using the TargetMachine wrapped by the ExecutionEngine and trying
to get the DataLayout would break.

It seems tricky to solve the problem completely in the C API
implementation. This patch tries to address this backward
compatibility in a more lighter way in the C++ API. The C API is
restored in its original state and the removed C++ API is
reintroduced, but privately. The C API is friended to the
TargetMachine and should be the only consumer for this API.

Reviewers: ributzka

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246044 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SPARC] Fix stupid oversight in stack realignment support.
James Y Knight [Wed, 26 Aug 2015 17:57:51 +0000 (17:57 +0000)]
[SPARC] Fix stupid oversight in stack realignment support.

If you're going to realign %sp to get object alignment properly (which
the code does), and stack offsets and alignments are calculated going
down from %fp (which they are), then the total stack size had better
be a multiple of the alignment. LLVM did indeed ensure that.

And then, after aligning, the sparc frame code added 96 (for sparcv8)
to the frame size, making any requested alignment of 64-bytes or
higher *guaranteed* to be misaligned. The test case added with r245668
even tests this exact scenario, and asserted the incorrect behavior,
which I somehow failed to notice. D'oh.

This change fixes the frame lowering code to align the stack size
*after* adding the spill area, instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246042 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[docs][Statepoint] Add definitions for base and derived pointers
Philip Reames [Wed, 26 Aug 2015 17:25:36 +0000 (17:25 +0000)]
[docs][Statepoint] Add definitions for base and derived pointers

This section will be expanded over the next few days.  This is just some initial content.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246041 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[llvm-mc] Ignore opcode size prefix in 64-bit CALL disassembly
Vedant Kumar [Wed, 26 Aug 2015 16:20:29 +0000 (16:20 +0000)]
[llvm-mc] Ignore opcode size prefix in 64-bit CALL disassembly

This is a fix for disassembling unusual instruction sequences in 64-bit
mode w.r.t the CALL rel16 instruction. It might be desirable to move the
check somewhere else, but it essentially mimics the special case
handling with JCXZ in 16-bit mode.

The current behavior accepts the opcode size prefix and causes the
call's immediate to stop disassembling after 2 bytes. When debugging
sequences of instructions with this pattern, the disassembler output
becomes extremely unreliable and essentially useless (if you jump midway
into what lldb thinks is a unified instruction, you'll lose %rip). So we
ignore the prefix and consume all 4 bytes when disassembling a 64-bit
mode binary.

Note: in Vol. 2A 3-99 the Intel spec states that CALL rel16 is N.S. N.S.
is defined as:

    Indicates an instruction syntax that requires an address override
    prefix in 64-bit mode and is not supported. Using an address
    override prefix in 64-bit mode may result in model-specific
    execution behavior. (Vol. 2A 3-7)

Since 0x66 is an operand override prefix we should be OK (although we
may want to warn about 0x67 prefixes to 0xe8). On the CPUs I tested
with, they all ignore the 0x66 prefix in 64-bit mode.

Patch by Matthew Barney!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246038 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Remove a use-after-free when collecting stats.
Chad Rosier [Wed, 26 Aug 2015 13:39:48 +0000 (13:39 +0000)]
[AArch64] Remove a use-after-free when collecting stats.

The call to mergePairedInsns() deletes MI, so the later use by isUnscaledLdSt()
is referencing freed memory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246033 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[llvm-objdump] Use the new MinVersion API introduced in r245938. NFC.
Davide Italiano [Wed, 26 Aug 2015 12:26:11 +0000 (12:26 +0000)]
[llvm-objdump] Use the new MinVersion API introduced in r245938. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246031 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Unify the integer min/max vector selection patterns with the intrinsic...
Silviu Baranga [Wed, 26 Aug 2015 11:11:14 +0000 (11:11 +0000)]
[AArch64] Unify the integer min/max vector selection patterns with the intrinsic ones

Summary:
This change lowers the aarch64 integer vector min/max intrinsic nodes to
generic min/max nodes and replaces the intrinsic selection patterns with
the generic ones.

There should already be testing in place for this, so no further tests
were added.

Reviewers: jmolloy

Subscribers: aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246030 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SROA] Rip out all support for SSAUpdater in SROA.
Chandler Carruth [Wed, 26 Aug 2015 09:09:29 +0000 (09:09 +0000)]
[SROA] Rip out all support for SSAUpdater in SROA.

This was only added to preserve the old ScalarRepl's use of SSAUpdater
which was originally to avoid use of dominance frontiers. Now, we only
need a domtree, and we'll need a domtree right after this pass as well
and so it makes perfect sense to always and only use the dom-tree
powered mem2reg. This was flag-flipper earlier and has stuck reasonably
so I wanted to gut the now-dead code out of SROA before we waste more
time with it. Among other things, this will make passmanager porting
easier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246028 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoKaleidoscope: Update libdeps corresponding to r246002.
NAKAMURA Takumi [Wed, 26 Aug 2015 08:05:55 +0000 (08:05 +0000)]
Kaleidoscope: Update libdeps corresponding to r246002.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246025 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[dsymutil] Emit real dSYM companion binaries."
Frederic Riss [Wed, 26 Aug 2015 06:41:57 +0000 (06:41 +0000)]
Revert "[dsymutil] Emit real dSYM companion binaries."

This reverts commit r246012.
Some bots do not like it (mips/s390).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246019 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoModernize with range-based for loops.
Alex Rosenberg [Wed, 26 Aug 2015 06:11:41 +0000 (06:11 +0000)]
Modernize with range-based for loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246018 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReduce code duplication.
Alex Rosenberg [Wed, 26 Aug 2015 06:11:38 +0000 (06:11 +0000)]
Reduce code duplication.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246017 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoTrailing whitespace
Alex Rosenberg [Wed, 26 Aug 2015 06:11:36 +0000 (06:11 +0000)]
Trailing whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246016 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[dsymutil] Emit real dSYM companion binaries.
Frederic Riss [Wed, 26 Aug 2015 05:10:04 +0000 (05:10 +0000)]
[dsymutil] Emit real dSYM companion binaries.

The binaries containing the linked DWARF generated by dsymutil are not
standard relocatable object files like emitted did previsously. They should be
dSYM companion files, which means they have a different file type in the
header, but also a couple other peculiarities:
 - they contain the segments and sections from the original binary in their
load commands, but not the actual contents. This means they get an address
and a size, but their offset is always 0 (but these are not virtual sections)
 - they also conatin all the defined symbols from the original binary

This makes MC a really bad fit to emit these kind of binaries. The approach
that was used in this patch is to leverage MC's section layout for the
debug sections, but to use a replacement for MachObjectWriter that lives
in MachOUtils.cpp. Some of the low-level helpers from MachObjectWriter
were reused too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246012 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[dsymutil] Store an optional BinaryPath in the debug map.
Frederic Riss [Wed, 26 Aug 2015 05:09:59 +0000 (05:09 +0000)]
[dsymutil] Store an optional BinaryPath in the debug map.

llvm-dsymutil needs to emit dSYM companion bundles. These are binary files
that replicate some of the orignal binary file properties (sections and
symbols). To get acces to these properties, pass the binary path in the
debug map.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246011 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[dsymutil] Make the warn and error helpers globally available. NFC.
Frederic Riss [Wed, 26 Aug 2015 05:09:55 +0000 (05:09 +0000)]
[dsymutil] Make the warn and error helpers globally available. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246010 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[dsymutil] Split NonRelocatableStringPool into its own file. NFC.
Frederic Riss [Wed, 26 Aug 2015 05:09:52 +0000 (05:09 +0000)]
[dsymutil] Split NonRelocatableStringPool into its own file. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246009 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MC] Split the layout part of MCAssembler::finish() into its own method. NFC.
Frederic Riss [Wed, 26 Aug 2015 05:09:49 +0000 (05:09 +0000)]
[MC] Split the layout part of MCAssembler::finish() into its own method. NFC.

Split a MCAssembler::layout() method out of MCAssembler::finish(). This allows
running the MCSections layout separately from the streaming of the output
file. This way if a client wants to use MC to generate section contents, but
emit something different than the standard relocatable object files it is
possible (llvm-dsymutil is such a client).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246008 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MC/MachO] Make some MachObjectWriter methods more generic. NFC.
Frederic Riss [Wed, 26 Aug 2015 05:09:46 +0000 (05:09 +0000)]
[MC/MachO] Make some MachObjectWriter methods more generic. NFC.

Hardcode less values in some mach-o header writing routines and pass them
as argument. Doing so will allow reusing this code in llvm-dsymutil.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246007 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoBig Kaleidoscope tutorial update.
Lang Hames [Wed, 26 Aug 2015 03:07:41 +0000 (03:07 +0000)]
Big Kaleidoscope tutorial update.

This commit switches the underlying JIT for the Kaleidoscope tutorials from
MCJIT to a custom ORC-based JIT, KaleidoscopeJIT. This fixes a lot of the bugs
in Kaleidoscope that were introduced when we deleted the legacy JIT. The
documentation for Chapter 4, which introduces the JIT APIs, is updated to
reflect the change.

Also included are a number of C++11 modernizations and general cleanup. Where
appropriate, the docs have been updated to reflect these changes too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246002 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoComparing operands should not require the same ValueID
JF Bastien [Wed, 26 Aug 2015 03:02:58 +0000 (03:02 +0000)]
Comparing operands should not require the same ValueID

Summary: When comparing basic blocks, there is an additional check that two Value*'s should have the same ID, which interferes with merging equivalent constants of different kinds (such as a ConstantInt and a ConstantPointerNull in the included testcase). The cmpValues function already ensures that the two values in each function are the same, so removing this check should not cause incorrect merging.

Also, the type comparison is redundant, based on reviewing the code and testing on the test suite and several large LTO bitcodes.

Author: jrkoenig
Reviewers: nlewycky, jfb, dschuff
Subscribers: llvm-commits
Differential revision: http://reviews.llvm.org/D12302

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246001 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoExpose more properties of llvm::fltSemantics
JF Bastien [Wed, 26 Aug 2015 02:32:45 +0000 (02:32 +0000)]
Expose more properties of llvm::fltSemantics

Summary: Adds accessor functions for all the fields in llvm::fltSemantics. This will be used in MergeFunctions to order two APFloats with different semanatics.

Author: jrkoenig
Reviewers: jfb
Subscribers: dschuff, llvm-commits
Differential revision: http://reviews.llvm.org/D12253

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245999 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFastISel: Use finishCondBranch() for ARM,Mips,PowerPC FastISel
Matthias Braun [Wed, 26 Aug 2015 01:55:47 +0000 (01:55 +0000)]
FastISel: Use finishCondBranch() for ARM,Mips,PowerPC FastISel

Note that after this change branch probabilities are preserved now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245998 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFastISel: Factor out common code; NFC intended
Matthias Braun [Wed, 26 Aug 2015 01:38:00 +0000 (01:38 +0000)]
FastISel: Factor out common code; NFC intended

This should be no functional change but for the record: For three cases
in X86FastISel this will change the order in which the FalseMBB and
TrueMBB of a conditional branch is addedd to the successor/predecessor
lists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245997 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWebAssembly: add small FIXME for AsmPrinter.
JF Bastien [Wed, 26 Aug 2015 00:50:49 +0000 (00:50 +0000)]
WebAssembly: add small FIXME for AsmPrinter.

Suggested by @sunfish as a follow-up to r245982.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245996 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRefactor to reduce duplication in OnDiskIterableChainedHashTable's iterators.
Richard Smith [Wed, 26 Aug 2015 00:22:41 +0000 (00:22 +0000)]
Refactor to reduce duplication in OnDiskIterableChainedHashTable's iterators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245995 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[dsymutil] actually fix test.
Frederic Riss [Tue, 25 Aug 2015 23:29:43 +0000 (23:29 +0000)]
[dsymutil] actually fix test.

Not all machines have lipo installed. Do not try to invoke it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245991 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMake variable argument intrinsics behave correctly in a Win64 CC function.
Charles Davis [Tue, 25 Aug 2015 23:27:41 +0000 (23:27 +0000)]
Make variable argument intrinsics behave correctly in a Win64 CC function.

Summary:
This change makes the variable argument intrinsics, `llvm.va_start` and
`llvm.va_copy`, and the `va_arg` instruction behave as they do on Windows
inside a `CallingConv::X86_64_Win64` function. It's needed for a Clang patch
I have to add support for GCC's `__builtin_ms_va_list` constructs.

Reviewers: nadav, asl, eugenis

CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1622

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245990 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWebAssembly: assert that there aren't any constant pools
JF Bastien [Tue, 25 Aug 2015 23:19:49 +0000 (23:19 +0000)]
WebAssembly: assert that there aren't any constant pools

WebAssembly will either use globals or immediates, since it's a virtual ISA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245989 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[dsymutil] Reapply r245960.
Frederic Riss [Tue, 25 Aug 2015 23:15:26 +0000 (23:15 +0000)]
[dsymutil] Reapply r245960.

There was an issue in the test setup because the test requires an arch that
wasn't filtered by the lit.local.cfg, but given the set of bots that failed,
I'm not confident this is the (only) issue. So this commit also adds more
output to the test to help me track down the failure if it happens again.

Original commit message:
[dsymutil] Rewrite thumb triple names in user visible messages.

We autodetect triples from the input file(s) while reading the mach-o debug map.
As we need to create a Target from those triples, we always chose the thumb
variant (because the arm variant might not be 'instantiable' eg armv7m). The
user visible architecture names should still be 'arm' and not 'thumb' variants
though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245988 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWebAssembly: emit `(func (param t) (result t))` s-expressions
JF Bastien [Tue, 25 Aug 2015 22:58:05 +0000 (22:58 +0000)]
WebAssembly: emit `(func (param t) (result t))` s-expressions

Summary: Match spec format: https://github.com/WebAssembly/spec/blob/master/ml-proto/test/fac.wasm

Reviewers: sunfish

Subscribers: llvm-commits, jfb

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245986 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWebAssembly: comment out .globl when printing textual assembly
JF Bastien [Tue, 25 Aug 2015 22:23:15 +0000 (22:23 +0000)]
WebAssembly: comment out .globl when printing textual assembly

Do the same for .weak (not implemented for now, but may as well to it). Update comment string to two semicolons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245982 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[msan] Precise instrumentation for icmp sgt %x, -1.
Evgeniy Stepanov [Tue, 25 Aug 2015 22:19:11 +0000 (22:19 +0000)]
[msan] Precise instrumentation for icmp sgt %x, -1.

Extend signed relational comparison instrumentation with a special
case for comparisons with -1. This fixes an MSan false positive when
such comparison is used as a sign bit test.

https://llvm.org/bugs/show_bug.cgi?id=24561

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245980 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[MC] Add a SetUsed default param to MCSymbol accessors (NFC)
Vedant Kumar [Tue, 25 Aug 2015 22:06:07 +0000 (22:06 +0000)]
[MC] Add a SetUsed default param to MCSymbol accessors (NFC)

Reviewed by: rafael

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245978 91177308-0d34-0410-b5e6-96231b3b80d8