platform/upstream/llvm.git
9 years ago[Statepoints][NFC] Rename variables to llvm style.
Sanjoy Das [Thu, 2 Jul 2015 02:53:39 +0000 (02:53 +0000)]
[Statepoints][NFC] Rename variables to llvm style.

Summary:
(I don't think this change needs review, this was uploaded to
phabricator to provide context for later dependent changes.)

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

llvm-svn: 241233

9 years ago[Statepoints][NFC] Add Statepoint::operator bool()
Sanjoy Das [Thu, 2 Jul 2015 02:53:36 +0000 (02:53 +0000)]
[Statepoints][NFC] Add Statepoint::operator bool()

Summary:
This allows the "if (Statepoint SP = Statepoint(I))" idiom.

(I don't think this change needs review, this was uploaded to
phabricator to provide context for later dependent changes.)

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

llvm-svn: 241232

9 years ago[Statepoints][NFC] Add Statepoint::getGCResult.
Sanjoy Das [Thu, 2 Jul 2015 02:53:34 +0000 (02:53 +0000)]
[Statepoints][NFC] Add Statepoint::getGCResult.

Summary:
Introduce a simple accessor to get the gc_result hanging off of a
statepoint.

(I don't think this change needs review, this was uploaded to
phabricator to provide context for later dependent changes.)

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

llvm-svn: 241231

9 years agoCOFF: Resolve AlternateNames using weak aliases.
Rui Ueyama [Thu, 2 Jul 2015 02:38:59 +0000 (02:38 +0000)]
COFF: Resolve AlternateNames using weak aliases.

Previously, we use SymbolTable::rename to resolve AlternateName symbols.
This patch is to merge that mechanism with weak aliases, so that we
remove that function.

llvm-svn: 241230

9 years agoSpecify -arch:IA32. Should fix hexagon bot.
Peter Collingbourne [Thu, 2 Jul 2015 02:14:50 +0000 (02:14 +0000)]
Specify -arch:IA32. Should fix hexagon bot.

llvm-svn: 241229

9 years agoMake getArchNameForCompilerRTLib return the right thing on 32-bit Windows. Fixes...
Peter Collingbourne [Thu, 2 Jul 2015 02:07:43 +0000 (02:07 +0000)]
Make getArchNameForCompilerRTLib return the right thing on 32-bit Windows. Fixes the tests there.

llvm-svn: 241228

9 years agoAdd declaration of _ReadWriteBarrier. Fixes build of asan tests on Windows.
Peter Collingbourne [Thu, 2 Jul 2015 02:06:59 +0000 (02:06 +0000)]
Add declaration of _ReadWriteBarrier. Fixes build of asan tests on Windows.

llvm-svn: 241227

9 years ago[LazyCallGraph] Port test case from r240039 to LCG.
Sanjoy Das [Thu, 2 Jul 2015 02:03:58 +0000 (02:03 +0000)]
[LazyCallGraph] Port test case from r240039 to LCG.

Summary:
r240039 adds a test case to check that CallGraph does the right thing
with respect to non-leaf intrinsics like statepoint and patchpoint.
This ports the same test case to LazyCallGraph.  LazyCallGraph already
does the right thing with respect to escaping function pointers so there
is no need to change any code.

Reviewers: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 241226

9 years agoDriver: add support for linking the UBSan runtime library on Windows.
Peter Collingbourne [Thu, 2 Jul 2015 01:48:12 +0000 (01:48 +0000)]
Driver: add support for linking the UBSan runtime library on Windows.

On Windows the user may invoke the linker directly, so we might not have an
opportunity to add runtime library flags to the linker command line. Instead,
instruct the code generator to embed linker directive in the object file
that cause the required runtime libraries to be linked.

We might also want to do something similar for ASan, but it seems to have
its own special complexities which may make this infeasible.

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

llvm-svn: 241225

9 years agoRe-apply r241217 with build fixes:
Peter Collingbourne [Thu, 2 Jul 2015 01:44:34 +0000 (01:44 +0000)]
Re-apply r241217 with build fixes:

- Disable building of the interceptor library on 64-bit Windows.
- Mangle names in /alternatename directive for 32-bit Windows.

llvm-svn: 241224

9 years agoMake an X86 specific directory and put the recent X86 tti specific
Eric Christopher [Thu, 2 Jul 2015 01:36:31 +0000 (01:36 +0000)]
Make an X86 specific directory and put the recent X86 tti specific
inlining test into it.

llvm-svn: 241223

9 years agoChange executable name to a.out.
Chaoren Lin [Thu, 2 Jul 2015 01:26:39 +0000 (01:26 +0000)]
Change executable name to a.out.

Summary: The long name causes problems with some shells.

Reviewers: sivachandra

Subscribers: lldb-commits

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

llvm-svn: 241222

9 years agoImplement TargetTransformInfo::hasCompatibleFunctionAttributes for X86.
Eric Christopher [Thu, 2 Jul 2015 01:11:50 +0000 (01:11 +0000)]
Implement TargetTransformInfo::hasCompatibleFunctionAttributes for X86.

This checks subtarget feature compatibility for inlining by verifying
that the callee is a strict subset of the caller's features. This includes
the cpu as part of the subtarget we can get via the incoming functions as
the backend takes CPUs as feature sets.

This allows us to inline things like:

int foo() { return baz(); }

int __attribute__((target("sse4.2"))) bar() {
  return foo();
}

so that generic code can be inlined into specialized functions.

llvm-svn: 241221

9 years agoAdd a routine to TargetTransformInfo that will allow targets to look
Eric Christopher [Thu, 2 Jul 2015 01:11:47 +0000 (01:11 +0000)]
Add a routine to TargetTransformInfo that will allow targets to look
at the attributes on a function to determine whether or not to allow
inlining.

