platform/upstream/llvm.git
10 years agoConsistently handle clang-tidy check names in ClangTidyError.
Alexander Kornienko [Wed, 2 Jul 2014 15:05:04 +0000 (15:05 +0000)]
Consistently handle clang-tidy check names in ClangTidyError.

Summary:
This patch removes " [check-name]" from the end of
ClangTidyMessage::Message. The " [check-name]" part is only appended when
printing diagnostics on the console. Clang errors are now marked with
"clang-diagnostic-error" check name, remarks and unknown warnings are marked
with "clang-diagnostic-unknown".

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 212180

10 years agoUndefine R2, R4, R6 after use.
Axel Naumann [Wed, 2 Jul 2014 14:40:35 +0000 (14:40 +0000)]
Undefine R2, R4, R6 after use.

llvm-svn: 212179

10 years agoAVX-512: dec/inc instructions are slow on KNL
Elena Demikhovsky [Wed, 2 Jul 2014 14:11:05 +0000 (14:11 +0000)]
AVX-512: dec/inc instructions are slow on KNL
After Alexey Volkov, I'm adding the same property for KNL, that prefers ADD/SUB instead of INC/DEC.
Added a test.

llvm-svn: 212178

10 years ago[mips] Make FileCheck prefixes match the CPU they check
Daniel Sanders [Wed, 2 Jul 2014 13:21:52 +0000 (13:21 +0000)]
[mips] Make FileCheck prefixes match the CPU they check

Summary:
For example: s/MIPS32-EB-AS/MIPS32R2-EB-AS/ since it is for MIPS32r2 not MIPS32.

This reduces the noise in my next Clang patch.

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

llvm-svn: 212177

10 years ago[Driver][Mips] If ABI name is not provided deduce it from the target triple
Simon Atanasyan [Wed, 2 Jul 2014 13:20:36 +0000 (13:20 +0000)]
[Driver][Mips] If ABI name is not provided deduce it from the target triple
not from the CPU name. This approach is closer to the method used by gcc driver.

llvm-svn: 212176

10 years agoARM: add support for v8 ldaex/stlex builtins.
Tim Northover [Wed, 2 Jul 2014 12:56:02 +0000 (12:56 +0000)]
ARM: add support for v8 ldaex/stlex builtins.

ARMv8 adds (to both AArch32 and AArch64) acquiring and releasing
variants of the exclusive operations, in line with the C++11 memory
model.

This adds support for two new intrinsics to expose them to C & C++
developers directly: __builtin_arm_ldaex and __builtin_arm_stlex, in
direct analogy with the versions with no implicit barrier.

rdar://problem/15885451

llvm-svn: 212175

10 years agoMake FunctionDecl::getReturnTypeSourceRange() support non-builtin types
Alp Toker [Wed, 2 Jul 2014 12:55:58 +0000 (12:55 +0000)]
Make FunctionDecl::getReturnTypeSourceRange() support non-builtin types

Also document that the function is a "best-effort" facility to extract source
ranges from limited AST type location info.

llvm-svn: 212174

10 years agoX86: inline all atomic operations up to 128-bits.
Tim Northover [Wed, 2 Jul 2014 10:25:45 +0000 (10:25 +0000)]
X86: inline all atomic operations up to 128-bits.

The backend *can* cope with all of these now, so Clang should give it the
chance. On CPUs without cmpxchg16b (e.g. the original athlon64) LLVM can reform
the libcalls.

rdar://problem/13496295

llvm-svn: 212173

10 years agoReplace uint32_t by lldb::RegisterKing in register context API.
Jean-Daniel Dupas [Wed, 2 Jul 2014 09:51:28 +0000 (09:51 +0000)]
Replace uint32_t by lldb::RegisterKing in register context API.

llvm-svn: 212172

10 years agoDon't accept qualified 'int' main return types in C++ or standard C mode
Alp Toker [Wed, 2 Jul 2014 07:07:20 +0000 (07:07 +0000)]
Don't accept qualified 'int' main return types in C++ or standard C mode

C++ [basic.start.main]p1: "It shall have a return type of type int"

ISO C is also clear about this, so only accept 'int' with qualifiers in GNUMode
C.

llvm-svn: 212171

10 years agoAdded test for capturing VLA types if the captured variable is a function parameter.
Alexey Bataev [Wed, 2 Jul 2014 07:05:22 +0000 (07:05 +0000)]
Added test for capturing VLA types if the captured variable is a function parameter.

llvm-svn: 212170

10 years agoMove operator[] to DomTreeNodeBase
Matt Arsenault [Wed, 2 Jul 2014 06:50:48 +0000 (06:50 +0000)]
Move operator[] to DomTreeNodeBase

The comment in base even refers to it, but it was only defined
in the subclass.

llvm-svn: 212169

10 years agoFix missing const
Matt Arsenault [Wed, 2 Jul 2014 06:45:26 +0000 (06:45 +0000)]
Fix missing const

llvm-svn: 212168

10 years agoInstCombine: Optimize x/INT_MIN to x==INT_MIN
David Majnemer [Wed, 2 Jul 2014 06:42:13 +0000 (06:42 +0000)]
InstCombine: Optimize x/INT_MIN to x==INT_MIN

The result of x/INT_MIN is either 0 or 1, we can just use an icmp
instead.

llvm-svn: 212167

