platform/upstream/llvm.git
9 years agoRefactor a lot of duplicated code for stub output.
Rafael Espindola [Tue, 7 Apr 2015 13:42:44 +0000 (13:42 +0000)]
Refactor a lot of duplicated code for stub output.

This also moves it earlier so that it they are produced before we print
an end symbol for the data section.

llvm-svn: 234315

9 years agoSilencing several "enumeral and non-enumeral type in conditional expression" warnings...
Aaron Ballman [Tue, 7 Apr 2015 13:28:37 +0000 (13:28 +0000)]
Silencing several "enumeral and non-enumeral type in conditional expression" warnings; NFC.

llvm-svn: 234314

9 years agoClear the stub map in getSortedStubs.
Rafael Espindola [Tue, 7 Apr 2015 12:59:28 +0000 (12:59 +0000)]
Clear the stub map in getSortedStubs.

This makes sure they are only output once (and frees a bit of memory).

llvm-svn: 234313

9 years ago[TableGen] Prevent invalid code generation when emitting AssemblerPredicate conditions.
Toma Tabacu [Tue, 7 Apr 2015 12:10:11 +0000 (12:10 +0000)]
[TableGen] Prevent invalid code generation when emitting AssemblerPredicate conditions.

Summary:
The loop which emits AssemblerPredicate conditions also links them together by emitting a '&&'.
If the 1st predicate is not an AssemblerPredicate, while the 2nd one is, nothing gets emitted for the 1st one, but we still emit the '&&' because of the 2nd predicate.
This generated code looks like "( && Cond2)" and is invalid.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: dsanders, llvm-commits

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

llvm-svn: 234312

9 years ago[ARM] Use getMappingAtomName in Release only
Denis Protivensky [Tue, 7 Apr 2015 11:51:39 +0000 (11:51 +0000)]
[ARM] Use getMappingAtomName in Release only

llvm-svn: 234311

9 years ago[MachineLICM] Remove obsolete comment about not considering reg pressure.
Daniel Jasper [Tue, 7 Apr 2015 11:43:32 +0000 (11:43 +0000)]
[MachineLICM] Remove obsolete comment about not considering reg pressure.

llvm-svn: 234310

9 years agoAdd test showing that MachineLICM is calculating register pressure wrong
Daniel Jasper [Tue, 7 Apr 2015 11:41:40 +0000 (11:41 +0000)]
Add test showing that MachineLICM is calculating register pressure wrong

More details: http://llvm.org/PR23143

llvm-svn: 234309

9 years agoFix a compiler error under MSVC
Timur Iskhodzhanov [Tue, 7 Apr 2015 11:26:00 +0000 (11:26 +0000)]
Fix a compiler error under MSVC

Error message was:
CGDebugInfo.cpp(1047) : error C2666: 'llvm::MDTypeRefArray::operator []' : 2 overloads have similar conversions
  DebugInfoMetadata.h(106): could be 'llvm::MDTypeRef llvm::MDTypeRefArray::operator [](unsigned int) const'
  while trying to match the argument list '(llvm::DITypeArray, int)'

llvm-svn: 234308

9 years agoIgnore mapping symbols on aarch64
Tamas Berghammer [Tue, 7 Apr 2015 10:43:50 +0000 (10:43 +0000)]
Ignore mapping symbols on aarch64

ELF symbol tables on aarch64 may contains some mapping symbols. They
provide information about the underlying data but interfere with symbol
look-up of lldb. They are already ignored on arm32. With this CL they
will be ignored on aarch64 also.

Differential revision: http://reviews.llvm.org/D8776

llvm-svn: 234307

9 years agoRevert "[SEH] Implement filter capturing in CodeGen"
Daniel Jasper [Tue, 7 Apr 2015 10:07:47 +0000 (10:07 +0000)]
Revert "[SEH] Implement filter capturing in CodeGen"

Test fails:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/3182/

llvm-svn: 234306

9 years agoimplement gdb-set output-radix
Ilia K [Tue, 7 Apr 2015 09:47:23 +0000 (09:47 +0000)]
implement gdb-set output-radix

Summary: Patch from chuckr@microsoft.com

Reviewers: abidh, ChuckR

Reviewed By: abidh

Subscribers: paulmaybee, ki.stfu, greggm, scarroll, lldb-commits

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

llvm-svn: 234305

9 years agoclang-format: Improve nested block formatting.
Daniel Jasper [Tue, 7 Apr 2015 08:20:35 +0000 (08:20 +0000)]
clang-format: Improve nested block formatting.

Before:
  functionA(functionB({
    int i;
    int j;
  }),
            aaaa, bbbb, cccc);

After:
  functionA(functionB({
              int i;
              int j;
            }),
            aaaa, bbbb, cccc);

llvm-svn: 234304

9 years ago[ARM] Rename applyThmReloc => applyThumb32Reloc
Denis Protivensky [Tue, 7 Apr 2015 07:14:13 +0000 (07:14 +0000)]
[ARM] Rename applyThmReloc => applyThumb32Reloc

llvm-svn: 234302

9 years ago[ARM] Add mapping symbols to PLT entries
Denis Protivensky [Tue, 7 Apr 2015 07:04:42 +0000 (07:04 +0000)]
[ARM] Add mapping symbols to PLT entries

