platform/upstream/llvm.git
9 years agoUse -Wcast-qual in cmake builds, not only autoconfo ones.
Roman Divacky [Thu, 13 Nov 2014 19:45:27 +0000 (19:45 +0000)]
Use -Wcast-qual in cmake builds, not only autoconfo ones.

llvm-svn: 221913

9 years agoRemoved r221896, it seems to break build in various ways.
Yury Gribov [Thu, 13 Nov 2014 19:37:30 +0000 (19:37 +0000)]
Removed r221896, it seems to break build in various ways.

llvm-svn: 221912

9 years agoR600/SI: Allow commuting with src2_modifiers
Matt Arsenault [Thu, 13 Nov 2014 19:26:50 +0000 (19:26 +0000)]
R600/SI: Allow commuting with src2_modifiers

llvm-svn: 221911

9 years agoR600/SI: Allow commuting some 3 op instructions
Matt Arsenault [Thu, 13 Nov 2014 19:26:47 +0000 (19:26 +0000)]
R600/SI: Allow commuting some 3 op instructions

e.g. v_mad_f32 a, b, c -> v_mad_f32 b, a, c

This simplifies matching v_madmk_f32.

This looks somewhat surprising, but it appears to be
OK to do this. We can commute src0 and src1 in all
of these instructions, and that's all that appears
to matter.

llvm-svn: 221910

9 years agoReturn word_t from read.
Rafael Espindola [Thu, 13 Nov 2014 18:44:53 +0000 (18:44 +0000)]
Return word_t from read.

This removes the need for a special Read64.

llvm-svn: 221909

9 years agoFixed "SBTarget SBDebugger::CreateTarget (const char *filename)" to use the same...
Greg Clayton [Thu, 13 Nov 2014 18:30:06 +0000 (18:30 +0000)]
Fixed "SBTarget SBDebugger::CreateTarget (const char *filename)" to use the same semantics as other SBDebugger::CreateTarget() functions.

The issues were:
- If you called this function with any arch other than the default target architecture, creating the target would fail because the Target::GetDefaultArchitecture() would not match the single architecture in the file specified. This caused running the test suite remotely with lldb-platform to fail many many tests due to the bad target.
- It would specify the currently selected platform which might not work for the specified platform

All other SBDebugger::CreateTarget calls do not assume an architecture or platform and if they aren't specified, they don't auto select the wrong one for you.

With this fix, SBTarget SBDebugger::CreateTarget (const char *filename) now behaves like the other SBDebugger::CreateTarget() variants.

llvm-svn: 221908

9 years agoRemove extra "/" character from paths resolved in iOS SDKs and also be sure to update...
Greg Clayton [Thu, 13 Nov 2014 18:25:33 +0000 (18:25 +0000)]
Remove extra "/" character from paths resolved in iOS SDKs and also be sure to update the SDK directory infos if needed before we start using m_sdk_directory_infos.

llvm-svn: 221907

9 years agoRefactor NativeProcessLinux::AttachToProcess in order to avoid reinterpret_cast from...
Oleksiy Vyalov [Thu, 13 Nov 2014 18:22:16 +0000 (18:22 +0000)]
Refactor NativeProcessLinux::AttachToProcess in order to avoid reinterpret_cast from NativeProcessProtocol* to NativeProcessLinux*.

llvm-svn: 221906

9 years agoARM: allow constpool entry to be moved to the user's block in all cases.
Tim Northover [Thu, 13 Nov 2014 17:58:53 +0000 (17:58 +0000)]
ARM: allow constpool entry to be moved to the user's block in all cases.

Normally entries can only move to a lower address, but when that wasn't viable,
the user's block was considered anyway. Unfortunately, it went via
createNewWater which wasn't designed to handle the case where there's already
an island after the block.

Unfortunately, the test we have is slow and fragile, and I couldn't reduce it
to anything sane even with the @llvm.arm.space intrinsic. The test change here
is recreating the previous one after the change.

rdar://problem/18545506

llvm-svn: 221905

9 years agoARM: avoid duplicating branches during constant islands.
Tim Northover [Thu, 13 Nov 2014 17:58:51 +0000 (17:58 +0000)]
ARM: avoid duplicating branches during constant islands.

We were using a naive heuristic to determine whether a basic block already had
an unconditional branch at the end. This mostly corresponded to reality
(assuming branches got optimised) because there's not much point in a branch to
the next block, but could go wrong.

llvm-svn: 221904

9 years agoARM: add @llvm.arm.space intrinsic for testing ConstantIslands.
Tim Northover [Thu, 13 Nov 2014 17:58:48 +0000 (17:58 +0000)]
ARM: add @llvm.arm.space intrinsic for testing ConstantIslands.

Creating tests for the ConstantIslands pass is very difficult, since it depends
on precise layout details. Having the ability to precisely inject a number of
bytes into the stream helps greatly.

llvm-svn: 221903

9 years agoFix the other build system.
Rafael Espindola [Thu, 13 Nov 2014 17:12:19 +0000 (17:12 +0000)]
Fix the other build system.

llvm-svn: 221901

9 years agoHook up FreeBSD AArch64 support
Ed Maste [Thu, 13 Nov 2014 16:55:42 +0000 (16:55 +0000)]
Hook up FreeBSD AArch64 support

Patch from Andrew Turner.

llvm-svn: 221900

9 years agoFix a regression on the disassembling C API.
Rafael Espindola [Thu, 13 Nov 2014 16:52:07 +0000 (16:52 +0000)]
Fix a regression on the disassembling C API.

The fix is easy. Unfortunately, we had 0 tests, so adding one was somewhat
complicated.