10 years ago[cleanup] Hoist an if-else chain on ISD opcodes (really designed for
Chandler Carruth [Wed, 2 Jul 2014 06:23:34 +0000 (06:23 +0000)]
[cleanup] Hoist an if-else chain on ISD opcodes (really designed for
switches) into a switch, and sink them into a dispatch function that can
return the result rather than awkward variable setting with breaks.

llvm-svn: 212166

10 years agoInstCombine: Add a vector variant test for PR20186
David Majnemer [Wed, 2 Jul 2014 06:14:13 +0000 (06:14 +0000)]
InstCombine: Add a vector variant test for PR20186

No functional change, just adding more test coverage that was meant to
go in with r212164.

llvm-svn: 212165

10 years agoInstCombine: Don't turn -(x/INT_MIN) -> x/INT_MIN
David Majnemer [Wed, 2 Jul 2014 06:07:09 +0000 (06:07 +0000)]
InstCombine: Don't turn -(x/INT_MIN) -> x/INT_MIN

It is not safe to negate the smallest signed integer, doing so yields
the same number back.

This fixes PR20186.

llvm-svn: 212164

10 years agoAdd range for-loop iterator adapter for cases in SwitchInst.
Owen Anderson [Wed, 2 Jul 2014 05:32:13 +0000 (05:32 +0000)]
Add range for-loop iterator adapter for cases in SwitchInst.

Patch by Marcello Maggioni, reviewed by Reid Kleckner.

llvm-svn: 212163

10 years ago[OPENMP, C++11] Improve code of InitVLACaptures function.
Alexey Bataev [Wed, 2 Jul 2014 05:15:00 +0000 (05:15 +0000)]
[OPENMP, C++11] Improve code of InitVLACaptures function.

llvm-svn: 212162

10 years agoaarch64: support target-specific .req assembler directive
Saleem Abdulrasool [Wed, 2 Jul 2014 04:50:23 +0000 (04:50 +0000)]
aarch64: support target-specific .req assembler directive

Based on the support for .req on ARM. The aarch64 variant has to keep track if
the alias register was a vector register (v0-31) or a general purpose or
VFP/Advanced SIMD ([bhsdq]0-31) register.

Patch by Janne Grunau!

llvm-svn: 212161

10 years agoPrevent Clang from crashing on template code.
Richard Trieu [Wed, 2 Jul 2014 04:39:38 +0000 (04:39 +0000)]
Prevent Clang from crashing on template code.

Fixes PR20110, where Clang hits an assertion failure when it expects that the
sub-expression of a bit cast to pointer to also be a pointer, but gets a value
instead.

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

llvm-svn: 212160

10 years ago[cleanup] Remove dead 'break;' statements that I meant to nuke in
Chandler Carruth [Wed, 2 Jul 2014 04:39:34 +0000 (04:39 +0000)]
[cleanup] Remove dead 'break;' statements that I meant to nuke in
r212158 but missed.

Thanks to Craig for spotting the goof!

llvm-svn: 212159

10 years ago[cleanup] Hoist the promotion dispatch logic into the promote function
Chandler Carruth [Wed, 2 Jul 2014 03:07:15 +0000 (03:07 +0000)]
[cleanup] Hoist the promotion dispatch logic into the promote function
so that we can use return to express it more cleanly and avoid so many
nested switch statements.

llvm-svn: 212158

10 years ago[cleanup] Nuke the 'VectorOp' bit of the promote method names.
Chandler Carruth [Wed, 2 Jul 2014 03:07:11 +0000 (03:07 +0000)]
[cleanup] Nuke the 'VectorOp' bit of the promote method names.

This doesn't add any information for methods in the VectorLegalizer
class that clearly take SDAG operations to legalize.

llvm-svn: 212157

10 years ago[OPENMP] Fixed error message reporting for nesting of regions
Alexey Bataev [Wed, 2 Jul 2014 03:04:53 +0000 (03:04 +0000)]
[OPENMP] Fixed error message reporting for nesting of regions

llvm-svn: 212156

10 years ago[x86] Clean up and modernize the doxygen and API comments for the vector
Chandler Carruth [Wed, 2 Jul 2014 02:16:57 +0000 (02:16 +0000)]
[x86] Clean up and modernize the doxygen and API comments for the vector
operation legalization code.

llvm-svn: 212155

10 years agoIntroduce a FunctionDecl::getReturnTypeSourceRange() utility
Alp Toker [Wed, 2 Jul 2014 01:47:15 +0000 (01:47 +0000)]
Introduce a FunctionDecl::getReturnTypeSourceRange() utility

This source range is useful for all kinds of diagnostic QOI and refactoring
work, so let's make it more discoverable.

This commit also makes use of the new function to enhance various diagnostics
relating to return types and resolves an old FIXME.

llvm-svn: 212154

10 years agoBreak out subtarget initialization that dependent variables need into
Eric Christopher [Wed, 2 Jul 2014 01:14:43 +0000 (01:14 +0000)]
Break out subtarget initialization that dependent variables need into
a separate function and clean up calling convention for helper function.

llvm-svn: 212153

10 years agoUnify these two lines.
Eric Christopher [Wed, 2 Jul 2014 01:02:28 +0000 (01:02 +0000)]
Unify these two lines.

llvm-svn: 212152

10 years agoMove MipsJITInfo to the subtarget rather than the target machine.
Eric Christopher [Wed, 2 Jul 2014 00:54:12 +0000 (00:54 +0000)]
Move MipsJITInfo to the subtarget rather than the target machine.

llvm-svn: 212151

10 years agoRemove unnecessary include.
Eric Christopher [Wed, 2 Jul 2014 00:54:10 +0000 (00:54 +0000)]
Remove unnecessary include.

llvm-svn: 212150

10 years agoRemove the cached InstrItineraryData on the TargetMachine, it's unnecessary.
Eric Christopher [Wed, 2 Jul 2014 00:54:07 +0000 (00:54 +0000)]
Remove the cached InstrItineraryData on the TargetMachine, it's unnecessary.

llvm-svn: 212149

10 years agoRemove the recommendation against using std::function
Reid Kleckner [Wed, 2 Jul 2014 00:42:07 +0000 (00:42 +0000)]
Remove the recommendation against using std::function

Clang-cl supports MSVC-style RTTI now, and we can even compile
typeid(...) with /GR-.  Just don't instantiate std::function with a
polymorphic type, or bad things will happen.

llvm-svn: 212148

10 years agoMove the subtarget dependent features from XCoreTargetMachine
Eric Christopher [Wed, 2 Jul 2014 00:10:09 +0000 (00:10 +0000)]
Move the subtarget dependent features from XCoreTargetMachine
down to the subtarget.

llvm-svn: 212147

10 years agoMake XCoreSelectionDAGInfo take a DataLayout since it only needs
Eric Christopher [Wed, 2 Jul 2014 00:10:05 +0000 (00:10 +0000)]
Make XCoreSelectionDAGInfo take a DataLayout since it only needs
that information.

llvm-svn: 212146

10 years agoAdd Kalimba support to ArchSpec.
Todd Fiala [Tue, 1 Jul 2014 23:33:32 +0000 (23:33 +0000)]
Add Kalimba support to ArchSpec.

See http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140630/011508.html
for more details.

Change by Matthew Gardiner.

llvm-svn: 212145

10 years agoclang/test/CodeGenCXX/microsoft-no-rtti-data.cpp: Relax an expression for -Asserts.
NAKAMURA Takumi [Tue, 1 Jul 2014 23:33:03 +0000 (23:33 +0000)]
clang/test/CodeGenCXX/microsoft-no-rtti-data.cpp: Relax an expression for -Asserts.

llvm-svn: 212144

10 years agoAlso run clang-format on llvm-nm.cpp to tidy things up. No functional changes.
Kevin Enderby [Tue, 1 Jul 2014 22:44:51 +0000 (22:44 +0000)]
Also run clang-format on llvm-nm.cpp to tidy things up. No functional changes.

llvm-svn: 212143

10 years agoCodeGen: Add some comments describing VFTable CG
David Majnemer [Tue, 1 Jul 2014 22:37:08 +0000 (22:37 +0000)]
CodeGen: Add some comments describing VFTable CG

No functionality change, just some comments to describe what is going
on.

llvm-svn: 212142

10 years agoRun clang-format on llvm-size.cpp to tidy things up. No functional changes.
Kevin Enderby [Tue, 1 Jul 2014 22:26:31 +0000 (22:26 +0000)]
Run clang-format on llvm-size.cpp to tidy things up. No functional changes.

llvm-svn: 212141

10 years ago[FastISel] Factor out stackmap intrinsic selection code into a dedicated helper metho...
Juergen Ributzka [Tue, 1 Jul 2014 22:25:49 +0000 (22:25 +0000)]
[FastISel] Factor out stackmap intrinsic selection code into a dedicated helper method. NFCI.

llvm-svn: 212140

10 years agoCodeGenCXX: Add tests for RTTI in VFTables
David Majnemer [Tue, 1 Jul 2014 22:25:00 +0000 (22:25 +0000)]
CodeGenCXX: Add tests for RTTI in VFTables

This test was supposed to go in with r212125.

llvm-svn: 212139

10 years agoDriver: Handle /GR- in a compatible way with MSVC
David Majnemer [Tue, 1 Jul 2014 22:24:56 +0000 (22:24 +0000)]
Driver: Handle /GR- in a compatible way with MSVC

There are slight differences between /GR- and -fno-rtti which made
mapping one to the other inappropriate.

-fno-rtti disables dynamic_cast, typeid, and does not emit RTTI related
information for the v-table.

/GR- does not generate complete object locators and thus will not
reference them in vftables.  However, constructs like dynamic_cast and
typeid are permitted.

This should bring our implementation of RTTI up to semantic parity with
MSVC modulo bugs.

llvm-svn: 212138

10 years agoWin64: Disable uwtable until we fix .pdata emission in LLVM
Reid Kleckner [Tue, 1 Jul 2014 22:23:54 +0000 (22:23 +0000)]
Win64: Disable uwtable until we fix .pdata emission in LLVM

LLVM r211399 started emitting .pdata for win64 by default.
Unfortunately, it produces invalid object files.  I plan to fix that
Soon.  For now, don't request unwind tables.  This fixes the clang-cl
self-host on win64.

llvm-svn: 212137

10 years agoX86: remove atomic instructions *after* we've iterated through them.
Tim Northover [Tue, 1 Jul 2014 22:10:30 +0000 (22:10 +0000)]
X86: remove atomic instructions *after* we've iterated through them.

Otherwise they get freed and the implicit "isa<XYZ>" tests following
turn out badly (at least under sanitizers).

Also corrects the ordering of unordered atomic stores.

llvm-svn: 212136

10 years ago[DAG] Pass the argument list to the CallLoweringInfo via move semantics. NFCI.
Juergen Ributzka [Tue, 1 Jul 2014 22:01:54 +0000 (22:01 +0000)]
[DAG] Pass the argument list to the CallLoweringInfo via move semantics. NFCI.

The argument list vector is never used after it has been passed to the
CallLoweringInfo and moving it to the CallLoweringInfo is cleaner and
pretty much as cheap as keeping a pointer to it.

llvm-svn: 212135

10 years agoX86: delegate expanding atomic libcalls to generic code.
Tim Northover [Tue, 1 Jul 2014 21:44:59 +0000 (21:44 +0000)]
X86: delegate expanding atomic libcalls to generic code.

On targets without cmpxchg16b or cmpxchg8b, the borderline atomic
operations were slipping through the gaps.

X86AtomicExpand.cpp was delegating to ISelLowering. Generic
ISelLowering was delegating to X86ISelLowering and X86ISelLowering was
asserting. The correct behaviour is to expand to a libcall, preferably
in generic ISelLowering.

This can be achieved by X86ISelLowering deciding it doesn't want the
faff after all.

llvm-svn: 212134

10 years agoOptimize InstCombine stack memory consumption
Reid Kleckner [Tue, 1 Jul 2014 21:36:20 +0000 (21:36 +0000)]
Optimize InstCombine stack memory consumption

This patch reduces the stack memory consumption of the InstCombine
function "isOnlyCopiedFromConstantGlobal() ", that in certain conditions
could overflow the stack because of excessive recursiveness.

For example, in a case like this:

%0 = alloca [50025 x i32], align 4
%1 = getelementptr inbounds [50025 x i32]* %0, i64 0, i64 0
store i32 0,                         i32* %1
%2 = getelementptr inbounds          i32* %1, i64 1
store i32 1,                         i32* %2
%3 = getelementptr inbounds          i32* %2, i64 1
store i32 2,                         i32* %3
%4 = getelementptr inbounds          i32* %3, i64 1
store i32 3,                         i32* %4
%5 = getelementptr inbounds          i32* %4, i64 1
store i32 4,                         i32* %5
%6 = getelementptr inbounds          i32* %5, i64 1
store i32 5,                         i32* %6
...

This piece of code crashes llvm when trying to apply instcombine on
desktop. On embedded devices this could happen with a much lower limit
of recursiveness.  Some instructions (getelementptr and bitcasts) make
the function recursively call itself on their uses, which is what makes
the example above consume so much stack (it becomes a recursive
depth-first tree visit with a very big depth).

The patch changes the algorithm to be semantically equivalent, but
iterative instead of recursive and the visiting order to be from a
depth-first visit to a breadth-first visit (visit all the instructions
of the current level before the ones of the next one).

Now if a lot of memory is required a heap allocation is done instead of
the the stack allocation, avoiding the possible crash.

Reviewed By: rnk

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

Patch by Marcello Maggioni!  We don't generally commit large stress test
that look for out of memory conditions, so I didn't request that one be
added to the patch.

llvm-svn: 212133

10 years agoFix typos.
Bruce Mitchener [Tue, 1 Jul 2014 21:22:11 +0000 (21:22 +0000)]
Fix typos.

llvm-svn: 212132

10 years agoTerminate italics tag.
Bruce Mitchener [Tue, 1 Jul 2014 21:19:25 +0000 (21:19 +0000)]
Terminate italics tag.

llvm-svn: 212131

10 years agoMove remaining LLVM_ENABLE_DUMP conditionals out of the headers
Alp Toker [Tue, 1 Jul 2014 21:19:13 +0000 (21:19 +0000)]
Move remaining LLVM_ENABLE_DUMP conditionals out of the headers

This macro is sometimes defined manually but isn't (and doesn't need to be) in
llvm-config.h so shouldn't appear in the headers, likewise NDEBUG.