Make PLT entry atoms represent mapping symbols in the Release mode,
while in the Debug mode they are still function-like symbols
with regular names.
It's legal that mapping symbols denote unnamed parts of code,
and PLT entries are not required to have function-like names.

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

llvm-svn: 234301

9 years agoclang-format: Indent relative to the ./-> and not the function name.
Daniel Jasper [Tue, 7 Apr 2015 06:41:24 +0000 (06:41 +0000)]
clang-format: Indent relative to the ./-> and not the function name.

Before:
  aaaaaaaaaaa     //
      .aaaa(      //
           bbbb)  // This is different ..
      .aaaa(      //
          cccc);  // .. from this.

After:
  aaaaaaaaaaa     //
      .aaaa(      //
          bbbb)   // This is identical ..
      .aaaa(      //
          cccc);  // .. to this.

llvm-svn: 234300

9 years ago[RuntimeDyld] Always allocate at least 1 byte for object sections in the JIT to
Lang Hames [Tue, 7 Apr 2015 06:27:56 +0000 (06:27 +0000)]
[RuntimeDyld] Always allocate at least 1 byte for object sections in the JIT to
ensure that section addresses are distinct.

mapSectionAddress will fail if two sections are allocated the same address,
which can happen if any section has zero size (since malloc(0) is implementation
defined). Unfortunately I've been unable to repro this with a simple test case.

Fixes <rdar://problem/20314015>.

llvm-svn: 234299

9 years ago[Orc] Save all the x86-64 GPRs before re-entering the JIT.
Lang Hames [Tue, 7 Apr 2015 06:12:21 +0000 (06:12 +0000)]
[Orc] Save all the x86-64 GPRs before re-entering the JIT.

The re-entry code should work for all calling conventions.

llvm-svn: 234298

9 years ago[Sema] Don't crash when __attribute__((nonnull)) is applied to blocks
David Majnemer [Tue, 7 Apr 2015 06:01:53 +0000 (06:01 +0000)]
[Sema] Don't crash when __attribute__((nonnull)) is applied to blocks

A simple case of asserting isFunctionOrMethod when we should have
asserted isFunctionOrMethodOrBlock.

This fixes PR23117.

llvm-svn: 234297

9 years agoIn many places, there was an #ifdef/#else block that selected one of two implmentatio...
Marshall Clow [Tue, 7 Apr 2015 05:21:38 +0000 (05:21 +0000)]
In many places, there was an #ifdef/#else block that selected one of two implmentations of rebind_alloc based on whether or not we had template aliases. Create a helper struct to encapsulate that bit of logic, and replace all the ifdefs with uses of that struct. No functionality change intented.

llvm-svn: 234296

9 years agoTry a third time to fix MSVC build after r234290
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 05:03:47 +0000 (05:03 +0000)]
Try a third time to fix MSVC build after r234290

I have no idea what MSVC means with its error text here :(.

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/2310

llvm-svn: 234295

9 years agoTry again to fix MSVC build after r234290
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 04:49:13 +0000 (04:49 +0000)]
Try again to fix MSVC build after r234290

Still failing:

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/2309

llvm-svn: 234294

9 years ago[ELF] Remove redundant const_cast
Simon Atanasyan [Tue, 7 Apr 2015 04:38:30 +0000 (04:38 +0000)]
[ELF] Remove redundant const_cast

No functional changes.

llvm-svn: 234293

9 years agoTry to fix MSVC build after r234290
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 04:33:42 +0000 (04:33 +0000)]
Try to fix MSVC build after r234290

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/2308

llvm-svn: 234292

9 years agoDebugInfo: Update for LLVM change in r234290
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 04:14:45 +0000 (04:14 +0000)]
DebugInfo: Update for LLVM change in r234290

The API for `DIArray` changed; use the new one.

llvm-svn: 234291

9 years agoDebugInfo: Remove DITypedArray<>, replace with typedefs
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 04:14:33 +0000 (04:14 +0000)]
DebugInfo: Remove DITypedArray<>, replace with typedefs

Replace all uses of `DITypedArray<>` with `MDTupleTypedArrayWrapper<>`
and `MDTypeRefArray`.  The APIs are completely different, but the
provided functionality is the same: treat an `MDTuple` as if it's an
array of a particular element type.

To simplify this patch a bit, I've temporarily typedef'ed
`DebugNodeArray` to `DIArray` and `MDTypeRefArray` to `DITypeArray`.
I've also temporarily conditionalized the accessors to check for null --
eventually these should be changed to asserts and the callers should
check for null themselves.

There's a tiny accompanying patch to clang.

llvm-svn: 234290

9 years agoDebugInfo: Remove DICompositeType mutation API
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 04:12:02 +0000 (04:12 +0000)]
DebugInfo: Remove DICompositeType mutation API

Change `DIBuilder` to mutate `MDCompositeTypeBase` directly, and remove
the wrapping API in `DICompositeType`.

llvm-svn: 234289

9 years agoDebugInfo: Use DebugNodeRef in MDImportedEntity::getEntity()
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 04:07:31 +0000 (04:07 +0000)]
DebugInfo: Use DebugNodeRef in MDImportedEntity::getEntity()

A quick cleanup to sue `DebugNodeRef` instead of `Metadata*` for
`MDImportedEntity::getEntity()`.

