Commit Graph

186481 Commits

Author SHA1 Message Date
Aaron Ballman 106fd7bed5 Fixing more -Wcast-qual warnings; NFC.
llvm-svn: 221782
2014-11-12 14:01:17 +00:00
Aaron Ballman 7a7b144117 Fixing a -Wcast-qual warning; NFC.
llvm-svn: 221781
2014-11-12 13:55:27 +00:00
Zoran Jovanovic fd888630b5 [mips][micromips] Add predicate 'InMicroMips' at CodeGen patterns for microMIPS instructions
Differential Revision: http://reviews.llvm.org/D6198

llvm-svn: 221780
2014-11-12 13:30:10 +00:00
Chandler Carruth 0c922fcec5 [x86] Start improving the matching of unpck instructions based on test
cases from Halide folks. This initial step was extracted from
a prototype change by Clay Wood to try and address regressions found
with Halide and the new vector shuffle lowering.

llvm-svn: 221779
2014-11-12 10:05:18 +00:00
Jay Foad 9b70a919db [ASan] Skip dump_instruction_bytes test on non-x86 targets
Summary: This test case is blatantly x86-specific, so skip it on other targets.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221778
2014-11-12 09:45:40 +00:00
Jay Foad 854655886b [ASan] Skip ptrace test on non-x86 targets
Summary:
Address sanitization of ptrace(2) is only implemented for x86, so skip
the test on other targets.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221777
2014-11-12 09:42:01 +00:00
Chandler Carruth ce6947d4cf [x86] Clean up a bunch of vector shuffle tests with my script. Notably,
removes windows line endings and other noise. This is in prelude to
making substantive changes to these tests.

llvm-svn: 221776
2014-11-12 09:17:15 +00:00
NAKAMURA Takumi c06606a98c MCDisassembler::getInstruction():: Prune also "\param Region", since it was removed in r221751. [-Wdocumentation]
llvm-svn: 221775
2014-11-12 07:42:26 +00:00
Elena Demikhovsky be8808dc3f AVX-512: Intrinsics for ERI
3 instructions: vrcp28, vrsqrt28, vexp2, only vector forms.
Intrinsics include SAE (Suppres All Exceptions) parameter.

http://reviews.llvm.org/D6214

llvm-svn: 221774
2014-11-12 07:31:03 +00:00
Jingyue Wu a48273390c Reverts r221772 which fails tests
llvm-svn: 221773
2014-11-12 07:19:25 +00:00
Jingyue Wu 635a9b14fa Disable indvar widening if arithmetics on the wider type are more expensive
Summary:
IndVarSimplify should not widen an indvar if arithmetics on the wider
indvar are more expensive than those on the narrower indvar. For
instance, although NVPTX64 treats i64 as a legal type, an ADD on i64 is
twice as expensive as that on i32, because the hardware needs to
simulate a 64-bit integer using two 32-bit integers.

Split from D6188, and based on D6195 which adds NVPTXTargetTransformInfo.

Fixes PR21148.

Test Plan:
Added @indvar_32_bit that verifies we do not widen an indvar if the arithmetics
on the wider type are more expensive.

Reviewers: jholewinski, eliben, meheff, atrick

Reviewed By: atrick

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 221772
2014-11-12 06:58:45 +00:00
Nico Weber 83a63877dc Mark TypeDecls used in explicit destructor calls as referenced.
Fixes PR21221. Patch by Axel Naumann, test by me.