Thanks to Kevin Enderby for the report.

llvm-svn: 221899

9 years ago[Hexagon]
Colin LeMahieu [Thu, 13 Nov 2014 16:36:30 +0000 (16:36 +0000)]
[Hexagon]
NFC Renaming reserved identifier.

llvm-svn: 221898

9 years agoclang-format: Format extern "C" blocks like namespace blocks.
Nico Weber [Thu, 13 Nov 2014 16:25:37 +0000 (16:25 +0000)]
clang-format: Format extern "C" blocks like namespace blocks.

namespace blocks act as if KeepEmptyLinesAtTheStartOfBlocks is always true,
and aren't collapsed to a single line even if they would fit. Do the same
for extern "C" blocks.

Before,

  extern "C" {

  void ExternCFunction();

  }

was collapsed into `extern "C" { void ExternCFunction(); }`. Now it stays like
it was.

Fixes http://crbug.com/432640 and part of PR21419.

llvm-svn: 221897

9 years ago[ASan] Add process basename to log name and error message to simplify analysis of...
Yury Gribov [Thu, 13 Nov 2014 16:01:23 +0000 (16:01 +0000)]
[ASan] Add process basename to log name and error message to simplify analysis of sanitized systems logs.

Reviewed at http://reviews.llvm.org/D5724

llvm-svn: 221896

9 years agoclang-format: [Java] Support Java enums.
Daniel Jasper [Thu, 13 Nov 2014 15:56:28 +0000 (15:56 +0000)]
clang-format: [Java] Support Java enums.

In Java, enums can contain a class body and enum constants can have
arguments as well as class bodies. Support most of that.

llvm-svn: 221895

9 years ago[Reassociate] Update comment. NFC.
Chad Rosier [Thu, 13 Nov 2014 15:40:20 +0000 (15:40 +0000)]
[Reassociate] Update comment. NFC.

llvm-svn: 221894

9 years ago[Mips] Add comment to the test case
Simon Atanasyan [Thu, 13 Nov 2014 15:29:37 +0000 (15:29 +0000)]
[Mips] Add comment to the test case

No functional changes.

llvm-svn: 221893

9 years agoSimplify code a bit. NFC.
Rafael Espindola [Thu, 13 Nov 2014 14:45:22 +0000 (14:45 +0000)]
Simplify code a bit. NFC.

Thanks to Sean Silva for the suggestion.

llvm-svn: 221892

9 years agoSmall optimization: once the size is know, we don't have to call fillCurWord.
Rafael Espindola [Thu, 13 Nov 2014 14:37:51 +0000 (14:37 +0000)]
Small optimization: once the size is know, we don't have to call fillCurWord.

llvm-svn: 221891

9 years ago[ELF] Fix the fileoffset according to the ELF spec.
Shankar Easwaran [Thu, 13 Nov 2014 14:30:21 +0000 (14:30 +0000)]
[ELF] Fix the fileoffset according to the ELF spec.

With --no-align-segments, there is a bug that the fileoffset may not be
congruent to virtual address modulo page alignment.

This patch fixes the problem.

llvm-svn: 221890

9 years agoDelete empty test/missing directory
Simon Atanasyan [Thu, 13 Nov 2014 14:13:12 +0000 (14:13 +0000)]
Delete empty test/missing directory

llvm-svn: 221889