llvm-svn: 234288

9 years agoDebugInfo: Move DIFlag accessors from DIVariable to MDLocalVariable
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 03:55:30 +0000 (03:55 +0000)]
DebugInfo: Move DIFlag accessors from DIVariable to MDLocalVariable

llvm-svn: 234287

9 years agoDebugInfo: Move DIExpression bit-piece API to MDExpression
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 03:49:59 +0000 (03:49 +0000)]
DebugInfo: Move DIExpression bit-piece API to MDExpression

llvm-svn: 234286

9 years agoDebugInfo: Remove special iterators from DIExpression
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 03:45:57 +0000 (03:45 +0000)]
DebugInfo: Remove special iterators from DIExpression

Remove special iterators from `DIExpression` in favour of same in
`MDExpression`.  There should be no functionality change here.

Note that the APIs are slightly different: `getArg(unsigned)` counts
from 0, not 1, in the `MDExpression` version of the iterator.

llvm-svn: 234285

9 years agoELF: Minimum alignment value is 1, not 0. NFC.
Rui Ueyama [Tue, 7 Apr 2015 03:44:26 +0000 (03:44 +0000)]
ELF: Minimum alignment value is 1, not 0. NFC.

Maybe we can interpret alignment 0 as "don't care", but for
consistency, it's good to set 1 instead of 0 where we allow
any alignments.

llvm-svn: 234284

9 years ago[LoopAccesses] New API to query if memchecks are necessary after partitioning
Adam Nemet [Tue, 7 Apr 2015 03:35:26 +0000 (03:35 +0000)]
[LoopAccesses] New API to query if memchecks are necessary after partitioning

This is used by Loop Distribution.

llvm-svn: 234283

9 years agoDebugInfo: Move DISubprogram::is*() queries to MDSubprogram
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 03:33:57 +0000 (03:33 +0000)]
DebugInfo: Move DISubprogram::is*() queries to MDSubprogram

Move body of `DISubprogram::isPrivate()` (etc.) to `MDSubprogram`, and
change the versions in `DISubprogram` to forward there.

This is just like r234275, but for subprograms instead of types.

llvm-svn: 234282

9 years agoELF: Add a comment to ELFFile::findAtom.
Rui Ueyama [Tue, 7 Apr 2015 02:52:34 +0000 (02:52 +0000)]
ELF: Add a comment to ELFFile::findAtom.

Also changed the local variable names to avoid line wrapping.

llvm-svn: 234281

9 years ago[Sema] Don't permit dependent alignments on non-dependent typedef-names
David Majnemer [Tue, 7 Apr 2015 02:37:09 +0000 (02:37 +0000)]
[Sema] Don't permit dependent alignments on non-dependent typedef-names

A dependent alignment attribute (like __attribute__((aligned(...))) or
__declspec(align(...))) on a non-dependent typedef or using declaration
poses a considerable challenge: the type is _not_ dependent, the size
_may_ be dependent if the type is used as an array type, the alignment
_is_ dependent.

It is reasonable for a compiler to be able to query the size and
alignment of a complete type.  Let's help that become an invariant.

This fixes PR22042.

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

llvm-svn: 234280

9 years agoFix weird comment line-wrapping.
Rui Ueyama [Tue, 7 Apr 2015 02:26:42 +0000 (02:26 +0000)]
Fix weird comment line-wrapping.

llvm-svn: 234279

9 years agoUse early continue.
Rui Ueyama [Tue, 7 Apr 2015 02:20:33 +0000 (02:20 +0000)]
Use early continue.

llvm-svn: 234278

9 years agoELF: Move more code from createAtoms to handleGnuLinkOnceSection.
Rui Ueyama [Tue, 7 Apr 2015 02:11:56 +0000 (02:11 +0000)]
ELF: Move more code from createAtoms to handleGnuLinkOnceSection.

So that createAtoms become more readable.

llvm-svn: 234277

9 years agoELF: Simplfiy ELFFile::createAtom.
Rui Ueyama [Tue, 7 Apr 2015 01:56:07 +0000 (01:56 +0000)]
ELF: Simplfiy ELFFile::createAtom.

createAtom function did too much in a single for-loop. This patch
splits the for-loop and extract COMDAT handling into a separate
function.

llvm-svn: 234276

9 years agoDebugInfo: Move DIType::is*() queries to MDType
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 01:24:30 +0000 (01:24 +0000)]
DebugInfo: Move DIType::is*() queries to MDType

Move body of `DIType::isObjectPointer()` (etc.) to `MDType`, and change
the versions in `DIType` to forward there.

llvm-svn: 234275

9 years agoDebugInfo: Move DIFlag-related API from DIDescriptor to DebugNode
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 01:21:40 +0000 (01:21 +0000)]
DebugInfo: Move DIFlag-related API from DIDescriptor to DebugNode

llvm-svn: 234274

9 years agoELF: Do not return error from handle{CommonSymbol,MergeString}.
Rui Ueyama [Tue, 7 Apr 2015 01:14:24 +0000 (01:14 +0000)]
ELF: Do not return error from handle{CommonSymbol,MergeString}.

llvm-svn: 234273

9 years agoELF: Do not return error from handleAbsoluteSymbol.
Rui Ueyama [Tue, 7 Apr 2015 01:08:16 +0000 (01:08 +0000)]
ELF: Do not return error from handleAbsoluteSymbol.

