platform/upstream/llvm.git
10 years ago[mips][mips64r6] Define _MIPS_FPSET, __mips_fpr, and __mips_nan2008 correctly on...
Daniel Sanders [Wed, 9 Jul 2014 13:56:23 +0000 (13:56 +0000)]
[mips][mips64r6] Define _MIPS_FPSET, __mips_fpr, and __mips_nan2008 correctly on MIPS32r6/MIPS64r6

Summary:
This removes the need to pass -mnan=2008 explicitly to be able to compile
the test-suite for MIPS32r6/MIPS64r6.

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

llvm-svn: 212619

10 years ago[mips] clz is defined to give 32 for zero. Similarly, dclz gives 64.
Daniel Sanders [Wed, 9 Jul 2014 13:43:19 +0000 (13:43 +0000)]
[mips] clz is defined to give 32 for zero. Similarly, dclz gives 64.

Summary:
While debugging another issue, I noticed that Mips currently specifies that the
count leading zero builtins are undefined when the input is zero. The
architecture specifications say that the clz and dclz instructions write 32 or
64 respectively when given zero.

This doesn't fix any bugs that I'm aware of but it may improve optimisation in
some cases.

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

llvm-svn: 212618

10 years agoclang-format: Fix behavior around pointer-to-member invocations.
Daniel Jasper [Wed, 9 Jul 2014 13:07:57 +0000 (13:07 +0000)]
clang-format: Fix behavior around pointer-to-member invocations.

Before:
  (aaaaaaaaaa->*
   bbbbbbb)(aaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaa));

After:
  (aaaaaaaaaa->*bbbbbbb)(
      aaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaa));

llvm-svn: 212617

10 years ago[all]: Use range-based ArgList adapter instead of filtered_begin/filtered_end
Tim Northover [Wed, 9 Jul 2014 13:03:54 +0000 (13:03 +0000)]
[all]: Use range-based ArgList adapter instead of filtered_begin/filtered_end

Some of those loops were pretty monstrous.

llvm-svn: 212616

10 years agoGeneric: add range-adapter for option parsing.
Tim Northover [Wed, 9 Jul 2014 13:03:37 +0000 (13:03 +0000)]
Generic: add range-adapter for option parsing.

I want to use it in lld, but while I'm here I'll update LLVM uses.

llvm-svn: 212615

10 years ago[x86] Fix a bug in my new zext-vector-inreg DAG trickery where we were
Chandler Carruth [Wed, 9 Jul 2014 12:36:54 +0000 (12:36 +0000)]
[x86] Fix a bug in my new zext-vector-inreg DAG trickery where we were
not widening the input type to the node sufficiently to let the ext take
place in a register.

This would in turn result in a mysterious bitcast assertion failure
downstream. First change here is to add back the helpful assert I had in
an earlier version of the code to catch this immediately.

Next change is to add support to the type legalization to detect when we
have widened the operand either too little or too much (for whatever
reason) and find a size-matched legal vector type to convert it to
first. This can also fail so we get a new fallback path, but that seems
OK.

With this, we no longer crash on vec_cast2.ll when using widening. I've
also added the CHECK lines for the zero-extend cases here. We still need
to support sign-extend and trunc (or something) to get plausible code
for the other two thirds of this test which is one of the regression
tests that showed the most scalarization when widening was
force-enabled. Slowly closing in on widening being a viable legalization
strategy without it resorting to scalarization at every turn. =]

llvm-svn: 212614

10 years ago[Mips] Make rel-dynamic-08.test test case independent from external input files.
Simon Atanasyan [Wed, 9 Jul 2014 12:31:11 +0000 (12:31 +0000)]
[Mips] Make rel-dynamic-08.test test case independent from external input files.

llvm-svn: 212613

10 years agoSink two variables only used in an assert into the assert itself. Should
Chandler Carruth [Wed, 9 Jul 2014 11:13:16 +0000 (11:13 +0000)]
Sink two variables only used in an assert into the assert itself. Should
fix the release builds with Werror.

llvm-svn: 212612

10 years agoX86: When lowering v8i32 himuls use the correct shuffle masks for AVX2.
Benjamin Kramer [Wed, 9 Jul 2014 11:12:39 +0000 (11:12 +0000)]
X86: When lowering v8i32 himuls use the correct shuffle masks for AVX2.

Turns out my trick of using the same masks for SSE4.1 and AVX2 didn't work out
as we have to blend two vectors. While there remove unecessary cross-lane moves
from the shuffles so the backend can lower it to palignr instead of vperm.

Fixes PR20118, a miscompilation of vector sdiv by constant on AVX2.

llvm-svn: 212611

10 years ago[x86] Add a ZERO_EXTEND_VECTOR_INREG DAG node and use it when widening
Chandler Carruth [Wed, 9 Jul 2014 10:58:18 +0000 (10:58 +0000)]
[x86] Add a ZERO_EXTEND_VECTOR_INREG DAG node and use it when widening
vector types to be legal and a ZERO_EXTEND node is encountered.

When we use widening to legalize vector types, extend nodes are a real
challenge. Either the input or output is likely to be legal, but in many
cases not both. As a consequence, we don't really have any way to
represent this situation and the prior code in the widening legalization
framework would just scalarize the extend operation completely.

This patch introduces a new DAG node to represent doing a zero extend of
a vector "in register". The core of the idea is to allow legal but
different vector types in the input and output. The output vector must
have fewer lanes but wider elements. The operation is defined to zero
extend the low elements of the input to the size of the output elements,
and drop all of the high elements which don't have a corresponding lane
in the output vector.

It also includes generic expansion of this node in terms of blending
a zero vector into the high elements of the vector and bitcasting
across. This in turn yields extremely nice code for x86 SSE2 when we use
the new widening legalization logic in conjunction with the new shuffle
lowering logic.

