platform/upstream/llvm.git
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

9 years agoFix sse4 for target attribute feature additions.
Eric Christopher [Wed, 1 Jul 2015 00:08:32 +0000 (00:08 +0000)]
Fix sse4 for target attribute feature additions.
This reinstates part of the hack removed in r233223, by special
casing sse4 as part of the feature additions. The notable change
here is that we consider it only as part of setting the SSE level
and not as part of the actual target features set which handles
setting the rest of the masks.

llvm-svn: 241130

9 years agoFix a TODO dealing with canonicalizing attributes on functions by
Eric Christopher [Wed, 1 Jul 2015 00:08:29 +0000 (00:08 +0000)]
Fix a TODO dealing with canonicalizing attributes on functions by
using a string map to canonicalize. Fix up a couple of testcases
that needed changing since we are no longer simply appending features
to the list, but all of their mask dependencies as well.

llvm-svn: 241129

9 years agoCOFF: Simplify SymbolTable::findLazy. NFC.
Rui Ueyama [Tue, 30 Jun 2015 23:46:52 +0000 (23:46 +0000)]
COFF: Simplify SymbolTable::findLazy. NFC.

llvm-svn: 241128

9 years ago[SanitizerCoverage] Don't add instrumentation to unreachable blocks.
Alexey Samsonov [Tue, 30 Jun 2015 23:11:45 +0000 (23:11 +0000)]
[SanitizerCoverage] Don't add instrumentation to unreachable blocks.

llvm-svn: 241127

9 years agoFix several typos in LangRef.rst related to loop unrolling metadata.
Mark Heffernan [Tue, 30 Jun 2015 22:48:51 +0000 (22:48 +0000)]
Fix several typos in LangRef.rst related to loop unrolling metadata.

llvm-svn: 241126

9 years ago[SEH] Add new intrinsics for recovering and restoring parent frames
Reid Kleckner [Tue, 30 Jun 2015 22:46:59 +0000 (22:46 +0000)]
[SEH] Add new intrinsics for recovering and restoring parent frames

The incoming EBP value established by the runtime is actually a pointer
to the end of the EH registration object, and not the true parent
function frame pointer. Clang doesn't need llvm.x86.seh.exceptioninfo
anymore because we know that the exception info pointer is at a fixed
offset from this incoming EBP.

The llvm.x86.seh.recoverfp intrinsic takes an EBP value provided by the
EH runtime and returns a pointer that is usable with llvm.framerecover.

The llvm.x86.seh.restoreframe intrinsic is inserted by the 32-bit
specific preparation pass in blocks targetted by the EH runtime. It
re-establishes any physical registers used by the parent function to
address the stack, such as the frame, base, and stack pointers.

Neither of these intrinsics correctly handle stack realignment prologues
yet, but it's possible to add that later.

Reviewers: majnemer

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

llvm-svn: 241125

9 years ago[IRBuilder] Delete unused constructor and SetInsertPoint overload.
Alexey Samsonov [Tue, 30 Jun 2015 22:38:22 +0000 (22:38 +0000)]
[IRBuilder] Delete unused constructor and SetInsertPoint overload.

llvm-svn: 241124

9 years agoFix memory leak in unittest added in r241101.
Alexey Samsonov [Tue, 30 Jun 2015 22:17:29 +0000 (22:17 +0000)]
Fix memory leak in unittest added in r241101.

llvm-svn: 241123

9 years ago[Cloning] Teach CloneModule about personality functions
David Majnemer [Tue, 30 Jun 2015 22:14:01 +0000 (22:14 +0000)]
[Cloning] Teach CloneModule about personality functions

CloneModule didn't take into account that it needed to remap the value
using values in the module.

This fixes PR23992.

llvm-svn: 241122

9 years agoFix use-after-free.
Peter Collingbourne [Tue, 30 Jun 2015 22:08:44 +0000 (22:08 +0000)]
Fix use-after-free.

llvm-svn: 241121

9 years ago[modules] Make sure macros get made visible in the top-level file if we've got
Richard Smith [Tue, 30 Jun 2015 21:29:55 +0000 (21:29 +0000)]
[modules] Make sure macros get made visible in the top-level file if we've got
local submodule visibility enabled; that top-level file might not actually be
the module includes buffer if use of prebuilt modules is disabled.

llvm-svn: 241120

9 years ago[asan] Suppress read_binary_name_regtest.c test failure on unsupported hosts.
Evgeniy Stepanov [Tue, 30 Jun 2015 21:28:55 +0000 (21:28 +0000)]
[asan] Suppress read_binary_name_regtest.c test failure on unsupported hosts.

read_binary_name_regtest.c requires seccomp kernel headers.
Make the test pass if <linux/seccomp.h> is missing.