This function never fails.

llvm-svn: 234272

9 years agoELF: Do not return error from handleUndefinedSymbol.
Rui Ueyama [Tue, 7 Apr 2015 01:04:15 +0000 (01:04 +0000)]
ELF: Do not return error from handleUndefinedSymbol.

This function is not supposed to return an error value.

llvm-svn: 234271

9 years agoReport an error when -m<os>-version-min= does not specify a version.
Bob Wilson [Tue, 7 Apr 2015 01:03:35 +0000 (01:03 +0000)]
Report an error when -m<os>-version-min= does not specify a version.

Currently if you use -mmacosx-version-min or -mios-version-min without
specifying a version number, clang silently sets the minimum version to
"0.0.0". This is almost certainly not what was intended, so it is better
to report it as an error. rdar://problem/20433945

llvm-svn: 234270

9 years agoELF: Do not return error from handleDefinedSymbol.
Rui Ueyama [Tue, 7 Apr 2015 01:00:20 +0000 (01:00 +0000)]
ELF: Do not return error from handleDefinedSymbol.

handleDefinedSymbol has return type of ErrorOr<ELFDefinedAtom *>.
However, it never returns an error. We are not checking errors.
It's marked as ErrorOr "just in case". That's a bad engineering
practice.

This patch simplifies the return type of the function.

llvm-svn: 234269

9 years agoIR: Rename MDSubrange::getLo() to getLowerBound()
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 00:39:59 +0000 (00:39 +0000)]
IR: Rename MDSubrange::getLo() to getLowerBound()

During initial review, the `lo:` field was renamed to `lowerBound:`.
Make the same change to the C++ API.

llvm-svn: 234267

9 years agoFix polly build after LLVM r234263
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 00:29:05 +0000 (00:29 +0000)]
Fix polly build after LLVM r234263

llvm-svn: 234266

9 years agoFix some minor abuse of C++ terminology in comments.
Richard Smith [Tue, 7 Apr 2015 00:14:27 +0000 (00:14 +0000)]
Fix some minor abuse of C++ terminology in comments.

llvm-svn: 234265

9 years ago[WinEH] Don't create an alloca for unnamed catch parameters
Reid Kleckner [Tue, 7 Apr 2015 00:09:59 +0000 (00:09 +0000)]
[WinEH] Don't create an alloca for unnamed catch parameters

The catch object parameter to llvm.eh.begincatch is optional, and can be
null. We can save some ourselves the stack space, copy ctor, and dtor
calls if we pass null.

llvm-svn: 234264

9 years agoDebugInfo: Drop dead code for loose DIDescriptor construction API
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 00:09:47 +0000 (00:09 +0000)]
DebugInfo: Drop dead code for loose DIDescriptor construction API

Delete `DIDescriptor::is*()` and the various constructors from `MDNode*`
in `DIDescriptor` subclasses.

If this just broke your out-of-tree code, you need to make updates along
the lines of r234255, r234256, r234257 and r234258:

  - Generally, `DIX().isX()` => `isa<MDX>()`.  So, `D.isCompileUnit()`
    should just be `isa<MDCompileUnit>(D)`, modulo checks for null.
      - Exception: `DILexicalBlock` => `MDLexicalBlockBase`.
      - Exception: `DIDerivedType` => `MDDerivedTypeBase`.
      - Exception: `DICompositeType` => `MDCompositeTypeBase`.
      - Exception: `DIVariable` => `MDLocalVariable`.
  - Note that (e.g.) `DICompileUnit` has an implicit constructor from
    `MDCompileUnit*`.

llvm-svn: 234263

9 years agobindings/go: Stop using DIDescriptor::is*() and auto-casting
Duncan P. N. Exon Smith [Tue, 7 Apr 2015 00:08:31 +0000 (00:08 +0000)]
bindings/go: Stop using DIDescriptor::is*() and auto-casting

Go bindings edition of r234255.

llvm-svn: 234262

9 years ago[SEH] Implement filter capturing in CodeGen
Reid Kleckner [Mon, 6 Apr 2015 23:51:44 +0000 (23:51 +0000)]
[SEH] Implement filter capturing in CodeGen

While capturing filters aren't very common, we'd like to outline
__finally blocks in the frontend to simplify -O0 EH preparation and
reduce code size. Finally blocks are usually have captures, and this is
the first step towards that.

Currently we don't support capturing 'this' or VLAs.

Reviewers: majnemer

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

llvm-svn: 234261

9 years agoFixed a crash because we weren't generating
Sean Callanan [Mon, 6 Apr 2015 23:51:08 +0000 (23:51 +0000)]
Fixed a crash because we weren't generating
type-safe relocations against @reloc_placeholder.

<rdar://problem/20438754>

llvm-svn: 234260

9 years agoIR: Fix -Werror noasserts build after r234255
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 23:34:41 +0000 (23:34 +0000)]
IR: Fix -Werror noasserts build after r234255

llvm-svn: 234259

9 years agoCodeGen: Stop using DIDescriptor::is*() and auto-casting
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 23:27:40 +0000 (23:27 +0000)]
CodeGen: Stop using DIDescriptor::is*() and auto-casting