9 years agoFixing -Wtype-limits warnings with the asserts (the expression would always evaluate...
Aaron Ballman [Thu, 13 Nov 2014 13:55:13 +0000 (13:55 +0000)]
Fixing -Wtype-limits warnings with the asserts (the expression would always evaluate to true). Also fixing a -Wcast-qual warning, where the cast expression isn't required.

llvm-svn: 221888

9 years agoFixing some sign comparison warnings from MSVC; NFC.
Aaron Ballman [Thu, 13 Nov 2014 13:39:49 +0000 (13:39 +0000)]
Fixing some sign comparison warnings from MSVC; NFC.

llvm-svn: 221887

9 years agoIR: Create the Metadata class
Duncan P. N. Exon Smith [Thu, 13 Nov 2014 13:17:47 +0000 (13:17 +0000)]
IR: Create the Metadata class

This will become the root of a new class hierarchy separate from
`Value`.  As a first step, stick it between `Value` and `MDNode`.

This is part of PR21532.

llvm-svn: 221886

9 years agoRegression test for the --serialize-diagnostics problem fixed in r221884.
Alexander Kornienko [Thu, 13 Nov 2014 13:09:16 +0000 (13:09 +0000)]
Regression test for the --serialize-diagnostics problem fixed in r221884.

llvm-svn: 221885

9 years agoSupport non-owned DiagnosticConsumer in SetupSerializedDiagnostics
Alexander Kornienko [Thu, 13 Nov 2014 13:08:27 +0000 (13:08 +0000)]
Support non-owned DiagnosticConsumer in SetupSerializedDiagnostics

This fixes an assertion when running clang-tidy on a file having
--serialize-diagnostics in compiler options. Committing a regression test
for clang-tidy separately.

Patch by Aaron Wishnick!

llvm-svn: 221884

9 years agoAVX-512: SINT_TO_FP cost model and some bugfixes
Elena Demikhovsky [Thu, 13 Nov 2014 11:46:16 +0000 (11:46 +0000)]
AVX-512: SINT_TO_FP cost model and some bugfixes
Checked some corner cases, for example translation
of <8 x i1> to <8 x double>

llvm-svn: 221883

9 years ago[asan] Switch to AsanInitFromRtl in .preinit_array.
Evgeniy Stepanov [Thu, 13 Nov 2014 09:50:56 +0000 (09:50 +0000)]
[asan] Switch to AsanInitFromRtl in .preinit_array.

There is no functionality change due to a check in AsanActivate.

llvm-svn: 221882

9 years ago[libclang] Make sure to visit the body of a CXXForRangeStmt.
Argyrios Kyrtzidis [Thu, 13 Nov 2014 09:50:19 +0000 (09:50 +0000)]
[libclang] Make sure to visit the body of a CXXForRangeStmt.

llvm-svn: 221881

9 years agoObject, COFF: Refactor code to get relocation iterators
David Majnemer [Thu, 13 Nov 2014 09:50:18 +0000 (09:50 +0000)]
Object, COFF: Refactor code to get relocation iterators

No functional change intended.

llvm-svn: 221880

9 years agoOCAMLFLAGS can contain =, don't use = with sed
Hal Finkel [Thu, 13 Nov 2014 09:29:30 +0000 (09:29 +0000)]
OCAMLFLAGS can contain =, don't use = with sed

Like HOST_LDFLAGS, etc. OCAMLFLAGS can contain =, so use ! as the substitution
separator instead of = (otherwise, sed might error).

llvm-svn: 221879

9 years agoThis patch changes the ownership of TLOF from TargetLoweringBase to TargetMachine...
Aditya Nandakumar [Thu, 13 Nov 2014 09:26:31 +0000 (09:26 +0000)]
This patch changes the ownership of TLOF from TargetLoweringBase to TargetMachine so that different subtargets could share the TLOF effectively

llvm-svn: 221878

9 years agoInstrProf: support PowerPC64
Jay Foad [Thu, 13 Nov 2014 09:24:32 +0000 (09:24 +0000)]
InstrProf: support PowerPC64

Summary:
I don't know anything about profiling but it seems to work out of the
box on PowerPC64. At least "make check-profile" works.

A few tests needed tweaking because PowerPC64 IR declares main with
"define signext i32 @main" instead of just "define i32 @main".

This also fixes the asan asan_and_llvm_coverage_test test, which
compiles with -coverage so requires that a profiling version of
libclang_rt has been built.

Reviewers: dexonsmith, kcc, samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits

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

llvm-svn: 221877

9 years agoRevert r219432 - "Revert "[BasicAA] Revert "Revert r218714 - Make better use of zext...
Hal Finkel [Thu, 13 Nov 2014 09:16:54 +0000 (09:16 +0000)]
Revert r219432 - "Revert "[BasicAA] Revert "Revert r218714 - Make better use of zext and sign information."""

Let's try this again...

This reverts r219432, plus a bug fix.

Description of the bug in r219432 (by Nick):

The bug was using AllPositive to break out of the loop; if the loop break
condition i != e is changed to i != e && AllPositive then the
test_modulo_analysis_with_global test I've added will fail as the Modulo will
be calculated incorrectly (as the last loop iteration is skipped, so Modulo
isn't updated with its Scale).

Nick also adds this comment:

ComputeSignBit is safe to use in loops as it takes into account phi nodes, and
the  == EK_ZeroEx check is safe in loops as, no matter how the variable changes
between iterations, zero-extensions will always guarantee a zero sign bit. The
isValueEqualInPotentialCycles check is therefore definitely not needed as all
the variable analysis holds no matter how the variables change between loop
iterations.

And this patch also adds another enhancement to GetLinearExpression - basically
to convert ConstantInts to Offsets (see test_const_eval and
test_const_eval_scaled for the situations this improves).

Original commit message:

This reverts r218944, which reverted r218714, plus a bug fix.

Description of the bug in r218714 (by Nick):

The original patch forgot to check if the Scale in VariableGEPIndex flipped the
sign of the variable. The BasicAA pass iterates over the instructions in the
order they appear in the function, and so BasicAliasAnalysis::aliasGEP is
called with the variable it first comes across as parameter GEP1. Adding a
%reorder label puts the definition of %a after %b so aliasGEP is called with %b
as the first parameter and %a as the second. aliasGEP later calculates that %a
== %b + 1 - %idxprom where %idxprom >= 0 (if %a was passed as the first
parameter it would calculate %b == %a - 1 + %idxprom where %idxprom >= 0) -
ignoring that %idxprom is scaled by -1 here lead the patch to incorrectly
conclude that %a > %b.

Revised patch by Nick White, thanks! Thanks to Lang to isolating the bug.
Slightly modified by me to add an early exit from the loop and avoid
unnecessary, but expensive, function calls.

Original commit message:

Two related things:

 1. Fixes a bug when calculating the offset in GetLinearExpression. The code
    previously used zext to extend the offset, so negative offsets were converted
    to large positive ones.

 2. Enhance aliasGEP to deduce that, if the difference between two GEP
    allocations is positive and all the variables that govern the offset are also
    positive (i.e. the offset is strictly after the higher base pointer), then
    locations that fit in the gap between the two base pointers are NoAlias.

Patch by Nick White!

llvm-svn: 221876

9 years ago[ASan] Fix large allocator test case to cope with 64k pages
Jay Foad [Thu, 13 Nov 2014 09:15:15 +0000 (09:15 +0000)]
[ASan] Fix large allocator test case to cope with 64k pages

Summary: My PowerPC64 Linux box has 64k pages. The test assumes 4k pages. Fix it.

Reviewers: glider, eugenis, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221875

9 years ago[liblang] Handle CXXForRangeStmt during AST visitation.
Argyrios Kyrtzidis [Thu, 13 Nov 2014 09:03:21 +0000 (09:03 +0000)]
[liblang] Handle CXXForRangeStmt during AST visitation.

llvm-svn: 221874

9 years agoObject, COFF: Increase code reuse
David Majnemer [Thu, 13 Nov 2014 08:46:37 +0000 (08:46 +0000)]
Object, COFF: Increase code reuse

Split getObject's smarts into checkOffset, use this to replace the
handwritten check in getSectionContents.  Similarly, replace checks in
section_rel_begin/section_rel_end with getNumberOfRelocations.

No functionality change intended.

llvm-svn: 221873

9 years agollvm-readobj: relocAddressLess could potentially lie
David Majnemer [Thu, 13 Nov 2014 07:54:05 +0000 (07:54 +0000)]
llvm-readobj: relocAddressLess could potentially lie

On error conditions, relocAddressLess might claim that a value is less
than itself.  Instead, abort llvm-readobj.  No functionality change
intended.

llvm-svn: 221872

9 years agollvm-readobj, COFF: Remove an unused variable
David Majnemer [Thu, 13 Nov 2014 07:42:13 +0000 (07:42 +0000)]
llvm-readobj, COFF: Remove an unused variable

printRelocation doesn't use the section contents.  No functionality
change intended.

llvm-svn: 221871

9 years agoObject, COFF: getRelocationSymbol shouldn't assert
David Majnemer [Thu, 13 Nov 2014 07:42:11 +0000 (07:42 +0000)]
Object, COFF: getRelocationSymbol shouldn't assert

lib/Object is supposed to be robust to malformed object files.  Don't
assert if we don't have a symbol table.  I'll try to come up with a test
case later.

llvm-svn: 221870

9 years agoObject, COFF: Cleanup some code in getSectionName
David Majnemer [Thu, 13 Nov 2014 07:42:09 +0000 (07:42 +0000)]
Object, COFF: Cleanup some code in getSectionName

Use StringRef::startswith to tidy up some code, no functionality change
intended.

llvm-svn: 221869

9 years agoObject, COFF: Fix some theoretical bugs
David Majnemer [Thu, 13 Nov 2014 07:42:07 +0000 (07:42 +0000)]
Object, COFF: Fix some theoretical bugs

getObject didn't consider the case where a pointer came before the start
of the object file.  No test is included, trying to come up with
something reasonable.

llvm-svn: 221868

9 years agoObject, COFF: Clean up formatting in hasExtendedRelocations
David Majnemer [Thu, 13 Nov 2014 07:42:05 +0000 (07:42 +0000)]
Object, COFF: Clean up formatting in hasExtendedRelocations

No functionality changed intended.

llvm-svn: 221867

9 years agoA pretty big overhaul of the TryFallbackUnwindPlan method in
Jason Molenda [Thu, 13 Nov 2014 07:31:45 +0000 (07:31 +0000)]
A pretty big overhaul of the TryFallbackUnwindPlan method in
RegisterContextLLDB.  I have core files of half a dozen tricky
unwind situations on x86/arm and they're all working pretty much
correctly at this point, but we'll need to keep an eye out for
unwinder regressions for a little while; it's tricky to get these
heuristics completely correct in all unwind situations.

<rdar://problem/18937193>

llvm-svn: 221866

9 years agoRead 64 bits at a time in the bitcode reader.
Rafael Espindola [Thu, 13 Nov 2014 07:23:22 +0000 (07:23 +0000)]
Read 64 bits at a time in the bitcode reader.

The reading of 64 bit values could still be optimized, but at least this cuts
down on the number of virtual calls to fetch more data.

llvm-svn: 221865

9 years ago[ELF] Add CodeModel attribute to the DefinedAtom class
Simon Atanasyan [Thu, 13 Nov 2014 07:03:41 +0000 (07:03 +0000)]
[ELF] Add CodeModel attribute to the DefinedAtom class

MIPS ELF symbols might contain some additional MIPS-specific flags
in the st_other field besides visibility ones. These flags indicate
code properties like microMIPS / MIPS16 encoding, position independent
code etc. We need to transfer the flags from input objects to the
output linked file to write them into the symbol table, adjust symbols
addresses etc.

I add new attribute CodeModel to the DefinedAtom class to hold target
specific flag and to get over YAML/Native format conversion barrier.
Other architectures/targets can extend CodeModel enumeration by their
own flags.

MIPS specific part of this patch adds support for STO_MIPS_MICROMIPS
flag. This flag marks microMIPS symbols. Such symbol should:
a) Has STO_MIPS_MICROMIPS in the corresponding .symtab record.
b) Has adjusted (odd) address in the corresponding .symtab
   and .dynsym records.