Instead switch them over to LLVM_DUMP_METHOD on the definitions.

llvm-svn: 212130

10 years agoMinumum -> Minimum.
Bruce Mitchener [Tue, 1 Jul 2014 21:18:35 +0000 (21:18 +0000)]
Minumum -> Minimum.

llvm-svn: 212129

10 years agoDebugInfo: Keep track of subprograms who's arguments have been promoted.
David Blaikie [Tue, 1 Jul 2014 21:13:37 +0000 (21:13 +0000)]
DebugInfo: Keep track of subprograms who's arguments have been promoted.

Matching behavior with DeadArgumentElimination (and leveraging some
now-common infrastructure), keep track of the function from debug info
metadata if arguments are promoted.

This may produce interesting debug info - since the arguments may be
missing or of different types... but at least backtraces, inlining, etc,
will be correct.

llvm-svn: 212128

10 years agoAST: Small simplification in VTableBuilder
David Majnemer [Tue, 1 Jul 2014 21:10:07 +0000 (21:10 +0000)]
AST: Small simplification in VTableBuilder

Stash whether or not we have an RTTI component away instead of
recomputing it.

llvm-svn: 212127

10 years agoIntroduce reduction types
Johannes Doerfert [Tue, 1 Jul 2014 20:52:51 +0000 (20:52 +0000)]
Introduce reduction types

  This change is particularly useful in the code generation as we need
  to know which binary operator/identity element we need to combine/initialize
  the privatization locations.

  + Print the reduction type for each memory access
  + Adjusted the test cases to comply with the new output format and
    to test for the right reduction type

