platform/upstream/llvm.git
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

9 years agosanitizer: new "strict_string_checks" run-time flag
Dmitry Vyukov [Mon, 6 Apr 2015 18:00:26 +0000 (18:00 +0000)]
sanitizer: new "strict_string_checks" run-time flag

This patch is related to Issue 346: moar string interceptors: strstr, strcasestr, strcspn, strpbrk
As was suggested in original review http://reviews.llvm.org/D6056 a new "strict_string_checks" run-time flag introduced.
The flag support applied for existing common, asan, msan and tsan interceptors. New asan tests added.

Change by Maria Guseva reviewed in http://reviews.llvm.org/D7123

llvm-svn: 234187

9 years agoDebugInfo: Remove dead DIRef::getName()
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 17:52:46 +0000 (17:52 +0000)]
DebugInfo: Remove dead DIRef::getName()

llvm-svn: 234186

9 years agoFor llvm-objdump added support for printing Objc2 32-bit runtime meta data
Kevin Enderby [Mon, 6 Apr 2015 17:47:03 +0000 (17:47 +0000)]
For llvm-objdump added support for printing Objc2 32-bit runtime meta data
with the existing -objc-meta-data and -macho options for Mach-O files.

llvm-svn: 234185

9 years agoPrefer uninitialized memory for scratch space.
Benjamin Kramer [Mon, 6 Apr 2015 17:45:11 +0000 (17:45 +0000)]
Prefer uninitialized memory for scratch space.

No functional change intended.

llvm-svn: 234184

9 years agoMetadata: Add typed array-like wrapper for MDTuple
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 17:45:07 +0000 (17:45 +0000)]
Metadata: Add typed array-like wrapper for MDTuple

Add `MDTupleTypedArrayWrapper`, a wrapper around `MDTuple` that adapts
it to look like an array and cast its operands to the given type.  This
is designed to be a replacement for `DITypedArray<>`, which is in the
`DIDescriptor` hierarchy.

llvm-svn: 234183

9 years agoDebugInfo: Remove dead code for accessing fields
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 17:21:05 +0000 (17:21 +0000)]
DebugInfo: Remove dead code for accessing fields

Most fields are now accessed via the new debug info hierarchy.  I'll
make the rest of this code dead soon.

llvm-svn: 234182

9 years agoAutoUpgrade: Remove obsolete dbg.declare/value upgrade
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 17:17:47 +0000 (17:17 +0000)]
AutoUpgrade: Remove obsolete dbg.declare/value upgrade

This upgrade of `@llvm.dbg.declare` and `@llvm.dbg.value` isn't useful,
since it's for an old debug info version.  The calls will get stripped
anyway by `UpgradeDebugInfo()`.

llvm-svn: 234181

9 years ago[SLSR] consider &B[S << i] as &B[(1 << i) * S]
Jingyue Wu [Mon, 6 Apr 2015 17:15:48 +0000 (17:15 +0000)]
[SLSR] consider &B[S << i] as &B[(1 << i) * S]

Summary: This reduces handling &B[(1 << i) * s] to handling &B[i * S].

Test Plan: slsr-gep.ll

Reviewers: meheff

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 234180

9 years ago[DAGCombiner] Add support for FCEIL, FFLOOR and FTRUNC vector constant folding
Simon Pilgrim [Mon, 6 Apr 2015 17:15:41 +0000 (17:15 +0000)]
[DAGCombiner] Add support for FCEIL, FFLOOR and FTRUNC vector constant folding

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

llvm-svn: 234179

9 years agoWe have an issue where if you use a C function right now that has no prototype, it...
Greg Clayton [Mon, 6 Apr 2015 17:14:02 +0000 (17:14 +0000)]
We have an issue where if you use a C function right now that has no prototype, it isn't marked as extern "C" and the name to lookup is some C++ mangled form of the name.