There is still more to do here. We need to support sign extension, any
extension, and potentially int-to-float conversions. My current plan is
to continue using similar synthetic nodes to model each of these
transitions with generic lowering code for each one.

However, with this patch LLVM already reaches performance parity with
GCC for the core C loops of the x264 code (assuming you disable the
hand-written assembly versions) when compiling for SSE2 and SSE3
architectures and enabling the new widening and lowering logic for
vectors.

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

llvm-svn: 212610

10 years agoclang-format polly to avoid buildbot noise
Tobias Grosser [Wed, 9 Jul 2014 10:50:10 +0000 (10:50 +0000)]
clang-format polly to avoid buildbot noise

llvm-svn: 212609

10 years ago[mips][mips64r6] Correct select patterns that have the condition or true/false values...
Daniel Sanders [Wed, 9 Jul 2014 10:47:26 +0000 (10:47 +0000)]
[mips][mips64r6] Correct select patterns that have the condition or true/false values backwards

Summary: This bug caused SingleSource/Regression/C/uint64_to_float and SingleSource/UnitTests/2002-05-02-CastTest3 to fail (among others).

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

llvm-svn: 212608

10 years ago[mips][mips64r6] Correct cond names in the cmp.cond.[ds] instructions
Daniel Sanders [Wed, 9 Jul 2014 10:40:20 +0000 (10:40 +0000)]
[mips][mips64r6] Correct cond names in the cmp.cond.[ds] instructions

Summary:
It seems we accidentally read the wrong column of the table MIPS64r6 spec
and used the names for c.cond.fmt instead of cmp.cond.fmt.

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

llvm-svn: 212607

10 years ago[x86] Initialize a pointer to null to fix a bug in r212602.
Chandler Carruth [Wed, 9 Jul 2014 10:36:42 +0000 (10:36 +0000)]
[x86] Initialize a pointer to null to fix a bug in r212602.

This should restore GCC hosts (which happen to put the bad stuff into
the pointer) and MSan, etc.

llvm-svn: 212606