llvm-svn: 241119

9 years ago[NVPTX] cleanups and refacotring in NVPTXFrameLowering.cpp
Jingyue Wu [Tue, 30 Jun 2015 21:28:31 +0000 (21:28 +0000)]
[NVPTX] cleanups and refacotring in NVPTXFrameLowering.cpp

Summary: NFC

Test Plan: no regression

Reviewers: wengxt

Reviewed By: wengxt

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 241118

9 years ago[MS ABI] Stick constructor closures in an IR COMDAT group
David Majnemer [Tue, 30 Jun 2015 21:23:51 +0000 (21:23 +0000)]
[MS ABI] Stick constructor closures in an IR COMDAT group

We no-longer stick linkonce_odr entities in COMDATs in the backend.
Instead, we rely on the IR COMDAT mechanism.

llvm-svn: 241117

9 years ago[FaultMaps] Let the frontend pre-select implicit null check candidates.
Sanjoy Das [Tue, 30 Jun 2015 21:22:32 +0000 (21:22 +0000)]
[FaultMaps] Let the frontend pre-select implicit null check candidates.

Summary:
This change introduces a !make.implicit metadata that allows the
frontend to pre-select the set of explicit null checks that will be
considered for transformation into implicit null checks.

The reason for not using profiling data instead of !make.implicit is
explained in the change to `FaultMaps.rst`.

Reviewers: atrick, reames, pgavlin, JosephTremoulet

Subscribers: llvm-commits

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

llvm-svn: 241116

9 years agoPack MCSymbol::HasName in to a spare bit in the section/fragment union.
Pete Cooper [Tue, 30 Jun 2015 20:54:21 +0000 (20:54 +0000)]
Pack MCSymbol::HasName in to a spare bit in the section/fragment union.

This is part of an effort to pack the average MCSymbol down to 24 bytes.

The HasName bit was pushing the size of the bitfield over to another word,
so this change uses a PointerIntPair to fit in it to unused bits of a
PointerUnion.

Reviewed by Rafael EspĂ­ndola

llvm-svn: 241115

9 years agoUse ErrorOr in getRelocationAdress.
Rafael Espindola [Tue, 30 Jun 2015 20:32:26 +0000 (20:32 +0000)]
Use ErrorOr in getRelocationAdress.

We can probably do better in this method, but this is an improvement and
enables further ErrorOr cleanups.

llvm-svn: 241114

9 years agoRevert part of r240623 (Enable memory sanitizer for PPC64) because the
Jay Foad [Tue, 30 Jun 2015 20:30:19 +0000 (20:30 +0000)]
Revert part of r240623 (Enable memory sanitizer for PPC64) because the
buildbots are still failing in check-ubsan.

llvm-svn: 241113

9 years agoImplement containsSymbol with other lower level methods.
Rafael Espindola [Tue, 30 Jun 2015 20:18:49 +0000 (20:18 +0000)]
Implement containsSymbol with other lower level methods.

llvm-svn: 241112

9 years agoMark N4508, LWG#2407, and LWG#2470 as complete. I don't see that 2470 requires any...
Marshall Clow [Tue, 30 Jun 2015 20:06:00 +0000 (20:06 +0000)]
Mark N4508, LWG#2407, and LWG#2470 as complete. I don't see that 2470 requires any changes to the library.

llvm-svn: 241111

9 years agoModified a comment about the reason for the patch (removed commented code).
Nemanja Ivanovic [Tue, 30 Jun 2015 20:01:16 +0000 (20:01 +0000)]
Modified a comment about the reason for the patch (removed commented code).

llvm-svn: 241110

9 years agoRemove Elf_Shdr_Iter. Diagnose files with invalid section header sizes.
Rafael Espindola [Tue, 30 Jun 2015 19:58:10 +0000 (19:58 +0000)]
Remove Elf_Shdr_Iter. Diagnose files with invalid section header sizes.

llvm-svn: 241109

9 years agoFixes a bug with __builtin_vsx_lxvdw4x on Little Endian systems
Nemanja Ivanovic [Tue, 30 Jun 2015 19:45:45 +0000 (19:45 +0000)]
Fixes a bug with __builtin_vsx_lxvdw4x on Little Endian systems

llvm-svn: 241108

9 years agoCOFF: Change the order of adding symbols to the symbol table.
Rui Ueyama [Tue, 30 Jun 2015 19:35:21 +0000 (19:35 +0000)]
COFF: Change the order of adding symbols to the symbol table.

Previously, the order of adding symbols to the symbol table was simple.
We have a list of all input files. We read each file from beginning of
the list and add all symbols in it to the symbol table.