Same as r234255, but for lib/CodeGen and lib/Target.

llvm-svn: 234258

9 years agoTransforms: Stop using DIDescriptor::is*() and auto-casting
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 23:27:00 +0000 (23:27 +0000)]
Transforms: Stop using DIDescriptor::is*() and auto-casting

Same as r234255, but for lib/Analysis and lib/Transforms.

llvm-svn: 234257

9 years agoCGDebugInfo: Stop using DIDescriptor::is*() and auto-casting
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 23:21:33 +0000 (23:21 +0000)]
CGDebugInfo: Stop using DIDescriptor::is*() and auto-casting

The clang edition of r234255: use built-in `isa<>`, `dyn_cast<>`, etc.,
and only build `DIDescriptor`s from pointers that are correctly typed.

llvm-svn: 234256

9 years agoIR: Stop using DIDescriptor::is*() and auto-casting
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 23:18:49 +0000 (23:18 +0000)]
IR: Stop using DIDescriptor::is*() and auto-casting

`DIDescriptor`'s subclasses allow construction from incompatible
pointers, and `DIDescriptor` defines a series of `isa<>`-like functions
(e.g., `isCompileUnit()` instead of `isa<MDCompileUnit>()`) that clients
tend to use like this:

    if (DICompileUnit(N).isCompileUnit())
      foo(DICompileUnit(N));

These construction patterns work together to make `DIDescriptor` behave
differently from normal pointers.

Instead, use built-in `isa<>`, `dyn_cast<>`, etc., and only build
`DIDescriptor`s from pointers that are valid for their type.

I've split this into a few commits for different parts of LLVM and clang
(to decrease the patch size and increase the chance of review).
Generally the changes I made were NFC, but in a few places I made things
stricter if it made sense from the surrounded code.

Eventually a follow-up commit will remove the API for the "old" way.

llvm-svn: 234255

9 years ago[libcxxabi] Disallow Base to Derived conversions for catching pointers to members.
Eric Fiselier [Mon, 6 Apr 2015 23:03:01 +0000 (23:03 +0000)]
[libcxxabi] Disallow Base to Derived conversions for catching pointers to members.

Summary:
I accidentally implemented the 4.11 [conv.mem] conversions for libc++abi in a recent patch. @majnemer pointed out that 5.13 [except.handle] only allows the pointer conversions in 4.10 and not those is 4.11. This patch no longer allows the following example code:

```c++
struct A {};
struct B : public A {};

int main() {
  try {
    throw (int A::*)0;
  } catch (int B::*) {
    // exception caught here.
  }
}
```

Reviewers: mclow.lists, jroelofs, majnemer

Reviewed By: majnemer

Subscribers: majnemer, cfe-commits

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

llvm-svn: 234254

9 years agoELF: Simplify CreateELF.
Rui Ueyama [Mon, 6 Apr 2015 23:02:47 +0000 (23:02 +0000)]
ELF: Simplify CreateELF.

CreateELF was a combination of templates and C preprocessor macros.
This patch removes uses of macros.

http://reviews.llvm.org/D8810

llvm-svn: 234253

9 years agoFix a very silly typo in my previous commit. I need more coffee.
Davide Italiano [Mon, 6 Apr 2015 22:57:58 +0000 (22:57 +0000)]
Fix a very silly typo in my previous commit. I need more coffee.

Spotted by Simon Atanasyan.

llvm-svn: 234252

9 years agoFix failure on builder clang-cmake-mips where it was printing a 32-bit address
Kevin Enderby [Mon, 6 Apr 2015 22:33:43 +0000 (22:33 +0000)]
Fix failure on builder clang-cmake-mips where it was printing a 32-bit address
incorrectly because it came from an expression using S.getAddress() which always
returns a 64-bit value.

llvm-svn: 234251

9 years agoDebugInfo: Allow isa<> on DIDescriptor and subclasses
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 22:32:20 +0000 (22:32 +0000)]
DebugInfo: Allow isa<> on DIDescriptor and subclasses

Allow LLVM-style casting on `DIDescriptor` and its subclasses so they
can behave more like raw pointers.  I haven't bothered with tests since
I have a follow-up commit coming shortly that uses them extensively in
tree, and I'm hoping to kill `DIDescriptor` entirely before too long (so
they won't have time to bitrot).

Usage examples:

    DIDescriptor D = foo();
    if (DICompileUnit CU = dyn_cast<MDCompileUnit>(D))
      return bar(CU);
    else if (auto *SP = dyn_cast<MDSubprogram>(D))
      return baz(SP);
    return other(D);

llvm-svn: 234250

9 years agoUse sext in fast isel.
Rafael Espindola [Mon, 6 Apr 2015 22:29:07 +0000 (22:29 +0000)]
Use sext in fast isel.

Fast isel used to zero extends immediates to 64 bits. This normally goes
unnoticed because the value is truncated to 32 bits for output.

Two cases were it is noticed:

* We fail to use smaller encodings.
* If the original constant was smaller than i32.

In the tests using i1 constants, codegen would change to use -1, which is fine
(and matches what regular isel does) since only the lowest bit is then used.

Instead, this patch then changes the ir to use i8 constants, which looks more
like what clang produces.

llvm-svn: 234249