llvm-svn: 221864

9 years agoUpdate \param(s) in MemoryObject::readBytes(). [-Wdocumentation]
NAKAMURA Takumi [Thu, 13 Nov 2014 04:56:41 +0000 (04:56 +0000)]
Update \param(s) in MemoryObject::readBytes(). [-Wdocumentation]

llvm-svn: 221863

9 years ago[ELF] Fix segment alignment.
Shankar Easwaran [Thu, 13 Nov 2014 04:33:06 +0000 (04:33 +0000)]
[ELF] Fix segment alignment.

The segment alignment for PT_LOAD segments is set to page size by default, but
if any of the sections require an alignment more than the page size, the segment
alignment property is set to the maximum alignment of the sections that are part
of the segment.

llvm-svn: 221862

9 years ago[x86] Teach the vector shuffle lowering to make a more nuanced decision
Chandler Carruth [Thu, 13 Nov 2014 04:06:10 +0000 (04:06 +0000)]
[x86] Teach the vector shuffle lowering to make a more nuanced decision
between splitting a vector into 128-bit lanes and recombining them vs.
decomposing things into single-input shuffles and a final blend.

This handles a large number of cases in AVX1 where the cross-lane
shuffles would be much more expensive to represent even though we end up
with a fast blend at the root. Instead, we can do a better job of
shuffling in a single lane and then inserting it into the other lanes.

