platform/upstream/llvm.git
9 years ago[AArch64] Fix a silent codegen fault in BUILD_VECTOR lowering.
James Molloy [Fri, 17 Oct 2014 17:06:31 +0000 (17:06 +0000)]
[AArch64] Fix a silent codegen fault in BUILD_VECTOR lowering.

We should be talking about the number of source elements, not the number of destination elements, given we know at this point that the source and dest element numbers are not the same.

While we're at it, avoid writing to std::vector::end()...

Bug found with random testing and a lot of coffee.

llvm-svn: 220051

9 years agoAdd an .arcconfig for libc++abi.
Dan Albert [Fri, 17 Oct 2014 16:48:56 +0000 (16:48 +0000)]
Add an .arcconfig for libc++abi.

llvm-svn: 220050

9 years ago[libcxxabi] Document the standalone build's requirements on llvm-config and llvm...
Eric Fiselier [Fri, 17 Oct 2014 16:32:06 +0000 (16:32 +0000)]
[libcxxabi] Document the standalone build's requirements on llvm-config and llvm sources.

The current documentation does not explain that the standalone build requires
the LLVM sources. This patch updates the documentation to reflect this
requirement and explains how to manually specify the location of the required
files.

llvm-svn: 220049

9 years agoDon't crash if find_executable return None.
Rafael Espindola [Fri, 17 Oct 2014 16:07:43 +0000 (16:07 +0000)]
Don't crash if find_executable return None.

This was crashing when trying to run the tests on Windows.

llvm-svn: 220048

9 years ago[PowerPC] Enable use of lxvw4x/stxvw4x in VSX code generation
Bill Schmidt [Fri, 17 Oct 2014 15:13:38 +0000 (15:13 +0000)]
[PowerPC] Enable use of lxvw4x/stxvw4x in VSX code generation

Currently the VSX support enables use of lxvd2x and stxvd2x for 2x64
types, but does not yet use lxvw4x and stxvw4x for 4x32 types.  This
patch adds that support.

As with lxvd2x/stxvd2x, this involves straightforward overriding of
the patterns normally recognized for lvx/stvx, with preference given
to the VSX patterns when VSX is enabled.

In addition, the logic for permitting misaligned memory accesses is
modified so that v4r32 and v4i32 are treated the same as v2f64 and
v2i64 when VSX is enabled.  Finally, the DAG generation for unaligned
loads is changed to just use a normal LOAD (which will become lxvw4x)
on P8 and later hardware, where unaligned loads are preferred over
lvsl/lvx/lvx/vperm.

A number of tests now generate the VSX loads/stores instead of
lvx/stvx, so this patch adds VSX variants to those tests.  I've also
added <4 x float> tests to the vsx.ll test case, and created a
vsx-p8.ll test case to be used for testing code generation for the
P8Vector feature.  For now, that simply tests the unaligned load/store
behavior.

This has been tested along with a temporary patch to enable the VSX
and P8Vector features, with no new regressions encountered with or
without the temporary patch applied.

llvm-svn: 220047

9 years agoMips: Only set divrem i64 to custom on 64bit
Jan Vesely [Fri, 17 Oct 2014 14:45:28 +0000 (14:45 +0000)]
Mips: Only set divrem i64 to custom on 64bit

Reviewed-by: Daniel Sanders <daniel.sanders@imgtec.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 220046

9 years agoR600: Add EG to FMA test
Jan Vesely [Fri, 17 Oct 2014 14:45:27 +0000 (14:45 +0000)]
R600: Add EG to FMA test

Reviewed-by: Tom Stellard <tom@stellard.net>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 220045

9 years agoSelectionDAG: Add sext_inreg optimizations
Jan Vesely [Fri, 17 Oct 2014 14:45:25 +0000 (14:45 +0000)]
SelectionDAG: Add sext_inreg optimizations

v2: use dyn_cast
    fixup comments
v3: use cast

Reviewed-by: Matt Arsenault <arsenm2@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 220044

9 years agoclang-format: Prefer breaking before trailing return arrows.
Daniel Jasper [Fri, 17 Oct 2014 14:37:40 +0000 (14:37 +0000)]
clang-format: Prefer breaking before trailing return arrows.

Before:
  auto SomeFunction(
      A aaaaaaaaaaaaaaaaaaaaa) const -> decltype(f(aaaaaaaaaaaaaaaaaaaaa)) {}

After:
  auto SomeFunction(A aaaaaaaaaaaaaaaaaaaaa) const
      -> decltype(f(aaaaaaaaaaaaaaaaaaaaa)) {}

llvm-svn: 220043

9 years ago[mips] Add support for COP1's Branch-On-Cond-Likely instructions
Vasileios Kalintiris [Fri, 17 Oct 2014 14:08:28 +0000 (14:08 +0000)]
[mips] Add support for COP1's Branch-On-Cond-Likely instructions

Summary: Depends on D5782

Reviewers: dsanders

Subscribers: llvm-commits

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

llvm-svn: 220042

9 years agoclang-format: [Java] Don't break immediately after "throws".
Daniel Jasper [Fri, 17 Oct 2014 13:36:14 +0000 (13:36 +0000)]
clang-format: [Java] Don't break immediately after "throws".

Before:
  public void doSooooooooooooooooooooooooooomething() throws
      LooooooooooooooooooooooooooooongException {}

After:
  public void doSooooooooooooooooooooooooooomething()
      throws LooooooooooooooooooooooooooooongException {}