llvm-svn: 241220

9 years agoRevert r241217, it breaks the build on Windows.
Nico Weber [Thu, 2 Jul 2015 01:10:03 +0000 (01:10 +0000)]
Revert r241217, it breaks the build on Windows.

llvm-svn: 241219

9 years agoInstrProf: Pack the coverage mapping structs that we write out
Justin Bogner [Thu, 2 Jul 2015 00:42:32 +0000 (00:42 +0000)]
InstrProf: Pack the coverage mapping structs that we write out

When we read this data we treat it as unaligned and packed, so we
should really be explicit about that when we write it.

llvm-svn: 241218

9 years agoubsan: Port runtime library to (32- and 64-bit) Windows.
Peter Collingbourne [Thu, 2 Jul 2015 00:35:47 +0000 (00:35 +0000)]
ubsan: Port runtime library to (32- and 64-bit) Windows.

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

llvm-svn: 241217

9 years agoAnother slightly less goofy example of scripted steps.
Jim Ingham [Thu, 2 Jul 2015 00:24:17 +0000 (00:24 +0000)]
Another slightly less goofy example of scripted steps.

llvm-svn: 241216

9 years agoCOFF: Rename getReplacement -> repl.
Rui Ueyama [Thu, 2 Jul 2015 00:21:11 +0000 (00:21 +0000)]
COFF: Rename getReplacement -> repl.

The previous name was too long to my taste.

llvm-svn: 241215

9 years agoCOFF: Change GCRoot member type from StringRef to Undefined. NFC.
Rui Ueyama [Thu, 2 Jul 2015 00:21:08 +0000 (00:21 +0000)]
COFF: Change GCRoot member type from StringRef to Undefined. NFC.

I think Undefined symbols are a bit more convenient than StringRefs
since SymbolBodies are handles for symbols. You can get resolved
symbols for undefined symbols just by calling getReplacmenet without
looking up the symbol table.

llvm-svn: 241214

9 years agoCOFF: Simplify and rename findMangle. NFC.
Rui Ueyama [Thu, 2 Jul 2015 00:04:14 +0000 (00:04 +0000)]
COFF: Simplify and rename findMangle. NFC.

Occasionally we have to resolve an undefined symbol to its
mangled symbol. Previously, we did that on calling side of
findMangle by explicitly updating SymbolBody.
In this patch, mangled symbols are handled as weak aliases
for undefined symbols.

llvm-svn: 241213

9 years agoReversed r238363, because the message is inconsistent
Sean Callanan [Wed, 1 Jul 2015 23:56:30 +0000 (23:56 +0000)]
Reversed r238363, because the message is inconsistent
with all the other assertion messages.

llvm-svn: 241212

9 years agoWebAssembly: start instructions
JF Bastien [Wed, 1 Jul 2015 23:41:25 +0000 (23:41 +0000)]
WebAssembly: start instructions

Summary:
* Add 64-bit address space feature.
* Rename SIMD feature to SIMD128.
* Handle single-thread model with an IR pass (same way ARM does).
* Rename generic processor to MVP, to follow design's lead.
* Add bleeding-edge processors, with all features included.
* Fix a few DEBUG_TYPE to match other backends.

Test Plan: ninja check

Reviewers: sunfish

Subscribers: jfb, llvm-commits

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

llvm-svn: 241211

9 years agoCheck to make sure we have a valid N_GSYM symbol name before we use it for anything.
Greg Clayton [Wed, 1 Jul 2015 23:29:06 +0000 (23:29 +0000)]
Check to make sure we have a valid N_GSYM symbol name before we use it for anything.

llvm-svn: 241210

9 years agoFix indentation.
Greg Clayton [Wed, 1 Jul 2015 23:28:31 +0000 (23:28 +0000)]
Fix indentation.

llvm-svn: 241209

9 years ago[Python] Allow PyLong values in integer lists (when converting to C lists)
Siva Chandra [Wed, 1 Jul 2015 23:27:32 +0000 (23:27 +0000)]
[Python] Allow PyLong values in integer lists (when converting to C lists)

Test Plan: dotest.py -p TestSBData

Reviewers: clayborg, granata.enrico

Reviewed By: clayborg, granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 241208

9 years ago[modules] Merging support for specializations of a function template. This very
Richard Smith [Wed, 1 Jul 2015 23:19:58 +0000 (23:19 +0000)]
[modules] Merging support for specializations of a function template. This very
rarely matters, but can affect whether two dependent types are canonically
equivalent.

llvm-svn: 241207

9 years ago[TwoAddressInstructionPass] Try 3 Addr Conversion After Commuting.
Quentin Colombet [Wed, 1 Jul 2015 23:12:13 +0000 (23:12 +0000)]
[TwoAddressInstructionPass] Try 3 Addr Conversion After Commuting.

TwoAddressInstructionPass stops after a successful commuting but 3 Addr
conversion might be good for some cases.

Consider:

int foo(int a, int b) {
  return a + b;
}

Before this commit, we emit:

addl %esi, %edi
movl %edi, %eax
ret

After this commit, we try 3 Addr conversion:

leal (%rsi,%rdi), %eax
ret

Patch by Volkan Keles <vkeles@apple.com>!

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

llvm-svn: 241206

9 years ago[modules] Remove some out-of-date (fixed) FIXMEs.
Richard Smith [Wed, 1 Jul 2015 23:10:03 +0000 (23:10 +0000)]
[modules] Remove some out-of-date (fixed) FIXMEs.

llvm-svn: 241205

9 years agoChange APInt comparison with uint64_t.
Pawel Bylica [Wed, 1 Jul 2015 22:56:43 +0000 (22:56 +0000)]
Change APInt comparison with uint64_t.