This fixes the remaining bits of Halide's regression captured in PR21281
for AVX1. However, the bug persists in AVX2 because I've made this
change reasonably conservative. The cases where it makes sense in AVX2
to split into 128-bit lanes are much more rare because we can often do
full permutations across all elements of the 256-bit vector. However,
the particular test case in PR21281 is an example of one of the rare
cases where it is *always* better to work in a single 128-bit lane. I'm
going to try to teach the logic to detect and form the good code even in
AVX2 next, but it will need to use a separate heuristic.

Finally, there is one pesky regression here where we previously would
craftily use vpermilps in AVX1 to shuffle both high and low halves at
the same time. We no longer pull that off, and not for any really good
reason. Ultimately, I think this is just another missing nuance to the
selection heuristic that I'll try to add in afterward, but this change
already seems strictly worth doing considering the magnitude of the
improvements in common matrix math shuffle patterns.

As always, please let me know if this causes a surprising regression for
you.

llvm-svn: 221861

9 years ago[ELF] Fix conditions for max-page-size.
Shankar Easwaran [Thu, 13 Nov 2014 04:03:46 +0000 (04:03 +0000)]
[ELF] Fix conditions for max-page-size.

Fix comments from Rui, also adds a test.

llvm-svn: 221860

9 years agoTestConcurrentEvents - delay threads not working
Vince Harron [Thu, 13 Nov 2014 04:00:23 +0000 (04:00 +0000)]
TestConcurrentEvents - delay threads not working

Part of TestConcurrentEvents starts threads that are supposed to be
delayed by one second.

Test was adding "delay" threads to the "actions" thread list instead
of the "delay_actions" list, which caused them to be started without
delay.

llvm-svn: 221859

9 years ago[ELF] Fix max-page-size option.
Shankar Easwaran [Thu, 13 Nov 2014 03:25:38 +0000 (03:25 +0000)]
[ELF] Fix max-page-size option.

The user can use the max-page-size option and set the maximum page size. Dont
check for maximum allowed values for page size, as its what the kernel is
configured with.

Fix the test as well.

llvm-svn: 221858

9 years ago[ELF] Check linker created dynamic variables
Shankar Easwaran [Thu, 13 Nov 2014 03:25:34 +0000 (03:25 +0000)]
[ELF] Check linker created dynamic variables

Check the values of _GLOBAL_OFFSET_TABLE_ and _DYNAMIC variables created by
linker.

llvm-svn: 221857

9 years agoUpdate COFF delay-import table tests for r221855.
Rui Ueyama [Thu, 13 Nov 2014 03:24:54 +0000 (03:24 +0000)]
Update COFF delay-import table tests for r221855.

This test should now have caught a bug fixed in r221853.

llvm-svn: 221856

9 years agollvm-readobj: Print out address table when dumping COFF delay-import table
Rui Ueyama [Thu, 13 Nov 2014 03:22:54 +0000 (03:22 +0000)]
llvm-readobj: Print out address table when dumping COFF delay-import table

llvm-svn: 221855

9 years agoAdd an assert and a test that verify r221709's fix.
Frederic Riss [Thu, 13 Nov 2014 03:20:23 +0000 (03:20 +0000)]
Add an assert and a test that verify r221709's fix.

llvm-svn: 221854

9 years ago[PECOFF] Fix delay-import address table contents.
Rui Ueyama [Thu, 13 Nov 2014 02:58:36 +0000 (02:58 +0000)]
[PECOFF] Fix delay-import address table contents.

Each entry in the delay-import address table had a wrong alignment
requirement if 32 bit. As a result it got wrong delay-import table.

Because llvm-readobj doesn't print out that field, we don't have a
test for that. I'll submit a test that would catch this bug after
improving llvm-readobj.

llvm-svn: 221853

9 years ago[x86] Don't form overly fragmented blends when splitting and
Chandler Carruth [Thu, 13 Nov 2014 02:42:08 +0000 (02:42 +0000)]
[x86] Don't form overly fragmented blends when splitting and
re-combining shuffles because nothing was available in the wider vector
type.

The key observation (which I've put in the comments for future
maintainers) is that at this point, no further combining is really
possible. And so even though these shuffles trivially could be combined,
we need to actually do that as we produce them when producing them this
late in the lowering.

This fixes another (huge) part of the Halide vector shuffle regressions.
As it happens, this was already well covered by the tests, but I hadn't
noticed how bad some of these got. The specific patterns that turn
directly into unpckl/h patterns were occurring *many* times in common
vector processing code.

There are still more problems here sadly, but trying to incrementally
tease them apart and it looks like this is the core of the problem in
the splitting logic.

There is some chance of regression here, you can see it in the test
changes. Specifically, where we stop forming pshufb in some cases, it is
possible that pshufb was in fact faster. Intel "says" that pshufb is
slower than the instruction sequences replacing it.

llvm-svn: 221852

9 years ago[CodeGenPrepare] Handle zero extensions in the TypePromotionHelper.
Quentin Colombet [Thu, 13 Nov 2014 01:44:51 +0000 (01:44 +0000)]
[CodeGenPrepare] Handle zero extensions in the TypePromotionHelper.