This used to be the case for "printf" before a function prototype was added to the builtin expression prefix file. This fix makes sure that if we get a mangled name that we don't find in the current target, that we only fall back to looking up function by basename if the function isn't contained in a namespace or class (no decl context).

llvm-svn: 234178

9 years agoVerifier: Check composite type template params
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 17:04:58 +0000 (17:04 +0000)]
Verifier: Check composite type template params

Add missing checks for `templateParams:` in `MDCompositeType`.  Pull the
current check for `MDSubprogram` to reduce duplicated code and fix it up
to print a good message when the immediate operand isn't an `MDTuple`
(as a drive-by, make the same fix to `variables:` in `MDSubprogram`).

llvm-svn: 234177

9 years ago[Objective-C patch] Patch to fix a crash in IRGen because
Fariborz Jahanian [Mon, 6 Apr 2015 16:56:39 +0000 (16:56 +0000)]
[Objective-C patch] Patch to fix a crash in IRGen because
of incorrect AST when a compound literal of Objective-C
property access is used to initialize a vertor of floats.
rdar://20407999

llvm-svn: 234176

9 years agoDebugInfo: Use MDFile instead of accessing operands directly, NFC
Duncan P. N. Exon Smith [Mon, 6 Apr 2015 16:43:40 +0000 (16:43 +0000)]
DebugInfo: Use MDFile instead of accessing operands directly, NFC

llvm-svn: 234175

9 years agoUse a comma after the unique keyword.
Rafael Espindola [Mon, 6 Apr 2015 16:34:41 +0000 (16:34 +0000)]
Use a comma after the unique keyword.

H.J. Lu noted that all .section options are separated by a comma.

This patch changes the syntax of unique to require one.

llvm-svn: 234174

9 years agoFix this test so it doesn't try to open a file to write to the source tree
David Blaikie [Mon, 6 Apr 2015 16:33:18 +0000 (16:33 +0000)]
Fix this test so it doesn't try to open a file to write to the source tree

llvm-svn: 234173

9 years agoFix printing of function names during unwind logging.
Zachary Turner [Mon, 6 Apr 2015 16:23:30 +0000 (16:23 +0000)]
Fix printing of function names during unwind logging.

llvm-svn: 234172

9 years agofix typos; NFC
Sanjay Patel [Mon, 6 Apr 2015 16:21:12 +0000 (16:21 +0000)]
fix typos; NFC

llvm-svn: 234171

9 years agoGating clang-fuzzer on the same conditions required to build the LLVMFuzzer library...
Aaron Ballman [Mon, 6 Apr 2015 16:10:32 +0000 (16:10 +0000)]
Gating clang-fuzzer on the same conditions required to build the LLVMFuzzer library. Otherwise, we can run into a situation where clang-fuzzer attempts to build, but its dependency was never built.

llvm-svn: 234170

9 years agoRemove unnecessary uses of AliasedSymbol.
Rafael Espindola [Mon, 6 Apr 2015 16:10:05 +0000 (16:10 +0000)]
Remove unnecessary uses of AliasedSymbol.

As pr19627 points out, every use of AliasedSymbol is likely a bug.

The main use was to avoid the oddity of a variable showing up as undefined. That
was fixed in r233995, which made these calls nops.

llvm-svn: 234169

9 years agoRemoving a spurious space; NFC.
Aaron Ballman [Mon, 6 Apr 2015 16:09:13 +0000 (16:09 +0000)]
Removing a spurious space; NFC.

llvm-svn: 234168

9 years ago[Mips] Guard modification of register usage masks by mutex
Simon Atanasyan [Mon, 6 Apr 2015 16:07:19 +0000 (16:07 +0000)]
[Mips] Guard modification of register usage masks by mutex

llvm-svn: 234167

9 years agotest: Move amd64 -> x86_64 translation to getArchitecture()
Ed Maste [Mon, 6 Apr 2015 15:50:48 +0000 (15:50 +0000)]
test: Move amd64 -> x86_64 translation to getArchitecture()