llvm-svn: 212126

10 years agoMS ABI: Reference MSVC RTTI from the VFTable
David Majnemer [Tue, 1 Jul 2014 20:30:31 +0000 (20:30 +0000)]
MS ABI: Reference MSVC RTTI from the VFTable

The pointer for a class's RTTI data comes right before the VFTable but
has no name.  To be properly compatible with this, we do the following:
* Create a single GlobalVariable which holds the contents of the VFTable
  _and_ the pointer to the RTTI data.
* Create a GlobalAlias, with appropriate linkage/visibility, that points
  just after the RTTI data pointer.  This ensures that the VFTable
  symbol will always refer to VFTable data.
* Create a Comdat with a "Largest" SelectionKind and stick the private
  GlobalVariable in it.  By transitivity, the GlobalAlias will be a
  member of the Comdat group.  Using "Largest" ensures that foreign
  definitions without an RTTI data pointer will _not_ be chosen in the
  final linked image.

Whether or not we emit RTTI data depends on several things:
* The -fno-rtti flag implies that we should never not emit a pointer to
  RTTI data before the VFTable.
* __declspec(dllimport) brings in the VFTable from a remote DLL. Use an
  available_externally GlobalVariable to provide a local definition of
  the VFTable.  This means that we won't have any available_externally
  definitions of things like complete object locators.  This is
  acceptable because they are never directly referenced.