Prior to this patch the TypePromotionHelper was promoting only sign extensions.
Supporting zero extensions changes:
- How constants are extended.
- How sign extensions, zero extensions, and truncate are composed together.
- How the type of the extended operation is recorded. Now we need to know the
  kind of the extension as well as its type.

Each change is fairly small, unlike the diff.
Most of the diff are comments/variable renaming to say "extension" instead of
"sign extension".

The performance improvements on the test suite are within the noise.

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

llvm-svn: 221851

9 years agoDo not override the existing definition of addr_size when adding new properties to...
Enrico Granata [Thu, 13 Nov 2014 01:38:38 +0000 (01:38 +0000)]
Do not override the existing definition of addr_size when adding new properties to SBTarget. Fixes rdar://18963842

llvm-svn: 221850

9 years agoCMake: stop setting (well, #undef'ing) HOST_LINK_VERSION; it's used in Clang, not...
Hans Wennborg [Thu, 13 Nov 2014 00:51:12 +0000 (00:51 +0000)]
CMake: stop setting (well, #undef'ing) HOST_LINK_VERSION; it's used in Clang, not LLVM

llvm-svn: 221849

9 years ago[FastISel][AArch64] Optimize select when one of the operands is a 'true' or 'false...
Juergen Ributzka [Thu, 13 Nov 2014 00:36:46 +0000 (00:36 +0000)]
[FastISel][AArch64] Optimize select when one of the operands is a 'true' or 'false' value.

Optimize selects of i1 in the presence of 'true' and 'false' operands to simple
logic operations.

This fixes rdar://problem/18960150.

llvm-svn: 221848

9 years ago[FastISel][AArch64] Fold the cmp into the select when possible.
Juergen Ributzka [Thu, 13 Nov 2014 00:36:43 +0000 (00:36 +0000)]
[FastISel][AArch64] Fold the cmp into the select when possible.

This folds the compare emission into the select emission when possible, so we
can directly use the flags and don't have to emit a separate compare.

Related to rdar://problem/18960150.

llvm-svn: 221847

9 years ago[FastISel][AArch64] Extend 'select' lowering to support also i1 to i16.
Juergen Ributzka [Thu, 13 Nov 2014 00:36:38 +0000 (00:36 +0000)]
[FastISel][AArch64] Extend 'select' lowering to support also i1 to i16.

Related to rdar://problem/18960150.

llvm-svn: 221846

9 years agoDrop a few unneeded ctor calls (missed code review comment).
Paul Robinson [Thu, 13 Nov 2014 00:36:34 +0000 (00:36 +0000)]
Drop a few unneeded ctor calls (missed code review comment).

llvm-svn: 221845

9 years agoCMake: Set HOST_LINK_VERSION on Darwin (PR21268)
Hans Wennborg [Thu, 13 Nov 2014 00:35:23 +0000 (00:35 +0000)]
CMake: Set HOST_LINK_VERSION on Darwin (PR21268)

The Autoconf build already does this, but it was never ported to
CMake. The host linker version affects the flags that Clang pass
to the linker, notably whether it passes -demangle or not.

http://reviews.llvm.org/D6239

llvm-svn: 221844

9 years agoFixes test.
Fariborz Jahanian [Thu, 13 Nov 2014 00:19:30 +0000 (00:19 +0000)]
Fixes test.

llvm-svn: 221843

9 years agoRevert "[dwarfdump] Add support for dumping accelerator tables."
Frederic Riss [Thu, 13 Nov 2014 00:15:15 +0000 (00:15 +0000)]
Revert "[dwarfdump] Add support for dumping accelerator tables."

This reverts commit r221836.

The tests are asserting on some buildbots. This also reverts the
test part of r221837 as it relies on dwarfdump dumping the
accelerator tables.

llvm-svn: 221842

9 years agoImprove long path name support on Windows.
Paul Robinson [Thu, 13 Nov 2014 00:12:14 +0000 (00:12 +0000)]
Improve long path name support on Windows.

Windows normally limits the length of an absolute path name to 260
characters; directories can have lower limits.  These limits increase
to about 32K if you use absolute paths with the special '\\?\'
prefix. Teach Support\Windows\Path.inc to use that prefix as needed.

TODO: Other parts of Support could also learn to use this prefix.
llvm-svn: 221841

9 years ago[Bitcode] AtEndOfStream should only check against the size if it's known.
Jordan Rose [Thu, 13 Nov 2014 00:08:41 +0000 (00:08 +0000)]
[Bitcode] AtEndOfStream should only check against the size if it's known.

This avoids an issue where AtEndOfStream mistakenly returns true at the /start/ of
a stream.

(In the rare case that the size is known and actually 0, the slow path will still
handle it correctly.)

llvm-svn: 221840

9 years agoTeach ScalarEvolution to sharpen range information.
Sanjoy Das [Thu, 13 Nov 2014 00:00:58 +0000 (00:00 +0000)]
Teach ScalarEvolution to sharpen range information.

If x is known to have the range [a, b), in a loop predicated by (icmp
ne x, a) its range can be sharpened to [a + 1, b).  Get
ScalarEvolution and hence IndVars to exploit this fact.

This change triggers an optimization to widen-loop-comp.ll, so it had
to be edited to get it to pass.

This change was originally landed in r219834 but had a bug and broke
ASan. It was reverted in r219878, and is now being re-landed after
fixing the original bug.

phabricator: http://reviews.llvm.org/D5639
reviewed by: atrick

llvm-svn: 221839

9 years agoAnother test for PR19372, showing why we need to keep checking arguments after a...
Richard Smith [Wed, 12 Nov 2014 23:50:13 +0000 (23:50 +0000)]
Another test for PR19372, showing why we need to keep checking arguments after a pack expansion.

llvm-svn: 221838

9 years agoFix emission of Dwarf accelerator table when there are multiple CUs.
Frederic Riss [Wed, 12 Nov 2014 23:48:14 +0000 (23:48 +0000)]
Fix emission of Dwarf accelerator table when there are multiple CUs.

The DIE offset in the accel tables is an offset relative to the start
of the debug_info section, but we were encoding the offset to the
start of the containing CU.

llvm-svn: 221837

9 years ago[dwarfdump] Add support for dumping accelerator tables.
Frederic Riss [Wed, 12 Nov 2014 23:48:10 +0000 (23:48 +0000)]
[dwarfdump] Add support for dumping accelerator tables.

The class used for the dump only allows to dump for the moment, but
it can (and will) be easily extended to support search also.

llvm-svn: 221836

9 years agoAllow DWARFFormValue::extractValue to be called with a null CU.
Frederic Riss [Wed, 12 Nov 2014 23:48:04 +0000 (23:48 +0000)]
Allow DWARFFormValue::extractValue to be called with a null CU.

Currently FormValues are only used for attributes of DIEs and thus
uers always have a CU lying around when calling into the FormValue
API.
Accelerator tables encode their information using the same Forms
as the attributes, thus it is natural to use DWARFFormValue to
extract/dump them. There is no CU in that case though. Allow the
API to be called with a null CU arguemnt by making the RelocMap
lookup conditional on the CU pointer validity. And document this
new behvior in the header. (Test coverage for this use of the API
comes in the DwarfAccelTable support patch)

llvm-svn: 221835

9 years agoRemove unsused variables.
Frederic Riss [Wed, 12 Nov 2014 23:48:01 +0000 (23:48 +0000)]
Remove unsused variables.

llvm-svn: 221834

9 years agoAdd another testcase.
Richard Smith [Wed, 12 Nov 2014 23:43:08 +0000 (23:43 +0000)]
Add another testcase.

llvm-svn: 221833

9 years agoPR19372: Keep checking template arguments after we see an argument pack
Richard Smith [Wed, 12 Nov 2014 23:38:38 +0000 (23:38 +0000)]
PR19372: Keep checking template arguments after we see an argument pack
expansion into a parameter pack; we know that we're still filling in that
parameter's arguments. Previously, if we hit this case for an alias template,
we'd try to substitute using non-canonical template arguments.

llvm-svn: 221832

9 years ago[mach-o] Sort GOT entries by name to make links reproducible
Nick Kledzik [Wed, 12 Nov 2014 23:34:23 +0000 (23:34 +0000)]
[mach-o] Sort GOT entries by name to make links reproducible

The GOT slots were being laid out in a random order by the GOTPass which
caused randomness in the output file.

Note: With this change lld now bootstraps on darwin.  That is:
1) link lld using system linker to make lld.1
2) link lld using lld.1 to make lld.2
3) link lld using lld.2 to make lld.3
Now lld.2 and lld.3 are identical.