9 years agoDebugInfo: Reimplement DIRef<>::resolve() using TypedDebugNodeRef<>
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 22:27:37 +0000 (22:27 +0000)]
DebugInfo: Reimplement DIRef<>::resolve() using TypedDebugNodeRef<>

Gut `DIRef<>::resolve()`, reimplementing it using
`TypedDebugNodeRef<>::resolve()`.  Use three separate functions rather
than some sort of type traits, since the latter (i.e., mapping `DIScope`
=> `MDScope`) seems heavy-handed.  I don't expect `DIRef<>` to last much
longer in tree anyway.

As a drive-by fix, make `TypedDebugNodeRef<>::resolve()` do the right
thing with `nullptr`.

llvm-svn: 234248

9 years ago[lit] Skip gtest names starting with DISABLED_
Reid Kleckner [Mon, 6 Apr 2015 22:16:58 +0000 (22:16 +0000)]
[lit] Skip gtest names starting with DISABLED_

The sanitizer test suite uses this idiom to disable a test.  Now that we
actually check if a test ran after invoking it, we see that zero tests
ran, and complain.

Instead, ignore tests starting with DISABLED_ completely. Fixes the
sanitizer test suite failures on Windows.

llvm-svn: 234247

9 years agoDebugInfo: Drop confusing forwarding API from DILexicalBlockFile
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 22:07:46 +0000 (22:07 +0000)]
DebugInfo: Drop confusing forwarding API from DILexicalBlockFile

Remove `DILexicalBlockFile::getScope()` (whose last use was removed from
clang in r234245), which illegally returned a `DILexicalBlock` despite
its scope sometimes being an `MDSubprogram`.  Also remove the
`getLineNumber()` and `getColumnNumber()` methods that just forwarded to
`DILexicalBlock`'s versions, since there don't seem to be any callers.

Note that the block of code removed from `DebugInfo.cpp` was actually
dead code, since `isLexicalBlock()` (the previous branch) always returns
true when `isLexicalBlockFile()` returns true.

An earlier (broken and untested) version of this was squashed into
r234222 and reverted in r234225.

llvm-svn: 234246

9 years agoDebugInfo: Use DILexicalBlockFile::getContext() over getScope()
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 22:04:18 +0000 (22:04 +0000)]
DebugInfo: Use DILexicalBlockFile::getContext() over getScope()

`getScope()` passes the scope back through a `DILexicalBlock` even
though the underlying pointer may be an incompatible `MDSubprogram`.
Just use `getContext()` directly.

llvm-svn: 234245

9 years agoFix check for options in "command alias"
Ted Woodward [Mon, 6 Apr 2015 21:55:14 +0000 (21:55 +0000)]
Fix check for options in "command alias"

Summary:
"command alias" can add invalid options to the command. "command alias start process launch -s" will add an extra argument, "<no-argument>" to the alias, so it runs "process launch -s <no-argument>", which launches the process with args that include "<no-argument>".

This patch changes the text compare of the variable value with "<OptionParser::eNoArgument>" to a compare of variable value_type with OptionParser::eNoArgument. It also moves the previous test inside the if, so it won't add a trailing space if there is no argument.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 234244

9 years agoEnable a test in TestSTL for GCC.
Siva Chandra [Mon, 6 Apr 2015 21:52:10 +0000 (21:52 +0000)]
Enable a test in TestSTL for GCC.

Summary:
Remove @skipIfGcc from a test in TestSTL as that test passes with GCC
now. Also, mark one of the dsym tests with @skipUnlessDarwin in TestSTL.

Test Plan: dotest.py -C gcc -p TestSTL

Reviewers: vharron

Subscribers: lldb-commits

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

llvm-svn: 234243

9 years ago[lit] Fix running gtest type-parameterized tests on Windows
Reid Kleckner [Mon, 6 Apr 2015 21:49:55 +0000 (21:49 +0000)]
[lit] Fix running gtest type-parameterized tests on Windows

The '/' character in the test name of a type-parameterized test is not a
path separator, and should not be '\' on Windows. We were passing a test
name to --gtest_filter which found no tests, so the exit code was zero,
indicating a passed test.

This bug has been here since r84387 in 2009, when Jeff Yasskin added the
original lit support for type-paratermized tests. Somewhere along the
line some of the ValueMapTests started failing, but we can fix those
separately.

llvm-svn: 234242

9 years agoReapply "DebugInfo: Loosen DILexicalBlock constructor"
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 21:46:46 +0000 (21:46 +0000)]
Reapply "DebugInfo: Loosen DILexicalBlock constructor"

This reverts commit r234225, reapplying r234222 in spirit.

This time, just include what the commit message actually describes:
loosen the `DILexicalBlock` constructor to require a
`MDLexicalBlockBase`, since that's what `DILexicalBlock` is wrapping.

llvm-svn: 234241

9 years ago[GNU] Implement --enable-new-dtags/--disable-new-dtags
Davide Italiano [Mon, 6 Apr 2015 21:45:31 +0000 (21:45 +0000)]
[GNU] Implement --enable-new-dtags/--disable-new-dtags

PR: 23036
Differential Revision: http://reviews.llvm.org/D8836

llvm-svn: 234240

9 years agoFix an issue where LLDB could crash when trying to figure out the return value layout...
Enrico Granata [Mon, 6 Apr 2015 21:39:56 +0000 (21:39 +0000)]
Fix an issue where LLDB could crash when trying to figure out the return value layout for an invalid type