Summary:
This patch changes the way APInt is compared with a value of type uint64_t.
Before the uint64_t value was truncated to the size of APInt before comparison.
Now the comparison takes into account full 64-bit precision.

Test Plan: Unit tests added. No regressions. Self-hosted check-all done as well.

Reviewers: chandlerc, dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 241204

9 years agoMark test_sb_api_listener_event_process_state as flakey
Ying Chen [Wed, 1 Jul 2015 22:50:28 +0000 (22:50 +0000)]
Mark test_sb_api_listener_event_process_state as flakey

llvm-svn: 241203

9 years agoRun teardown and setup before retry for expectedFlakey tests
Ying Chen [Wed, 1 Jul 2015 22:44:27 +0000 (22:44 +0000)]
Run teardown and setup before retry for expectedFlakey tests

Summary:
If test is decorated with expectedFlakey*, run teardown and setup before retry
Don't run retry if the test is already decorated with xfail or skip

Test Plan:
Mark TestMultithreaded.test_sb_api_listener_event_process_state as expectedFlakey
Run ./dotest.py -p TestMultithreaded.py -A x86_64 -C gcc4.9.2

Reviewers: vharron, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 241202

9 years ago[analyzer] Prevent ccc/c++-analyzer from hanging on Windows.
Anton Yartsev [Wed, 1 Jul 2015 22:35:29 +0000 (22:35 +0000)]
[analyzer] Prevent ccc/c++-analyzer from hanging on Windows.

'fork'+'exec' combination made scan-build and ccc-analyzer hang under Windows. The patch replaces 'fork'+'exec' with more reliable 'system' (ccc-analyzer) and piped 'open' (scan-build). See http://reviews.llvm.org/D8774 and http://reviews.llvm.org/D9357 for more details.

llvm-svn: 241201

9 years agoTest for specific output in lit test
Matthias Braun [Wed, 1 Jul 2015 22:34:59 +0000 (22:34 +0000)]
Test for specific output in lit test

llvm-svn: 241200

9 years ago[SEH] Update EmitCapturedLocals to match r241187
Reid Kleckner [Wed, 1 Jul 2015 22:33:45 +0000 (22:33 +0000)]
[SEH] Update EmitCapturedLocals to match r241187

It was still using frameaddress(1) to get the parent FP, even though it
had the value it wanted as a parameter.

llvm-svn: 241199

9 years agoCOFF: Chagne weak alias' type from SymbolBody** to SymbolBody*. NFC.
Rui Ueyama [Wed, 1 Jul 2015 22:32:23 +0000 (22:32 +0000)]
COFF: Chagne weak alias' type from SymbolBody** to SymbolBody*. NFC.

llvm-svn: 241198

9 years ago[LoopVectorize] Use ReplaceInstWithInst() helper where appropriate.
Alexey Samsonov [Wed, 1 Jul 2015 22:18:30 +0000 (22:18 +0000)]
[LoopVectorize] Use ReplaceInstWithInst() helper where appropriate.

This is mostly an NFC, which increases code readability (instead of
saving old terminator, generating new one in front of old, and deleting
old, we just call a function). However, it would additionaly copy
the debug location from old instruction to replacement, which
would help PR23837.

llvm-svn: 241197

9 years agoPack MCSymbol::Flags in to the bitfield with other members. NFC.
Pete Cooper [Wed, 1 Jul 2015 21:57:51 +0000 (21:57 +0000)]
Pack MCSymbol::Flags in to the bitfield with other members.  NFC.

All file formats only needed 16-bits right now which is enough to fit
in to the padding with other fields.

This reduces the size of MCSymbol to 24-bytes on a 64-bit system.  The
layout is now

   0 | class llvm::MCSymbol
   0 |   class llvm::PointerIntPair SectionOrFragmentAndHasName
   0 |     intptr_t Value
     |   [sizeof=8, dsize=8, align=8
     |    nvsize=8, nvalign=8]

   8 |   unsigned int IsTemporary
   8 |   unsigned int IsRedefinable
   8 |   unsigned int IsUsed
   8 |   _Bool IsRegistered
   8 |   unsigned int IsExternal
   8 |   unsigned int IsPrivateExtern
   8 |   unsigned int Kind
   9 |   unsigned int IsUsedInReloc
   9 |   unsigned int SymbolContents
   9 |   unsigned int CommonAlignLog2
  10 |   uint32_t Flags
  12 |   uint32_t Index
  16 |   union
  16 |     uint64_t Offset
  16 |     uint64_t CommonSize
  16 |     const class llvm::MCExpr * Value
     |   [sizeof=8, dsize=8, align=8
     |    nvsize=8, nvalign=8]

     | [sizeof=24, dsize=24, align=8
     |  nvsize=24, nvalign=8]

llvm-svn: 241196

9 years ago[Sema] Range-loopify InititializationSequence destructor. NFC intended.
Davide Italiano [Wed, 1 Jul 2015 21:51:58 +0000 (21:51 +0000)]
[Sema] Range-loopify InititializationSequence destructor. NFC intended.

llvm-svn: 241195

9 years ago[ELF] Make OutputSection::memSize `const` member function. NFC
Simon Atanasyan [Wed, 1 Jul 2015 21:44:55 +0000 (21:44 +0000)]
[ELF] Make OutputSection::memSize `const` member function. NFC

llvm-svn: 241194

9 years ago[WebAssembly] Define separate Target instances for 32-bit and 64-bit.
Dan Gohman [Wed, 1 Jul 2015 21:42:34 +0000 (21:42 +0000)]
[WebAssembly] Define separate Target instances for 32-bit and 64-bit.

llvm-svn: 241193