10 years ago[mips][mips64r6] Use JALR for indirect branches instead of JR (which is not available...
Daniel Sanders [Wed, 9 Jul 2014 10:21:59 +0000 (10:21 +0000)]
[mips][mips64r6] Use JALR for indirect branches instead of JR (which is not available on MIPS32r6/MIPS64r6)

Summary:
This completes the change to use JALR instead of JR on MIPS32r6/MIPS64r6.

Reviewers: jkolek, vmedic, zoran.jovanovic, dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 212605

10 years ago[mips][mips64r6] Use JALR for returns instead of JR (which is not available on MIPS32...
Daniel Sanders [Wed, 9 Jul 2014 10:16:07 +0000 (10:16 +0000)]
[mips][mips64r6] Use JALR for returns instead of JR (which is not available on MIPS32r6/MIPS64r6)

Summary:
RET, and RET_MM have been replaced by a pseudo named PseudoReturn.
In addition a version with a 64-bit GPR named PseudoReturn64 has been
added.

Instruction selection for a return matches RetRA, which is expanded post
register allocation to PseudoReturn/PseudoReturn64. During MipsAsmPrinter,
this PseudoReturn/PseudoReturn64 are emitted as:
- (JALR64 $zero, $rs) on MIPS64r6
- (JALR $zero, $rs) on MIPS32r6
- (JR_MM $rs) on microMIPS
- (JR $rs) otherwise

On MIPS32r6/MIPS64r6, 'jr $rs' is an alias for 'jalr $zero, $rs'. To aid
development and review (specifically, to ensure all cases of jr are
updated), these aliases are temporarily named 'r6.jr' instead of 'jr'.
A follow up patch will change them back to the correct mnemonic.

Added (JALR $zero, $rs) to MipsNaClELFStreamer's definition of an indirect
jump, and removed it from its definition of a call.
Note: I haven't accounted for MIPS64 in MipsNaClELFStreamer since it's
doesn't appear to account for any MIPS64-specifics.

The return instruction created as part of eh_return expansion is now expanded
using expandRetRA() so we use the right return instruction on MIPS32r6/MIPS64r6
('jalr $zero, $rs').

Also, fixed a misuse of isABI_N64() to detect 64-bit wide registers in
expandEhReturn().

Reviewers: jkolek, vmedic, mseaborn, zoran.jovanovic, dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 212604

10 years agoAdd ability to emit internal instruction representation to CodeGen assembly output.
Daniel Sanders [Wed, 9 Jul 2014 10:07:36 +0000 (10:07 +0000)]
Add ability to emit internal instruction representation to CodeGen assembly output.

Summary:
This patch re-uses the implementation of 'llvm-mc -show-inst' and makes it
available to llc as 'llc -asm-show-inst'.

This is necessary to test parts of MIPS32r6/MIPS64r6 without resorting to
'llc -filetype=obj' tests. For example, on MIPS32r2 and earlier we use the
'jr $rs' instruction for indirect branches and returns. On MIPS32r6, we no
longer have 'jr $rs' and use 'jalr $zero, $rs' instead. The catch is that,
on MIPS32r6, 'jr $rs' is an alias for 'jalr $zero, $rs' and is the preferred
way of writing this instruction. As a result, all MIPS ISA's emit 'jr $rs' in
their assembly output and the assembler encodes this to different opcodes
according to the ISA.

Using this option, we can check that the MCInst really is a JR or a JALR by
matching the emitted comment. This removes the need for a 'llc -filetype=obj'
test.

Reviewers: rafael, dsanders

Reviewed By: dsanders

Subscribers: zoran.jovanovic, llvm-commits

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

llvm-svn: 212603

10 years ago[x86] Re-apply a variant of the x86 side of r212324 now that the rest
Chandler Carruth [Wed, 9 Jul 2014 10:06:58 +0000 (10:06 +0000)]
[x86] Re-apply a variant of the x86 side of r212324 now that the rest
has settled without incident, removing the x86-specific and overly
strict 'isVectorSplat' routine in favor of generic and more powerful
splat detection.

The primary motivation and result of this is that the x86 backend can
now see through splats which contain undef elements. This is essential
if we are using a widening form of legalization and I've updated a test
case to also run in that mode as before this change the generated code
for the test case was completely scalarized.

This version of the patch much more carefully handles the undef lanes.
- We aren't overly conservative about them in the shift lowering
  (where we will never use the splat itself).
- One place where the splat would have been re-used by the existing code
  now explicitly constructs a new constant splat that will be safe.
- The broadcast lowering is much more reasonable with undefs by doing
  a correct check of whether the splat is the only user of a loaded
  value, checking that the splat actually crosses multiple lanes before
  using a broadcast, and handling broadcasts of non-constant splats.

As a consequence of the last bullet, the weird usage of vpshufd instead
of vbroadcast is gone, and we actually can lower an AVX splat with
vbroadcastss where before we emitted a really strange pattern of
a vector load and a manual splat across the vector.

llvm-svn: 212602

10 years agoFixed incompatibility with MSVC builds in range-based for loops in DataRecursiveASTVi...
Alexey Bataev [Wed, 9 Jul 2014 10:00:31 +0000 (10:00 +0000)]
Fixed incompatibility with MSVC builds in range-based for loops in DataRecursiveASTVisitor and RecursiveASTVisitor for OpenMP constructs.

llvm-svn: 212601

10 years agoRevert commit 212599.
Alexey Bataev [Wed, 9 Jul 2014 09:50:46 +0000 (09:50 +0000)]
Revert commit 212599.

llvm-svn: 212600

10 years ago[OPENMP] Fixed incompatibility in [Data]RecursiveASTVisitor::TraverseOMPExecutableDir...
Alexey Bataev [Wed, 9 Jul 2014 09:33:29 +0000 (09:33 +0000)]
[OPENMP] Fixed incompatibility in [Data]RecursiveASTVisitor::TraverseOMPExecutableDirective method with MSVC for range-based loops.

llvm-svn: 212599

10 years agoARM: use LLVM's atomicrmw instructions when ldrex/strex are available.
Tim Northover [Wed, 9 Jul 2014 09:24:43 +0000 (09:24 +0000)]
ARM: use LLVM's atomicrmw instructions when ldrex/strex are available.

Having some kind of weird kernel-assisted ABI for these when the
native instructions are available appears to be (and should be) the
exception; OSs have been gradually opting in for years and the code
was getting silly.

So let LLVM decide whether it's possible/profitable to inline them by
default.

Patch by Phoebe Buckheister.

llvm-svn: 212598

10 years agoclang-format: Add new option to indent wrapped function declarations.
Daniel Jasper [Wed, 9 Jul 2014 08:42:42 +0000 (08:42 +0000)]
clang-format: Add new option to indent wrapped function declarations.

Though not completely identical, make former
IndentFunctionDeclarationAfterType change this flag for backwards
compatibility (it is somewhat close in meaning and better the err'ing on
an unknown config flag).

llvm-svn: 212597

10 years ago[ASan/Win] Don't instrument COMDAT globals. Properly fixes PR20244.
Timur Iskhodzhanov [Wed, 9 Jul 2014 08:35:33 +0000 (08:35 +0000)]
[ASan/Win] Don't instrument COMDAT globals. Properly fixes PR20244.

llvm-svn: 212596

10 years agoSourceMgr: consistently use 'unsigned' for the memory buffer ID type
Dmitri Gribenko [Wed, 9 Jul 2014 08:30:15 +0000 (08:30 +0000)]
SourceMgr: consistently use 'unsigned' for the memory buffer ID type

llvm-svn: 212595

10 years agoclang-format: Update flag documentation.
Daniel Jasper [Wed, 9 Jul 2014 08:19:11 +0000 (08:19 +0000)]
clang-format: Update flag documentation.

llvm-svn: 212594

10 years agoDelete removed formatting option.
Daniel Jasper [Wed, 9 Jul 2014 08:18:31 +0000 (08:18 +0000)]
Delete removed formatting option.

llvm-svn: 212593

10 years ago[OPENMP] Improved code of DataRecursiveASTVisitor and RecursiveASTVisitor for OpenMP...
Alexey Bataev [Wed, 9 Jul 2014 08:00:46 +0000 (08:00 +0000)]
[OPENMP] Improved code of DataRecursiveASTVisitor and RecursiveASTVisitor for OpenMP constructs per Tobias Grosser comments.

llvm-svn: 212592

10 years agoclang-format: Revamp function declaration/definition indentation.
Daniel Jasper [Wed, 9 Jul 2014 07:50:33 +0000 (07:50 +0000)]
clang-format: Revamp function declaration/definition indentation.

Key changes:
- Correctly (well ...) distinguish function declarations and variable
  declarations with ()-initialization.
- Don't indent when breaking function declarations/definitions after the
  return type.
- Indent variable declarations and typedefs when breaking after the
  type.

This fixes llvm.org/PR17999.

llvm-svn: 212591

10 years agoProspective -fsanitize=memory build fix following r212586
Alp Toker [Wed, 9 Jul 2014 06:27:05 +0000 (06:27 +0000)]
Prospective -fsanitize=memory build fix following r212586

This -f group flag appears to influence linker flags, breaking the usual rules
and causing CMake's link invocation to fail during feature detection due to
missing link dependencies (msan_*).

Let's forcibly add it for now to get things the way they were before feature
detection started working.

llvm-svn: 212590

10 years agoFix typos.
Nikola Smiljanic [Wed, 9 Jul 2014 05:42:35 +0000 (05:42 +0000)]
Fix typos.

llvm-svn: 212589

10 years agoUse correct memeber when displaying StringMap's size.
Nikola Smiljanic [Wed, 9 Jul 2014 05:34:24 +0000 (05:34 +0000)]
Use correct memeber when displaying StringMap's size.

llvm-svn: 212588

10 years agoCMake: make __DATE__, __TIME__ etc. macro usage an error
Alp Toker [Wed, 9 Jul 2014 03:39:32 +0000 (03:39 +0000)]
CMake: make __DATE__, __TIME__ etc. macro usage an error

When LLVM_ENABLE_TIMESTAMPS has been disabled we can prevent the preprocessor
from embedding dates, times and file timestamps.

There are a few motivations for this:

  1) Validate the recent CMake feature detection bugfix from LLVM r212586 with
     a flag that's not actually available everywhere.

  2) Dogfood clang's new -Wdate-time warning from r210511 when bootstrapping.

  3) Encourage reproducible builds.