llvm-svn: 234239

9 years agoRevert "DebugInfo: Loosen DILexicalBlock constructor"
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 21:30:23 +0000 (21:30 +0000)]
Revert "DebugInfo: Loosen DILexicalBlock constructor"

This reverts commit r234222, while I look into bot failures [1].  I'll
recommit soon.

[1]: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/7117/

llvm-svn: 234225

9 years agoArgPromo: Bail out earlier for varargs functions
David Blaikie [Mon, 6 Apr 2015 21:27:31 +0000 (21:27 +0000)]
ArgPromo: Bail out earlier for varargs functions

llvm-svn: 234224

9 years agoELF: Do not mix link-once and group sections.
Rui Ueyama [Mon, 6 Apr 2015 21:21:43 +0000 (21:21 +0000)]
ELF: Do not mix link-once and group sections.

Previously, we put both link-once and group sections into the same map
and seaparated them out when we use them. Apparently we should put them
into seaprate maps in the first place.

This piece of code is added recently, and I still don't understand all
of them. Looks like we need to clean this up even more.

llvm-svn: 234223

9 years agoDebugInfo: Loosen DILexicalBlock constructor
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 21:16:11 +0000 (21:16 +0000)]
DebugInfo: Loosen DILexicalBlock constructor

This class wraps `MDLexicalBlockBase`, so allow construction from it!
Currently doesn't cause any problems because of the explicit `MNode*`
constructor, but I'll be removing that soon enough.

llvm-svn: 234222

9 years agoFix a call to std::unique to actually discard the trailing (junk) elements.
James Dennett [Mon, 6 Apr 2015 21:09:24 +0000 (21:09 +0000)]
Fix a call to std::unique to actually discard the trailing (junk) elements.

Found by inspection.  (No other instances of this problem were found.)

llvm-svn: 234221

9 years agoMove `checkInterfaceFunction` to ModuleUtils
Ismail Pazarbasi [Mon, 6 Apr 2015 21:09:08 +0000 (21:09 +0000)]
Move `checkInterfaceFunction` to ModuleUtils

Summary:
Instead of making a local copy of `checkInterfaceFunction` for each
sanitizer, move the function in a common place.

Reviewers: kcc, samsonov

Subscribers: llvm-commits

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

llvm-svn: 234220

9 years ago[opaque pointer type] Avoid using PointerType::getElementType when parsing IR
David Blaikie [Mon, 6 Apr 2015 20:59:48 +0000 (20:59 +0000)]
[opaque pointer type] Avoid using PointerType::getElementType when parsing IR

A few calls are left in for error checking - but I'm commenting those
out & trying to build some IR tests (aiming for Argument Promotion to
start with). When I get any of these tests passing I may add flag to
disable the checking so I can add tests that pass with the assertion in
place.

llvm-svn: 234206

9 years agoReplace the `createImplicitFiles` method return type with `void`
Simon Atanasyan [Mon, 6 Apr 2015 20:43:35 +0000 (20:43 +0000)]
Replace the `createImplicitFiles` method return type with `void`

All instances of the `createImplicitFiles` always return `true` and this
return value is used nowhere.

llvm-svn: 234205

9 years agoRemove return after report_fatal_error which has noreturn attribute.
Rui Ueyama [Mon, 6 Apr 2015 20:25:18 +0000 (20:25 +0000)]
Remove return after report_fatal_error which has noreturn attribute.

llvm-svn: 234204

9 years agoFix weird line-wrapping.
Rui Ueyama [Mon, 6 Apr 2015 20:10:09 +0000 (20:10 +0000)]
Fix weird line-wrapping.

llvm-svn: 234203

9 years agoMSan told me that we actually dump the entire scratch buffer into PCH files, initiali...
Benjamin Kramer [Mon, 6 Apr 2015 20:01:49 +0000 (20:01 +0000)]
MSan told me that we actually dump the entire scratch buffer into PCH files, initialize it.

Writing 4k of zeros is preferrable to 4k of random memory. Document that. While
there remove the initialization of the first byte of the buffer and start at
index zero. It was writing a literal '0' instead of a null byte at the
beginning anyways, which didn't matter since we never read it.

llvm-svn: 234202

9 years agoDebugInfo: Remove DIDescriptor::Verify()
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 19:49:39 +0000 (19:49 +0000)]
DebugInfo: Remove DIDescriptor::Verify()

Remove `DIDescriptor::Verify()` and the `Verify()`s from subclasses.
They had already been gutted, and just did an `isa<>` check.

In a couple of cases I've temporarily dropped the check entirely, but
subsequent commits are going to disallow conversions to the
`DIDescriptor`s directly from `MDNode`, so the checks will come back in
another form soon enough.

llvm-svn: 234201

9 years agoDebugInfo: Add MDTypeRefArray, to replace DITypeArray
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 19:48:50 +0000 (19:48 +0000)]
DebugInfo: Add MDTypeRefArray, to replace DITypeArray

This array-like wrapper adapts `MDTuple` to have elements of `MDTypeRef`
(whereas `MDTypeArray` has elements of `MDType`).  This is necessary to
migrate code using `DITypeArray`.  The only use of this is
`MDSubroutineType`'s `getTypeArray()` accessor.