9 years ago[ELF/AArch64] Initial General-dynamic TLS support
Adhemerval Zanella [Wed, 1 Jul 2015 21:35:39 +0000 (21:35 +0000)]
[ELF/AArch64] Initial General-dynamic TLS support

This patch adds initial general-dynamic TLS support for AArch64.  Currently
no optimization is done to realx for more performance-wise models (initial-exec
or local-exec).  This patch also only currently handles correctly executable
generation, although priliminary DSO support through PLT specific creation
is also added.

With this change clang/llvm bootstrap with lld is possible in static configuration
(some DSO creation fails due missing Linker script support, not AArch64 specific),
although make check also shows some issues.

llvm-svn: 241192

9 years ago[NVPTX] expand extload/truncstore for vectors of floats
Jingyue Wu [Wed, 1 Jul 2015 21:32:42 +0000 (21:32 +0000)]
[NVPTX] expand extload/truncstore for vectors of floats

Summary:
According to PTX ISA:

For convenience, ld, st, and cvt instructions permit source and destination data operands to be wider than the instruction-type size, so that narrow values may be loaded, stored, and converted using regular-width registers. For example, 8-bit or 16-bit values may be held directly in 32-bit or 64-bit registers when being loaded, stored, or converted to other types and sizes. The operand type checking rules are relaxed for bit-size and integer (signed and unsigned) instruction types; floating-point instruction types still require that the operand type-size matches exactly, unless the operand is of bit-size type.

So, the ISA does not support load with extending/store with truncatation for floating numbers. This is reflected in setting the loadext/truncstore actions to expand in the code for floating numbers, but vectors of floating numbers are not taken care of.

As a result, loading a vector of floats followed by a fp_extend may be combined by DAGCombiner to a extload, and the extload may be lowered to NVPTXISD::LoadV2 with extending information. However, NVPTXISD::LoadV2 does not perform extending, and no extending instructions are inserted. Finally, PTX instructions with mismatched types are generated, like
ld.v2.f32 {%fd3, %fd4}, [%rd2]

This patch adds the correct actions for vectors of floats, so DAGCombiner would not create loads with extending, and correct code is generated.

Patched by Gang Hu.

Test Plan: Test case attached.

Reviewers: jingyue

Reviewed By: jingyue

Subscribers: llvm-commits, jholewinski

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

llvm-svn: 241191

9 years agoNoticed that std::allocator<const T> was missing the definition for is_always_equal...
Marshall Clow [Wed, 1 Jul 2015 21:23:40 +0000 (21:23 +0000)]
Noticed that std::allocator<const T> was missing the definition for is_always_equal. Fixed this, and added a test for it.

llvm-svn: 241190

9 years agoEncode MCSymbol alignment as log2(align).
Pete Cooper [Wed, 1 Jul 2015 21:07:03 +0000 (21:07 +0000)]
Encode MCSymbol alignment as log2(align).

Given that alignments are always powers of 2, just encode it this way.

This matches how we encode alignment on IR GlobalValue's for example.

This compresses the CommonAlign member down to 5 bits which allows it
to pack better with the surrounding fields.

Reviewed by Duncan Exon Smith.

llvm-svn: 241189

9 years agoclang-format: Support member function reference qualifiers with
Daniel Jasper [Wed, 1 Jul 2015 21:02:24 +0000 (21:02 +0000)]
clang-format: Support member function reference qualifiers with
trailing return types.

Before:
  template <typename T>
      auto x() & -> int {}

After:
  template <typename T>
  auto x() & -> int {}

llvm-svn: 241188

9 years ago[SEH] Delete the 32-bit IR lowering for __finally blocks and use x64
Reid Kleckner [Wed, 1 Jul 2015 21:00:00 +0000 (21:00 +0000)]
[SEH] Delete the 32-bit IR lowering for __finally blocks and use x64

32-bit finally funclets are intended to be called both directly from the
parent function and indirectly from the EH runtime. Because we aren't
contorting LLVM's X86 prologue to match MSVC's, calling the finally
block directly passes in a different value of EBP than the one that the
runtime provides. We need an adapter thunk to adjust EBP to the expected
value. However, WinEHPrepare already has to solve this problem when
cleanups are not pre-outlined, so we can go ahead and rely on it rather
than duplicating work.

Now we only do the llvm.x86.seh.recoverfp dance for 32-bit SEH filter
functions.

llvm-svn: 241187

9 years ago[WinEH] Use llvm.x86.seh.recoverfp in WinEHPrepare
Reid Kleckner [Wed, 1 Jul 2015 20:59:25 +0000 (20:59 +0000)]
[WinEH] Use llvm.x86.seh.recoverfp in WinEHPrepare

Don't pattern match for frontend outlined finally calls on non-x64
platforms. The 32-bit runtime uses a different funclet prototype.  Now,
the frontend is pre-outlining the finally bodies so that it ends up
doing most of the heavy lifting for variable capturing. We're just
outlining the callsite, and adapting the frameaddress(0) call to line up
the frame pointer recovery.

llvm-svn: 241186

9 years ago[NVPTX] Move NVPTXPeephole after NVPTXPrologEpilogPass
Jingyue Wu [Wed, 1 Jul 2015 20:08:06 +0000 (20:08 +0000)]
[NVPTX] Move NVPTXPeephole after NVPTXPrologEpilogPass

Summary:
Offset of frame index is calculated by NVPTXPrologEpilogPass. Before
that the correct offset of stack objects cannot be obtained, which
leads to wrong offset if there are more than 2 frame objects. This patch
move NVPTXPeephole after NVPTXPrologEpilogPass. Because the frame index
is already replaced by %VRFrame in NVPTXPrologEpilogPass, we check
VRFrame register instead, and try to remove the VRFrame if there
is no usage after NVPTXPeephole pass.