llvm-svn: 212587

10 years agoCMake: fix compiler feature detection
Alp Toker [Wed, 9 Jul 2014 03:38:19 +0000 (03:38 +0000)]
CMake: fix compiler feature detection

add_flag_if_supported() and add_flag_or_print_warning() were effectively
no-ops, just returning the value of the first result (usually
'-fno-omit-frame-pointer') for all subsequent checks for different flags.

Due to the way CMake caches feature detection results, we need to provide
symbolic variable names which will persist the cached results. This commit
fixes feature detection using these two macros.

The feature checks now run and get stored correctly, and the correct output can
be observed in configure logs:

  -- Performing Test C_SUPPORTS_FPIC
  -- Performing Test C_SUPPORTS_FPIC - Success
  -- Performing Test CXX_SUPPORTS_FPIC
  -- Performing Test CXX_SUPPORTS_FPIC - Success

llvm-svn: 212586

10 years agoclang-interpreter: don't check input file existence, we're in-process
Alp Toker [Wed, 9 Jul 2014 01:37:36 +0000 (01:37 +0000)]
clang-interpreter: don't check input file existence, we're in-process

This flag is set by most other tools and avoids extra stat() calls. The
frontend will diagnose anyway as it performs the check atomically while opening
files at point of use.

We could probably make Driver::CheckInputsExist default to false and only
enable it in the main 'clang' binary, or even better only perform the checks if
we know the tool is external but that needs more thought.

llvm-svn: 212585

10 years agoSimplify warning flag value handling from r206826
Alp Toker [Wed, 9 Jul 2014 01:37:24 +0000 (01:37 +0000)]
Simplify warning flag value handling from r206826

Also give the field it a more appropriate name and improve the docs.

llvm-svn: 212584

10 years ago__arm64__ and __aarch64__ #ifdef adjustments
Todd Fiala [Wed, 9 Jul 2014 01:29:05 +0000 (01:29 +0000)]
__arm64__ and __aarch64__ #ifdef adjustments

Change by Paul Osmialowski

See http://reviews.llvm.org/D4379 for details.

llvm-svn: 212583

10 years agoCorrect indentation level for one line.
Jason Molenda [Wed, 9 Jul 2014 01:10:37 +0000 (01:10 +0000)]
Correct indentation level for one line.

llvm-svn: 212582

10 years ago[SDAG] At the suggestion of Hal, switch to an output parameter that
Chandler Carruth [Wed, 9 Jul 2014 00:41:34 +0000 (00:41 +0000)]
[SDAG] At the suggestion of Hal, switch to an output parameter that
tracks which elements of the build vector are in fact undef.

This should make actually inpsecting them (likely in my next patch)
reasonably pretty. Also makes the output parameter optional as it is
clear now that *most* users are happy with undefs in their splats.

llvm-svn: 212581

10 years ago[ms-coff] Add a test for proper handling of full Windows path names in the .drectve...
Ehsan Akhgari [Wed, 9 Jul 2014 00:40:50 +0000 (00:40 +0000)]
[ms-coff] Add a test for proper handling of full Windows path names in the .drectve section

Summary: This test ensures that we can correctly specify a full Windows path to the clang ASAN runtime libraries.  This is in preparation to fix PR20246.

Reviewers: rafael

Subscribers: llvm-commits

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

llvm-svn: 212580

10 years agoChange llvm-nm to use -M instead of -s to work with latest llvm-nm
Nick Kledzik [Wed, 9 Jul 2014 00:25:52 +0000 (00:25 +0000)]
Change llvm-nm to use -M instead of -s to work with latest llvm-nm

llvm-svn: 212579

10 years agorewrap to 80 cols, no behavior change
Nico Weber [Tue, 8 Jul 2014 23:54:25 +0000 (23:54 +0000)]
rewrap to 80 cols, no behavior change

llvm-svn: 212578

10 years agoMipsTargetStreamer.h: Avoid "using" to appease msc17.
NAKAMURA Takumi [Tue, 8 Jul 2014 23:48:22 +0000 (23:48 +0000)]
MipsTargetStreamer.h: Avoid "using" to appease msc17.

llvm-svn: 212577

10 years agoChanged the lvm-nm alias "-s" for -print-armap to "-M".
Kevin Enderby [Tue, 8 Jul 2014 23:47:31 +0000 (23:47 +0000)]
Changed the lvm-nm alias "-s" for -print-armap to "-M".
This will allow the "-s" flag to implemented in the future as it
is in darwin’s nm(1) to list symbols only in the specified section.

Given a LGTM by Shankar Easwaran who originally implemented
the support for lvm-nm’s -print-armap and archive map symbols.

llvm-svn: 212576

