platform/upstream/llvm.git
9 years ago-Wsentinel: Suggest nullptr in C++11 instead of NULL
Reid Kleckner [Thu, 13 Nov 2014 23:19:36 +0000 (23:19 +0000)]
-Wsentinel: Suggest nullptr in C++11 instead of NULL

llvm-svn: 221945

9 years agoRelax the gcov version.ll test to check '.' instead of '\*'
Reid Kleckner [Thu, 13 Nov 2014 23:07:55 +0000 (23:07 +0000)]
Relax the gcov version.ll test to check '.' instead of '\*'

The escaping of the '\*' doesn't work with my combination of testing
tools.

llvm-svn: 221944

9 years agoSilence MSVC warning on missing return after fully covered switch
Reid Kleckner [Thu, 13 Nov 2014 23:07:22 +0000 (23:07 +0000)]
Silence MSVC warning on missing return after fully covered switch

llvm-svn: 221943

9 years agoFix assert/crash on invalid with __builtin_constant_p conditionals in constant expres...
Richard Smith [Thu, 13 Nov 2014 23:03:19 +0000 (23:03 +0000)]
Fix assert/crash on invalid with __builtin_constant_p conditionals in constant expressions.

llvm-svn: 221942

9 years agoR600/SI: Fix fmin_legacy / fmax_legacy matching for SI
Matt Arsenault [Thu, 13 Nov 2014 23:03:09 +0000 (23:03 +0000)]
R600/SI: Fix fmin_legacy / fmax_legacy matching for SI

select_cc is expanded on SI, so this was never matched.

llvm-svn: 221941

9 years agoUse nullptr instead of NULL for variadic sentinels
Reid Kleckner [Thu, 13 Nov 2014 22:55:19 +0000 (22:55 +0000)]
Use nullptr instead of NULL for variadic sentinels

Windows defines NULL to 0, which when used as an argument to a variadic
function, is not a null pointer constant. As a result, Clang's
-Wsentinel fires on this code. Using '0' would be wrong on most 64-bit
platforms, but both MSVC and Clang make it work on Windows. Sidestep the
issue with nullptr.

llvm-svn: 221940

9 years agoRevert "[GVN] Perform Scalar PRE on gep indices that feed loads before doing Load...
Chad Rosier [Thu, 13 Nov 2014 22:54:59 +0000 (22:54 +0000)]
Revert "[GVN] Perform Scalar PRE on gep indices that feed loads before doing Load PRE."

This reverts commit r221924.  It appears the commit was a bit premature and is causing
bot failures that need further investigation.

llvm-svn: 221939

9 years ago[x86] Add some tests for specific patterns of lane-flips combined with
Chandler Carruth [Thu, 13 Nov 2014 22:49:44 +0000 (22:49 +0000)]
[x86] Add some tests for specific patterns of lane-flips combined with
in-lane shuffles that aren't always handled well by the current vector
shuffle lowering.

No functionality change yet, that will follow in a subsequent commit.

llvm-svn: 221938

9 years agoMark more locale tests as unsupported with ASAN and MSAN
Eric Fiselier [Thu, 13 Nov 2014 22:45:23 +0000 (22:45 +0000)]
Mark more locale tests as unsupported with ASAN and MSAN

llvm-svn: 221937

9 years agoFix -Wcast-qual warnings in sanitizers
Alexey Samsonov [Thu, 13 Nov 2014 22:40:59 +0000 (22:40 +0000)]
Fix -Wcast-qual warnings in sanitizers

llvm-svn: 221936

9 years agoMove calls to push_back out of readAbbreviated(Literal|Field).
Rafael Espindola [Thu, 13 Nov 2014 22:29:02 +0000 (22:29 +0000)]
Move calls to push_back out of readAbbreviated(Literal|Field).

These functions always return a single value and not all callers want to
push them into a SmallVector.

llvm-svn: 221934

9 years agoObjective-C. Fixes a regression caused by implementation
Fariborz Jahanian [Thu, 13 Nov 2014 22:27:05 +0000 (22:27 +0000)]
Objective-C. Fixes a regression caused by implementation
of new warning for deprecated method call for receiver
of type 'id'. This addresses rdar://18960378 where
unintended warnings being issued.

llvm-svn: 221933

9 years agoAvoid usage of char16_t as MSVC "14" doesn't appear to support it
Reid Kleckner [Thu, 13 Nov 2014 22:09:56 +0000 (22:09 +0000)]
Avoid usage of char16_t as MSVC "14" doesn't appear to support it

Fixes the MSVC "14" build.

llvm-svn: 221932

9 years agoFix nested namespace with decltype to hopefully work with MSVC
David Blaikie [Thu, 13 Nov 2014 21:56:57 +0000 (21:56 +0000)]
Fix nested namespace with decltype to hopefully work with MSVC

Build failed here:
http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/14629/steps/build_Lld/logs/stdio

So I'm taking a shot in the dark that MSVC (whatever version that is)
can't cope with nested name specifiers with a decltype prefix.

llvm-svn: 221931

9 years agoMake a few helper functions static. NFC.
Rafael Espindola [Thu, 13 Nov 2014 21:54:59 +0000 (21:54 +0000)]
Make a few helper functions static. NFC.

llvm-svn: 221930

9 years ago[ASan] Really fix zero_page_pc test for PowerPC
Jay Foad [Thu, 13 Nov 2014 21:53:00 +0000 (21:53 +0000)]
[ASan] Really fix zero_page_pc test for PowerPC

Summary:
As a follow-up to D6167, this patch fixes the test to account for
another difference between PowerPC and x86 systems.

On x86 if you branch to an invalid address, you get a SIGSEGV with PC
set to the invalid address (and si_addr in the siginfo struct also set
to the same address).