llvm-svn: 220041

9 years ago[CMake] check-lld: Prune llvm-mc. It is unused.
NAKAMURA Takumi [Fri, 17 Oct 2014 12:55:58 +0000 (12:55 +0000)]
[CMake] check-lld: Prune llvm-mc. It is unused.

llvm-svn: 220040

9 years agolld/lib/Core/Error.cpp: Appease g++-4.7, corresponding to LLVM r210687.
NAKAMURA Takumi [Fri, 17 Oct 2014 12:55:49 +0000 (12:55 +0000)]
lld/lib/Core/Error.cpp: Appease g++-4.7, corresponding to LLVM r210687.

llvm-svn: 220039

9 years agoRevert r219977, "Re-commit r217995 and follow-up patches (r217997, r218011, r218053...
NAKAMURA Takumi [Fri, 17 Oct 2014 12:48:37 +0000 (12:48 +0000)]
Revert r219977, "Re-commit r217995 and follow-up patches (r217997, r218011, r218053). These were"

It broke some builders. I guess it'd be reproducible with --vg.

  Failing Tests (3):
      Clang :: CXX/except/except.spec/p1.cpp
      Clang :: SemaTemplate/instantiate-exception-spec-cxx11.cpp
      Clang :: SemaTemplate/instantiate-exception-spec.cpp

llvm-svn: 220038

9 years agoAdd explicit triple to clang/test/CodeGen/sanitize-address-field-padding.cpp, for...
NAKAMURA Takumi [Fri, 17 Oct 2014 12:48:01 +0000 (12:48 +0000)]
Add explicit triple to clang/test/CodeGen/sanitize-address-field-padding.cpp, for now. It's incompatible to ms mangling.

llvm-svn: 220037

9 years ago[mips] Add support for COP0's Branch-On-Cond-Likely instructions
Vasileios Kalintiris [Fri, 17 Oct 2014 12:38:35 +0000 (12:38 +0000)]
[mips] Add support for COP0's Branch-On-Cond-Likely instructions

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 220036

9 years ago[DSE] Remove no-data-layout-only type-based overlap checking
Hal Finkel [Fri, 17 Oct 2014 11:56:00 +0000 (11:56 +0000)]
[DSE] Remove no-data-layout-only type-based overlap checking

DSE's overlap checking contained special logic, used only when no DataLayout
was available, which inferred a complete overwrite when the pointee types were
equal. This logic seems fine for regular loads/stores, but does not work for
memcpy and friends. Instead of fixing this, I'm just removing it.
Philosophically, transformations should not contain enhanced behavior used only
when data layout is lacking (data layout should be strictly additive), and
maintaining these rarely-tested code paths seems not worthwhile at this stage.

Credit to Aliaksei Zasenka for the bug report and the diagnosis. The test case
(slightly reduced from that provided by Aliaksei) replaces the original
contents of test/Transforms/DeadStoreElimination/no-targetdata.ll -- a few
other tests have been updated to have a data layout.

llvm-svn: 220035

9 years agocomplex long double support for PowerPC
Joerg Sonnenberger [Fri, 17 Oct 2014 11:51:19 +0000 (11:51 +0000)]
complex long double support for PowerPC

llvm-svn: 220034

9 years agoOptimize Type::isStructureOrClassType() by reusing RT->getDecl().
Yaron Keren [Fri, 17 Oct 2014 11:44:44 +0000 (11:44 +0000)]
Optimize Type::isStructureOrClassType() by reusing RT->getDecl().

RecordType->getDecl() which maps to TagType::getDecl() is not a simple
accessor but a loop on redecls in getInterestingTagDecl.

isStructureOrClassType() was calling getDecl() three times performing
three times the work actually required. It is optimized by calling
RT->getDecl() once and reusing the result three times.

llvm-svn: 220033

9 years agoD5775: The new test case was missing from the preceding commit.
Artyom Skrobov [Fri, 17 Oct 2014 10:25:09 +0000 (10:25 +0000)]
D5775: The new test case was missing from the preceding commit.

llvm-svn: 220032

9 years agoD5775: Fix of assertion failure in case of non-POD unions with bitfields. Patch by...
Artyom Skrobov [Fri, 17 Oct 2014 10:22:03 +0000 (10:22 +0000)]
D5775: Fix of assertion failure in case of non-POD unions with bitfields. Patch by Evgeny Astigeevich!

llvm-svn: 220031

9 years agoUser c-tor name to fix the sanitizer test
Renato Golin [Fri, 17 Oct 2014 10:09:25 +0000 (10:09 +0000)]
User c-tor name to fix the sanitizer test

llvm-svn: 220030

9 years agoTrying to fix failing Clang sanitizer test on ARM bots
Renato Golin [Fri, 17 Oct 2014 09:40:21 +0000 (09:40 +0000)]
Trying to fix failing Clang sanitizer test on ARM bots

llvm-svn: 220029

9 years agoTowards PR21289: don't lose track of unexpanded parameter packs with
Richard Smith [Fri, 17 Oct 2014 02:46:42 +0000 (02:46 +0000)]
Towards PR21289: don't lose track of unexpanded parameter packs with
non-dependent types, in CXXScalarValueInitExprs and in the
nested-name-specifier or template arguments of a DeclRefExpr in particular.

llvm-svn: 220028