This patch changes that order. Now all archive files are added to the
symbol table first, and then all the other object files are added.
This shouldn't change the behavior in single-threading, and make room
to parallelize in multi-threading.

In the first step, only lazy symbols are added to the symbol table
because archives contain only Lazy symbols. Member object files
found to be necessary are queued. In the second step, defined and
undefined symbols are added from object files. Adding an undefined
symbol to the symbol table may cause more member files to be added
to the queue. We simply continue reading all object files until the
queue is empty.

Finally, new archive or object files may be added to the queues by
object files' directive sections (which contain new command line
options).

The above process is repeated until we get no new files.

Symbols defined both in object files and in archives can make results
undeterministic. If an archive is read before an object, a new member
file gets linked, while in the other way, no new file would be added.
That is the most popular cause of an undeterministic result or linking
failure as I observed. Separating phases of adding lazy symbols and
undefined symbols makes that deterministic. Adding symbols in each
phase should be parallelizable.

llvm-svn: 241107

9 years agoMore range-based-for-loopification. NFC
Douglas Katzman [Tue, 30 Jun 2015 19:32:57 +0000 (19:32 +0000)]
More range-based-for-loopification. NFC

llvm-svn: 241106

9 years agoUse range loops. NFC.
Rafael Espindola [Tue, 30 Jun 2015 19:24:51 +0000 (19:24 +0000)]
Use range loops. NFC.

llvm-svn: 241105

9 years agoUse range loop.
Rafael Espindola [Tue, 30 Jun 2015 19:13:25 +0000 (19:13 +0000)]
Use range loop.

llvm-svn: 241104

9 years agoCOFF: Do not assign linker-weak symbols to selectany comdat sections.
Peter Collingbourne [Tue, 30 Jun 2015 19:10:31 +0000 (19:10 +0000)]
COFF: Do not assign linker-weak symbols to selectany comdat sections.

It is mandatory to specify a comdat in order to receive comdat semantics
for a symbol. We were previously getting this wrong in -function-sections
mode; linker-weak symbols were being emitted in a selectany comdat. This
change causes such symbols to use a noduplicates comdat instead, fixing
the inconsistency.

Also correct an inaccuracy in the docs.

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

llvm-svn: 241103

9 years agoCodeGen: Assign an appropriate comdat to thunks.
Peter Collingbourne [Tue, 30 Jun 2015 19:07:26 +0000 (19:07 +0000)]
CodeGen: Assign an appropriate comdat to thunks.

Previously we were not assigning a comdat to thunks in the Microsoft ABI,
which would have required us to emit these functions outside of a comdat.
(Due to an inconsistency in how we were emitting objects, we were getting this
right most of the time, but only when compiling with function sections.) This
code generator change causes us to create a comdat for each thunk.

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

llvm-svn: 241102

9 years ago[DebugInfo] Let IRBuilder::SetInsertPoint(BB::iterator) update current debug location.
Alexey Samsonov [Tue, 30 Jun 2015 19:07:20 +0000 (19:07 +0000)]
[DebugInfo] Let IRBuilder::SetInsertPoint(BB::iterator) update current debug location.

IRBuilder::SetInsertPoint(BB, BB::iterator) is an older version of
IRBuilder::SetInsertPoint(Instruction). However, the latter updates
the current debug location of emitted instruction, while the former
doesn't, which is confusing.

Unify the behavior of these methods: now they both set current debug
location to the debug location of instruction at insertion point.

The callers of IRBuilder::SetInsertPoint(BB, BB::iterator) doesn't
seem to depend on the old behavior (keeping the original debug info
location). On the contrary, sometimes they (e.g. SCEV) *should* be
updating debug info location, but don't. I'll look at gdb bots after
the commit to check that we don't regress on debug info somewhere.

This change may make line table more fine-grained, thus increasing
debug info size. I haven't observed significant increase, though:
it varies from negligible to 0.3% on several binaries and self-hosted
Clang.

This is yet another change targeted at resolving PR23837.

llvm-svn: 241101

9 years agoUse range loop.
Rafael Espindola [Tue, 30 Jun 2015 19:02:00 +0000 (19:02 +0000)]
Use range loop.

llvm-svn: 241100

9 years ago[NVPTX] Fix issue introduced in D10321
Jingyue Wu [Tue, 30 Jun 2015 18:59:19 +0000 (18:59 +0000)]
[NVPTX] Fix issue introduced in D10321

Summary:
Really check if %SP is not used in other places, instead of checking only exact
one non-dbg use.

Patched by Xuetian Weng.

Test Plan:
@foo4 in test/CodeGen/NVPTX/local-stack-frame.ll, create a case that
SP will appear twice.

Reviewers: jholewinski, jingyue