On PowerPC, you get a SIGSEGV with PC pointing at the branch
instruction, but si_addr set to the invalid address.

You can see this difference if you run the test case under gdb.

Reviewers: kcc, glider, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 221929

9 years agoUse unique_ptr to handle ownership of TreePatterns in CodeGenDAGPatterns::PatternFrag...
David Blaikie [Thu, 13 Nov 2014 21:40:02 +0000 (21:40 +0000)]
Use unique_ptr to handle ownership of TreePatterns in CodeGenDAGPatterns::PatternFragments

We might be able to use unique_ptr to handle ownership of the
TreePatternNodes too - looking into that next.

llvm-svn: 221928

9 years agoSpecify checksums properly for llgs test suite packets.
Stephane Sezer [Thu, 13 Nov 2014 21:39:24 +0000 (21:39 +0000)]
Specify checksums properly for llgs test suite packets.

Summary: These checksums are ignored by llgs but some implementations require them to be specified properly.

Test Plan: Re-run llgs tests with the checksums and make sure we don't break anything.

Reviewers: tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 221927

9 years agoWe can get the TLOF from the TargetMachine - so constructor no longer requires Target...
Aditya Nandakumar [Thu, 13 Nov 2014 21:29:21 +0000 (21:29 +0000)]
We can get the TLOF from the TargetMachine - so constructor no longer requires TargetLoweringObjectFile to be passed.

llvm-svn: 221926

9 years ago[CMake] Detect if -Wfoo is supported instead of -Wno-foo, as GCC occasionally silentl...
Alexey Samsonov [Thu, 13 Nov 2014 21:19:53 +0000 (21:19 +0000)]
[CMake] Detect if -Wfoo is supported instead of -Wno-foo, as GCC occasionally silently discards unknown -Wno-foo flags.

llvm-svn: 221925

9 years ago[GVN] Perform Scalar PRE on gep indices that feed loads before doing Load PRE.
Chad Rosier [Thu, 13 Nov 2014 21:17:58 +0000 (21:17 +0000)]
[GVN] Perform Scalar PRE on gep indices that feed loads before doing Load PRE.

Phabricator Revision: http://reviews.llvm.org/D6103
Patch by "Balaram Makam" <bmakam@codeaurora.org>!

llvm-svn: 221924

9 years ago[FastISel][AArch64] Don't bail during simple GEP instruction selection.
Juergen Ributzka [Thu, 13 Nov 2014 20:50:44 +0000 (20:50 +0000)]
[FastISel][AArch64] Don't bail during simple GEP instruction selection.

The generic FastISel code would bail, because it can't emit a sign-extend for
AArch64. This copies the code over and uses AArch64 specific emit functions.

This is not ideal and 'computeAddress' should handles this, so it can fold the
address computation into the memory operation.

I plan to clean up 'computeAddress' anyways, so I will add that in a future
commit.

Related to rdar://problem/18962471.

llvm-svn: 221923

9 years agoR600/SI: Use s_movk_i32
Matt Arsenault [Thu, 13 Nov 2014 20:44:23 +0000 (20:44 +0000)]
R600/SI: Use s_movk_i32

llvm-svn: 221922

9 years agoR600/SI: Fix definition for s_cselect_b32
Matt Arsenault [Thu, 13 Nov 2014 20:23:36 +0000 (20:23 +0000)]
R600/SI: Fix definition for s_cselect_b32

These were directly using the old base instruction
class, and specifying the wrong register classes
for operands. The operands can be the other special
inputs besides SGPRs. The op name was also being
directly used for the asm string, so this was printed
without any operands.

llvm-svn: 221921

9 years agoR600: Fix assert on empty function
Matt Arsenault [Thu, 13 Nov 2014 20:07:40 +0000 (20:07 +0000)]
R600: Fix assert on empty function

If a function is just an unreachable, this would hit a
"this is not a MachO target" assertion because of setting
HasSubsectionViaSymbols.

llvm-svn: 221920

9 years agoUn-break the big-endian buildbots
Rui Ueyama [Thu, 13 Nov 2014 20:07:06 +0000 (20:07 +0000)]
Un-break the big-endian buildbots

llvm-svn: 221919

9 years agoPR21437, final part of DR1330: delay-parsing of exception-specifications. This
Richard Smith [Thu, 13 Nov 2014 20:01:57 +0000 (20:01 +0000)]
PR21437, final part of DR1330: delay-parsing of exception-specifications. This
is a re-commit of Doug's r154844 (modernized and updated to fit into current
Clang).

llvm-svn: 221918

9 years agoR600: Error on initializer for LDS.
Matt Arsenault [Thu, 13 Nov 2014 19:56:13 +0000 (19:56 +0000)]
R600: Error on initializer for LDS.

Also give a proper error for other address spaces.

llvm-svn: 221917

9 years agoR600/SI: Get rid of FCLAMP_SI pseudo
Matt Arsenault [Thu, 13 Nov 2014 19:49:04 +0000 (19:49 +0000)]
R600/SI: Get rid of FCLAMP_SI pseudo

It's not necessary. Also use complex patterns to allow
src modifier usage.

llvm-svn: 221916

9 years agoObject, Mach-O: Refactor and clean code up
David Majnemer [Thu, 13 Nov 2014 19:48:56 +0000 (19:48 +0000)]
Object, Mach-O: Refactor and clean code up

Don't assert if we can return an error code, reuse existing
functionality like is64Bit().

llvm-svn: 221915

9 years agoRemove -Wcast-qual as it's inherited from llvm since r221913.
Roman Divacky [Thu, 13 Nov 2014 19:47:31 +0000 (19:47 +0000)]
Remove -Wcast-qual as it's inherited from llvm since r221913.

llvm-svn: 221914

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