To my knowledge, this completes the implementation of MSVC RTTI code
generation.

Further semantic work should be done to properly support /GR-.

llvm-svn: 212125

10 years agoMove the subtarget dependent features from SystemZTargetMachine
Eric Christopher [Tue, 1 Jul 2014 20:19:02 +0000 (20:19 +0000)]
Move the subtarget dependent features from SystemZTargetMachine
down to the subtarget. Add an initialization routine to assist.

llvm-svn: 212124

10 years agoRemove the use and initialization of the target machine and subtarget
Eric Christopher [Tue, 1 Jul 2014 20:18:59 +0000 (20:18 +0000)]
Remove the use and initialization of the target machine and subtarget
from SystemZFrameLowering.

llvm-svn: 212123

10 years agoDebugInfo: Provide a utility for building a mapping from llvm::Function*s to llvm...
David Blaikie [Tue, 1 Jul 2014 20:05:26 +0000 (20:05 +0000)]
DebugInfo: Provide a utility for building a mapping from llvm::Function*s to llvm::DISubprograms

Update DeadArgumentElimintation to use this, with the intent of reusing
the functionality for ArgumentPromotion as well.

llvm-svn: 212122

10 years ago[MSan] Fixup r212082: enable tests for _mm_ intrinsics if and only if the
Alexey Samsonov [Tue, 1 Jul 2014 19:58:41 +0000 (19:58 +0000)]
[MSan] Fixup r212082: enable tests for _mm_ intrinsics if and only if the
unit test source file is compiled with Clang.

llvm-svn: 212121

10 years agoAArch64: fix comment typo
Tim Northover [Tue, 1 Jul 2014 19:47:09 +0000 (19:47 +0000)]
AArch64: fix comment typo

llvm-svn: 212120

10 years agoX86: expand atomics in IR instead of as MachineInstrs.
Tim Northover [Tue, 1 Jul 2014 18:53:31 +0000 (18:53 +0000)]
X86: expand atomics in IR instead of as MachineInstrs.

The logic for expanding atomics that aren't natively supported in
terms of cmpxchg loops is much simpler to express at the IR level. It
also allows the normal optimisations and CodeGen improvements to help
out with atomics, instead of using a limited set of possible
instructions..

rdar://problem/13496295

llvm-svn: 212119

10 years agoclang-cl: Ignore /Zc:inline and /Zc:rvalueCast
Reid Kleckner [Tue, 1 Jul 2014 18:27:02 +0000 (18:27 +0000)]
clang-cl: Ignore /Zc:inline and /Zc:rvalueCast

These flags enable behavior in MSVC that Clang has by default.

/Zc:inline essentially marks all COMDATs as discardable.  In LLVM
parlance, this means using linkonce_odr linkage, which is what we
already do.

llvm-svn: 212117

10 years ago[docs] Fix a mangled sentence.
Sean Silva [Tue, 1 Jul 2014 18:22:32 +0000 (18:22 +0000)]
[docs] Fix a mangled sentence.

Fixes PR20169

llvm-svn: 212116

10 years ago[docs] Remove stray HTML tag.
Sean Silva [Tue, 1 Jul 2014 18:15:00 +0000 (18:15 +0000)]
[docs] Remove stray HTML tag.

Fixes PR20167

llvm-svn: 212115

10 years ago[X86] AVX512: Allow writemasks with vpcmp
Adam Nemet [Tue, 1 Jul 2014 18:03:45 +0000 (18:03 +0000)]
[X86] AVX512: Allow writemasks with vpcmp

For now I only updated the _alt variants.  The main variants are used by
codegen and that will need a bit more work to trigger.

<rdar://problem/17492620>

llvm-svn: 212114