llvm-svn: 221771
2014-11-12 04:33:52 +00:00
Rafael Espindola d6bce443d7 Delete dead code. NFC.
llvm-svn: 221770
2014-11-12 04:31:19 +00:00
Richard Trieu b6b141d601 delete => delete[] for arrays.
llvm-svn: 221769
2014-11-12 04:19:57 +00:00
Bill Schmidt 9ec8cea02b [PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New code in altivec.h defines these in terms of new builtins, which
are themselves defined in BuiltinsPPC.def.  The builtins are converted
to LLVM intrinsics in CGBuiltin.cpp.  Additional code is added to
builtins-ppc-vsx.c to verify the correct generation of the intrinsics.

Note that I moved the other VSX builtins so all VSX builtins will be
alphabetical in their own section in BuiltinsPPC.def.

There is a companion patch for LLVM.

llvm-svn: 221768
2014-11-12 04:19:56 +00:00
Bill Schmidt 729547847f [PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New LLVM intrinsics are provided to represent these four instructions
in IntrinsicsPowerPC.td.  These are patterned after the similar
intrinsics for lvx and stvx (Altivec).  In PPCInstrVSX.td, these
intrinsics are tied to the code gen patterns, with additional patterns
to allow plain vanilla loads and stores to still generate these
instructions.

At -O1 and higher the intrinsics are immediately converted to loads
and stores in InstCombineCalls.cpp.  This will open up more
optimization opportunities while still allowing the correct
instructions to be generated.  (Similar code exists for aligned
Altivec loads and stores.)

The new intrinsics are added to the code that checks for consecutive
loads and stores in PPCISelLowering.cpp, as well as to
PPCTargetLowering::getTgtMemIntrinsic().

There's a new test to verify the correct instructions are generated.
The loads and stores tend to be reordered, so the test just counts
their number.  It runs at -O2, as it's not very effective to test this
at -O0, when many unnecessary loads and stores are generated.

I ended up having to modify vsx-fma-m.ll.  It turns out this test case
is slightly unreliable, but I don't know a good way to prevent
problems with it.  The xvmaddmdp instructions read and write the same
register, which is one of the multiplicands.  Commutativity allows
either to be chosen.  If the FMAs are reordered differently than
expected by the test, the register assignment can be different as a
result.  Hopefully this doesn't change often.

There is a companion patch for Clang.

llvm-svn: 221767
2014-11-12 04:19:40 +00:00
Rafael Espindola 79e1f9ff99 Merge StreamableMemoryObject into MemoryObject.
Every MemoryObject is a StreamableMemoryObject since the removal of
StringRefMemoryObject, so just merge the two.

I will clean up the MemoryObject interface in the upcoming commits.

llvm-svn: 221766
2014-11-12 03:55:46 +00:00
Nico Weber 28309185b2 Mark TypeDecls used in member initializers as referenced.
Without this, -Wunused-local-typedef would incorrectly warn on the two typedefs
in this program:

void foo() {
  struct A {};
  struct B : public A {
    typedef A INHERITED;
    B() : INHERITED() {}

    typedef B SELF;
    B(int) : SELF() {}
  };
}

llvm-svn: 221765
2014-11-12 03:52:25 +00:00
Nico Weber aa0117c628 clang-format a few lines, fixes one 80col violation. nfc.
llvm-svn: 221764
2014-11-12 03:44:43 +00:00
David Blaikie e645e40ac2 Fix non-variadic function_ref cases to match r221753
llvm-svn: 221763
2014-11-12 03:28:57 +00:00
Rafael Espindola ada304d4dd Don't duplicate name in comments. NFC.
llvm-svn: 221762
2014-11-12 03:25:45 +00:00
Rafael Espindola d0692a2868 Revert "Use a function_ref now that it works (r221753)."
This reverts commit r221756.

David Blaikie pointed out it was unsafe.

llvm-svn: 221761
2014-11-12 03:17:33 +00:00
Jason Molenda 4b0c118713 Enable armv7 core file writing for Mach-O binaries.
The problems with the dyld all image infos struct 
seems to be specific to arm64.

llvm-svn: 221760
2014-11-12 02:39:14 +00:00
Rafael Espindola 5b7bb884e6 Remove unused method. NFC.
llvm-svn: 221759
2014-11-12 02:35:31 +00:00
Rafael Espindola 5468ded718 Make readBytes pure virtual. Every real implementation has it.
llvm-svn: 221758
2014-11-12 02:30:38 +00:00
Rafael Espindola ef0482f50a Remove unused method. NFC.
llvm-svn: 221757
2014-11-12 02:27:40 +00:00
Rafael Espindola 559586b6e5 Use a function_ref now that it works (r221753).
llvm-svn: 221756
2014-11-12 02:23:37 +00:00
Rafael Espindola cac0088e91 Remove the now unused StringRefMemoryObject.h.
llvm-svn: 221755
2014-11-12 02:13:27 +00:00
Richard Smith 775118a28b Try a different workaround for GCC 4.7.2 lambda capture bug. The previous
workaround took us from wrong-code to ICE.

llvm-svn: 221754
2014-11-12 02:09:03 +00:00
David Blaikie 45dc480b75 Ensure function_refs are copyable even from non-const references
A subtle bug was found where attempting to copy a non-const function_ref
lvalue would actually invoke the generic forwarding constructor (as it
was a closer match - being T& rather than the const T& of the implicit
copy constructor). In the particular case this lead to a dangling
function_ref member (since it had referenced the function_ref passed by
value to its ctor, rather than the outer function_ref that was still
alive)

SFINAE the converting constructor to not be considered if the copy
constructor is available and demonstrate that this causes the copy to
refer to the original functor, not to the function_ref it was copied
from. (without the code change, the test would fail as Y would be
referencing X and Y() would see the result of the mutation to X, ie: 2)

llvm-svn: 221753
2014-11-12 02:06:08 +00:00
Rafael Espindola 434df0a18c Update for llvm API change.
llvm-svn: 221752
2014-11-12 02:04:31 +00:00
Rafael Espindola 7fc5b87480 Pass an ArrayRef to MCDisassembler::getInstruction.
With this patch MCDisassembler::getInstruction takes an ArrayRef<uint8_t>
instead of a MemoryObject.

Even on X86 there is a maximum size an instruction can have. Given
that, it seems way simpler and more efficient to just pass an ArrayRef
to the disassembler instead of a MemoryObject and have it do a virtual
call every time it wants some extra bytes.

llvm-svn: 221751
2014-11-12 02:04:27 +00:00
Richard Smith 2e32155b58 Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.


This is a re-commit of r219977:

r219977 was reverted in r220038 because it hit a wrong-code bug in GCC 4.7.2.
(That's gcc.gnu.org/PR56135, and affects any implicit lambda-capture of
'this' within a template.)


r219977 was a re-commit of r217995, r218011, and r218053:

r217995 was reverted in r218058 because it hit a rejects-valid bug in MSVC.
(Incorrect overload resolution in the presence of using-declarations.)
It was re-committed in r219977 with a workaround for the MSVC rejects-valid.

r218011 was a workaround for an MSVC parser bug. (Incorrect desugaring of
unbraced range-based for loop).

llvm-svn: 221750
2014-11-12 02:00:47 +00:00
Duncan P. N. Exon Smith 68caa7d34d Revert "Update for LLVM API change in r221024"
This reverts commit r221073 to match upstream revert in r221711.

llvm-svn: 221749
2014-11-12 01:59:53 +00:00
Richard Smith d8a52a7831 PR21536: Fix a corner case where we'd get confused by a pack expanding into the
penultimate parameter of a template parameter list, where the last parameter is
itself a pack, and build a bogus empty final pack argument.

llvm-svn: 221748
2014-11-12 01:43:45 +00:00
Nick Kledzik f44dbda542 Object, support both mach-o archive t.o.c file names
For historical reasons archives on mach-o have two possible names for the 
file containing the table of contents for the archive: "__.SYMDEF SORTED" 
and "__.SYMDEF".  But the libObject archive reader only supported the former.

This patch fixes llvm::object::Archive to support both names.

llvm-svn: 221747
2014-11-12 01:37:45 +00:00
Rafael Espindola 35a12a85a1 Remove a bit of dead code.
Every "real" object file implements this an ptx doesn't use it.

llvm-svn: 221746
2014-11-12 01:27:22 +00:00
Richard Smith 17c00b4328 Fix this code to follow the coding style regarding anonymous namespaces and
static functions. Make a bunch of file-local functions static. Remove one
unused static function revealed by this.

llvm-svn: 221745
2014-11-12 01:24:00 +00:00
Douglas Gregor 64c7d45292 Make Sema::CollectMultipleMethodsInGlobalPool() public.
It's useful for out-of-tree clients to be able to query the global
Objective-C method pool, and only Sema can do that right now.

llvm-svn: 221744
2014-11-12 01:12:47 +00:00
Jason Molenda 229525848a Sketch out the armv7 and arm64 core file writing support in
ObjectFileMachO.  It's close but we seem to be missing some
of the memory region segments - not exactly sure how that's
happening.  The register context writing into the LC_THREAD
load commands is working correctly though.

Slightly reordered the arm64 definitions in ArchSpec.cpp so
when we look for an arm64 core file definiton we're getting
a cpu subtype of CPU_ANY which we can't put in the mach
header of a core file.  Make the first definition we find by
linear search have the currently correct '1' cpu subtype.

llvm-svn: 221743
2014-11-12 01:11:36 +00:00
Philip Reames 319c48eb2d Extend intrinsic name mangling to support arrays, named structs, and function types.
Currently, we have a type parameter mechanism for intrinsics. Rather than having to specify a separate intrinsic for each combination of argument and return types, we can specify a single intrinsic with one or more type parameters. These type parameters are passed explicitly to Intrinsic::getDeclaration or can be specified implicitly in the naming of the intrinsic function in an LL file.

Today, the types are limited to integer, floating point, and pointer types. With a goal of supporting symbolic targets for patchpoints and statepoints, this change adds support for function types.  The change also includes support for first class aggregate types (named structures and arrays) since these appear in function types we've encountered.  

Reviewed by: atrick, ributzka
Differential Revision: http://reviews.llvm.org/D4608

llvm-svn: 221742
2014-11-12 00:21:51 +00:00
NAKAMURA Takumi 12fb0057d1 clang/test/CodeGenCXX/debug-info-cxx1y.cpp: Add %itanium_abi_triple for incompatible MS targets.
llvm-svn: 221741
2014-11-11 23:51:53 +00:00
Matt Arsenault ea8df3a141 Make TreePattern::error use Twine
The underlying error function already uses a Twine,
and most of the uses build up strings.

llvm-svn: 221740
2014-11-11 23:48:11 +00:00
Kostya Serebryany 4133eabb45 [clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1
Summary: If we've added poisoned paddings to a type do not emit memcpy for operator=.

Test Plan: regression tests.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221739
2014-11-11 23:38:13 +00:00
Chad Rosier f53f07046b [Reassociate] Canonicalize negative constants out of expressions.
Add support for FDiv, which was regressed by the previous commit.

llvm-svn: 221738
2014-11-11 23:36:42 +00:00
Philip Reames 66c6de61ee Canonicalize an assume(load != null) into !nonnull metadata
We currently have two ways of informing the optimizer that the result of a load is never null: metadata and assume. This change converts the second in to the former. This avoids a need to implement optimizations using both forms.

We should probably extend this basic idea to metadata of other forms; in particular, range metadata. We view is that assumes should be considered a "last resort" for when there isn't a more canonical way to represent something.

Reviewed by: Hal
Differential Revision: http://reviews.llvm.org/D5951

llvm-svn: 221737
2014-11-11 23:33:19 +00:00
Kaelyn Takata 2e764b83aa Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping the
code for calling CorrectTypo.

Includes a needed fix for non-C++ code to not choke on TypoExprs (which
also resolves a TODO from r220698).

llvm-svn: 221736
2014-11-11 23:26:58 +00:00
Kaelyn Takata 49d84328d9 Create two helpers for running the typo-correction tree transform.
One takes an Expr* and the other is a simple wrapper that takes an
ExprResult instead, and handles checking whether the ExprResult is
invalid.

Additionally, allow an optional callback that is run on the full result
of the tree transform, for filtering potential corrections based on the
characteristics of the resulting expression once all of the typos have
been replaced.

llvm-svn: 221735
2014-11-11 23:26:56 +00:00
Kaelyn Takata 5c3dc4be08 Replace MemberTypoDiags and MemberExprTypoRecovery with lambdas.
llvm-svn: 221734
2014-11-11 23:26:54 +00:00
Duncan P. N. Exon Smith c5800f68bd libLTO: Allow linker to choose context of modules and codegen
Add API for specifying which `LLVMContext` each `lto_module_t` and
`lto_code_gen_t` is in.

In particular, this enables the following flow:

    for (auto &File : Files) {
      lto_module_t M = lto_module_create_in_local_context(File...);
      querySymbols(M);
      lto_module_dispose(M);
    }

    lto_code_gen_t CG = lto_codegen_create_in_local_context();
    for (auto &File : FilesToLink) {
      lto_module_t M = lto_module_create_in_codegen_context(File..., CG);
      lto_codegen_add_module(CG, M);
      lto_module_dispose(M);
    }
    lto_codegen_compile(CG);
    lto_codegen_write_merged_modules(CG, ...);
    lto_codegen_dispose(CG);

This flow has a few benefits.

  - Only one module (two if you count the combined module in the code
    generator) is in memory at a time.

  - Metadata (and constants) from files that are parsed to query symbols
    but not linked into the code generator don't pollute the global
    context.

  - The first for loop can be parallelized, since each module is in its
    own context.

  - When the code generator is disposed, the memory from LTO gets freed.

rdar://problem/18767512

llvm-svn: 221733
2014-11-11 23:19:23 +00:00