Rather than sprinkling this knowledge throughout the test suite, just
translate amd64 to x86_64 globally.

llvm-svn: 234166

9 years agoBe consistent when deciding if a relocation is needed.
Rafael Espindola [Mon, 6 Apr 2015 15:27:57 +0000 (15:27 +0000)]
Be consistent when deciding if a relocation is needed.

Before when deciding if we needed a relocation in A-B, we wore only checking
if A was weak.

This fixes the asymmetry.

The "InSet" argument should probably be renamed to "ForValue", since InSet is
very MachO specific, but doing so in this patch would make it hard to read.

This fixes PR22815.

llvm-svn: 234165

9 years agotest: Add amd64 architecture alias for x86_64
Ed Maste [Mon, 6 Apr 2015 15:23:21 +0000 (15:23 +0000)]
test: Add amd64 architecture alias for x86_64

64-bit x86 is called amd64 on FreeBSD.

llvm-svn: 234164

9 years ago[LinkerScript] Handle symbols defined in linker scripts in case of shared lib
Simon Atanasyan [Mon, 6 Apr 2015 15:15:01 +0000 (15:15 +0000)]
[LinkerScript] Handle symbols defined in linker scripts in case of shared lib

This patch is a follow-up to the rL232409 and allows define symbols
in a linker script in case of linking shared library.

llvm-svn: 234163

9 years ago[ELF] Use override keyword instead of virtual
Simon Atanasyan [Mon, 6 Apr 2015 15:09:39 +0000 (15:09 +0000)]
[ELF] Use override keyword instead of virtual

No functional changes.

llvm-svn: 234162

9 years agoDisable all link optimizations in a debug build.
Rafael Espindola [Mon, 6 Apr 2015 15:04:31 +0000 (15:04 +0000)]
Disable all link optimizations in a debug build.

This taking linking clang on my machine with gold from 16.980257914 to
15.933037649 seconds.

llvm-svn: 234161

9 years agoDon't pass -O3 to the linker in debug builds.
Rafael Espindola [Mon, 6 Apr 2015 14:51:01 +0000 (14:51 +0000)]
Don't pass -O3 to the linker in debug builds.

This takes linking clang in a debug build with gold form 19.518925697 to
16.406388685 seconds.

llvm-svn: 234160

9 years agoDon't use -ffunction-sections -fdata-sections on debug builds.
Rafael Espindola [Mon, 6 Apr 2015 14:34:43 +0000 (14:34 +0000)]
Don't use -ffunction-sections -fdata-sections on debug builds.

Unfortunately, on ELF there is not used attribute on the .o files,
so there is no easy way to keep the dump function alive.

If we are not gcing, we may as well produce non gcable files and
avoid the cost.

Linking a debug clang now takes 18.856225992 seconds, before it
took 21.206897447.

I will try avoiding --gc-sections -O3 on a followup patch.

llvm-svn: 234159

9 years agoTest commit. Improve comments in APInt. NFC.
Pawel Bylica [Mon, 6 Apr 2015 13:31:39 +0000 (13:31 +0000)]
Test commit. Improve comments in APInt. NFC.

llvm-svn: 234158

9 years ago[ELF] Use override keyword instead of virtual
Simon Atanasyan [Mon, 6 Apr 2015 13:26:15 +0000 (13:26 +0000)]
[ELF] Use override keyword instead of virtual

No functional changes.

llvm-svn: 234157

9 years ago[ELF] Remove redundant forward class declarations
Simon Atanasyan [Mon, 6 Apr 2015 13:26:10 +0000 (13:26 +0000)]
[ELF] Remove redundant forward class declarations

No functional changes.

llvm-svn: 234156

9 years ago[Mips] Remove redundant non-template MipsRelocationHandler class
Simon Atanasyan [Mon, 6 Apr 2015 13:26:04 +0000 (13:26 +0000)]
[Mips] Remove redundant non-template MipsRelocationHandler class