Patched by Xuetian Weng.

Test Plan:
Strengthened test/CodeGen/NVPTX/local-stack-frame.ll to check the
offset calculation based on SP and SPL.

Reviewers: jholewinski, jingyue

Reviewed By: jingyue

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 241185

9 years agoWhen I introduced hard-coded formatters, I made them non-cacheable
Enrico Granata [Wed, 1 Jul 2015 20:06:40 +0000 (20:06 +0000)]
When I introduced hard-coded formatters, I made them non-cacheable

This is because - in theory - the formatter could match on not just the type, but also other properties of a ValueObject, so a per-type caching would not be a good thing
On the other hand, that is not always true - sometimes the matching truly is per-type

So, introduce a non-cacheable attribute on formatters that decides whether a formatter should or should not be cached. That way, the few formatters that don't want themselves cached can do so, but most formatters (including most hard-coded ones) can cache themselves just fine

llvm-svn: 241184

9 years ago[PPC64LE] Enable missing lxvdsx optimization, and related swap optimization
Bill Schmidt [Wed, 1 Jul 2015 19:40:07 +0000 (19:40 +0000)]
[PPC64LE] Enable missing lxvdsx optimization, and related swap optimization

When adding little-endian vector support for PowerPC last year, I
inadvertently disabled an optimization that recognizes a load-splat
idiom and generates the lxvdsx instruction.  This patch moves the
offending logic so lxvdsx is once again generated.

This pattern is frequently generated by the vectorizer for scalar
loads of an effective constant.  Previously the lxvdsx instruction was
wrongly listed as lane-sensitive for the VSX swap optimization (since
both doublewords are identical, swaps are safe).  This patch fixes
this as well, so that vectorized code using lxvdsx can now have swaps
removed from the computation.

There is an existing test (@test50) in test/CodeGen/PowerPC/vsx.ll
that checks for the missing optimization.  However, vsx.ll was only
being tested for POWER7 with big-endian code generation.  I've added
a little-endian RUN statement and expected LE code generation for all
the tests in vsx.ll to give us a bit better VSX coverage, including
what's needed for this patch.

llvm-svn: 241183

9 years ago[modules] Don't make out-of-line member specializations of an instantiated
Richard Smith [Wed, 1 Jul 2015 19:32:54 +0000 (19:32 +0000)]
[modules] Don't make out-of-line member specializations of an instantiated
class template specialization visible just because the class template
specialization's definition is visible.

llvm-svn: 241182

9 years agoAdd a missing space.
Jim Ingham [Wed, 1 Jul 2015 19:27:08 +0000 (19:27 +0000)]
Add a missing space.

llvm-svn: 241181

9 years ago[modules] Skip trailing attributes when skipping a class definition during parse...
Richard Smith [Wed, 1 Jul 2015 18:56:50 +0000 (18:56 +0000)]
[modules] Skip trailing attributes when skipping a class definition during parse-merging.

llvm-svn: 241180

9 years agoadd a cl::opt override for TargetLoweringBase's JumpIsExpensive
Sanjay Patel [Wed, 1 Jul 2015 18:10:20 +0000 (18:10 +0000)]
add a cl::opt override for TargetLoweringBase's JumpIsExpensive

This patch is not intended to change existing codegen behavior for any target.
It just exposes the JumpIsExpensive setting on the command-line to allow for
easier testing and emergency overrides.

Also, change the existing regression test to use FileCheck, explicitly specify
the jump-is-expensive option, and use more precise checks.

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

llvm-svn: 241179

9 years agoDisallow in-source builds (as we already do for the cmake build).
Jonathan Roelofs [Wed, 1 Jul 2015 18:09:21 +0000 (18:09 +0000)]
Disallow in-source builds (as we already do for the cmake build).

http://reviews.llvm.org/D10614

llvm-svn: 241178

9 years agoRevert "[DebugInfo] Fix debug info generation for function static variables, typedefs...
David Blaikie [Wed, 1 Jul 2015 18:07:22 +0000 (18:07 +0000)]
Revert "[DebugInfo] Fix debug info generation for function static variables, typedefs, and records"

Caused PR24008.

This reverts commit r241154.

llvm-svn: 241177

9 years agoRevert "[DWARF] Fix debug info generation for function static variables, typedefs...
David Blaikie [Wed, 1 Jul 2015 18:07:16 +0000 (18:07 +0000)]
Revert "[DWARF] Fix debug info generation for function static variables, typedefs, and records"

Caused PR24008

This reverts commit 37cb5f1c2db9f42d29f26b215585f56bb64ae4f5.

llvm-svn: 241176

9 years agofix formatting; NFC
Sanjay Patel [Wed, 1 Jul 2015 17:58:53 +0000 (17:58 +0000)]
fix formatting; NFC

llvm-svn: 241175

9 years agofix typos in comment; NFC
Sanjay Patel [Wed, 1 Jul 2015 17:55:07 +0000 (17:55 +0000)]
fix typos in comment; NFC

llvm-svn: 241174

9 years agoFix typo in comment.
Dawn Perchik [Wed, 1 Jul 2015 17:41:02 +0000 (17:41 +0000)]
Fix typo in comment.

llvm-svn: 241173

9 years agoLivePhysRegs: Add support to add pristine registers when populating with live-in...
Matthias Braun [Wed, 1 Jul 2015 17:17:17 +0000 (17:17 +0000)]
LivePhysRegs: Add support to add pristine registers when populating with live-in/live-out registers.

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

llvm-svn: 241172

9 years ago[SEH] Add 32-bit lowering for SEH __try
Reid Kleckner [Wed, 1 Jul 2015 17:10:10 +0000 (17:10 +0000)]
[SEH] Add 32-bit lowering for SEH __try