llvm-svn: 221831

9 years agoFix so this test runs successfully on armv7 devices.
Greg Clayton [Wed, 12 Nov 2014 23:17:47 +0000 (23:17 +0000)]
Fix so this test runs successfully on armv7 devices.

llvm-svn: 221830

9 years agoTemporary revert r221818 until all the problems
Anton Korobeynikov [Wed, 12 Nov 2014 23:15:38 +0000 (23:15 +0000)]
Temporary revert r221818 until all the problems
with objc stuff will be resolved.

llvm-svn: 221829

9 years agoAdd a makefile even though it isn't used by the test in case we need to debug it...
Greg Clayton [Wed, 12 Nov 2014 23:13:23 +0000 (23:13 +0000)]
Add a makefile even though it isn't used by the test in case we need to debug it when it fails.

llvm-svn: 221828

9 years ago[CodeGenPrepare] Replace other uses of EVT::getEVT with TL::getValueType.
Ahmed Bougacha [Wed, 12 Nov 2014 23:05:03 +0000 (23:05 +0000)]
[CodeGenPrepare] Replace other uses of EVT::getEVT with TL::getValueType.

r221820 fixed a problem (PR21548) where an iPTR was used in TLI legality checks,
which isn't valid and resulted in a failed assertion.
The solution was to lower pointer types into the correct target's VT, by
using TL::getValueType instead of EVT::getEVT.

This commit changes 3 other uses of EVT::getEVT, but without any tests:
- One of these non-lowered EVTs is passed to allowsMisalignedMemoryAccesses,
which goes into target's TL implementation and doesn't cause any problem (yet.)
- Two others are passed to TLI.isOperationLegalOrCustom:
  - one only looks at extensions, so doesn't concern pointers.
  - one only looks at binary operators, so also isn't a problem.

The latter might some day be exposed to pointers and cause the same assert as
the original PR, because there's a comment hinting at also supporting cast ops.

For consistency, update all of them and be done with it.

llvm-svn: 221827

9 years agoPR21518: Use unsigned arithmetic for trapping add/sub functions.
Bob Wilson [Wed, 12 Nov 2014 23:01:24 +0000 (23:01 +0000)]
PR21518: Use unsigned arithmetic for trapping add/sub functions.

The code in {add,sub}v.i3 routines does not trap when it should, because
it performs the actual add/subtract operation in signed arithmetic,
rather than unsigned.

Patch by Francois-Xavie Coudert!

llvm-svn: 221826