llvm-svn: 234155

9 years ago[Mips] Replace MipsRelocationHandler::readAddend() by a regular function
Simon Atanasyan [Mon, 6 Apr 2015 13:25:58 +0000 (13:25 +0000)]
[Mips] Replace MipsRelocationHandler::readAddend() by a regular function

The readAddend() does not depend on MipsRelocationHandler and should not
be its member function.

llvm-svn: 234154

9 years ago[Mips] Reformat the code with clang-format
Simon Atanasyan [Mon, 6 Apr 2015 13:25:52 +0000 (13:25 +0000)]
[Mips] Reformat the code with clang-format

llvm-svn: 234153

9 years agoHasSideEffects() should return false for calls to pure and const functions.
Michael Kuperstein [Mon, 6 Apr 2015 13:22:01 +0000 (13:22 +0000)]
HasSideEffects() should return false for calls to pure and const functions.

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

llvm-svn: 234152

9 years agoMinor follow-up fix to r234150
Timur Iskhodzhanov [Mon, 6 Apr 2015 12:54:06 +0000 (12:54 +0000)]
Minor follow-up fix to r234150

llvm-svn: 234151

9 years ago[ASan] Unify handling of loaded modules between POSIX and Windows
Timur Iskhodzhanov [Mon, 6 Apr 2015 12:49:30 +0000 (12:49 +0000)]
[ASan] Unify handling of loaded modules between POSIX and Windows

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

llvm-svn: 234150

9 years agoUpdate our list of distros a bit.
Benjamin Kramer [Mon, 6 Apr 2015 12:30:43 +0000 (12:30 +0000)]
Update our list of distros a bit.

- Debian jessie will be released this month, add the next testing version to the list.
- RHEL7 was released last june.
- Ubuntu utopic was released last october, vivid will follow later this month.

llvm-svn: 234149

9 years agoAdd hard float versions of FP to LL conversions
Sergey Dmitrouk [Mon, 6 Apr 2015 11:54:51 +0000 (11:54 +0000)]
Add hard float versions of FP to LL conversions

This adds hard-float implementation for the following builtins:

* __fixdfdi()
* __fixsfdi()
* __fixunsdfdi()
* __fixunssfdi()

The soft-float implementation does never raise floating point
exceptions, which doesn't allow clients to detect floating point
conversion errors.

I must mention that I had to refer to libgcc's implementation to
write these functions.

Related unit-tests of compiler-rt passed with these changes.

Patch was somewhat out-dated, so was updated locally without any
functional changes.

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

llvm-svn: 234148

9 years ago[ASan] Do not print thread IDs and stacks for unknown threads.
Alexander Potapenko [Mon, 6 Apr 2015 10:32:45 +0000 (10:32 +0000)]
[ASan] Do not print thread IDs and stacks for unknown threads.

llvm-svn: 234147

9 years agoclang/test/Profile/profile-does-not-exist.c: Avoid checking a message line in the...
NAKAMURA Takumi [Mon, 6 Apr 2015 08:16:36 +0000 (08:16 +0000)]
clang/test/Profile/profile-does-not-exist.c: Avoid checking a message line in the message catalog.

llvm-svn: 234146

9 years agotsan: fix munmap interceptor
Dmitry Vyukov [Mon, 6 Apr 2015 07:57:32 +0000 (07:57 +0000)]
tsan: fix munmap interceptor

MetaMap::ResetRange/FreeRange rounds the range up to at least kMetaShadowSize.
This is requried for e.g. free(malloc(0)). However, munmap returns EINVAL
and do not unmap any memory when length arguments is equal to 0.
So don't free meta shadow in this case as well.

llvm-svn: 234145

9 years ago[AArch64] Fix error in AARCH64_ADR_GOT_PAGE handler
Denis Protivensky [Mon, 6 Apr 2015 07:44:59 +0000 (07:44 +0000)]
[AArch64] Fix error in AARCH64_ADR_GOT_PAGE handler