This re-lands r236052 and adds support for __exception_code().

In 32-bit SEH, the exception code is not available in eax. It is only
available in the filter function, and now we arrange to load it and
store it into an escaped variable in the parent frame.

As a consequence, we have to disable the "catch i8* null" optimization
on 32-bit and always generate a filter function. We can re-enable the
optimization if we detect an __except block that doesn't use the
exception code, but this probably isn't worth optimizing.

Reviewers: majnemer

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

llvm-svn: 241171

9 years ago[SEH] Don't assert if the parent function lacks a personality
Reid Kleckner [Wed, 1 Jul 2015 16:45:47 +0000 (16:45 +0000)]
[SEH] Don't assert if the parent function lacks a personality

The EH code might have been deleted as unreachable and the personality
pruned while the filter is still present.  Currently I'm hitting this at
-O0 due to the clang bug PR24009.

llvm-svn: 241170

9 years ago[AsmPrinter] Hide implementation details
Benjamin Kramer [Wed, 1 Jul 2015 16:18:16 +0000 (16:18 +0000)]
[AsmPrinter] Hide implementation details

NFC.

llvm-svn: 241169

9 years agoFix OMPT event_barrer_end
Jonathan Peyton [Wed, 1 Jul 2015 15:16:04 +0000 (15:16 +0000)]
Fix OMPT event_barrer_end

The OMPT status is never equal to ompt_status_track. ompt_status_track = 0x2
and ompt_status_track_callback = 0x6 just share a bit, so that we can check
for traceing and callbacks with the same status.

Patch by Tim Cramer

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

llvm-svn: 241167

9 years ago[AArch64] Implement add/adds/sub/subs/cmp/cmn with negative immediate aliases
Arnaud A. de Grandmaison [Wed, 1 Jul 2015 15:05:58 +0000 (15:05 +0000)]
[AArch64] Implement add/adds/sub/subs/cmp/cmn with negative immediate aliases

This patch teaches the AsmParser to accept add/adds/sub/subs/cmp/cmn
with a negative immediate operand and convert them as shown:

  add  Rd, Rn, -imm -> sub  Rd, Rn, imm
  sub  Rd, Rn, -imm -> add  Rd, Rn, imm
  adds Rd, Rn, -imm -> subs Rd, Rn, imm
  subs Rd, Rn, -imm -> adds Rd, Rn, imm
  cmp  Rn, -imm     -> cmn  Rn, imm
  cmn  Rn, -imm     -> cmp  Rn, imm

Those instructions are an alternate syntax available to assembly coders,
and are needed in order to support code already compiling with some other
assemblers (gas). They are documented in the "ARMv8 Instruction Set
Overview", in the "Arithmetic (immediate)" section. This makes llvm-mc
a programmer-friendly assembler !

This also fixes PR20978: "Assembly handling of adding negative numbers
not as smart as gas".

llvm-svn: 241166

9 years ago[SDAG] Give InstrEmitter hidden visibility
Benjamin Kramer [Wed, 1 Jul 2015 14:55:10 +0000 (14:55 +0000)]
[SDAG] Give InstrEmitter hidden visibility

NFC.

llvm-svn: 241165

9 years ago[CodeGen] Reduce visibility of implementation details
Benjamin Kramer [Wed, 1 Jul 2015 14:47:39 +0000 (14:47 +0000)]
[CodeGen] Reduce visibility of implementation details

NFC.

llvm-svn: 241164

9 years ago[Sparc] Rearrange SparcInstrInfo, no change.
James Y Knight [Wed, 1 Jul 2015 14:38:07 +0000 (14:38 +0000)]
[Sparc] Rearrange SparcInstrInfo, no change.

Move some instructions into order of sections in the spec, as the rest
already were.

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

llvm-svn: 241163

9 years agoTest committed in r241153 is more target-specific than I thought.
Michael Kuperstein [Wed, 1 Jul 2015 13:45:25 +0000 (13:45 +0000)]
Test committed in r241153 is more target-specific than I thought.
Moving the (original, x86-only) test to the X86 directory.

llvm-svn: 241162

9 years agoExpand Phabricator docs slightly
Scott Douglass [Wed, 1 Jul 2015 13:41:18 +0000 (13:41 +0000)]
Expand Phabricator docs slightly

llvm-svn: 241161

9 years ago[clang-tidy] minor coding style tweak. make functions static.
Daniel Marjamaki [Wed, 1 Jul 2015 13:29:27 +0000 (13:29 +0000)]
[clang-tidy] minor coding style tweak. make functions static.

llvm-svn: 241160

9 years agoAVX-512: Implemented missing encoding for FMA scalar instructions
Igor Breger [Wed, 1 Jul 2015 13:24:28 +0000 (13:24 +0000)]
AVX-512: Implemented missing encoding for FMA scalar instructions
Added tests for encoding

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

llvm-svn: 241159

9 years agoFix non-target-specific test not to use the x86 triple.
Michael Kuperstein [Wed, 1 Jul 2015 13:05:57 +0000 (13:05 +0000)]
Fix non-target-specific test not to use the x86 triple.

llvm-svn: 241158

9 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 1 Jul 2015 12:56:33 +0000 (12:56 +0000)]
Update for llvm api change.

llvm-svn: 241157

9 years agoReturn ErrorOr from getSection.
Rafael Espindola [Wed, 1 Jul 2015 12:56:27 +0000 (12:56 +0000)]
Return ErrorOr from getSection.

This also improves the logic of what is an error:

* getSection(uint_32): only return an error if the index is out of bounds. The
  index 0 corresponds to a perfectly valid entry.
* getSection(Elf_Sym): Returns null for symbols that normally don't have
  sections and error for out of bound indexes.