10 years ago[X86] AVX512: Factor generating the AsmString into avx512_icmp_cc
Adam Nemet [Tue, 1 Jul 2014 18:03:43 +0000 (18:03 +0000)]
[X86] AVX512: Factor generating the AsmString into avx512_icmp_cc

Adding a writemask variant would require a third asm string to be passed to
the template.  Generate the AsmString in the template instead.

No change in X86.td.expanded.

llvm-svn: 212113

10 years ago[TSan] Equalize the behavior of __tsan_get_allocated_size and user_alloc_usable_size.
Alexey Samsonov [Tue, 1 Jul 2014 18:01:20 +0000 (18:01 +0000)]
[TSan] Equalize the behavior of __tsan_get_allocated_size and user_alloc_usable_size.

The former used to crash with a null deref if it was given a not owned pointer,
while the latter returned 0. Now they both return 0. This is still not the best possible
behavior: it is better to print an error report with a stack trace, pointing
to the error in user code, as we do in ASan.

llvm-svn: 212112

10 years agoThis creates a valid Python API for Windows, pending some issues. The changes include...
Deepak Panickal [Tue, 1 Jul 2014 17:57:19 +0000 (17:57 +0000)]
This creates a valid Python API for Windows, pending some issues. The changes included are -

 - Ported the SWIG wrapper shell scripts to Python so that they would work on Windows too along with other platforms
 - Updated CMake handling to fix SWIG errors and manage sym-linking on Windows to liblldb.dll
 - More build fixes for Windows

The pending issues are that two Python modules, termios and pexpect are not available on Windows.
These are currently required for the Python command interpreter to be used from within LLDB.

llvm-svn: 212111

10 years agoGCC compatibility: Ignore -finput_charset=UTF-8 argument. It is the default in Clang.
Sylvestre Ledru [Tue, 1 Jul 2014 17:24:27 +0000 (17:24 +0000)]
GCC compatibility: Ignore -finput_charset=UTF-8 argument. It is the default in Clang.
Currently, we fail with an error.

Reviewers: rafael

Reviewed By: rafael

Subscribers: rnk, cfe-commits

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

llvm-svn: 212110

10 years agoRevert "MachineScheduler: better book-keeping for asserts."
Chad Rosier [Tue, 1 Jul 2014 17:23:11 +0000 (17:23 +0000)]
Revert "MachineScheduler: better book-keeping for asserts."

This reverts commit r212088, which is causing a number of spec
failures.  Will provide reduced test cases shortly.
PR20057

llvm-svn: 212109

10 years agoAdd the -arch flag support to llvm-size like what was done to llvm-nm
Kevin Enderby [Tue, 1 Jul 2014 17:19:10 +0000 (17:19 +0000)]
Add the -arch flag support to llvm-size like what was done to llvm-nm
to select the slice out of a Mach-O universal file.  This also includes
support for -arch all, selecting the host architecture by default from
a universal file and checking if -arch is used with a standard Mach-O
it matches that architecture.

llvm-svn: 212108

10 years agoUse native ::pid_t in Linux ProcessMonitor (local debugging).
Todd Fiala [Tue, 1 Jul 2014 16:30:53 +0000 (16:30 +0000)]
Use native ::pid_t in Linux ProcessMonitor (local debugging).

There were a few places where we were not catching the possibility of negative
error codes in waitpid() calls.  This change fixes those remaining after
the llgs branch fixes to ProcessMonitor.

Change by Shawn Best.

llvm-svn: 212107

10 years ago[PeepholeOptimzer] Fix a typo in a comment.
Quentin Colombet [Tue, 1 Jul 2014 16:23:44 +0000 (16:23 +0000)]
[PeepholeOptimzer] Fix a typo in a comment.
Spotted by Amara Emerson.

llvm-svn: 212106

10 years agoRemove unused typedef. GCC warns about this.
Benjamin Kramer [Tue, 1 Jul 2014 15:39:32 +0000 (15:39 +0000)]
Remove unused typedef. GCC warns about this.

llvm-svn: 212105

10 years agoGlobalOpt: Don't swap private for internal linkage
David Majnemer [Tue, 1 Jul 2014 15:26:50 +0000 (15:26 +0000)]
GlobalOpt: Don't swap private for internal linkage

There were transforms whose *intent* was to downgrade the linkage of
external objects to have internal linkage.

However, it fired on things with private linkage as well.

llvm-svn: 212104

10 years agoGlobalOpt: FileCheck-ize test
David Majnemer [Tue, 1 Jul 2014 15:26:47 +0000 (15:26 +0000)]
GlobalOpt: FileCheck-ize test

No functionality change.

llvm-svn: 212103

10 years agoRephrase loop so it doesn't leave unused bools around in Release mode.
Benjamin Kramer [Tue, 1 Jul 2014 14:46:44 +0000 (14:46 +0000)]
Rephrase loop so it doesn't leave unused bools around in Release mode.

llvm-svn: 212102

10 years agoAvoid revocations when possible.
Rafael Espindola [Tue, 1 Jul 2014 14:34:30 +0000 (14:34 +0000)]
Avoid revocations when possible.

This is a small targeted fix for pr20119. The code needs quiet a bit of
refactoring and I added some FIXMEs about it, but I want to get the testcase
passing first.

llvm-svn: 212101