The error was introduced during mechanical replacement
of raw memory reads/writes to use readxxle/writexxle functions
in r230725.

Noted and fixed by Suprateeka R Hegde <hegdesmailbox@gmail.com>

llvm-svn: 234144

9 years agoThis reverts commit r234104, bringing back 233393 now that ARM is fixed.
Rafael Espindola [Mon, 6 Apr 2015 04:36:45 +0000 (04:36 +0000)]
This reverts commit r234104, bringing back  233393 now that ARM is fixed.

Original message:

Don't use unique section names by default if using the integrated as.

This saves some IO and ccache space by not creating long section names. It
should work with every ELF linker.

llvm-svn: 234143

9 years agoStore the sh_link of ARM_EXIDX directly in MCSectionELF.
Rafael Espindola [Mon, 6 Apr 2015 04:25:18 +0000 (04:25 +0000)]
Store the sh_link of ARM_EXIDX directly in MCSectionELF.

This avoids some pretty horrible and broken name based section handling.

llvm-svn: 234142

9 years agoDon't crash when passing a non-existent file to -fprofile-instr-use=.
Nico Weber [Mon, 6 Apr 2015 04:16:48 +0000 (04:16 +0000)]
Don't crash when passing a non-existent file to -fprofile-instr-use=.

Fixes a regression from r229434.

llvm-svn: 234141

9 years agoSimplify this function a bit. NFC.
Rafael Espindola [Mon, 6 Apr 2015 03:16:51 +0000 (03:16 +0000)]
Simplify this function a bit. NFC.

The case values are not a tidy enum we can fully cover. They even ovelap
over the various extension.

Just use a default:

llvm-svn: 234140

9 years agoSimplify mapping from relocation sections to relocated sections.
Rafael Espindola [Mon, 6 Apr 2015 03:09:30 +0000 (03:09 +0000)]
Simplify mapping from relocation sections to relocated sections.

Just store the section in MCSectionELF. This avoids multiple hash lookups.

This will also be used by ARM_EXIDX.

llvm-svn: 234139

9 years ago[Orc] Tidy up the assembly for the x86-64 resolver block.
Lang Hames [Mon, 6 Apr 2015 03:01:29 +0000 (03:01 +0000)]
[Orc] Tidy up the assembly for the x86-64 resolver block.

llvm-svn: 234138

9 years agoAdd documentation for llgoi, update README
Peter Collingbourne [Sun, 5 Apr 2015 23:32:13 +0000 (23:32 +0000)]
Add documentation for llgoi, update README

llvm-svn: 234137

9 years agoRoll gofrontend to 15a24202fa42.
Peter Collingbourne [Sun, 5 Apr 2015 23:32:10 +0000 (23:32 +0000)]
Roll gofrontend to 15a24202fa42.

Takes us to Go 1.4.2 plus a number of bug fixes.

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

llvm-svn: 234136

9 years agoRoll gofrontend to 07baa07598ea; roll libffi to r219477.
Peter Collingbourne [Sun, 5 Apr 2015 23:31:49 +0000 (23:31 +0000)]
Roll gofrontend to 07baa07598ea; roll libffi to r219477.

Incorporates https://codereview.appspot.com/198770044, which causes us to start
using the static chain register for closures instead of __go_{get,set}_closure.

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

llvm-svn: 234135

9 years agoRoll gofrontend to a6e10414311a
Peter Collingbourne [Sun, 5 Apr 2015 23:30:42 +0000 (23:30 +0000)]
Roll gofrontend to a6e10414311a

This takes us to Go 1.4. Also includes a couple of changes to the test
suite, both in the runtime package:

- Disable TestSetPanicOnFault. We cannot support this scenario at all,
  due to LLVM's lack of non-call exceptions.

- Tweak TestFinalizerType. This test only passes with two GC runs.

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

llvm-svn: 234134