10 years agoTweak for lldb coding style consistency.
Jason Molenda [Tue, 8 Jul 2014 23:46:39 +0000 (23:46 +0000)]
Tweak for lldb coding style consistency.

llvm-svn: 212575

10 years agorewrap to 80 cols, no behavior change
Nico Weber [Tue, 8 Jul 2014 23:46:20 +0000 (23:46 +0000)]
rewrap to 80 cols, no behavior change

llvm-svn: 212574

10 years agoAArch64: Better codegen for loading from __fp16.
Jim Grosbach [Tue, 8 Jul 2014 23:28:48 +0000 (23:28 +0000)]
AArch64: Better codegen for loading from __fp16.

Loading will generally extend to an f32 or an 64, so make sure
to match those patterns directly to load into the FPR16 register
class directly rather than going through the integer GPRs.

This also eliminates an extra step in the convert-to-f64 path
which was first converting to f32 and then to f64 from there.

rdar://17594379

llvm-svn: 212573

10 years agoImprove BasicAA CS-CS queries
Hal Finkel [Tue, 8 Jul 2014 23:16:49 +0000 (23:16 +0000)]
Improve BasicAA CS-CS queries

BasicAA contains knowledge of certain intrinsics, such as memcpy and memset,
and uses that information to form more-accurate answers to CallSite vs. Loc
ModRef queries. Unfortunately, it did not use this information when answering
CallSite vs. CallSite queries.

Generically, when an intrinsic takes one or more pointers and the intrinsic is
marked only to read/write from its arguments, the offset/size is unknown. As a
result, the generic code that answers CallSite vs. CallSite (and CallSite vs.
Loc) queries in AA uses UnknownSize when forming Locs from an intrinsic's
arguments. While BasicAA's CallSite vs. Loc override could use more-accurate
size information for some intrinsics, it did not do the same for CallSite vs.
CallSite queries.

This change refactors the intrinsic-specific logic in BasicAA into a generic AA
query function: getArgLocation, which is overridden by BasicAA to supply the
intrinsic-specific knowledge, and used by AA's generic implementation. This
allows the intrinsic-specific knowledge to be used by both CallSite vs. Loc and
CallSite vs. CallSite queries, and simplifies the BasicAA implementation.

Currently, only one function, Mac's memset_pattern16, is handled by BasicAA
(all the rest are intrinsics). As a side-effect of this refactoring, BasicAA's
getModRefBehavior override now also returns OnlyAccessesArgumentPointees for
this function (which is an improvement).

llvm-svn: 212572

10 years ago[PECOFF] Fix .bss section alignment
Rui Ueyama [Tue, 8 Jul 2014 23:11:01 +0000 (23:11 +0000)]
[PECOFF] Fix .bss section alignment

Previously the alignment of the .bss section was not
properly set because of a bug in AtomizeDefinedSymbolsInSection.
We set the alignment of the section at the end of the function,
but we use an eraly return for the .bss section, so the code had
been skipped.

llvm-svn: 212571

10 years agoDominanceInfo is strongly preferred over RegionInfo
Tobias Grosser [Tue, 8 Jul 2014 22:51:03 +0000 (22:51 +0000)]
DominanceInfo is strongly preferred over RegionInfo

This is and always was strong community consensus. Make this clear in the header
in case newcomers may not be aware.

llvm-svn: 212570

10 years agostring_view enhancements. Move to the correct namespace. Better constexpr support...
Marshall Clow [Tue, 8 Jul 2014 22:38:11 +0000 (22:38 +0000)]
string_view enhancements. Move to the correct namespace. Better constexpr support (thanks to Richard for the suggestions). Update the tests to match this. Add <experimental/__config for experimental macros/etc to live.

llvm-svn: 212569

