platform/upstream/llvm.git
10 years agoFix msc17 build. RegionInfo::RegionInfo::recalculate() doesn't make sense.
NAKAMURA Takumi [Sun, 20 Jul 2014 03:57:51 +0000 (03:57 +0000)]
Fix msc17 build. RegionInfo::RegionInfo::recalculate() doesn't make sense.

llvm-svn: 213466

10 years agoFix -Asserts build introduced since r213456.
NAKAMURA Takumi [Sun, 20 Jul 2014 00:00:42 +0000 (00:00 +0000)]
Fix -Asserts build introduced since r213456.

llvm-svn: 213465

10 years agoSure up ownership passing of the PBQPBuilder by passing unique_ptrs by value rather...
David Blaikie [Sat, 19 Jul 2014 21:19:45 +0000 (21:19 +0000)]
Sure up ownership passing of the PBQPBuilder by passing unique_ptrs by value rather than lvalue reference.

Also removes an unnecessary '.release()' that should've been a std::move
anyway. (I'm on a hunt for '.release()' calls)

llvm-svn: 213464

10 years agoMC: permit emitting a symbol value as section relative
Saleem Abdulrasool [Sat, 19 Jul 2014 21:01:58 +0000 (21:01 +0000)]
MC: permit emitting a symbol value as section relative

This adds an optional parameter to the EmitSymbolValue method in MCStreamer to
permit emitting a symbol value as a section relative value.  This is to cover
the use in MCDwarf which should not really know about how to emit a section
relative value for a given target.

This addresses post-review comments from Eric Christopher in SVN r213275.

llvm-svn: 213463

10 years ago[Mips] Replace assembler code by YAML to make the test 'dynlib-dynamic.test'
Simon Atanasyan [Sat, 19 Jul 2014 20:18:46 +0000 (20:18 +0000)]
[Mips] Replace assembler code by YAML to make the test 'dynlib-dynamic.test'
target independent.

llvm-svn: 213462

10 years agoRevert accidentally committed r213459
Matt Arsenault [Sat, 19 Jul 2014 19:17:33 +0000 (19:17 +0000)]
Revert accidentally committed r213459

llvm-svn: 213461

10 years agoFix build with GCC.
Matt Arsenault [Sat, 19 Jul 2014 19:16:36 +0000 (19:16 +0000)]
Fix build with GCC.

Seems like a bug in either GCC or clang, but I'm
not sure which is right.

llvm-svn: 213460

10 years agoXXX - Increase unroll threshold
Matt Arsenault [Sat, 19 Jul 2014 19:16:34 +0000 (19:16 +0000)]
XXX - Increase unroll threshold

llvm-svn: 213459

10 years agoR600/SI: implement range reduction for sin/cos
Matt Arsenault [Sat, 19 Jul 2014 18:44:39 +0000 (18:44 +0000)]
R600/SI: implement range reduction for sin/cos

These instructions can only take a limited input range, and return
the constant value 1 out of range. We should do range reduction to
be able to process arbitrary values. Use a FRACT instruction after
normalization to achieve this. Also add a test for constant folding
with the lowered code with unsafe-fp-math enabled.

v2: use DAG lowering instead of intrinsic, adapt test
v3: calculate constant, fold pattern into instruction definition
v4: misc style fixes, add sin-fold testcase, cosmetics

Patch by Grigori Goronzy

llvm-svn: 213458

10 years agoUpdate for RegionInfo changes.
Matt Arsenault [Sat, 19 Jul 2014 18:40:17 +0000 (18:40 +0000)]
Update for RegionInfo changes.

Mostly related to missing includes and renaming of
the pass to RegionInfoPass.

llvm-svn: 213457

10 years agoTemplatify RegionInfo so it works on MachineBasicBlocks
Matt Arsenault [Sat, 19 Jul 2014 18:29:29 +0000 (18:29 +0000)]
Templatify RegionInfo so it works on MachineBasicBlocks

llvm-svn: 213456

10 years agoR600: Implement a few simple TTI queries.
Matt Arsenault [Sat, 19 Jul 2014 18:15:16 +0000 (18:15 +0000)]
R600: Implement a few simple TTI queries.

I'm not sure if these have any effect right now.

llvm-svn: 213455

10 years agoIf a module build reports errors, don't try to load it
Ben Langmuir [Sat, 19 Jul 2014 16:29:28 +0000 (16:29 +0000)]
If a module build reports errors, don't try to load it

... just to find out that it didn't build.

llvm-svn: 213454

10 years ago[LoopVectorize] Use CreateAligned(Load|Store)
Hal Finkel [Sat, 19 Jul 2014 13:39:45 +0000 (13:39 +0000)]
[LoopVectorize] Use CreateAligned(Load|Store)

IRBuilder has CreateAligned(Load|Store) functions; use them and we don't need
to make a second call to setAlignment.

No functionality change intended.

llvm-svn: 213453

10 years ago[LoopVectorize] Propagate known metadata to vectorized instructions
Hal Finkel [Sat, 19 Jul 2014 13:33:16 +0000 (13:33 +0000)]
[LoopVectorize] Propagate known metadata to vectorized instructions

There are some kinds of metadata that are safe to propagate from the scalar
instructions to the vector instructions (fpmath and tbaa currently).

Regarding TBAA, one might worry about propagating it on if-converted loads and
stores, because the metadata might have had a control dependency on the
condition, and thus actually aliased with some other non-speculated memory
access when the condition was false. However, this would be caught by the
runtime overlap checks.

llvm-svn: 213452

10 years ago[x86] Fix wrong shuffle mask in test 'combine-vec-shuffle-3.ll'. No functional change.
Andrea Di Biagio [Sat, 19 Jul 2014 07:52:58 +0000 (07:52 +0000)]
[x86] Fix wrong shuffle mask in test 'combine-vec-shuffle-3.ll'. No functional change.

Function @test3c should check that the DAGCombiner is able to fold a pair of
shuffles into a new shuffle with a permute mask of <6,7,2,3>. However, one of
the shuffles in @test3c had a wrong permute mask; this prevented the DAGCombiner
from folding the shuffles into the expected result.
Now that the shuffle mask is fixed, the backend correctly folds the two shuffles
in function @test3c into a single movhlps instruction.

llvm-svn: 213451

10 years agoRevert D3908 due to issues on Mac platforms
Viktor Kutuzov [Sat, 19 Jul 2014 05:58:38 +0000 (05:58 +0000)]
Revert D3908 due to issues on Mac platforms

llvm-svn: 213450

10 years agoHandle AddrSpaceCast in stripAndAccumulateInBoundsConstantOffsets
Hal Finkel [Sat, 19 Jul 2014 03:32:02 +0000 (03:32 +0000)]
Handle AddrSpaceCast in stripAndAccumulateInBoundsConstantOffsets

All of the other similar functions in that part of the file look through
addrspacecast in addition to bitcast, and I see no reason why
stripAndAccumulateInBoundsConstantOffsets shouldn't do so also.

llvm-svn: 213449

10 years agoMergedLoadStoreMotion.cpp: Fix msc17 build. Member initializer is unavailable.
NAKAMURA Takumi [Sat, 19 Jul 2014 03:29:25 +0000 (03:29 +0000)]
MergedLoadStoreMotion.cpp: Fix msc17 build. Member initializer is unavailable.

llvm-svn: 213448

10 years agoMake Value::isDereferenceablePointer handle offsets to pointer types with dereference...
Hal Finkel [Sat, 19 Jul 2014 03:25:16 +0000 (03:25 +0000)]
Make Value::isDereferenceablePointer handle offsets to pointer types with dereferenceable attributes

When we have a parameter (or call site return) with a dereferenceable
attribute, it can specify the size of an array pointed to by that parameter. If
we have a value for which we can accumulate a constant offset to such a
parameter, then we can use that offset in a direct comparison with the size
specified by the dereferenceable attribute.

This enables us to handle cases like this:

  int foo(int a[static 3]) {
    return a[2]; /* this is always dereferenceable */
  }

llvm-svn: 213447

10 years agoCleanup comparisons to VariableArrayType::Static for non-VLAs
Hal Finkel [Sat, 19 Jul 2014 02:13:40 +0000 (02:13 +0000)]
Cleanup comparisons to VariableArrayType::Static for non-VLAs

The enum is part of ArrayType, so there is no functional change, but comparing
to ArrayType::Static for non-VLAs makes more sense.

llvm-svn: 213446

10 years agoTypePrinter should not ignore IndexTypeCVRQualifiers on constant-sized arrays
Hal Finkel [Sat, 19 Jul 2014 02:01:03 +0000 (02:01 +0000)]
TypePrinter should not ignore IndexTypeCVRQualifiers on constant-sized arrays

C99 array parameters can have index-type CVR qualifiers, and the TypePrinter
should print them when present (and we were not for constant-sized arrays).
Otherwise, we'd drop the restrict in:

  int foo(int a[restrict static 3]) { ... }

llvm-svn: 213445

10 years agoUse the dereferenceable attribute on C99 array parameters with static
Hal Finkel [Sat, 19 Jul 2014 01:41:07 +0000 (01:41 +0000)]
Use the dereferenceable attribute on C99 array parameters with static

In C99, an array parameter declarator might have the form:
  direct-declarator '[' 'static' type-qual-list[opt] assign-expr ']'

where the static keyword indicates that the caller will always provide a
pointer to the beginning of an array with at least the number of elements
specified by the assignment expression. For constant sizes, we can use the
new dereferenceable attribute to pass this information to the optimizer. For
VLAs, we don't know the size, but (for addrspace(0)) do know that the pointer
must be nonnull (and so we can use the nonnull attribute).

llvm-svn: 213444

10 years agoPR20356: Fix all Sema warnings with mismatched ext_/warn_ versus
Richard Smith [Sat, 19 Jul 2014 01:39:17 +0000 (01:39 +0000)]
PR20356: Fix all Sema warnings with mismatched ext_/warn_ versus
ExtWarn/Warnings. Mostly the name of the warning was changed to match the
semantics, but in the PR20356 cases, the warning was about valid code, so the
diagnostic was changed from ExtWarn to Warning instead.

llvm-svn: 213443

10 years agoARM: correct WoA __builtin_alloca handling on O0
Saleem Abdulrasool [Sat, 19 Jul 2014 01:29:51 +0000 (01:29 +0000)]
ARM: correct WoA __builtin_alloca handling on O0

When performing a dynamic stack adjustment without optimisations, we would mark
SP as def and R4 as kill.  This occurred as part of the expansion of a
WIN__CHKSTK SDNode which indicated the proper handling of SP and R4.  The result
would be that we would double define SP as part of an operation, which is
obviously incorrect.

Furthermore, the VTList for the chain had an incorrect parameter type of i32
instead of Other.

Correct these to permit proper lowering of __builtin_alloca at -O0.

llvm-svn: 213442

10 years agoclang/test/Misc/backend-optimization-failure.cpp: Appease to add -triple=x86_64.
NAKAMURA Takumi [Sat, 19 Jul 2014 01:17:32 +0000 (01:17 +0000)]
clang/test/Misc/backend-optimization-failure.cpp: Appease to add -triple=x86_64.

FIXME: Could this be made generic?
llvm-svn: 213441

10 years agoAdd the ability to suppress the creation of a persistent
Jim Ingham [Sat, 19 Jul 2014 01:09:16 +0000 (01:09 +0000)]
Add the ability to suppress the creation of a persistent
result variable and use in in "Process::LoadImage" so that,
for instance, "process load" doesn't increment the return
variable number.

llvm-svn: 213440

10 years agoRemove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"
David Blaikie [Sat, 19 Jul 2014 01:06:45 +0000 (01:06 +0000)]
Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"

It's also possible to just write "= nullptr", but there's some question
of whether that's as readable, so I leave it up to authors to pick which
they prefer for now. If we want to discuss standardizing on one or the
other, we can do that at some point in the future.

llvm-svn: 213439

10 years agoRemove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"
David Blaikie [Sat, 19 Jul 2014 01:05:11 +0000 (01:05 +0000)]
Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"

It's also possible to just write "= nullptr", but there's some question
of whether that's as readable, so I leave it up to authors to pick which
they prefer for now. If we want to discuss standardizing on one or the
other, we can do that at some point in the future.

llvm-svn: 213438

10 years ago[MS-ABI] Assign SEH handler indices to __try blocks
Warren Hunt [Sat, 19 Jul 2014 00:45:07 +0000 (00:45 +0000)]
[MS-ABI] Assign SEH handler indices to __try blocks
Assigns indices to try blocks. These indices will used in constructing
tables that the mscrt function __except_handler3 reads during SEH.
Testing will occur once we actually emit the tables, in a subsequent
patch.

llvm-svn: 213437

10 years agoIn Process::LoadImage, use the same function call both to call dlopen and to collect
Jim Ingham [Sat, 19 Jul 2014 00:37:06 +0000 (00:37 +0000)]
In Process::LoadImage, use the same function call both to call dlopen and to collect
the error if there is one.

llvm-svn: 213436

10 years ago[MCJIT] Add a 'decodeAddend' method to RuntimeDyldMachO and teach
Lang Hames [Sat, 19 Jul 2014 00:19:17 +0000 (00:19 +0000)]
[MCJIT] Add a 'decodeAddend' method to RuntimeDyldMachO and teach
getBasicRelocationEntry to use this rather than 'memcpy' to get the
relocation addend. Targets with non-trivial addend encodings (E.g. AArch64) can
override decodeAddend to handle immediates with interesting encodings.

No functional change.

llvm-svn: 213435

10 years agoCodeGen: Properly null-check typeid expressions
David Majnemer [Sat, 19 Jul 2014 00:17:06 +0000 (00:17 +0000)]
CodeGen: Properly null-check typeid expressions

Thoroughly check for a pointer dereference which yields a glvalue.  Look
through casts, comma operators, conditional operators, paren
expressions, etc.

This was originally D4416.

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

llvm-svn: 213434

10 years agoLLDB now correctly handles virtual inheritance.
Greg Clayton [Sat, 19 Jul 2014 00:12:57 +0000 (00:12 +0000)]
LLDB now correctly handles virtual inheritance.

Test case added as well.

<rdar://problem/16785904>

llvm-svn: 213433

10 years agoRevert "Reapply "DebugInfo: Ensure that all debug location scope chains from instruct...
Eric Christopher [Fri, 18 Jul 2014 23:57:20 +0000 (23:57 +0000)]
Revert "Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself.""""

After a successful build it seems to have come back on a later build.

This reverts commit r213391.

llvm-svn: 213432

10 years agoRevert r213415, "Merge two lines". It broke tests in -Asserts builds.
NAKAMURA Takumi [Fri, 18 Jul 2014 23:46:16 +0000 (23:46 +0000)]
Revert r213415, "Merge two lines". It broke tests in -Asserts builds.

CGBuilder doesn't name instructions with Name. We should use Inst::setName() to name an instruction explicitly here.

llvm-svn: 213431

10 years agoFundamentally change the MipsSubtarget replacement machinery:
Eric Christopher [Fri, 18 Jul 2014 23:41:32 +0000 (23:41 +0000)]
Fundamentally change the MipsSubtarget replacement machinery:

a) Move the replacement level decision to the target machine.
b) Create additional subtargets at the TargetMachine level to
   cache and make replacement easy.
c) Make the mips16 features obvious.
d) Remove the override logic as it no longer does anything.
e) Have MipsModuleDAGToDAGISel take only the target machine.
f) Have the constant islands pass grab the current subtarget
   from the MachineFunction (via the TargetMachine) instead
   of caching it.
g) Unconditionally initialize TLOF.
h) Remove the old complicated subtarget based resetting and
   replace it with simple conditionals.

llvm-svn: 213430

10 years agoFrameLowering depends only upon the Subtarget, so only take a subtarget
Eric Christopher [Fri, 18 Jul 2014 23:33:47 +0000 (23:33 +0000)]
FrameLowering depends only upon the Subtarget, so only take a subtarget
during initialization.

llvm-svn: 213429

10 years ago[X86 inline-asm] Error out on inline-asm constraint "=f".
Akira Hatanaka [Fri, 18 Jul 2014 23:30:30 +0000 (23:30 +0000)]
[X86 inline-asm] Error out on inline-asm constraint "=f".

<rdar://problem/17476689>

llvm-svn: 213428

10 years ago[PowerPC] 32-bit ELF PIC support
Hal Finkel [Fri, 18 Jul 2014 23:29:49 +0000 (23:29 +0000)]
[PowerPC] 32-bit ELF PIC support

This adds initial support for PPC32 ELF PIC (Position Independent Code; the
-fPIC variety), thus rectifying a long-standing deficiency in the PowerPC
backend.

Patch by Justin Hibbits!

llvm-svn: 213427

10 years agoIn preparation for replacing the whole subtarget on the target machine,
Eric Christopher [Fri, 18 Jul 2014 23:25:04 +0000 (23:25 +0000)]
In preparation for replacing the whole subtarget on the target machine,
have target lowering take the subtarget explicitly.

llvm-svn: 213426

10 years agoMake InstrInfo depend only upon the Subtarget getting passed in
Eric Christopher [Fri, 18 Jul 2014 23:25:00 +0000 (23:25 +0000)]
Make InstrInfo depend only upon the Subtarget getting passed in
rather than the TargetMachine.

llvm-svn: 213425

10 years agoTypePrinter should not omit the static keyword in array parameter declarators
Hal Finkel [Fri, 18 Jul 2014 23:19:20 +0000 (23:19 +0000)]
TypePrinter should not omit the static keyword in array parameter declarators

In C99, an array parameter declarator might have the form: direct-declarator
'[' 'static' type-qual-list[opt] assign-expr ']'

and when the size of the array is a constant, don't omit the static keyword
when printing the type. Also, in the VLA case, put a space after the static
keyword (some assignment expression must follow it).

llvm-svn: 213424

10 years agoObjective-C. Patch to warn if the result of calling a property getter
Fariborz Jahanian [Fri, 18 Jul 2014 22:59:10 +0000 (22:59 +0000)]
Objective-C. Patch to warn if the result of calling a property getter
is unused (this is match behavior when property-dot syntax is used to
use same getter). rdar://17514245
Patch by Anders Carlsson with minor refactoring by me.

llvm-svn: 213423

10 years agoThe subtarget in MipsTargetLowering isn't going to change and
Eric Christopher [Fri, 18 Jul 2014 22:55:25 +0000 (22:55 +0000)]
The subtarget in MipsTargetLowering isn't going to change and
so doesn't need to be a pointer, but a reference.

llvm-svn: 213422

10 years agoAllow the user to override the LLDB_TEST_COMPILER at CMake level.
Zachary Turner [Fri, 18 Jul 2014 22:46:22 +0000 (22:46 +0000)]
Allow the user to override the LLDB_TEST_COMPILER at CMake level.

llvm-svn: 213421

10 years agoAvoid caching the relocation model on the subtarget, this is for
Eric Christopher [Fri, 18 Jul 2014 22:34:20 +0000 (22:34 +0000)]
Avoid caching the relocation model on the subtarget, this is for
two reasons:

a) we're already caching the target machine which contains it,
b) which relocation model you get is dependent upon whether or
not you ask before MCCodeGenInfo is constructed on the target
machine, so avoid any latent issues there.

llvm-svn: 213420

10 years agoRemove commented out code.
Eric Christopher [Fri, 18 Jul 2014 22:34:18 +0000 (22:34 +0000)]
Remove commented out code.

llvm-svn: 213419

10 years agoClean up some style and formatting issues.
Eric Christopher [Fri, 18 Jul 2014 22:34:14 +0000 (22:34 +0000)]
Clean up some style and formatting issues.

llvm-svn: 213418

10 years agoDebugInfo: Assert that all abstract scopes are subprograms, rather than conditionalizing.
David Blaikie [Fri, 18 Jul 2014 22:26:59 +0000 (22:26 +0000)]
DebugInfo: Assert that all abstract scopes are subprograms, rather than conditionalizing.

There's nothing else these should ever be...

llvm-svn: 213417

10 years agoReinstate r213348, reverted in r213395, with an additional bug fix and more
Richard Smith [Fri, 18 Jul 2014 22:13:40 +0000 (22:13 +0000)]
Reinstate r213348, reverted in r213395, with an additional bug fix and more
thorough tests.

Original commit message:

[modules] Fix macro hiding bug exposed if:

 * A submodule of module A is imported into module B
 * Another submodule of module A that is not imported into B exports a macro
 * Some submodule of module B also exports a definition of the macro, and
   happens to be the first submodule of B that imports module A.

In this case, we would incorrectly determine that A's macro redefines B's
macro, and so we don't need to re-export B's macro at all.

This happens with the 'assert' macro in an LLVM self-host. =(

llvm-svn: 213416

10 years agoMerge two lines
Alexey Samsonov [Fri, 18 Jul 2014 21:29:55 +0000 (21:29 +0000)]
Merge two lines

llvm-svn: 213415

10 years agoFix build breakage introduced with r213412.
Mark Heffernan [Fri, 18 Jul 2014 21:29:41 +0000 (21:29 +0000)]
Fix build breakage introduced with r213412.

llvm-svn: 213414

10 years agoTest commit. Having trouble committing from one machine but not
Zachary Turner [Fri, 18 Jul 2014 21:06:51 +0000 (21:06 +0000)]
Test commit.  Having trouble committing from one machine but not
another, attempting to fix it.

llvm-svn: 213413

10 years agoRemove unroll pragma metadata after it is used.
Mark Heffernan [Fri, 18 Jul 2014 21:04:33 +0000 (21:04 +0000)]
Remove unroll pragma metadata after it is used.

llvm-svn: 213412

10 years agoFix a bug with order of operations.
Zachary Turner [Fri, 18 Jul 2014 21:03:06 +0000 (21:03 +0000)]
Fix a bug with order of operations.

llvm-svn: 213411

10 years agoMake lldb -P work on Windows.
Zachary Turner [Fri, 18 Jul 2014 20:36:08 +0000 (20:36 +0000)]
Make lldb -P work on Windows.

lldb -P, which outputs its python path, works by using Host-layer
facilities to get information about the loaded python module.  This
Host functionality was unimplemented on Windows, so this patch
implements it.  Additionally, it removes a pexpect dependency from
the test runner and uses an equivalent invocation of subprocess.

Reviewed by: Todd Fiala

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

llvm-svn: 213410

10 years agoFix a couple of formatting and style issues.
Eric Christopher [Fri, 18 Jul 2014 20:35:49 +0000 (20:35 +0000)]
Fix a couple of formatting and style issues.

llvm-svn: 213409

10 years ago[MCJIT] [AArch64] Make sure to propegate ARM64_RELOC_ADDEND values into the
Lang Hames [Fri, 18 Jul 2014 20:29:36 +0000 (20:29 +0000)]
[MCJIT] [AArch64] Make sure to propegate ARM64_RELOC_ADDEND values into the
RelocationEntry.

No test case yet, as this primarily hits GOT entries, which RuntimeDyldChecker
can't examine yet. I'm actively working on features that will enable us to
test this.

llvm-svn: 213408

10 years agoMake non-module passes unconditionally added in the pass
Eric Christopher [Fri, 18 Jul 2014 20:29:02 +0000 (20:29 +0000)]
Make non-module passes unconditionally added in the pass
manager for mips, and early exit if we don't want to do
anything because of the current subtarget.

llvm-svn: 213407

10 years agoAdd tests for atomic adds on floats.
Eli Bendersky [Fri, 18 Jul 2014 20:11:26 +0000 (20:11 +0000)]
Add tests for atomic adds on floats.

llvm-svn: 213406

10 years agoRevert "CodeGen: Properly null-check typeid expressions"
David Majnemer [Fri, 18 Jul 2014 20:00:13 +0000 (20:00 +0000)]
Revert "CodeGen: Properly null-check typeid expressions"

This reverts commit r213401, r213402, r213403, and r213404.

I accidently committed these changes instead of updating the
differential.

llvm-svn: 213405

10 years agoAddress Richard's latest feedback.
David Majnemer [Fri, 18 Jul 2014 19:53:25 +0000 (19:53 +0000)]
Address Richard's latest feedback.

llvm-svn: 213404

10 years agoAddress Richard's comments
David Majnemer [Fri, 18 Jul 2014 19:53:23 +0000 (19:53 +0000)]
Address Richard's comments

llvm-svn: 213403

10 years agoAddress Richard's comments.
David Majnemer [Fri, 18 Jul 2014 19:53:21 +0000 (19:53 +0000)]
Address Richard's comments.

llvm-svn: 213402

10 years agoCodeGen: Properly null-check typeid expressions
David Majnemer [Fri, 18 Jul 2014 19:53:17 +0000 (19:53 +0000)]
CodeGen: Properly null-check typeid expressions

Summary:
Thoroughly check for a pointer dereference which yields a glvalue.  Look
through casts, comma operators, conditional operators, paren
expressions, etc.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 213401

10 years agoRecommit: Handle diagnostic warnings in Frontend diagnostic handler.
Tyler Nowicki [Fri, 18 Jul 2014 19:40:19 +0000 (19:40 +0000)]
Recommit: Handle diagnostic warnings in Frontend diagnostic handler.

Clang uses a diagnostic handler to grab diagnostic messages so it can print them
with the line of source code they refer to. This patch extends this to handle
optimization failures that were added to llvm to produce a warning when
loop vectorization is explicitly specified (using a pragma clang loop directive)
but fails.

Update renames warning flag name to avoid indicating the flag's severity and
adds a test.

Reviewed by Alp Toker

llvm-svn: 213400

10 years agoRename DiagnosticInfoOptimizationWarning to DiagnosticInfoOptimizationFailure
Tyler Nowicki [Fri, 18 Jul 2014 19:36:04 +0000 (19:36 +0000)]
Rename DiagnosticInfoOptimizationWarning to DiagnosticInfoOptimizationFailure
so the severity of the message is not part of the type name.

Reviewed by Alp Toker

llvm-svn: 213399

10 years agoUse CHECK-LABEL where appropriate in this test.
Eli Bendersky [Fri, 18 Jul 2014 19:32:09 +0000 (19:32 +0000)]
Use CHECK-LABEL where appropriate in this test.

llvm-svn: 213398

10 years agoAdd loop unrolling metadata descriptions to docs/LangRef.rst.
Mark Heffernan [Fri, 18 Jul 2014 19:24:51 +0000 (19:24 +0000)]
Add loop unrolling metadata descriptions to docs/LangRef.rst.

llvm-svn: 213397

10 years agoMergedLoadStoreMotion pass
Gerolf Hoflehner [Fri, 18 Jul 2014 19:13:09 +0000 (19:13 +0000)]
MergedLoadStoreMotion pass

Merges equivalent loads on both sides of a hammock/diamond
and hoists into into the header.
Merges equivalent stores on both sides of a hammock/diamond
and sinks it to the footer.
Can enable if conversion and tolerate better load misses
and store operand latencies.

llvm-svn: 213396

10 years agoRevert "[modules] Fix macro hiding bug exposed if:"
Ben Langmuir [Fri, 18 Jul 2014 18:38:24 +0000 (18:38 +0000)]
Revert "[modules] Fix macro hiding bug exposed if:"

This is breaking the system modules on Darwin, because something that
was defined and re-exported no longer is.  Might be this patch, or might
just be a really poor interaction with an existing visibility bug.

This reverts commit r213348.

llvm-svn: 213395

10 years agoFixing warnings shouldn't introduce a crasher.
Greg Clayton [Fri, 18 Jul 2014 18:32:45 +0000 (18:32 +0000)]
Fixing warnings shouldn't introduce a crasher.

Fix the warning the correct way without making things crash when ENABLE_MUTEX_ERROR_CHECKING is non enabled.

<rdar://problem/17703039>

llvm-svn: 213394

10 years ago[UBsan] Skip -fsanitize=vptr instrumentations when the pointer value is null.
Alexey Samsonov [Fri, 18 Jul 2014 18:15:39 +0000 (18:15 +0000)]
[UBsan] Skip -fsanitize=vptr instrumentations when the pointer value is null.

Otherwise -fsanitize=vptr causes the program to crash when it downcasts
a null pointer.

Reviewed in http://reviews.llvm.org/D4412.
Patch by Byoungyoung Lee!

llvm-svn: 213393

10 years agoMake sure globals created by UBSan are not instrumented by ASan.
Alexey Samsonov [Fri, 18 Jul 2014 17:50:06 +0000 (17:50 +0000)]
Make sure globals created by UBSan are not instrumented by ASan.

Summary:
This change adds description of globals created by UBSan
instrumentation (UBSan handlers, type descriptors, filenames) to
llvm.asan.globals metadata, effectively "blacklisting" them. This can
dramatically decrease the data section in binaries built with UBSan+ASan,
as UBSan tends to create a lot of handlers, and ASan instrumentation
increases the global size to at least 64 bytes.

Test Plan: clang regression test suite

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, byoungyoung, kcc

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

llvm-svn: 213392

10 years agoReapply "DebugInfo: Ensure that all debug location scope chains from instructions...
David Blaikie [Fri, 18 Jul 2014 17:49:10 +0000 (17:49 +0000)]
Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."""

Recommits 212776 which was reverted in r212793. This has been committed
and recommitted a few times as I try to test it harder and find/fix more
issues. The most recent revert was due to an asan bot failure which I
can't seem to reproduce locally, though I believe I'm following all the
steps the buildbot does.

So I'm going to recommit this in the hopes of investigating the failure
on the buildbot itself... apologies in advance for the bot noise. If
anyone sees failures with this /please/ provide me with any
reproductions, etc.

llvm-svn: 213391

10 years ago[Mips] Replace assembler code by YAML to make the test 'base-address.test'
Simon Atanasyan [Fri, 18 Jul 2014 17:23:21 +0000 (17:23 +0000)]
[Mips] Replace assembler code by YAML to make the test 'base-address.test'
target independent.

llvm-svn: 213390

10 years agoFix build failure on windows
David Peixotto [Fri, 18 Jul 2014 16:41:58 +0000 (16:41 +0000)]
Fix build failure on windows

Add explicit constructor to struct instead of using brace initialization.

llvm-svn: 213389

10 years agoFor i386, gcc 4.9 under Debian (at least) updated its paths to i586-linux-gnu
Sylvestre Ledru [Fri, 18 Jul 2014 16:24:57 +0000 (16:24 +0000)]
For i386, gcc 4.9 under Debian (at least) updated its paths to i586-linux-gnu
(i486-linux-gnu previously). Adding this triple to the list of search.
Also impacts clang 3.4.2

Reported on the Debian bug tracking system here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754963
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755183

llvm-svn: 213388

10 years agoMC: support different sized constants in constant pools
David Peixotto [Fri, 18 Jul 2014 16:05:14 +0000 (16:05 +0000)]
MC: support different sized constants in constant pools

On AArch64 the pseudo instruction ldr <reg>, =... supports both
32-bit and 64-bit constants. Add support for 64 bit constants for
the pools to support the pseudo instruction fully.

Changes the AArch64 ldr-pseudo tests to use 32-bit registers and
adds tests with 64-bit registers.

Patch by Janne Grunau!

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

llvm-svn: 213387

10 years agoMark C++ reference parameters as dereferenceable
Hal Finkel [Fri, 18 Jul 2014 15:52:10 +0000 (15:52 +0000)]
Mark C++ reference parameters as dereferenceable

Because references must be initialized using some evaluated expression, they
must point to something, and a callee can assume the reference parameter is
dereferenceable. Taking advantage of a new attribute just added to LLVM, mark
them as such.

Because dereferenceability in addrspace(0) implies nonnull in the backend, we
don't need both attributes. However, we need to know the size of the object to
use the dereferenceable attribute, so for incomplete types we still emit only
nonnull.

llvm-svn: 213386

10 years agoAdd a dereferenceable attribute
Hal Finkel [Fri, 18 Jul 2014 15:51:28 +0000 (15:51 +0000)]
Add a dereferenceable attribute

This attribute indicates that the parameter or return pointer is
dereferenceable. Practically speaking, loads from such a pointer within the
associated byte range are safe to speculatively execute. Such pointer
parameters are common in source languages (C++ references, for example).

llvm-svn: 213385

10 years agotsan: fix Go runtime build with clang
Dmitry Vyukov [Fri, 18 Jul 2014 15:32:22 +0000 (15:32 +0000)]
tsan: fix Go runtime build with clang

llvm-svn: 213384

10 years ago[mips] Use Triple::getVendor() instead of Triple::getVendorName() to identify 'mti...
Daniel Sanders [Fri, 18 Jul 2014 15:05:38 +0000 (15:05 +0000)]
[mips] Use Triple::getVendor() instead of Triple::getVendorName() to identify 'mti' vendor triples.

llvm-svn: 213383

10 years agotsan: expose atomic operations in Go runtime
Dmitry Vyukov [Fri, 18 Jul 2014 14:54:02 +0000 (14:54 +0000)]
tsan: expose atomic operations in Go runtime

llvm-svn: 213382

10 years agoAdd MIPS Technologies to the vendors in llvm::Triple.
Daniel Sanders [Fri, 18 Jul 2014 14:28:19 +0000 (14:28 +0000)]
Add MIPS Technologies to the vendors in llvm::Triple.

This is a prerequisite for checking for 'mti' and 'img' in a consistent way in
clang. Previously 'img' could use Triple::getVendor() but 'mti' could only use
Triple::getVendorName().

llvm-svn: 213381

10 years agoRevert "Emit lifetime.start / lifetime.end markers for unnamed temporary objects."
Arnaud A. de Grandmaison [Fri, 18 Jul 2014 14:23:58 +0000 (14:23 +0000)]
Revert "Emit lifetime.start / lifetime.end markers for unnamed temporary objects."

This reverts commit dbf785a6432f78a8ec229665876647c4cc610d3d, while I qm
investigating a buildbot failure.

llvm-svn: 213380

10 years agoEmit lifetime.start / lifetime.end markers for unnamed temporary objects.
Arnaud A. de Grandmaison [Fri, 18 Jul 2014 13:36:33 +0000 (13:36 +0000)]
Emit lifetime.start / lifetime.end markers for unnamed temporary objects.

This will give more information to the optimizers so that they can reuse stack slots.

llvm-svn: 213379

10 years agoAArch64: implement efficient f16 bitcasts
Tim Northover [Fri, 18 Jul 2014 13:07:05 +0000 (13:07 +0000)]
AArch64: implement efficient f16 bitcasts

Because i16 is illegal, there's no native DAG method to
represent a bitcast to or from an f16 type. This meant LLVM was
inserting a stack store/load pair which is really not ideal.

llvm-svn: 213378

10 years agoNVPTX: support fpext/fptrunc to and from f16.
Tim Northover [Fri, 18 Jul 2014 13:01:43 +0000 (13:01 +0000)]
NVPTX: support fpext/fptrunc to and from f16.

llvm-svn: 213377

10 years agoR600: support fpext/fptrunc operations to and from f16.
Tim Northover [Fri, 18 Jul 2014 13:01:37 +0000 (13:01 +0000)]
R600: support fpext/fptrunc operations to and from f16.

llvm-svn: 213376

10 years agoAArch64: support f16 extend/trunc operations.
Tim Northover [Fri, 18 Jul 2014 13:01:31 +0000 (13:01 +0000)]
AArch64: support f16 extend/trunc operations.

llvm-svn: 213375

10 years agoX86: support fpext/fptrunc operations to and from 16-bit floats.
Tim Northover [Fri, 18 Jul 2014 13:01:25 +0000 (13:01 +0000)]
X86: support fpext/fptrunc operations to and from 16-bit floats.

llvm-svn: 213374

10 years agoARM: support legalisation of "fptrunc ... to half" operations.
Tim Northover [Fri, 18 Jul 2014 13:01:19 +0000 (13:01 +0000)]
ARM: support legalisation of "fptrunc ... to half" operations.

llvm-svn: 213373

10 years agoCodeGen: soften f16 type by default instead of marking legal.
Tim Northover [Fri, 18 Jul 2014 12:41:46 +0000 (12:41 +0000)]
CodeGen: soften f16 type by default instead of marking legal.

Actual support for softening f16 operations is still limited, and can be added
when it's needed.  But Soften is much closer to being a useful thing to try
than keeping it Legal when no registers can actually hold such values.

Longer term, we probably want something between Soften and Promote semantics
for most targets, it'll be more efficient to promote the 4 basic operations to
f32 than libcall them.

llvm-svn: 213372

10 years agoSuppress 'not handled in switch' warning
Renato Golin [Fri, 18 Jul 2014 12:13:04 +0000 (12:13 +0000)]
Suppress 'not handled in switch' warning

llvm-svn: 213371

10 years agoAdd FreeBSD support to the Asan symbolization script
Viktor Kutuzov [Fri, 18 Jul 2014 12:07:00 +0000 (12:07 +0000)]
Add FreeBSD support to the Asan symbolization script
Differential Revision: http://reviews.llvm.org/D4560

llvm-svn: 213370

10 years ago[ARM] Add earlyclobber constraint to pre/post-indexed ARM STR instructions.
Tilmann Scheller [Fri, 18 Jul 2014 12:05:49 +0000 (12:05 +0000)]
[ARM] Add earlyclobber constraint to pre/post-indexed ARM STR instructions.

The post-indexed instructions were missing the constraint, causing unpredictable STR instructions to be emitted.

The earlyclobber constraint on the pre-indexed STR instructions is not strictly necessary, as the instruction selection for pre-indexed STR instructions goes through an additional layer of pseudo instructions which have the constraint defined, however it doesn't hurt to specify the constraint directly on the pre-indexed instructions as well, since at some point someone might create instances of them programmatically and then the constraint is definitely needed.

This fixes PR20323.

llvm-svn: 213369

10 years agoAdd FreeBSD support to the address sanitizer's waitid.cc test case
Viktor Kutuzov [Fri, 18 Jul 2014 12:02:42 +0000 (12:02 +0000)]
Add FreeBSD support to the address sanitizer's waitid.cc test case
Differential Revision: http://reviews.llvm.org/D4422

llvm-svn: 213368

10 years agoRefactor ARM subarchitecture parsing
Renato Golin [Fri, 18 Jul 2014 12:00:48 +0000 (12:00 +0000)]
Refactor ARM subarchitecture parsing

Re-commit of a patch to rework the triple parsing on ARM to a more sane
model.

Patch by Gabor Ballabas.

llvm-svn: 213367