9 years agoNow really fix the typo in the test
Anton Korobeynikov [Wed, 12 Nov 2014 22:58:08 +0000 (22:58 +0000)]
Now really fix the typo in the test

llvm-svn: 221825

9 years agoUpdate the tests to handle proper result type of (?:)
Anton Korobeynikov [Wed, 12 Nov 2014 22:48:38 +0000 (22:48 +0000)]
Update the tests to handle proper result type of (?:)

llvm-svn: 221824

9 years ago[Objective-C++ IRGen] do not generate .cxx_construct
Fariborz Jahanian [Wed, 12 Nov 2014 22:37:43 +0000 (22:37 +0000)]
[Objective-C++ IRGen] do not generate .cxx_construct
for class that contains trivially-constructible struct ivar.
rdar://18950072

llvm-svn: 221823

9 years ago[mach-o] Support linker synthesized mach_header symbols.
Nick Kledzik [Wed, 12 Nov 2014 22:21:56 +0000 (22:21 +0000)]
[mach-o] Support linker synthesized mach_header symbols.

On darwin in final linked images, the __TEXT segment covers that start of the
file.  That means in memory a process can see the mach_header (and load commands)
for every loaded image in a process.  There are APIs that take and return the
mach_header addresses as a way to specify a particular loaded image.

For completeness, any code can get the address of the mach_header of the image
it is in by using &__dso_handle.  In addition there are mach-o type specific
symbols like __mh_execute_header.

The linker needs to supply a definition for any of these symbols if used.  But
the address the symbol it resolves to is not in any section.  Instead it is the
address of the start of the __TEXT segment.

I needed to make a small change to SimpleFileNode to not override
resetNextIndex() because the Driver creates a SimpleFileNode to hold the
internal/implicit files that the context/writer can create. For some reason
SimpleFileNode overrode resetNextIndex() to do nothing instead of reseting
the index (which mach-o needs if the internal file is an archive).

llvm-svn: 221822

9 years agoFix fallout from r219557
Anton Korobeynikov [Wed, 12 Nov 2014 22:19:06 +0000 (22:19 +0000)]
Fix fallout from r219557

Summary:
Consider the following nifty 1 liner: (0 ? csqrtl(2.0f) : sqrtl(2.0f)). One can easily obtain such code from e.g. tgmath. Right now it produces an assertion because we fail to do the promotion real => _Complex real.

The case was properly handled previously (old handleOtherComplexFloatConversion routine), but was forgotten in the current version. This seems to be about fallout from r219557

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221821

9 years ago[CodeGenPrepare][AArch64] Fix a TLI legality check on iPTR to use a lowered instead.
Ahmed Bougacha [Wed, 12 Nov 2014 22:16:55 +0000 (22:16 +0000)]
[CodeGenPrepare][AArch64] Fix a TLI legality check on iPTR to use a lowered instead.

Fixes PR21548.  Related to PR20474.

llvm-svn: 221820

9 years agoExpose the number of Newton-Raphson iterations applied to the hardware's reciprocal...
Sanjay Patel [Wed, 12 Nov 2014 21:39:01 +0000 (21:39 +0000)]
Expose the number of Newton-Raphson iterations applied to the hardware's reciprocal estimate as a parameter (x86).

This is a follow-on to r221706 and r221731 and discussed in more detail in PR21385.

This patch also loosens the testcase checking for btver2. We know that the "1.0" will be loaded, but
we can't tell exactly when, so replace the CHECK-NEXT specifiers with plain CHECKs. The CHECK-NEXT
sequence relied on a quirk of post-RA-scheduling that may change independently of anything in these tests.

llvm-svn: 221819

9 years agoFix brace init of unions with unnamed struct members
Reid Kleckner [Wed, 12 Nov 2014 21:30:23 +0000 (21:30 +0000)]
Fix brace init of unions with unnamed struct members

The check for unnamed members was intended to skip unnamed bitfields,
but it ended up skipping unnamed structs. This lead to an assertion in
IRGen.

llvm-svn: 221818

9 years agoAdd fortified (__*_chk) library functions to TLI (NFC)
Ahmed Bougacha [Wed, 12 Nov 2014 21:23:34 +0000 (21:23 +0000)]
Add fortified (__*_chk) library functions to TLI (NFC)

One of them (__memcpy_chk) was already there, the others were checked
by comparing function names.
Note that the fortified libfuncs are now part of TLI, but are always
available, because they aren't generated, only optimized into the
non-checking versions.

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

llvm-svn: 221817

9 years agoUpdate Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
Richard Smith [Wed, 12 Nov 2014 21:16:38 +0000 (21:16 +0000)]
Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
which we don't yet implement).

llvm-svn: 221816

9 years agoAdd decorator for failing null dereference test on FreeBSD
Ed Maste [Wed, 12 Nov 2014 20:53:04 +0000 (20:53 +0000)]
Add decorator for failing null dereference test on FreeBSD

llvm.org/pr21550

llvm-svn: 221815

9 years agoAdd a test for PR21528 to make sure ASan C++ symbolization doesn't regress
Timur Iskhodzhanov [Wed, 12 Nov 2014 20:37:57 +0000 (20:37 +0000)]
Add a test for PR21528 to make sure ASan C++ symbolization doesn't regress

llvm-svn: 221814

9 years agoTemporary fix for PR21528 - use mangled C++ function names in COFF debug info to...
Timur Iskhodzhanov [Wed, 12 Nov 2014 20:21:20 +0000 (20:21 +0000)]
Temporary fix for PR21528 - use mangled C++ function names in COFF debug info to un-break ASan on Windows

llvm-svn: 221813