10 years agoAdd support for BSD format Archive map symbols (aka the table of contents
Kevin Enderby [Tue, 8 Jul 2014 22:10:02 +0000 (22:10 +0000)]
Add support for BSD format Archive map symbols (aka the table of contents
from a __.SYMDEF or "__.SYMDEF SORTED" archive member).

llvm-svn: 212568

10 years agoMake sure that qProcessInfo packet returns correct cpu type/subtype for processes...
Greg Clayton [Tue, 8 Jul 2014 21:45:21 +0000 (21:45 +0000)]
Make sure that qProcessInfo packet returns correct cpu type/subtype for processes on Haswell machines with a Haswell enabled kernel.

<rdar://problem/17332107>

llvm-svn: 212567

10 years agoMS compat: Allow lookup of types from dependent bases in functions
Reid Kleckner [Tue, 8 Jul 2014 21:35:03 +0000 (21:35 +0000)]
MS compat: Allow lookup of types from dependent bases in functions

If we want to resolve the remaining FIXMEs here, we probably want to
extend the main lookup mechanism to perform lookup into dependent bases,
but we would have to tread lightly.  Adding more name lookup has major
impact on compile time.

If we did extend the main mechanism, we would add a flag to LookupResult
that allows us to find names from dependent base classes where the base
is a specialization of a known template.  The final LookupResult would
still return LookupResult::NotFoundInCurrentInstantiation, but it would
have a collection of Decls.  If we find a real lookup result, we would
clear the flag and the existing lookup results and begin accumulating
only real lookup results.

We would structure the lookup as a secondary lookup between normal
lookup and typo correction for normal compilation, but for MSVC
compatibility mode, we would always enable this extra lookup into
dependent bases.

llvm-svn: 212566

10 years agotsan: reapply 212531 and 212532 with a fix
Dmitry Vyukov [Tue, 8 Jul 2014 20:37:16 +0000 (20:37 +0000)]
tsan: reapply 212531 and 212532 with a fix
don't reset s->addr as well

llvm-svn: 212565

10 years agoRemove unnecessary check for NULL
Alexey Samsonov [Tue, 8 Jul 2014 20:23:18 +0000 (20:23 +0000)]
Remove unnecessary check for NULL

llvm-svn: 212564

10 years agotest: merge arm-intrin into ms-intrin, fix invocation
Saleem Abdulrasool [Tue, 8 Jul 2014 20:21:29 +0000 (20:21 +0000)]
test: merge arm-intrin into ms-intrin, fix invocation

This merges the two tests into one since there is no real reason to separate
them.  It also fixes the test invocation to specify -fms-compatibility without
which we would end up without an Intrin.h header.

llvm-svn: 212563

10 years ago[TSan] Revert r212531 and r212532.
Alexey Samsonov [Tue, 8 Jul 2014 20:17:19 +0000 (20:17 +0000)]
[TSan] Revert r212531 and r212532.

They cause "check-tsan" command to hang. Details in r212532 review thread.

llvm-svn: 212562

10 years agoAllow more lookup of types in dependent base classes
Reid Kleckner [Tue, 8 Jul 2014 20:05:48 +0000 (20:05 +0000)]
Allow more lookup of types in dependent base classes

MSVC appears to perform name lookup into dependent base classes when the
dependent base class has a known primary template.  This allows them to
know whether some unqualified ids are types or not, which allows them to
parse more class templates without typename keywords.

We can do the same thing when type name lookup fails, and if we find a
single type decl in one of our dependent base classes, recover as though
the user wrote 'typename MyClass::TypeFromBase'.

This allows us to parse some COM smart pointer classes in wrl/client.h
from the Windows 8 SDK.

Reviewers: rsmith

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

llvm-svn: 212561

10 years agotsan: allow memory overlap in __tsan_java_move
Dmitry Vyukov [Tue, 8 Jul 2014 20:01:12 +0000 (20:01 +0000)]
tsan: allow memory overlap in __tsan_java_move
JVM actually moves memory between overlapping ranges.

llvm-svn: 212560

10 years agoAdd the ability to provide a "count" option to the various "thread step-*" operations...
Jim Ingham [Tue, 8 Jul 2014 19:28:57 +0000 (19:28 +0000)]
Add the ability to provide a "count" option to the various "thread step-*" operations.  Only
step-inst and step-inst are currently supported, the rest just warn that they are not supported
if you try to provide a count.

llvm-svn: 212559

10 years agoDocument the "thread.completed-expression" feature in the "expression" command help.
Jim Ingham [Tue, 8 Jul 2014 19:27:35 +0000 (19:27 +0000)]
Document the "thread.completed-expression" feature in the "expression" command help.

llvm-svn: 212558

10 years agoDon't pull in setjmp.h in -ffreestanding compiles.
Nico Weber [Tue, 8 Jul 2014 18:34:46 +0000 (18:34 +0000)]
Don't pull in setjmp.h in -ffreestanding compiles.

Also provide _setjmpex(). r200243 put in _setjmp() and _setjmpex() behind a
comment since jmp_buf wasn't available. r200344 added jmp_buf and put in
_setjmp(), but missed _setjmpex().

llvm-svn: 212557

10 years agoReplace a few // comments with /**/ comments in headers, for consistency.
Nico Weber [Tue, 8 Jul 2014 18:29:27 +0000 (18:29 +0000)]
Replace a few // comments with /**/ comments in headers, for consistency.

llvm-svn: 212556

10 years agoSema: Don't allow CVR qualifiers before structors
David Majnemer [Tue, 8 Jul 2014 18:18:04 +0000 (18:18 +0000)]
Sema: Don't allow CVR qualifiers before structors

We would silently accept volatile ~S() when the user probably intended
to write virtual ~S().

This fixes PR20238.

llvm-svn: 212555

10 years agoRevert accidental change to Xcode project.
Bruce Mitchener [Tue, 8 Jul 2014 18:09:58 +0000 (18:09 +0000)]
Revert accidental change to Xcode project.

llvm-svn: 212554

10 years agoFix typos.
Bruce Mitchener [Tue, 8 Jul 2014 18:05:41 +0000 (18:05 +0000)]
Fix typos.

llvm-svn: 212553

10 years agoSimplify Host::GetOSVersion() on macosx.
Jean-Daniel Dupas [Tue, 8 Jul 2014 17:42:17 +0000 (17:42 +0000)]
Simplify Host::GetOSVersion() on macosx.

It removes usage of the deprecated function CFURLCreateDataAndPropertiesFromResource().

llvm-svn: 212552

10 years agoPR20227: materialize a temporary when dynamic_casting a class prvalue to a
Richard Smith [Tue, 8 Jul 2014 17:25:14 +0000 (17:25 +0000)]
PR20227: materialize a temporary when dynamic_casting a class prvalue to a
reference type.

llvm-svn: 212551

10 years agoRevert "GlobalDCE: Delete available_externally initializers if it allows removing...
Pete Cooper [Tue, 8 Jul 2014 17:06:03 +0000 (17:06 +0000)]
Revert "GlobalDCE: Delete available_externally initializers if it allows removing the value the initializer is referring to."

This reverts commit 5b55a47e94e28fbb56d0cd5d72c3db9105c15b4c.

A test case was found to crash after this was applied.  I'll file a bug to track fixing this with the test case needed.

llvm-svn: 212550

10 years agoAs funny as it might look, this wasn't what I intended to test.
Benjamin Kramer [Tue, 8 Jul 2014 16:42:54 +0000 (16:42 +0000)]
As funny as it might look, this wasn't what I intended to test.

llvm-svn: 212549

10 years agoRemove hack from dotest.py to fix extra output on -P command, and fix MacOSX multi...
Todd Fiala [Tue, 8 Jul 2014 16:29:54 +0000 (16:29 +0000)]
Remove hack from dotest.py to fix extra output on -P command, and fix MacOSX multi-threaded test run collisions on crashlog.dylib.

On MacOSX, we need to adjust the way we clean up the crashlog dylib in deleteCrashInfoDylib().
Right now it is only geared to run one test at a time.  For now I'm just skipping the delete.
I'll work with Apple on a fix that handles this.  It seems to only cause one dylib total to
hang around that might otherwise have been deleted.  Fixes MacOSX multiple tests running
at the same time.  (I didn't hit this on Yosemite, might be an issue that only shows up
on Mavericks?)

llvm-svn: 212548

10 years ago[PowerPC] Implement atomic NAND operations as actual NAND
Ulrich Weigand [Tue, 8 Jul 2014 16:16:02 +0000 (16:16 +0000)]
[PowerPC] Implement atomic NAND operations as actual NAND

This changes the implementation of atomic NAND operations
from "a & ~b" (compatible with GCC < 4.4) to actual "~(a & b)"
(compatible with GCC >= 4.4).

This is in line with the common-code and ARM back-end change
implemented in r212433.

llvm-svn: 212547

10 years agoUse explicit if and restore lost FileCheck error code checking.
Benjamin Kramer [Tue, 8 Jul 2014 16:15:48 +0000 (16:15 +0000)]
Use explicit if and restore lost FileCheck error code checking.

llvm-svn: 212546

10 years agoUpdate unit test for signature change.
Benjamin Kramer [Tue, 8 Jul 2014 16:07:39 +0000 (16:07 +0000)]
Update unit test for signature change.

llvm-svn: 212545

10 years agoTurn some Twine locals into const char * variables.
Benjamin Kramer [Tue, 8 Jul 2014 16:07:36 +0000 (16:07 +0000)]
Turn some Twine locals into const char * variables.

No functionality change, just stylistic cleanup. Change made by clang-tidy
and clang-format.

llvm-svn: 212544

10 years agoFix broken tests due to new error output.
Todd Fiala [Tue, 8 Jul 2014 15:55:32 +0000 (15:55 +0000)]
Fix broken tests due to new error output.

This reverses out the options validators changes.  We'll get these
back in once the changes to the output can be resolved.

Restores broken tests on FreeBSD, Linux, MacOSX.

Changes reverted: r212500, r212317, r212290.

llvm-svn: 212543

10 years ago[Mips] Make rel-dynamic-07.test test case independent from external input files.
Simon Atanasyan [Tue, 8 Jul 2014 15:47:55 +0000 (15:47 +0000)]
[Mips] Make rel-dynamic-07.test test case independent from external input files.

llvm-svn: 212542

10 years agoImprove memory ownership of vfs::Files in the FileSystemStatCache by using std::uniqu...
David Blaikie [Tue, 8 Jul 2014 15:46:02 +0000 (15:46 +0000)]
Improve memory ownership of vfs::Files in the FileSystemStatCache by using std::unique_ptr

Spotted after a memory leak (due to the complexities of manual memory
management) was fixed in 212466.

llvm-svn: 212541

10 years ago[clang-tidy] Address review comments for the Twine checker.
Benjamin Kramer [Tue, 8 Jul 2014 15:41:20 +0000 (15:41 +0000)]
[clang-tidy] Address review comments for the Twine checker.

- Remove unused includes.
- Minor wording fix.
- Added support to check for clang-tidy messages to check_clang_tidy_fix.sh
= Updated test case.

llvm-svn: 212540

10 years ago[DAG] Teach how to combine a pair of shuffles into a single shuffle if the resulting...
Andrea Di Biagio [Tue, 8 Jul 2014 15:22:29 +0000 (15:22 +0000)]
[DAG] Teach how to combine a pair of shuffles into a single shuffle if the resulting mask is legal.

This patch teaches how to fold a shuffle according to rule:
  shuffle (shuffle (x, undef, M0), undef, M1) -> shuffle(x, undef, M2)

We do this only if the resulting mask M2 is legal; this is to avoid introducing
illegal shuffles that are potentially expanded into a sub-optimal sequence
of target specific dag nodes.

This patch has the advantage of being target independent, since it works on ISD
nodes. Therefore, all targets (not only x86) can take advantage of this rule.
The idea behind this patch is that most shuffle pairs can be safely combined
before we run the legalizer on vector operations. This allows us to
combine/simplify dag nodes earlier in the process and not only immediately
before instruction selection stage.

That said. This patch is not meant to replace any existing target specific
combine rules; backends might still introduce new shuffles during legalization
stage. Also, this rule is very simple and avoids to aggressively optimize
shuffles.

llvm-svn: 212539

10 years agoFix some failing tests for the standard containers. The tests were failing in 32...
Marshall Clow [Tue, 8 Jul 2014 15:19:40 +0000 (15:19 +0000)]
Fix some failing tests for the standard containers. The tests were failing in 32-bit mode because they assumed that std::size_type and make_unsigned<ptrdiff_t>::type were always the same type. No change to libc++, just the tests.

llvm-svn: 212538

10 years agoFix some Twine locals.
Benjamin Kramer [Tue, 8 Jul 2014 14:55:06 +0000 (14:55 +0000)]
Fix some Twine locals.

Two of those are use after frees. Found by clang-tidy, fixed by me.

llvm-svn: 212537

10 years agoFix broken MacOSX Xcode build for CommandOptionValidators.cpp.
Todd Fiala [Tue, 8 Jul 2014 14:52:11 +0000 (14:52 +0000)]
Fix broken MacOSX Xcode build for CommandOptionValidators.cpp.

llvm-svn: 212536

10 years ago[clang-tidy] Add a little checker for Twine locals in LLVM.
Benjamin Kramer [Tue, 8 Jul 2014 14:32:17 +0000 (14:32 +0000)]
[clang-tidy] Add a little checker for Twine locals in LLVM.

Those often cause use after free bugs and should be generally avoided.
Technically it is safe to have a Twine with >=2 components in a variable
but I don't think it is a good pattern to follow. The almost trivial checker
comes with elaborated fix-it hints that turn the Twine into a std::string
if necessary and otherwise fall back to the original type if the Twine
is created from a single value.

llvm-svn: 212535

10 years ago[msan] Fix out of bounds access in origin copying.
Evgeniy Stepanov [Tue, 8 Jul 2014 14:15:23 +0000 (14:15 +0000)]
[msan] Fix out of bounds access in origin copying.

llvm-svn: 212534

10 years ago[tsan] Enable tsan's deadlock detector by default.
Kostya Serebryany [Tue, 8 Jul 2014 13:40:08 +0000 (13:40 +0000)]
[tsan] Enable tsan's deadlock detector by default.

The tsan's deadlock detector has been used in Chromium for a while;
it found a few real bugs and reported no false positives.
So, it's time to give it a bit more exposure.

llvm-svn: 212533

10 years agotsan: fix a potential hang
Dmitry Vyukov [Tue, 8 Jul 2014 13:36:59 +0000 (13:36 +0000)]
tsan: fix a potential hang

idx0 is not updated in the branch,
so if we take that branch idx0 will stay updated forever

llvm-svn: 212532

10 years agotsan: fix a bug in metamap
Dmitry Vyukov [Tue, 8 Jul 2014 13:28:01 +0000 (13:28 +0000)]
tsan: fix a bug in metamap

The bug happens in the following case:
Mutex is located at heap block beginning,
when we call MutexDestroy, s->next is set to 0,
so free can't find the MBlock related to the block.

llvm-svn: 212531

10 years ago[ASan/Win] Don't instrument private COMDAT globals until PR20244 is properly fixed
Timur Iskhodzhanov [Tue, 8 Jul 2014 13:18:58 +0000 (13:18 +0000)]
[ASan/Win] Don't instrument private COMDAT globals until PR20244 is properly fixed

llvm-svn: 212530

10 years ago[tsan] fix deadlock detector's interoperation with java locks (https://code.google...
Kostya Serebryany [Tue, 8 Jul 2014 13:16:03 +0000 (13:16 +0000)]
[tsan] fix deadlock detector's interoperation with java locks (https://code.google.com/p/thread-sanitizer/issues/detail?id=67)

llvm-svn: 212529

10 years ago[mips] Fixed struct/class mismatch introduced in r212522.
Daniel Sanders [Tue, 8 Jul 2014 13:13:42 +0000 (13:13 +0000)]
[mips] Fixed struct/class mismatch introduced in r212522.

Clang emits a warning about this.

llvm-svn: 212528

10 years agotsan: remove unnecessary line split
Dmitry Vyukov [Tue, 8 Jul 2014 13:07:23 +0000 (13:07 +0000)]
tsan: remove unnecessary line split

llvm-svn: 212527

10 years ago[tsan] fix pthread_rwlock_tryrdlock interceptor, don't try to detect deadlocks when...
Kostya Serebryany [Tue, 8 Jul 2014 12:46:30 +0000 (12:46 +0000)]
[tsan] fix pthread_rwlock_tryrdlock interceptor, don't try to detect deadlocks when reporting bad unlock

llvm-svn: 212526

10 years ago[OPENMP] Allow ‘reduction’ clause on ‘omp simd’ directive.
Alexander Musman [Tue, 8 Jul 2014 11:33:21 +0000 (11:33 +0000)]
[OPENMP] Allow ‘reduction’ clause on ‘omp simd’ directive.

llvm-svn: 212525

10 years agoMove misplaced x86_32 ABI code
Richard Sandiford [Tue, 8 Jul 2014 11:10:34 +0000 (11:10 +0000)]
Move misplaced x86_32 ABI code

r184166 added an X86_32 function in the middle of the SystemZ code.
The SystemZ port had been added only a couple of weeks earlier and
the original patch probably predated that.

No behavioral change intended.

llvm-svn: 212524

10 years agoFix r212522 - [mips] Improve encapsulation of the .MIPS.abiflags implementation and...
Daniel Sanders [Tue, 8 Jul 2014 10:35:52 +0000 (10:35 +0000)]
Fix r212522 - [mips] Improve encapsulation of the .MIPS.abiflags implementation and limit scope of related enums

Added two lines that should have been in r212522.

llvm-svn: 212523

10 years ago[mips] Improve encapsulation of the .MIPS.abiflags implementation and limit scope...
Daniel Sanders [Tue, 8 Jul 2014 10:11:38 +0000 (10:11 +0000)]
[mips] Improve encapsulation of the .MIPS.abiflags implementation and limit scope of related enums

Summary:
Follow on to r212519 to improve the encapsulation and limit the scope of the enums.

Also merged two very similar parser functions, fixed a bug where ASE's
were not being reported, and marked CPR1's as being 128-bit when MSA is
enabled.

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

llvm-svn: 212522

10 years agoRevert "Refactor ARM subarchitecture parsing"
Renato Golin [Tue, 8 Jul 2014 10:06:16 +0000 (10:06 +0000)]
Revert "Refactor ARM subarchitecture parsing"

This reverts commit 7b4a6882467e7fef4516a0cbc418cbfce0fc6f6d.

llvm-svn: 212521

10 years agoTruncate the immediate in logical operation to the register width
Arnaud A. de Grandmaison [Tue, 8 Jul 2014 09:53:04 +0000 (09:53 +0000)]
Truncate the immediate in logical operation to the register width

And continue to produce an error if the 32 most significant bits are not all ones or zeros.

llvm-svn: 212520