Reviewed By: jingyue

Subscribers: llvm-commits, sfantao, jholewinski

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

llvm-svn: 241099

9 years agoUpdate testcases: DICompileUnits are now created distinct by DIBuilder.
Adrian Prantl [Tue, 30 Jun 2015 18:32:50 +0000 (18:32 +0000)]
Update testcases: DICompileUnits are now created distinct by DIBuilder.

llvm-svn: 241098

9 years agoFix a fixme and make DICompileUnit a distinct node. Tested via clang.
Adrian Prantl [Tue, 30 Jun 2015 18:32:18 +0000 (18:32 +0000)]
Fix a fixme and make DICompileUnit a distinct node. Tested via clang.

llvm-svn: 241097

9 years agoFix compilation failure introduced in r241093.
Alex Lorenz [Tue, 30 Jun 2015 18:32:02 +0000 (18:32 +0000)]
Fix compilation failure introduced in r241093.

llvm-svn: 241096

9 years agoK-ballo pointed out that I missed one of the specializations of packaged_task when...
Marshall Clow [Tue, 30 Jun 2015 18:28:35 +0000 (18:28 +0000)]
K-ballo pointed out that I missed one of the specializations of packaged_task when I committed r241068. Thanks for the catch.

llvm-svn: 241095

9 years agoAdd a test of an elf file with an invalid section index.
Rafael Espindola [Tue, 30 Jun 2015 18:23:07 +0000 (18:23 +0000)]
Add a test of an elf file with an invalid section index.

We were already checking, but were missing a test.

llvm-svn: 241094

9 years agoMIR Serialization: Serialize MBB successors.
Alex Lorenz [Tue, 30 Jun 2015 18:16:42 +0000 (18:16 +0000)]
MIR Serialization: Serialize MBB successors.

This commit implements serialization of the machine basic block successors. It
uses a YAML flow sequence that contains strings that have the MBB references.
The MBB references in those strings use the same syntax as the MBB machine
operands in the machine instruction strings.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 241093

9 years agoForgot the support include file in r241091
Marshall Clow [Tue, 30 Jun 2015 18:16:12 +0000 (18:16 +0000)]
Forgot the support include file in r241091

llvm-svn: 241092

9 years agoAdd tests for LWG#2299. While doing so, I noticed that the tests we have for the...
Marshall Clow [Tue, 30 Jun 2015 18:15:41 +0000 (18:15 +0000)]
Add tests for LWG#2299. While doing so, I noticed that the tests we have for the transparent comparators don't actually call them. Fix those tests, too. Now one of them is failing, due to a missing const in <map>. Add that (twice). Next step is to do the same for <unordered_map>

llvm-svn: 241091

9 years agoRelax this test so it also works on platforms that use characters other
Adrian Prantl [Tue, 30 Jun 2015 18:05:46 +0000 (18:05 +0000)]
Relax this test so it also works on platforms that use characters other
than forward slashes as path separators.

llvm-svn: 241090

9 years agoUse copy init instead of direct init.
Rafael Espindola [Tue, 30 Jun 2015 18:04:46 +0000 (18:04 +0000)]
Use copy init instead of direct init.

llvm-svn: 241089

9 years agoUse an early exit to improve readability. (NFC)
Adrian Prantl [Tue, 30 Jun 2015 18:01:05 +0000 (18:01 +0000)]
Use an early exit to improve readability. (NFC)

llvm-svn: 241088

9 years agoMIR Printer: extract the code that prints MBB references into a new method. NFC.
Alex Lorenz [Tue, 30 Jun 2015 18:00:16 +0000 (18:00 +0000)]
MIR Printer: extract the code that prints MBB references into a new method. NFC.

This commit enables the MIR printer to reuse the code that prints MBB
references.

llvm-svn: 241087

9 years agoMIR Parser: refactor error reporting for machine instruction parser errors. NFC.
Alex Lorenz [Tue, 30 Jun 2015 17:55:00 +0000 (17:55 +0000)]
MIR Parser: refactor error reporting for machine instruction parser errors. NFC.

This commit extracts the code that reports an error that's produced by the
machine instruction parser into a new method that can be reused in other places.

llvm-svn: 241086

9 years agoMIR Parser: make the machine instruction parsing interface more consistent. NFC.
Alex Lorenz [Tue, 30 Jun 2015 17:47:50 +0000 (17:47 +0000)]
MIR Parser: make the machine instruction parsing interface more consistent. NFC.

This commit refactors the interface for machine instruction parser. It adopts
the pattern of returning a bool and passing in the result in the first argument
that is used by the other parsing methods for the the method 'parse' and the
function 'parseMachineInstr'.

llvm-svn: 241085