llvm-svn: 234200

9 years agoUse llvm::cast at where we don't expect a null value.
Rui Ueyama [Mon, 6 Apr 2015 19:45:32 +0000 (19:45 +0000)]
Use llvm::cast at where we don't expect a null value.

llvm-svn: 234199

9 years agoDebugInfo: Remove dead DIType::operator DITypeRef(), NFC
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 19:23:22 +0000 (19:23 +0000)]
DebugInfo: Remove dead DIType::operator DITypeRef(), NFC

llvm-svn: 234198

9 years agoDebugInfo: Use MDTypeRef throughout the hierarchy
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 19:03:45 +0000 (19:03 +0000)]
DebugInfo: Use MDTypeRef throughout the hierarchy

Use `MDTypeRef` (etc.) in the new debug info hierarchy rather than raw
`Metadata *` pointers.

I rolled in a change to `DIBuilder` that looks unrelated: take `DIType`
instead of `DITypeRef` as type arguments when creating variables.
However, this was the simplest way to use `MDTypeRef` within the
functions, and didn't require any cleanups from callers in clang (since
they were all passing in `DIType`s anyway, relying on their implicit
conversions to `DITypeRef`).

llvm-svn: 234197

9 years ago[WinEH] Don't sink allocas into child handlers
Reid Kleckner [Mon, 6 Apr 2015 18:50:38 +0000 (18:50 +0000)]
[WinEH] Don't sink allocas into child handlers

The uselist isn't enough to infer anything about the lifetime of such
allocas. If we want to re-add this optimization, we will need to
leverage lifetime markers to do it.

Fixes PR23122.

llvm-svn: 234196

9 years agoARM: do not relax Thumb1 -> Thumb2 if only Thumb1 is available.
Tim Northover [Mon, 6 Apr 2015 18:44:42 +0000 (18:44 +0000)]
ARM: do not relax Thumb1 -> Thumb2 if only Thumb1 is available.

After recognising that a certain narrow instruction might need a relocation to
be represented, we used to unconditionally relax it to a Thumb2 instruction to
permit this. Unfortunately, some CPUs (e.g. v6m) don't even have most Thumb2
instructions, so we end up emitting a completely invalid instruction.

Theoretically, ELF does have relocations for these situations; but they are
fairly unusable with such short ranges and the ABI document even says they're
documented "for completeness". So an error is probably better there too.

rdar://20391953

llvm-svn: 234195

9 years agoIf memory read does not find a NULL terminator, still print whatever it gathered...
Enrico Granata [Mon, 6 Apr 2015 18:41:17 +0000 (18:41 +0000)]
If memory read does not find a NULL terminator, still print whatever it gathered instead of just NOP'ing out

However, remark that this is an incomplete chunk of data by still emitting the "no NULL found" warning

rdar://20330073

llvm-svn: 234194

9 years ago[X86][SSE] Use (V)PINSRB for direct byte insertion in 16i8 buildvector on SSE4.1...
Simon Pilgrim [Mon, 6 Apr 2015 18:39:00 +0000 (18:39 +0000)]
[X86][SSE] Use (V)PINSRB for direct byte insertion in 16i8 buildvector on SSE4.1 targets

This patch allows SSE4.1 targets to use (V)PINSRB to create 16i8 vectors by inserting i8 scalars directly into a XMM register instead of merging pairs of i8 scalars into a i16 and using the SSE2 PINSRW instruction.

This allows folding of byte loads and reduces scalar register usage as well.

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

llvm-svn: 234193

9 years agoUpgrade testcases after LLVM r234181
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 18:25:51 +0000 (18:25 +0000)]
Upgrade testcases after LLVM r234181

Until r234181 we were silently upgrading old `@llvm.dbg` intrinsics.
Fix testcases in polly that were relying on that.

llvm-svn: 234192

9 years agoIgnore IOError from missing child.log.
Chaoren Lin [Mon, 6 Apr 2015 18:23:48 +0000 (18:23 +0000)]
Ignore IOError from missing child.log.

Summary:
TestMiCliSupport (among other TestMi*) fails on Linux with

```
IOError: [Errno 2] No such file or directory: 'child.log'
```

Reviewers: clayborg, ki.stfu

Reviewed By: ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 234191

9 years agoFix failure on builder llvm-clang-lld-x86_64-debian-fast as the
Kevin Enderby [Mon, 6 Apr 2015 18:18:23 +0000 (18:18 +0000)]
Fix failure on builder llvm-clang-lld-x86_64-debian-fast as the
test macho-objc-meta-data.test had a line it shouldn't have had.

llvm-svn: 234190

9 years agoAdd some type safety to GlobalObject/GlobalValue - they're always PointerTypes so...
David Blaikie [Mon, 6 Apr 2015 18:06:06 +0000 (18:06 +0000)]
Add some type safety to GlobalObject/GlobalValue - they're always PointerTypes so let's type them that way.

llvm-svn: 234189

9 years agoDebugInfo: Create MDTypeRef, etc., to replace DITypeRef
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 18:02:43 +0000 (18:02 +0000)]
DebugInfo: Create MDTypeRef, etc., to replace DITypeRef

Create a string-based wrapper in the debug info hierarchy for type
references.

llvm-svn: 234188