In many places this just moves the report_fatal_error up the stack, but those
can then be fixed in smaller patches.

llvm-svn: 241156

9 years ago[clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr...
Alexander Kornienko [Wed, 1 Jul 2015 12:39:40 +0000 (12:39 +0000)]
[clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr...

Enhance clang-tidy readability-simplify-boolean-expr to handle 'if (e) return
true; return false;' and improve replacement expressions.

This changeset extends the simplify boolean expression check in clang-tidy to
simplify if (e) return true; return false; to return e; (note the lack of an
else clause on the if statement.) By default, chained conditional assignment is
left unchanged, unless a configuration parameter is set to non-zero to override
this behavior.

It also improves the handling of replacement expressions to apply
static_cast<bool>(expr) when expr is not of type bool.

http://reviews.llvm.org/D9810

Patch by Richard Thomson!

llvm-svn: 241155

9 years ago[DebugInfo] Fix debug info generation for function static variables, typedefs, and...
Michael Kuperstein [Wed, 1 Jul 2015 12:34:39 +0000 (12:34 +0000)]
[DebugInfo] Fix debug info generation for function static variables, typedefs, and records

Function static variables, typedefs and records (class, struct or union) declared inside
a lexical scope were associated with the function as their parent scope, rather than the
lexical scope they are defined or declared in.

This fixes PR19238

Patch by: amjad.aboud@intel.com
Differential Revision: http://reviews.llvm.org/D9760

llvm-svn: 241154

9 years ago[DWARF] Fix debug info generation for function static variables, typedefs, and records
Michael Kuperstein [Wed, 1 Jul 2015 12:33:11 +0000 (12:33 +0000)]
[DWARF] Fix debug info generation for function static variables, typedefs, and records

Function static variables, typedefs and records (class, struct or union) declared inside
a lexical scope were associated with the function as their parent scope, rather than the
lexical scope they are defined or declared in.

This fixes PR19238

Patch by: amjad.aboud@intel.com
Differential Revision: http://reviews.llvm.org/D9758

llvm-svn: 241153

9 years ago[X86] Avoid over-relaxation of 8-bit immediates in integer arithmetic instructions.
Michael Kuperstein [Wed, 1 Jul 2015 10:54:42 +0000 (10:54 +0000)]
[X86] Avoid over-relaxation of 8-bit immediates in integer arithmetic instructions.

Only consider an instruction a candidate for relaxation if the last operand of the
instruction is an expression. We previously checked whether any operand is an expression,
which is useless, since for all instructions concerned, the only operand that may be
affected by relaxation is the last one.
In addition, this removes the check for having RIP as an argument, since it was
plain wrong - even when one of the arguments is RIP, relaxation may still be needed.

This fixes PR9807.

Patch by: david.l.kreitzer@intel.com
Differential Revision: http://reviews.llvm.org/D10766

llvm-svn: 241152

9 years agoRevert part of r241149, "Fix PR23872: Integrated assembler error message when using...
NAKAMURA Takumi [Wed, 1 Jul 2015 10:28:09 +0000 (10:28 +0000)]
Revert part of r241149, "Fix PR23872: Integrated assembler error message when using .type directive with @ in AArch32 assembly."

The test should be split among targets. llvm/test/MC/ELF/ is assumed as X86.

llvm-svn: 241151

9 years ago[mips][microMIPS] Implement SLL and NOP instructions
Zoran Jovanovic [Wed, 1 Jul 2015 09:54:51 +0000 (09:54 +0000)]
[mips][microMIPS] Implement SLL and NOP instructions
http://reviews.llvm.org/D10474

llvm-svn: 241150

9 years agoFix PR23872: Integrated assembler error message when using .type directive with ...
Gabor Ballabas [Wed, 1 Jul 2015 08:58:49 +0000 (08:58 +0000)]
Fix PR23872: Integrated assembler error message when using .type directive with @ in AArch32 assembly.

The AArch32 assembler parses the '@' as a comment symbol, so the error message shouldn't suggest
that '@<type>' is a valid replacement when assembling for AArch32 target.

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

llvm-svn: 241149

9 years ago[modules] Don't require the 'inline' specifier when merging an inline function;
Richard Smith [Wed, 1 Jul 2015 07:24:18 +0000 (07:24 +0000)]
[modules] Don't require the 'inline' specifier when merging an inline function;
any source of the inline nature is sufficient.

llvm-svn: 241146

9 years ago[OPENMP 4.0] Initial support for 'omp cancellation point' construct.
Alexey Bataev [Wed, 1 Jul 2015 06:57:41 +0000 (06:57 +0000)]
[OPENMP 4.0] Initial support for 'omp cancellation point' construct.

Add parsing and sema analysis for 'omp cancellation point' directive.

llvm-svn: 241145

9 years agoFix a couple of unused variables in no-asserts
Justin Bogner [Wed, 1 Jul 2015 05:41:50 +0000 (05:41 +0000)]
Fix a couple of unused variables in no-asserts

llvm-svn: 241144

9 years ago[LoopUnroll] Use undef for phis with no value live
David Majnemer [Wed, 1 Jul 2015 05:38:07 +0000 (05:38 +0000)]
[LoopUnroll] Use undef for phis with no value live

We would create a phi node with a zero initialized operand instead of
undef in the case where no value was originally available.  This was
problematic for x86_mmx which has no null value.

llvm-svn: 241143

9 years ago[SCCP] Turn loads of null into undef instead of zero initialized values
David Majnemer [Wed, 1 Jul 2015 05:37:57 +0000 (05:37 +0000)]
[SCCP] Turn loads of null into undef instead of zero initialized values

Surprisingly, this is a correctness issue: the mmx type exists for
calling convention purposes, LLVM doesn't have a zero representation for
them.

This partially fixes PR23999.

llvm-svn: 241142

9 years ago-frewrite-includes: Prefer insert to emplace
Justin Bogner [Wed, 1 Jul 2015 04:53:19 +0000 (04:53 +0000)]
-frewrite-includes: Prefer insert to emplace

Some bots didn't like r241140.

llvm-svn: 241141

9 years ago-frewrite-includes: Rework how includes and modules are differentiated
Justin Bogner [Wed, 1 Jul 2015 04:40:10 +0000 (04:40 +0000)]
-frewrite-includes: Rework how includes and modules are differentiated

The map of FileChange structs here was storing two disjoint types of
information:

1. A pointer to the Module that an #include directive implicitly
   imported

2. A FileID and FileType for an included file. These would be left
   uninitialized in the Module case.

This change splits these two kinds of information into their own maps,
which both simplifies how we access either and avoids the undefined
behaviour we were hitting due to the uninitialized fields in the
included file case.

Mostly NFC, but fixes some errors found by self-host with ubsan.

llvm-svn: 241140

9 years ago[NaryReassociate] enhances nsw by leveraging @llvm.assume
Jingyue Wu [Wed, 1 Jul 2015 03:38:49 +0000 (03:38 +0000)]
[NaryReassociate] enhances nsw by leveraging @llvm.assume

Summary:
nsw are flaky and can often be removed by optimizations. This patch enhances
nsw by leveraging @llvm.assume in the IR. Specifically, NaryReassociate now
understands that

    assume(a + b >= 0) && assume(a >= 0) ==> a +nsw b

As a result, it can split more sext(a + b) into sext(a) + sext(b) for CSE.

Test Plan: nary-gep.ll

Reviewers: broune, meheff

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 241139

9 years agoGetting started docs: https, and check signature
JF Bastien [Wed, 1 Jul 2015 03:32:08 +0000 (03:32 +0000)]
Getting started docs: https, and check signature

Summary: Download should be over https, not insecure ftp at least for the signature and key files. The signature should also get verified.

Test Plan: None

Reviewers: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 241138

9 years ago[modules] Before checking whether the controlling macro of a header is defined,
Richard Smith [Wed, 1 Jul 2015 02:29:35 +0000 (02:29 +0000)]
[modules] Before checking whether the controlling macro of a header is defined,
update the identifier in case we've imported a definition of the macro (and
thus the contents of the header) from a module.

Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer
makes sense to keep these separate now that the only user of the former also
needs the latter.

llvm-svn: 241137

9 years agoCodeGen: Do not give local-linkage functions externally available linkage, even tempo...
Peter Collingbourne [Wed, 1 Jul 2015 02:10:26 +0000 (02:10 +0000)]
CodeGen: Do not give local-linkage functions externally available linkage, even temporarily.

When an internal-linkage thunk is code gen'd, CodeGenVTables::emitThunk
will first be called with ForVTable=true (which incorrectly set the
thunk's linkage to available_externally under the Itanium ABI) and later
with ForVTable=false (which reset it to internal). Because we will always
see a call with ForVTable=false, this incorrect linkage never ended up in
the final IR. However, the temporary presence of this linkage caused us
to give such functions a comdat as a result of code introduced in r241102.
To avoid this, check that the thunk is externally visible before giving it
available_externally linkage.

llvm-svn: 241136

9 years ago[modules] Make the include guard optimization fire a bit more when considering
Richard Smith [Wed, 1 Jul 2015 01:51:38 +0000 (01:51 +0000)]
[modules] Make the include guard optimization fire a bit more when considering
re-entering a modular header.

When we do the include guard check, we're in the visibility state for the file
with the #include; the include guard may not be visible there, but we don't
actually need it to be: if we've already parsed the submodule we're considering
entering, it's always safe to skip it.

llvm-svn: 241135

9 years agoUse a stable sort to guarantee target feature ordering in the IR
Eric Christopher [Wed, 1 Jul 2015 01:07:12 +0000 (01:07 +0000)]
Use a stable sort to guarantee target feature ordering in the IR
in order to make testing somewhat more feasible. Has the advantage
of making it easier to find target features as well.

llvm-svn: 241134

9 years agoCodeGen: Resize LifetimeExtendedCleanupHeader to avoid alignment issues
Justin Bogner [Wed, 1 Jul 2015 00:59:27 +0000 (00:59 +0000)]
CodeGen: Resize LifetimeExtendedCleanupHeader to avoid alignment issues

The LifetimeExtendedCleanupHeader is carefully fit into 32 bytes,
meaning that cleanups on the LifetimeExtendedCleanupStack are *always*
allocated at a misaligned address and cause undefined behaviour.

There are two ways to solve this - add padding after the header when
we allocated our cleanups, or just simplify the header and let it use
64 bits in the first place. I've opted for the latter, and added a
static assert to avoid the issue in the future.

llvm-svn: 241133

9 years agoRename ClangUserExpression members to avoid confusion with language.
Dawn Perchik [Wed, 1 Jul 2015 00:54:02 +0000 (00:54 +0000)]
Rename ClangUserExpression members to avoid confusion with language.

The new names clarify that the members have to do with the execution
context and not the language.  For example, m_cplusplus was renamed to
m_in_cplusplus_method.

llvm-svn: 241132

9 years ago[Sema] Don't crash when deduction fails for decltype(auto)
David Majnemer [Wed, 1 Jul 2015 00:29:28 +0000 (00:29 +0000)]
[Sema] Don't crash when deduction fails for decltype(auto)

We didn't check the return result of BuildDecltypeType, resulting in us
crashing when we tried to grab the canonical version of the type.

This fixes PR23995.

llvm-svn: 241131