9 years agoFix bashism in build.sh.
Peter Collingbourne [Fri, 17 Oct 2014 02:20:40 +0000 (02:20 +0000)]
Fix bashism in build.sh.

llvm-svn: 220027

9 years agoBreak out of the command word parsing loop if we hit
Jason Molenda [Fri, 17 Oct 2014 02:10:33 +0000 (02:10 +0000)]
Break out of the command word parsing loop if we hit
an invalid combination of words; don't accidentally
continue trying to parse the command line.
clang static analysis fixit.

llvm-svn: 220026

9 years agoAdd #if 0 around unreachable block of code to suppress warnings.
Jason Molenda [Fri, 17 Oct 2014 01:56:57 +0000 (01:56 +0000)]
Add #if 0 around unreachable block of code to suppress warnings.
clang warnings.

llvm-svn: 220025

9 years agoAdd null-checks around getter/setter before using them.
Jason Molenda [Fri, 17 Oct 2014 01:55:08 +0000 (01:55 +0000)]
Add null-checks around getter/setter before using them.
clang static analyzer fixit.

llvm-svn: 220024

9 years agoRemove incorrect usage of JoinedOrSeparate.
Richard Smith [Fri, 17 Oct 2014 01:52:48 +0000 (01:52 +0000)]
Remove incorrect usage of JoinedOrSeparate.

llvm-svn: 220023

9 years agoA << operation would be undefined for a bit-selecting
Jason Molenda [Fri, 17 Oct 2014 01:52:30 +0000 (01:52 +0000)]
A << operation would be undefined for a bit-selecting
function because of a '1u' making it a 32-bit value
when it really needed to be a 64-bit value.  Trivial to fix
once I figured out what was going on.
clang static analzyer fixit.

llvm-svn: 220022

9 years agoAdd back commits r219835 and a fixed version of r219829.
Rafael Espindola [Fri, 17 Oct 2014 01:48:58 +0000 (01:48 +0000)]
Add back commits r219835 and a fixed version of r219829.

The only difference from r219829 is using

getOrCreateSectionSymbol(*ELFSec)

instead of

GetOrCreateSymbol(ELFSec->getSectionName())

in ELFObjectWriter which causes us to use the correct section symbol even if
we have multiple sections with the same name.

Original messages:

r219829:
Correctly handle references to section symbols.

When processing assembly like

.long .text

we were creating a new undefined symbol .text. GAS on the other hand would
handle that as a reference to the .text section.

This patch implements that by creating the section symbols earlier so that
they are visible during asm parsing.

The patch also updates llvm-readobj to print the symbol number in the relocation
dump so that the test can differentiate between two sections with the same name.

r219835:
Allow forward references to section symbols.

llvm-svn: 220021

9 years agoPR21215: Support -fmodule-map-file being specified multiple times. Support
Richard Smith [Fri, 17 Oct 2014 01:42:53 +0000 (01:42 +0000)]
PR21215: Support -fmodule-map-file being specified multiple times. Support
loading multiple module map files from the same directory.

llvm-svn: 220020

9 years ago[PPC] Adjust some PowerPC tests to account for presence/absence of VSX
Bill Schmidt [Fri, 17 Oct 2014 01:41:22 +0000 (01:41 +0000)]
[PPC] Adjust some PowerPC tests to account for presence/absence of VSX

Patch by Bill Seurer; committed on his behalf.

These test cases generate slightly different code sequences when VSX
is activated and thus fail. The update turns off VSX explicitly for
the existing checks and then adds a second set of checks for most of
them that test the VSX instruction output.

llvm-svn: 220019

9 years agoRemove always-true part of a conditional expression.
Jason Molenda [Fri, 17 Oct 2014 01:38:10 +0000 (01:38 +0000)]
Remove always-true part of a conditional expression.
clang warning.

llvm-svn: 220018

9 years agoPut #if 0 blocks around three sections of code that are intentionally
Jason Molenda [Fri, 17 Oct 2014 01:36:20 +0000 (01:36 +0000)]
Put #if 0 blocks around three sections of code that are intentionally
unreachable so we don't get warnings about them.