10 years ago[PeepholeOptimizer] Advanced rewriting of copies to avoid cross register banks
Quentin Colombet [Tue, 1 Jul 2014 14:33:36 +0000 (14:33 +0000)]
[PeepholeOptimizer] Advanced rewriting of copies to avoid cross register banks
copies.

This patch extends the peephole optimization introduced in r190713 to produce
register-coalescer friendly copies when possible.

This extension taught the existing cross-bank copy optimization how to deal
with the instructions that generate cross-bank copies, i.e., insert_subreg,
extract_subreg, reg_sequence, and subreg_to_reg.
E.g.
b = insert_subreg e, A, sub0 <-- cross-bank copy
...
C = copy b.sub0 <-- cross-bank copy

Would produce the following code:
b = insert_subreg e, A, sub0 <-- cross-bank copy
...
C = copy A <-- same-bank copy

This patch also introduces a new helper class for that: ValueTracker.
This class implements the logic to look through the copy related instructions
and get the related source.

For now, the advanced rewriting is disabled by default as we are lacking the
semantic on target specific instructions to catch the motivating examples.

Related to <rdar://problem/12702965>.

llvm-svn: 212100

10 years ago[RegAllocGreedy] Provide a flag to disable the local reassignment heuristic.
Quentin Colombet [Tue, 1 Jul 2014 14:08:37 +0000 (14:08 +0000)]
[RegAllocGreedy] Provide a flag to disable the local reassignment heuristic.
By default, no functionality change.

Before evicting a local variable, this heuristic tries to find another (set of)
local(s) that can be reassigned to a free color.

In some extreme cases (large basic blocks with tons of local variables), the
compilation time is dominated by the local interference checks that this
heuristic must perform, with no code gen gain.
E.g., the motivating example takes 4 minutes to compile with this heuristic, 12
seconds without.

Improving the situation will likely require to make drastic changes to the
register allocator and/or the interference check framework.

For now, provide this flag to better understand the impact of that heuristic.

<rdar://problem/17444599>

llvm-svn: 212099

10 years agoRemove CleanupHackLevel from CGException.
Logan Chien [Tue, 1 Jul 2014 11:47:10 +0000 (11:47 +0000)]
Remove CleanupHackLevel from CGException.

This patch removes the dead code, and refines the
getEHResumeBlock() slightly.

The CleanupHackLevel was a hack to the old exception
handling intrinsics, which have several issues with function
inliner.

Since LLVM 3.0, the new landingpad and resume instructions
are added to LLVM IR.  With the new exception handling
mechanism, most of the issues are fixed now.  We should
always use these instructions to implement the exception
handling code nowadays, and we don't need the hack any more.

Besides, the `CleanupHackLevel` is a compile-time constant,
thus other cases have been considered as dead code for a while.

llvm-svn: 212097

10 years ago[Driver][Mips] MIPS ABI names "32" and "64" used as arguments of the "-mabi"
Simon Atanasyan [Tue, 1 Jul 2014 10:59:09 +0000 (10:59 +0000)]
[Driver][Mips] MIPS ABI names "32" and "64" used as arguments of the "-mabi"
command line option only. Internally we convert them to the "o32" and "n64"
respectively. So we do not need to refer them anywhere after that conversion.

No functional changes.

llvm-svn: 212096

10 years agoRemove obsolete function TargetRegistry::getClosestTargetForJIT()
Alp Toker [Tue, 1 Jul 2014 10:47:13 +0000 (10:47 +0000)]
Remove obsolete function TargetRegistry::getClosestTargetForJIT()

This was kept around "for compatibility through 2.6" in 2009 and is not used or
tested.

llvm-svn: 212095

10 years ago[mach-o]: make the default dylib install-name the output filename.
Tim Northover [Tue, 1 Jul 2014 08:41:45 +0000 (08:41 +0000)]
[mach-o]: make the default dylib install-name the output filename.

llvm-svn: 212094

10 years ago[mach-o] add representation for LC_ID_DYLIB to MachONormalizedFile
Tim Northover [Tue, 1 Jul 2014 08:15:41 +0000 (08:15 +0000)]
[mach-o] add representation for LC_ID_DYLIB to MachONormalizedFile

It still needs to be tied into BinaryReader, but this allows reasonably
sensible creation of SharedLibrary atoms on MachO.

llvm-svn: 212093

10 years agoEnable test/CodeGen/indirect-goto.c in 64b for local arrays
Gerolf Hoflehner [Tue, 1 Jul 2014 05:10:06 +0000 (05:10 +0000)]
Enable test/CodeGen/indirect-goto.c in 64b for local arrays

In 32b mode the reference count for block addresses
is not zero. This prevents inlining and constant
folding and causes the test to fail. Changing
the triple allows runnning the test in 64b mode.

The array in foo2 is now local instead of static until
at lower optimization levels the interprocedural constant
propagator is invoked before the global optimizer.

llvm-svn: 212092

10 years agoTemporarily disable the indirect-goto.c test.
Bob Wilson [Tue, 1 Jul 2014 04:56:06 +0000 (04:56 +0000)]
Temporarily disable the indirect-goto.c test.

llvm r212077 causes this test to fail. We need to reorder some passes and
possibly make other changes to reenable the optimization being tested here.

llvm-svn: 212091