Completely initialize a structure instead of leaving some of its fields
potentially indeterminate (although in reality they would all be set
before use -- but the compiler warning doesn't know that).

clang warning.

llvm-svn: 220017

9 years agoAdd a test that would have found the bug in r219829.
Rafael Espindola [Fri, 17 Oct 2014 01:34:23 +0000 (01:34 +0000)]
Add a test that would have found the bug in r219829.

llvm-svn: 220016

9 years agoARM: Fix a bug which was causing convergence failure in constant-island pass.
Akira Hatanaka [Fri, 17 Oct 2014 01:31:47 +0000 (01:31 +0000)]
ARM: Fix a bug which was causing convergence failure in constant-island pass.

The bug is in ARMConstantIslands::createNewWater where the upper bound of the
new water split point is computed:

// This could point off the end of the block if we've already got constant
// pool entries following this block; only the last one is in the water list.
// Back past any possible branches (allow for a conditional and a maximally
// long unconditional).
if (BaseInsertOffset + 8 >= UserBBI.postOffset()) {
  BaseInsertOffset = UserBBI.postOffset() - UPad - 8;
  DEBUG(dbgs() << format("Move inside block: %#x\n", BaseInsertOffset));
}

The split point is supposed to be somewhere between the machine instruction that
loads from the constant pool entry and the end of the basic block, before branch
instructions. The code above is fine if the basic block is large enough and
there are a sufficient number of instructions following the machine instruction.
However, if the machine instruction is near the end of the basic block,
BaseInsertOffset can point to the machine instruction or another instruction
that precedes it, and this can lead to convergence failure.

This commit fixes this bug by ensuring BaseInsertOffset is larger than the
offset of the instruction following the constant-loading instruction.

rdar://problem/18581150

llvm-svn: 220015

9 years agoSwitch to range-based for loop. No functionality change.
Richard Smith [Fri, 17 Oct 2014 01:26:52 +0000 (01:26 +0000)]
Switch to range-based for loop. No functionality change.

llvm-svn: 220014

9 years ago[asan] the run-time part of intra-object-overflow detector (-fsanitize-address-field...
Kostya Serebryany [Fri, 17 Oct 2014 01:22:37 +0000 (01:22 +0000)]
[asan] the run-time part of intra-object-overflow detector (-fsanitize-address-field-padding=1). Note that all of this is still experimental; don't use unless you are brave.

llvm-svn: 220013

9 years agoMaking all @expectedFailure markers take an explicit bugnumber annotation. This used...
Enrico Granata [Fri, 17 Oct 2014 01:11:29 +0000 (01:11 +0000)]
Making all @expectedFailure markers take an explicit bugnumber annotation. This used to be optional, but that makes it harder to track what tests are failing for what reason. So, make it mandatory, in the form of refusing to run the test suite if annotations are missing

llvm-svn: 220012

9 years agoDon't enable the log here. It was just me debugging
Enrico Granata [Fri, 17 Oct 2014 01:09:06 +0000 (01:09 +0000)]
Don't enable the log here. It was just me debugging

llvm-svn: 220011

9 years agoRevert commit r219835 and r219829.
Rafael Espindola [Fri, 17 Oct 2014 01:06:02 +0000 (01:06 +0000)]
Revert commit r219835 and r219829.

Revert "Correctly handle references to section symbols."
Revert "Allow forward references to section symbols."

Rui found a regression I am debugging.

llvm-svn: 220010

9 years agoPer comments on PR12350, move DR244 back from 'done' to 'partial' and add tests showi...
Richard Smith [Fri, 17 Oct 2014 01:03:17 +0000 (01:03 +0000)]
Per comments on PR12350, move DR244 back from 'done' to 'partial' and add tests showing what we get wrong.

llvm-svn: 220009

9 years ago[OCaml] Add Llvm.instr_clone.
Peter Zotov [Fri, 17 Oct 2014 01:02:40 +0000 (01:02 +0000)]
[OCaml] Add Llvm.instr_clone.

llvm-svn: 220008

9 years ago[LLVM-C] Add LLVMInstructionClone.
Peter Zotov [Fri, 17 Oct 2014 01:02:34 +0000 (01:02 +0000)]
[LLVM-C] Add LLVMInstructionClone.

llvm-svn: 220007

9 years agoCodeGen: Kill FillInNullDataMemberPointers
David Majnemer [Fri, 17 Oct 2014 01:00:43 +0000 (01:00 +0000)]
CodeGen: Kill FillInNullDataMemberPointers

It exists to handle the case where base subobjects are character arrays.
This never happens.

llvm-svn: 220006

9 years agoAST: Remove dead code from RecordLayoutBuilder
David Majnemer [Fri, 17 Oct 2014 01:00:41 +0000 (01:00 +0000)]
AST: Remove dead code from RecordLayoutBuilder

No functionality change intended.

llvm-svn: 220005

9 years ago[llvm-symbolizer] Introduce the -dsym-hint option.
Alexander Potapenko [Fri, 17 Oct 2014 00:50:19 +0000 (00:50 +0000)]
[llvm-symbolizer] Introduce the -dsym-hint option.

llvm-symbolizer will consult one of the .dSYM paths passed via -dsym-hint
if it fails to find the .dSYM bundle at the default location.

llvm-svn: 220004

9 years agoAdd a few more bug IDs for x'fail test cases
Enrico Granata [Fri, 17 Oct 2014 00:47:44 +0000 (00:47 +0000)]
Add a few more bug IDs for x'fail test cases

llvm-svn: 220003

9 years agotrying to fix the new test again, this time for the clang-cmake-armv7-a15 bot
Kostya Serebryany [Fri, 17 Oct 2014 00:47:30 +0000 (00:47 +0000)]
trying to fix the new test again, this time for the clang-cmake-armv7-a15 bot

llvm-svn: 220002

9 years agoMade multi-line test case actions possible in
Sean Callanan [Fri, 17 Oct 2014 00:39:37 +0000 (00:39 +0000)]
Made multi-line test case actions possible in
the inline test cases.  This makes them much
more readable.

llvm-svn: 220001

9 years ago[CMake] lld: Introduce ${cmake_2_8_12_INTERFACE} onto each target_link_libraries...
NAKAMURA Takumi [Fri, 17 Oct 2014 00:37:49 +0000 (00:37 +0000)]
[CMake] lld: Introduce ${cmake_2_8_12_INTERFACE} onto each target_link_libraries. [PR20254]

FIXME: Dependencies should be reorganized.
llvm-svn: 220000

9 years agoR600/SI: Simplify debug printing
Matt Arsenault [Fri, 17 Oct 2014 00:36:20 +0000 (00:36 +0000)]
R600/SI: Simplify debug printing

llvm-svn: 219999

9 years ago[libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.
Eric Fiselier [Fri, 17 Oct 2014 00:31:47 +0000 (00:31 +0000)]
[libcxx] Fix SFINAE in <cmath>. Patch from K-Ballo.

Delay instantiation of `__numeric_type` within <cmath>,
don't instantiate it when the `is_arithmetic` conditions do not hold as it causes
errors with user-defined types with ambiguous conversions. Fixes PR21083.

llvm-svn: 219998

9 years agoSanitizerBlacklist: blacklist functions by their source location.
Alexey Samsonov [Fri, 17 Oct 2014 00:20:19 +0000 (00:20 +0000)]
SanitizerBlacklist: blacklist functions by their source location.

This commit changes the way we blacklist functions in ASan, TSan,
MSan and UBSan. We used to treat function as "blacklisted"
and turned off instrumentation in it in two cases:

1) Function is explicitly blacklisted by its mangled name.
This part is not changed.

2) Function is located in llvm::Module, whose identifier is
contained in the list of blacklisted sources. This is completely
wrong, as llvm::Module may not correspond to the actual source
file function is defined in. Also, function can be defined in
a header, in which case user had to blacklist the .cpp file
this header was #include'd into, not the header itself.
Such functions could cause other problems - for instance, if the
header was included in multiple source files, compiled
separately and linked into a single executable, we could end up
with both instrumented and non-instrumented version of the same
function participating in the same link.

After this change we will make blacklisting decision based on
the SourceLocation of a function definition. If a function is
not explicitly defined in the source file, (for example, the
function is compiler-generated and responsible for
initialization/destruction of a global variable), then it will
be blacklisted if the corresponding global variable is defined
in blacklisted source file, and will be instrumented otherwise.

After this commit, the active users of blacklist files may have
to revisit them. This is a backwards-incompatible change, but
I don't think it's possible or makes sense to support the
old incorrect behavior.

I plan to make similar change for blacklisting GlobalVariables
(which is ASan-specific).

llvm-svn: 219997

9 years agoAppease the buildbots with the special case for non-set variables
Filipe Cabecinhas [Thu, 16 Oct 2014 23:54:26 +0000 (23:54 +0000)]
Appease the buildbots with the special case for non-set variables

llvm-svn: 219994

9 years agoTeach SanitizerBlacklist to blacklist by SourceLocation. NFC.
Alexey Samsonov [Thu, 16 Oct 2014 23:50:26 +0000 (23:50 +0000)]
Teach SanitizerBlacklist to blacklist by SourceLocation. NFC.

llvm-svn: 219993

9 years agoAlways compile debuginfo-tests for the host triple
Filipe Cabecinhas [Thu, 16 Oct 2014 23:43:34 +0000 (23:43 +0000)]
Always compile debuginfo-tests for the host triple

Since these tests expect a working debugger, always compile them for the
host triple, assuming a working debugger is present.

This enables us to compile and run them, even when clang is, by default,
a cross-compiler (but can still target the host).

llvm-svn: 219992

9 years agoAdd our own copy of the find_executable function to cope with installations
Peter Collingbourne [Thu, 16 Oct 2014 23:43:20 +0000 (23:43 +0000)]
Add our own copy of the find_executable function to cope with installations
that do not have the distutils.spawn package. Should hopefully fix the
aarch64 buildbot.

llvm-svn: 219991

9 years ago[mach-o] Fix crash when -all_load used with dylibs
Nick Kledzik [Thu, 16 Oct 2014 23:42:42 +0000 (23:42 +0000)]
[mach-o] Fix crash when -all_load used with dylibs

-all_load tells the darwin linker to immediately load all members of all
archives.  The code do that used reinterpret_cast<> instead of dyn_cast<>.
If the file was a dylib, the reinterpret_cast<> turned a pointer to a dylib
into a pointer to an archive...boom.

Added test case to reproduce the crash, simplified the code and used dyn_cast<>.

llvm-svn: 219990

9 years agoAdded %itanium_abi_host_triple to fix debuginfo-tests when clang is a cross-compiler...
Filipe Cabecinhas [Thu, 16 Oct 2014 23:41:40 +0000 (23:41 +0000)]
Added %itanium_abi_host_triple to fix debuginfo-tests when clang is a cross-compiler by default

llvm-svn: 219989

9 years agoR600/SI: Remove another VALU pattern
Matt Arsenault [Thu, 16 Oct 2014 23:33:37 +0000 (23:33 +0000)]
R600/SI: Remove another VALU pattern

llvm-svn: 219988

9 years ago[libcxx] Add support for LLVM_USE_SANITIZER=Undefined
Eric Fiselier [Thu, 16 Oct 2014 23:21:59 +0000 (23:21 +0000)]
[libcxx] Add support for LLVM_USE_SANITIZER=Undefined

LLVM_USE_SANITIZER=Undefined support was added to the LLVM CMake configuration.
Update libc++'s handling of LLVM_USE_SANITIZER to support this as well.

llvm-svn: 219987

9 years agoAttach a bug number to these failures
Enrico Granata [Thu, 16 Oct 2014 23:17:46 +0000 (23:17 +0000)]
Attach a bug number to these failures

llvm-svn: 219986

9 years agoSplit this test case to handle each literal kind uniquely
Enrico Granata [Thu, 16 Oct 2014 23:16:13 +0000 (23:16 +0000)]
Split this test case to handle each literal kind uniquely

llvm-svn: 219985

9 years agoAdded a new kind of test case: the "inline" test
Sean Callanan [Thu, 16 Oct 2014 23:15:22 +0000 (23:15 +0000)]
Added a new kind of test case: the "inline" test
case.  This test case style attempts to shed all
of the boilerplate that is required for test
cases, and let 80% of test cases use a much terser
syntax.

Inline testcases have much simplified python files
(the corresponding .py file should contain two
lines of code) and require no Makefile, because the
Makefile is generated automatically.  Breakpoints
are set automatically and the indicated breakpoint
actions (specified after a magic //% comment) are
executed when the breakpoint is hit.

All other testcases are unaffected.

One thing I'm not really happy with yet is the way
multiple actions for the same line are specified.
I'm going to use lang/c/struct_types as a guinea
pig to develop this further.

llvm-svn: 219984

9 years agoChange a use of mktemp() to mkstemp() for better security.
Jason Molenda [Thu, 16 Oct 2014 23:10:03 +0000 (23:10 +0000)]
Change a use of mktemp() to mkstemp() for better security.
We have two more uses of mktemp still in the source base
but they'll take a little more consideration.
clang static analyzer fixit.

llvm-svn: 219983

9 years agoThe number '5' triggers a bug unrelated to LLDB, and is not instrumental to this...
Enrico Granata [Thu, 16 Oct 2014 23:06:40 +0000 (23:06 +0000)]
The number '5' triggers a bug unrelated to LLDB, and is not instrumental to this test in any way. Use another, randomly chosen, number to make the test pass again and provide useful actionable feedback about things that truly matter

llvm-svn: 219982

9 years agoSome more test marking
Enrico Granata [Thu, 16 Oct 2014 23:03:06 +0000 (23:03 +0000)]
Some more test marking

llvm-svn: 219981

9 years agoThis test needs the SB headers to make sense
Enrico Granata [Thu, 16 Oct 2014 23:02:45 +0000 (23:02 +0000)]
This test needs the SB headers to make sense

llvm-svn: 219980

9 years agoAdd a test for the -b (batch mode) option to the lldb driver.
Jim Ingham [Thu, 16 Oct 2014 23:02:14 +0000 (23:02 +0000)]
Add a test for the -b (batch mode) option to the lldb driver.

llvm-svn: 219979

9 years agoFix this test case to actually work - it was relying on a certain 'po' output which...
Enrico Granata [Thu, 16 Oct 2014 23:02:03 +0000 (23:02 +0000)]
Fix this test case to actually work - it was relying on a certain 'po' output which wasn't occurring

llvm-svn: 219978

9 years agoRe-commit r217995 and follow-up patches (r217997, r218011, r218053). These were
Richard Smith [Thu, 16 Oct 2014 23:00:46 +0000 (23:00 +0000)]
Re-commit r217995 and follow-up patches (r217997, r218011, r218053). These were
reverted in r218058 because they triggered a rejects-valid bug in MSVC.

Original commit message from r217995:

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.

llvm-svn: 219977

9 years agoInitial version of Go bindings.
Peter Collingbourne [Thu, 16 Oct 2014 22:48:02 +0000 (22:48 +0000)]
Initial version of Go bindings.

This code is based on the existing LLVM Go bindings project hosted at:
https://github.com/go-llvm/llvm

Note that all contributors to the gollvm project have agreed to relicense
their changes under the LLVM license and submit them to the LLVM project.

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

llvm-svn: 219976

9 years agoIntroduce LLVMParseCommandLineOptions C API function.
Peter Collingbourne [Thu, 16 Oct 2014 22:47:52 +0000 (22:47 +0000)]
Introduce LLVMParseCommandLineOptions C API function.

llvm-svn: 219975

9 years agoSema: handle additional case of qualified types
Saleem Abdulrasool [Thu, 16 Oct 2014 22:42:53 +0000 (22:42 +0000)]
Sema: handle additional case of qualified types

A second instance of attributed types escaped the previous change, identified
thanks to Richard Smith!  When deducing the void case, we would also assume that
the type would not be attributed.  Furthermore, properly handle multiple
attributes being applied to a single TypeLoc.

Properly handle this case and future-proof a bit by ignoring parenthesis
further.  The test cases do use the additional parenthesis to ensure that this
case remains properly handled.

Addresses post-commit review comments from Richard Smith to SVN r219851.

llvm-svn: 219974

9 years agoSome more failure to bug tracking
Enrico Granata [Thu, 16 Oct 2014 22:27:17 +0000 (22:27 +0000)]
Some more failure to bug tracking

llvm-svn: 219973

9 years agoAssociate a bug tracking ID with this test case
Enrico Granata [Thu, 16 Oct 2014 22:06:26 +0000 (22:06 +0000)]
Associate a bug tracking ID with this test case

llvm-svn: 219972

9 years agoThis test actually works alright - we were just checking for the wrong string
Enrico Granata [Thu, 16 Oct 2014 22:04:05 +0000 (22:04 +0000)]
This test actually works alright - we were just checking for the wrong string

llvm-svn: 219971

9 years agoI see this test case crash - skip for now
Enrico Granata [Thu, 16 Oct 2014 21:42:34 +0000 (21:42 +0000)]
I see this test case crash - skip for now

llvm-svn: 219970

9 years agotest/CodeGen/sections.c: add triple
Hans Wennborg [Thu, 16 Oct 2014 21:36:23 +0000 (21:36 +0000)]
test/CodeGen/sections.c: add triple

llvm-svn: 219969

9 years agoReduce code duplication between patchpoint and non-patchpoint lowering. NFC.
Juergen Ributzka [Thu, 16 Oct 2014 21:26:35 +0000 (21:26 +0000)]
Reduce code duplication between patchpoint and non-patchpoint lowering. NFC.

This is in preparation for another patch that makes patchpoints invokable.

Reviewers: atrick, ributzka
Reviewed By: ributzka
Subscribers: llvm-commits

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

llvm-svn: 219967

9 years agoOnly call RemovePersistentVariable on expr_result if that shared
Jason Molenda [Thu, 16 Oct 2014 21:25:43 +0000 (21:25 +0000)]
Only call RemovePersistentVariable on expr_result if that shared
pointer contains something.

llvm-svn: 219966

9 years agotrying to fix the new test on hexagon-build
Kostya Serebryany [Thu, 16 Oct 2014 21:22:40 +0000 (21:22 +0000)]
trying to fix the new test on hexagon-build

llvm-svn: 219965

9 years agoRework this code so that it does not trigger a compiler warning. NFC
Enrico Granata [Thu, 16 Oct 2014 21:18:58 +0000 (21:18 +0000)]
Rework this code so that it does not trigger a compiler warning. NFC

llvm-svn: 219964

9 years ago[SROA] Switch the common variable name for the 'AllocaSlices' class to
Chandler Carruth [Thu, 16 Oct 2014 21:11:55 +0000 (21:11 +0000)]
[SROA] Switch the common variable name for the 'AllocaSlices' class to
'AS'.

Using 'S' as this was a terrible idea. Arguably, 'AS' is not much
better, but it at least follows the idea of using initialisms and
removes active confusion about the AllocaSlices variable and a Slice
variable.

llvm-svn: 219963

9 years ago[SROA] More range-based cleanups to SROA, these brought to you by
Chandler Carruth [Thu, 16 Oct 2014 21:05:14 +0000 (21:05 +0000)]
[SROA] More range-based cleanups to SROA, these brought to you by
clang-modernize.

I did have to clean up the variable types and whitespace a bit because
the use of auto made the code much less readable here.

llvm-svn: 219962

9 years agoInsert poisoned paddings between fields in C++ classes so that AddressSanitizer can...
Kostya Serebryany [Thu, 16 Oct 2014 20:54:52 +0000 (20:54 +0000)]
Insert poisoned paddings between fields in C++ classes so that AddressSanitizer can find intra-object-overflow bugs

Summary:
The general approach is to add extra paddings after every field
in AST/RecordLayoutBuilder.cpp, then add code to CTORs/DTORs that poisons the paddings
(CodeGen/CGClass.cpp).

Everything is done under the flag -fsanitize-address-field-padding.
The blacklist file (-fsanitize-blacklist) allows to avoid the transformation
for given classes or source files.

See also https://code.google.com/p/address-sanitizer/wiki/IntraObjectOverflow

Test Plan: run SPEC2006 and some of the Chromium tests with  -fsanitize-address-field-padding

Reviewers: samsonov, rnk, rsmith

Reviewed By: rsmith

Subscribers: majnemer, cfe-commits

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

llvm-svn: 219961

9 years agoMS Compat: mark globals emitted in read-only sections const
Hans Wennborg [Thu, 16 Oct 2014 20:52:46 +0000 (20:52 +0000)]
MS Compat: mark globals emitted in read-only sections const

They cannot be written to, so marking them const makes sense and may improve
optimisation.

As a side-effect, SectionInfos has to be moved from Sema to ASTContext.

It also fixes this problem, that occurs when compiling ATL:

  warning LNK4254: section 'ATL' (C0000040) merged into '.rdata' (40000040) with different attributes

The ATL headers are putting variables in a special section that's marked
read-only. However, Clang currently can't model that read-onlyness in the IR.
But, by making the variables const, the section does become read-only, and
the linker warning is avoided.

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

llvm-svn: 219960

9 years ago[mach-o] update __eh_frame handling for Nick's suggestions
Tim Northover [Thu, 16 Oct 2014 20:52:18 +0000 (20:52 +0000)]
[mach-o] update __eh_frame handling for Nick's suggestions

First, add a comment to support more variation in FDE formats. Second, refactor
fde -> function handling into a separate function living in the ArchHandler.

llvm-svn: 219959

9 years ago[SROA] Switch a couple of overly complex iterator accessors to just be
Chandler Carruth [Thu, 16 Oct 2014 20:42:08 +0000 (20:42 +0000)]
[SROA] Switch a couple of overly complex iterator accessors to just be
ArrayRef accessors.

I think this even came up in review that this was over-engineered, and
indeed it was. Time to un-build it.

llvm-svn: 219958

9 years agoErase fence insertion from SelectionDAGBuilder.cpp (NFC)
Robin Morisset [Thu, 16 Oct 2014 20:34:57 +0000 (20:34 +0000)]
Erase fence insertion from SelectionDAGBuilder.cpp (NFC)

Summary:
Backends can use setInsertFencesForAtomic to signal to the middle-end that
montonic is the only memory ordering they can accept for
stores/loads/rmws/cmpxchg. The code lowering those accesses with a stronger
ordering to fences + monotonic accesses is currently living in
SelectionDAGBuilder.cpp. In this patch I propose moving this logic out of it
for several reasons:
- There is lots of redundancy to avoid: extremely similar logic already
  exists in AtomicExpand.
- The current code in SelectionDAGBuilder does not use any target-hooks, it
  does the same transformation for every backend that requires it
- As a result it is plain *unsound*, as it was apparently designed for ARM.
  It happens to mostly work for the other targets because they are extremely
  conservative, but Power for example had to switch to AtomicExpand to be
  able to use lwsync safely (see r218331).
- Because it produces IR-level fences, it cannot be made sound ! This is noted
  in the C++11 standard (section 29.3, page 1140):
```
Fences cannot, in general, be used to restore sequential consistency for atomic
operations with weaker ordering semantics.
```
It can also be seen by the following example (called IRIW in the litterature):
```
atomic<int> x = y = 0;
int r1, r2, r3, r4;
Thread 0:
  x.store(1);
Thread 1:
  y.store(1);
Thread 2:
  r1 = x.load();
  r2 = y.load();
Thread 3:
  r3 = y.load();
  r4 = x.load();
```
r1 = r3 = 1 and r2 = r4 = 0 is impossible as long as the accesses are all seq_cst.
But if they are lowered to monotonic accesses, no amount of fences can prevent it..

This patch does three things (I could cut it into parts, but then some of them
would not be tested/testable, please tell me if you would prefer that):
- it provides a default implementation for emitLeadingFence/emitTrailingFence in
terms of IR-level fences, that mimic the original logic of SelectionDAGBuilder.
As we saw above, this is unsound, but the best that can be done without knowing
the targets well (and there is a comment warning about this risk).
- it then switches Mips/Sparc/XCore to use AtomicExpand, relying on this default
implementation (that exactly replicates the logic of SelectionDAGBuilder, so no
functional change)
- it finally erase this logic from SelectionDAGBuilder as it is dead-code.

Ideally, each target would define its own override for emitLeading/TrailingFence
using target-specific fences, but I do not know the Sparc/Mips/XCore memory model
well enough to do this, and they appear to be dealing fine with the ARM-inspired
default expansion for now (probably because they are overly conservative, as
Power was). If anyone wants to compile fences more agressively on these
platforms, the long comment should make it clear why he should first override
emitLeading/TrailingFence.

Test Plan: make check-all, no functional change

Reviewers: jfb, t.p.northover

Subscribers: aemerson, llvm-commits

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

llvm-svn: 219957

9 years agoR600/SI: Remove unnecessary VALU patterns
Matt Arsenault [Thu, 16 Oct 2014 20:31:50 +0000 (20:31 +0000)]
R600/SI: Remove unnecessary VALU patterns

These haven't been necessary since allowing
selecting SALU instructions in non-entry blocks
was enabled.

llvm-svn: 219956

9 years ago[SROA] Start more deeply moving SROA to use ranges rather than just
Chandler Carruth [Thu, 16 Oct 2014 20:24:07 +0000 (20:24 +0000)]
[SROA] Start more deeply moving SROA to use ranges rather than just
iterators.

There are a ton of places where it essentially wants ranges
rather than just iterators. This is just the first step that adds the
core slice range typedefs and uses them in a couple of places. I still
have to explicitly construct them because they've not been punched
throughout the entire set of code. More range-based cleanups incoming.

llvm-svn: 219955

9 years agoNo longer emit diagnostics about unused results (comparisons, etc) from unevaluated...
Aaron Ballman [Thu, 16 Oct 2014 20:13:28 +0000 (20:13 +0000)]
No longer emit diagnostics about unused results (comparisons, etc) from unevaluated contexts. Fixes PR18571.

llvm-svn: 219954

9 years agoR600: Fix nonsensical implementation of computeKnownBits for BFE
Matt Arsenault [Thu, 16 Oct 2014 20:07:40 +0000 (20:07 +0000)]
R600: Fix nonsensical implementation of computeKnownBits for BFE

This was resulting in invalid simplifications of sdiv

llvm-svn: 219953

9 years agoUpdate for llvm change.
Rafael Espindola [Thu, 16 Oct 2014 20:00:22 +0000 (20:00 +0000)]
Update for llvm change.

llvm-svn: 219952

9 years agoDelete -std-compile-opts.
Rafael Espindola [Thu, 16 Oct 2014 20:00:02 +0000 (20:00 +0000)]
Delete -std-compile-opts.

These days -std-compile-opts was just a silly alias for -O3.

llvm-svn: 219951

9 years agoAllow call-slop optzn for destinations with a suitable dereferenceable attribute
Bjorn Steinbrink [Thu, 16 Oct 2014 19:43:08 +0000 (19:43 +0000)]
Allow call-slop optzn for destinations with a suitable dereferenceable attribute

Summary:
Currently, call slot optimization requires that if the destination is an
argument, the argument has the sret attribute. This is to ensure that
the memory access won't trap. In addition to sret, we can also allow the
optimization to happen for arguments that have the new dereferenceable
attribute, which gives the same guarantee.

Subscribers: llvm-commits

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

llvm-svn: 219950

9 years ago[mach-o] Add support for upward linking
Nick Kledzik [Thu, 16 Oct 2014 19:31:28 +0000 (19:31 +0000)]
[mach-o] Add support for upward linking

To deal with cycles in shared library dependencies, the darwin linker supports
marking specific link dependencies as "upward".  An upward link is when a
lower level library links against a higher level library.

llvm-svn: 219949