10 years agoPR15677 - Crash in template diffing. Check that expression is evaluatable before...
Nikola Smiljanic [Tue, 1 Jul 2014 04:17:53 +0000 (04:17 +0000)]
PR15677 - Crash in template diffing. Check that expression is evaluatable before evaluating it.

llvm-svn: 212090

10 years agoRevert "DebugInfo: Ensure that all debug location scope chains from instructions...
David Blaikie [Tue, 1 Jul 2014 04:11:45 +0000 (04:11 +0000)]
Revert "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."

This reverts commit r212085.

This breaks the sanitizer bot... & I thought I'd tried pretty hard not
to do that. Guess I need to try harder.

llvm-svn: 212089

10 years agoMachineScheduler: better book-keeping for asserts.
Andrew Trick [Tue, 1 Jul 2014 03:23:13 +0000 (03:23 +0000)]
MachineScheduler: better book-keeping for asserts.

Fixes another test case under PR20057.

llvm-svn: 212088

10 years agoclang-interpreter: use LLVM interpreter if JIT is unavailable
Alp Toker [Tue, 1 Jul 2014 03:19:50 +0000 (03:19 +0000)]
clang-interpreter: use LLVM interpreter if JIT is unavailable

Update the strategy in r212083 to try JIT first and otherwise fall back to the
interpreter. This gives the best of both worlds and still builds fine with no
targets enabled.

Requires supporting changes from LLVM r212086.

llvm-svn: 212087

10 years agoExecutionEngine::create(): fix interpreter fallback when JIT is unavailable
Alp Toker [Tue, 1 Jul 2014 03:18:49 +0000 (03:18 +0000)]
ExecutionEngine::create(): fix interpreter fallback when JIT is unavailable

ForceInterpreter=false shouldn't disable the interpreter completely because it
can still be necessary to interpret if the target doesn't support JIT.

No obvious way to test this in LLVM, but this matches what
LLVMCreateExecutionEngineForModule() does and fixes the clang-interpreter
example in the clang source tree which uses the ExecutionEngine.

llvm-svn: 212086

10 years agoDebugInfo: Ensure that all debug location scope chains from instructions within a...
David Blaikie [Tue, 1 Jul 2014 03:11:59 +0000 (03:11 +0000)]
DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself.

Originally committed in r211723, reverted in r211724 due to failure
cases found and fixed (ArgumentPromotion: r211872, Inlining: r212065),
and I now believe the invariant actually holds for some reasonable
amount of code (but I'll keep an eye on the buildbots and see what
happens... ).

Original commit message:

PR20038: DebugInfo: Inlined call sites where the caller has debug info
but the call itself has no debug location.

This situation does bad things when inlined, so I've fixed Clang not to
produce inlinable call sites without locations when the caller has debug
info (in the one case where I could find that this occurred). This
updates the PR20038 test case to be what clang now produces, and readds
the assertion that had to be removed due to this bug.

I've also beefed up the debug info verifier to help diagnose these
issues in the future, and I hope to add checks to the inliner to just
assert-fail if it encounters this situation. If, in the future, we
decide we have to cope with this situation, the right thing to do is
probably to just remove all the DebugLocs from the inlined instructions.

llvm-svn: 212085

10 years agodriver: add link dependency on CodeGen
Alp Toker [Tue, 1 Jul 2014 02:42:02 +0000 (02:42 +0000)]
driver: add link dependency on CodeGen

Fix the build when no targets are enabled. This dependency is incurred by two
unfortunate entries in LinkAllPasses.h included from cc1_main.cpp:

  llvm::createJumpInstrTablesPass();
  llvm::createCodeGenPreparePass();

llvm-svn: 212084

10 years agoclang-interpreter: interpret instead of JITing
Alp Toker [Tue, 1 Jul 2014 02:41:55 +0000 (02:41 +0000)]
clang-interpreter: interpret instead of JITing

Fixes the build when no targets are selected, or no native target is built.

This also better matches up with the description/title of the example and
demonstrates how clang can be used to run C++ on constrained environments
without file IO or executable memory permissions (e.g. iOS apps).

A comment is added explaining how to extend the demo with JIT support as
needed.

llvm-svn: 212083

10 years agoAdd the way to disable MSan unit tests for _mm_* intrinsics
Alexey Samsonov [Tue, 1 Jul 2014 01:38:52 +0000 (01:38 +0000)]
Add the way to disable MSan unit tests for _mm_* intrinsics

llvm-svn: 212082

10 years agoFix .seh_stackalloc 0
Reid Kleckner [Tue, 1 Jul 2014 00:42:47 +0000 (00:42 +0000)]
Fix .seh_stackalloc 0

seh_stackalloc 0 is not representable in Win64 SEH info, so emitting it
is a bug.

Reviewers: rnk

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

Patch by Vadim Chugunov!

llvm-svn: 212081

10 years ago[FIX] Don't consider reductions which are partially outside the SCoP
Johannes Doerfert [Tue, 1 Jul 2014 00:32:29 +0000 (00:32 +0000)]
[FIX] Don't consider reductions which are partially outside the SCoP

  + Test case

llvm-svn: 212080

10 years agoGlobalOpt: Handle non-zero offsets for aliases
David Majnemer [Tue, 1 Jul 2014 00:30:56 +0000 (00:30 +0000)]
GlobalOpt: Handle non-zero offsets for aliases

An alias with an aliasee of a non-zero GEP is not trivially replacable
with it's aliasee.

llvm-svn: 212079