7 years ago[RuntimeDyld] Make sure we emit MachO __eh_frame and __gcc_except_tab sections,
Lang Hames [Wed, 15 Apr 2015 03:39:22 +0000 (03:39 +0000)]
[RuntimeDyld] Make sure we emit MachO __eh_frame and __gcc_except_tab sections,
even if there are no references to them in the code.

This allows exceptions thrown from JIT'd code to be caught by the JIT itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234975 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange range-based for-loop to use const auto&. No functionality change.
Richard Trieu [Wed, 15 Apr 2015 03:17:49 +0000 (03:17 +0000)]
Change range-based for-loop to use const auto&.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234974 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agouselistorder: Remove the global bits
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 03:14:06 +0000 (03:14 +0000)]
uselistorder: Remove the global bits

Remove all the global bits to do with preserving use-list order by
moving the `cl::opt`s to the individual tools that want them.  There's a
minor functionality change to `libLTO`, in that you can't send in
`-preserve-bc-uselistorder=false`, but making that bit settable (if it's
worth doing) should be through explicit LTO API.

As a drive-by fix, I removed some includes of `UseListOrder.h` that were
made unnecessary by recent commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234973 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[bpf] fix build
Alexei Starovoitov [Wed, 15 Apr 2015 02:48:57 +0000 (02:48 +0000)]
[bpf] fix build

fix build due to refactoring in DIL/MDL and raw_pwrite_stream

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234971 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agouselistorder: Pull the bit through PrintModulePass
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 02:38:06 +0000 (02:38 +0000)]
uselistorder: Pull the bit through PrintModulePass

Now the callers of `PrintModulePass()` (etc.) that care about use-list
order in assembly pass in the flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234969 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agouselistorder: Pull the assembly bit up out of the printer
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 02:12:41 +0000 (02:12 +0000)]
uselistorder: Pull the assembly bit up out of the printer

Pull the `-preserve-ll-uselistorder` bit up through all the callers of
`Module::print()`.  I converted callers of `operator<<` to
`Module::print()` where necessary to pull the bit through.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234968 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agouselistorder: Start pulling out -preserve-ll-uselistorder
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 01:36:30 +0000 (01:36 +0000)]
uselistorder: Start pulling out -preserve-ll-uselistorder

For consistency, start pulling out `-preserve-ll-uselistorder`.  I'll
drop the global state for both eventually.  This pulls it up to
`Module::print()` (but not past there).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234966 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange range-based for-loops to be -Wrange-loop-analysis clean.
Richard Trieu [Wed, 15 Apr 2015 01:21:15 +0000 (01:21 +0000)]
Change range-based for-loops to be -Wrange-loop-analysis clean.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234963 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agouselistorder: Pull bit through BitcodeWriterPass
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 00:34:24 +0000 (00:34 +0000)]
uselistorder: Pull bit through BitcodeWriterPass

Now the callers of `BitcodeWriterPass` decide whether or not to preserve
bitcode use-list order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234959 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix build error from r234957
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 00:13:51 +0000 (00:13 +0000)]
Fix build error from r234957

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234958 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agouselistorder: Pull the bit through WriteToBitcodFile()
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 00:10:50 +0000 (00:10 +0000)]
uselistorder: Pull the bit through WriteToBitcodFile()

Change the callers of `WriteToBitcodeFile()` to pass `true` or
`shouldPreserveBitcodeUseListOrder()` explicitly.  I left the callers
that want to send `false` alone.

I'll keep pushing the bit higher until hopefully I can delete the global
`cl::opt` entirely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234957 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agouselistorder: Thread bit through ValueEnumerator
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 23:45:11 +0000 (23:45 +0000)]
uselistorder: Thread bit through ValueEnumerator

Canonicalize access to whether to preserve use-list order in bitcode on
a `bool` stored in `ValueEnumerator`.  Next step, expose this as a
`bool` through `WriteBitcodeToFile()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234956 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse the ability to pwrite to simplify the ELF writer.
Rafael Espindola [Tue, 14 Apr 2015 22:54:16 +0000 (22:54 +0000)]
Use the ability to pwrite to simplify the ELF writer.

Now we don't have to do 2 synchronized passes to compute offsets and then
write the file.

This also includes a fix for the corner case of seeking in /dev/null. It
is not an error, but on some systems (Linux) the returned offset is
always 0. An error is signaled by returning -1. This is checked by
the existing tests now that "clang -o /dev/null ..." seeks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234952 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse raw_pwrite_stream in the object writer/streamer.
Rafael Espindola [Tue, 14 Apr 2015 22:14:34 +0000 (22:14 +0000)]
Use raw_pwrite_stream in the object writer/streamer.

The ELF object writer will take advantage of that in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234950 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WinEH] Avoid emitting xdata tables twice for cleanups
Reid Kleckner [Tue, 14 Apr 2015 21:42:36 +0000 (21:42 +0000)]
[WinEH] Avoid emitting xdata tables twice for cleanups

Since adding invokes of llvm.donothing to cleanups, we come here now,
and trivial EH cleanup usage from clang fails to compile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234948 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCorrect 'teh' and other typos / repeated words.
Ed Maste [Tue, 14 Apr 2015 20:52:58 +0000 (20:52 +0000)]
Correct 'teh' and other typos / repeated words.

Patch by Eitan Adler.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234939 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Inliner] Don't inline functions with frameescape calls
Reid Kleckner [Tue, 14 Apr 2015 20:38:14 +0000 (20:38 +0000)]
[Inliner] Don't inline functions with frameescape calls

Inlining such intrinsics is very difficult, since you need to
simultaneously transform many calls to llvm.framerecover and potentially
duplicate the functions containing them.  Normally this intrinsic isn't
added until EH preparation, which is part of the backend pass pipeline
after inlining.  However, if it were to get fed through the inliner,
this change will ensure that it doesn't break the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234937 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoOnly recalculate DFS Numbers if invalid. Invalidate DFS numbers on reset. Add unit...
Daniel Berlin [Tue, 14 Apr 2015 19:49:26 +0000 (19:49 +0000)]
Only recalculate DFS Numbers if invalid. Invalidate DFS numbers on reset. Add unit test to verify recalculation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234933 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake updateDFSNumbers API public
Daniel Berlin [Tue, 14 Apr 2015 19:09:16 +0000 (19:09 +0000)]
Make updateDFSNumbers API public

There are a number of passes that could be sped up by using dominator tree DFS numbers to order or compare things across multiple bbs
(MemorySSA, MergedLoadStoreMotion, EarlyCSE, Sinking, GVN, NewGVN, for starters :P).

For example, GVN/CSE elimination can be done with a simple stack/etc (instead of full-on scoped hash table or repeated leader set walks)
  if the DFS pair is stored next to leaders.

The dominator tree keeps them, and the DOM tree nodes expose them as public, but you have no guarantee they are up to date (and in fact,
if you split blocks or whatever during your pass, they definitely won't be)

This means passes either have to compute their own versions[1], or make 32 queries, or ....
Rather than try to hide this, i just made the API public, and make it do nothing if the numbers are already valid.

[1] Which we want as a non-recursive walk, which is not pretty, sadly,
because it cannot use the depth first iterators since you don't get called on the way back up. So you either have to do one walk with po_iterator
and one with df_iterator, or write your own non-recursive walk that looks identical to the one in updateDFSNumbers.

Reviewers: chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234930 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoverify-uselistorder: More outs() and errs(), less dbgs()
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 19:04:03 +0000 (19:04 +0000)]
verify-uselistorder: More outs() and errs(), less dbgs()

Change all the normally relevant output in `verify-uselistorder` from
using `dbgs()` to using `outs()` and `errs()`.  Now you don't need
`-debug=uselistorder` to figure out what's going on (or at what stage
verification failed, or to get the paths of the left-behind temporary
files).  This is a debugging tool, so I put the logging messages on
`outs()` and the error messages on `errs()`.

I also adjusted the output to be less ***loud***.  Not sure why I was so
`*`-happy when I first wrote this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234929 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIR: Set -preserve-bc-uselistorder=false by default
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 18:33:00 +0000 (18:33 +0000)]
IR: Set -preserve-bc-uselistorder=false by default

But keep it on by default in `llvm-as`, `opt`, `bugpoint`, `llvm-link`,
`llvm-extract`, and `LTOCodeGenerator`.  Part of PR5680.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234921 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIR: Rename 'use-list-order' options to 'uselistorder'
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 18:19:27 +0000 (18:19 +0000)]
IR: Rename 'use-list-order' options to 'uselistorder'

Rename options to be consistent with the name of `verify-uselistorder`,
and update `DEBUG_TYPE` (etc.) to be consistent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234919 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd ladder graph utility
Daniel Berlin [Tue, 14 Apr 2015 18:14:38 +0000 (18:14 +0000)]
Add ladder graph utility

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234917 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Pubnames: Do not include variable declarations in pubnames
David Blaikie [Tue, 14 Apr 2015 18:08:25 +0000 (18:08 +0000)]
DebugInfo: Pubnames: Do not include variable declarations in pubnames

This causes badness for GDB which expects to find a definition in any
compile_unit that has an entry for the variable in its pubnames.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234915 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate test case to include the original source code & account for some changes in...
David Blaikie [Tue, 14 Apr 2015 17:17:04 +0000 (17:17 +0000)]
Update test case to include the original source code & account for some changes in clang's order of emission

I'd added some stuff to this test case without adding the original
source, which makes updating/adding further stuff rather difficult. So
update it first (& it seems in the interim Clang's changed its output
order a bit, so adjust the CHECK lines to account for that - rather than
hand hacking the IR order which just makes it harder to maintain/change
next time)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234911 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RuntimeDyld] Make SectionEntry's Name field a std::string.
Lang Hames [Tue, 14 Apr 2015 17:13:10 +0000 (17:13 +0000)]
[RuntimeDyld] Make SectionEntry's Name field a std::string.

StringRef is unsafe here, since SectionEntry instances can outlive the
ObjectFile instances they are created from.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234910 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Orc] Reapply r234815, outputting via stdout instead.
Lang Hames [Tue, 14 Apr 2015 16:58:05 +0000 (16:58 +0000)]
[Orc] Reapply r234815, outputting via stdout instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234908 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[msvc] Strip /W[0-4] before appending /W4
Zachary Turner [Tue, 14 Apr 2015 16:57:54 +0000 (16:57 +0000)]
[msvc] Strip /W[0-4] before appending /W4

Certain versions of CMake specify /W3 as part of CMAKE_CXX_FLAGS
by default, before you do anything.  Appending /W4 to the end of
this and using the Ninja generator results in

cl : Command line warning D9025 : overriding '/W3' with '/W4'.

It is not possible to suppress this since it is a command line
warning and not a compiler warning, so we must fix the command
line to contain only one value for /Wn.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234907 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Add implicit conversion from DISubprogram to DIScope
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 16:19:44 +0000 (16:19 +0000)]
DebugInfo: Add implicit conversion from DISubprogram to DIScope

As a follow-up to r234850, add an implicit conversion from
`DISubprogram` to `DIScope` to support Kaleidoscope Ch. 8.  This also
reverts that band-aid from r234890.

(/me learns *again* to build Kaleidoscope before commit...)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234904 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "The code that originally made me discover this is:"
Rafael Espindola [Tue, 14 Apr 2015 15:56:33 +0000 (15:56 +0000)]
Revert "The code that originally made me discover this is:"

This reverts commit r234898.
CodeGen/ARM/2013-10-11-select-stalls.ll was faling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234903 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove RefreshCallGraph to remove invalid call graph edge.
Chad Rosier [Tue, 14 Apr 2015 15:52:57 +0000 (15:52 +0000)]
Improve RefreshCallGraph to remove invalid call graph edge.

With commit r219944, InstCombine can now turn a sqrtl into a llvm.fabs.f64.
The call graph edge originally representing the call to sqrtl becomes invalid.
This patch modifies CGPassManager::RefreshCallGraph() to remove the invalid
call graph edge, which can triggers an assert in

Phabricator Review: http://reviews.llvm.org/D7705
Patch by Lawrence Hu <lawrence@codeaurora.org>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234902 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRefactor: Simplify boolean expressions in ARM target
Alexander Kornienko [Tue, 14 Apr 2015 15:32:58 +0000 (15:32 +0000)]
Refactor: Simplify boolean expressions in ARM target

Simplify boolean expressions using `true` and `false` with `clang-tidy`


Patch by Richard Thomson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234901 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange the testcase mtriple to x86_64-unknown-unknown
Krzysztof Parzyszek [Tue, 14 Apr 2015 15:28:42 +0000 (15:28 +0000)]
Change the testcase mtriple to x86_64-unknown-unknown

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234900 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix MSVC build.
Rafael Espindola [Tue, 14 Apr 2015 15:25:14 +0000 (15:25 +0000)]
Fix MSVC build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234899 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoThe code that originally made me discover this is:
Daniel Jasper [Tue, 14 Apr 2015 15:20:37 +0000 (15:20 +0000)]
The code that originally made me discover this is:

  if ((a & 0x1) == 0x1) {

In this case we don't actually have any branch probability information and
should not assume to have any. LLVM transforms this into:

  %and = and i32 %a, 1
  %tobool = icmp eq i32 %and, 0

So, in this case, the result of a bitwise and is compared against 0,
but nevertheless, we should not assume to have probability

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234898 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Allow non-standard INS/DUP encodings
Bradley Smith [Tue, 14 Apr 2015 15:07:26 +0000 (15:07 +0000)]
[AArch64] Allow non-standard INS/DUP encodings

The ARMv8 ARMARM states that for these instructions in A64 state:

  "Unspecified bits in "imm5" are ignored but should be set to zero by an assembler.", (imm4 for INS).

Make the disassembler accept any encoding with these ignored bits set to 1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234896 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd raw_pwrite_stream type.
Rafael Espindola [Tue, 14 Apr 2015 15:00:34 +0000 (15:00 +0000)]
Add raw_pwrite_stream type.

This is a raw_ostream that also supports pwrite.
I will be used in a sec.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234895 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoR600/SI: Fix verifier error caused by SIAnnotateControlFlow
Tom Stellard [Tue, 14 Apr 2015 14:36:45 +0000 (14:36 +0000)]
R600/SI: Fix verifier error caused by SIAnnotateControlFlow

This pass will always try to insert llvm.SI.ifbreak intrinsics
in the same block that its conditional value is computed in.  This is
a problem when conditions for breaks or continue are computed outside
of the loop, because the llvm.SI.ifbreak intrinsic ends up being inserted
outside of the loop.

This patch fixes this problem by inserting the llvm.SI.ifbreak
intrinsics in the loop header when the condition is computed outside
the loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234891 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFixing a compile error with MSVC 2013 where there is no conversion from DISubprogram...
Aaron Ballman [Tue, 14 Apr 2015 14:19:09 +0000 (14:19 +0000)]
Fixing a compile error with MSVC 2013 where there is no conversion from DISubprogram to DIScope directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234890 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoError out of ParseBitcodeInto(Module*) if we haven't read a Module
Filipe Cabecinhas [Tue, 14 Apr 2015 14:07:15 +0000 (14:07 +0000)]
Error out of ParseBitcodeInto(Module*) if we haven't read a Module

Without this check the following case failed:

Skip a SubBlock which is not a MODULE_BLOCK_ID nor a BLOCKINFO_BLOCK_ID
Got to end of file

TheModule would still be == nullptr, and we would subsequentially fail
when materializing the Module (assert at the start of

Bug found with AFL.

Reviewers: dexonsmith, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234887 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSilencing a -Wreturn-type warning, as the switch is fully-covered; NFC.
Aaron Ballman [Tue, 14 Apr 2015 13:26:11 +0000 (13:26 +0000)]
Silencing a -Wreturn-type warning, as the switch is fully-covered; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234884 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-enable target-specific relocation table sorting and use it for Mips
Petar Jovanovic [Tue, 14 Apr 2015 13:23:34 +0000 (13:23 +0000)]
Re-enable target-specific relocation table sorting and use it for Mips

Some targets (ie. Mips) have additional rules for ordering the relocation
table entries. Allow them to override generic sortRelocs(), which sorts
entries by Offset.
Then override this function for Mips, to emit HI16 and GOT16 relocations
against the local symbol in pair with the corresponding LO16 relocation.

Patch by Vladimir Stefanovic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234883 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MachineLICM] Use newer model of register pressure sets.
Daniel Jasper [Tue, 14 Apr 2015 11:56:25 +0000 (11:56 +0000)]
[MachineLICM] Use newer model of register pressure sets.

TargetRegisterInfo::getRegPressureLimit has a note that it is an old
model that relies on manually entered classes. Using the newer model of
register pressure sets seems more appropriate. We might eventually even
switch to lib/CodeGen/RegisterPressure.cpp, but we should probably do
incremental changes here.

Using the newer model also makes it easier to take regmasks into account
which is necessary to fix llvm.org/PR23143. I am currently also
preparing a patch for that, but would like to do this switch

Review: http://reviews.llvm.org/D8986

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234880 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRoll back llvm/test/ExecutionEngine/MCJIT/cross-module-sm-pic-a.ll, possibly wrong...
NAKAMURA Takumi [Tue, 14 Apr 2015 10:54:14 +0000 (10:54 +0000)]
Roll back llvm/test/ExecutionEngine/MCJIT/cross-module-sm-pic-a.ll, possibly wrong commit.

It reverts part of r234839, "[RuntimeDyldELF] Improve GOT support".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234879 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix crash in DebugInfoFinder when adding a module with forward declared composite...
Anders Waldenborg [Tue, 14 Apr 2015 09:18:17 +0000 (09:18 +0000)]
Fix crash in DebugInfoFinder when adding a module with forward declared composite type

The testcase that is included in the patch caused a crash when doing DebugInfoFinder::processModule
on the module due to DCT->getElements() returning nullptr in DebugInfoFinder::processType.

By doing "DCT->getElements()" instead of "DCT->getElements()->operands()" one gets a DIArray
instead of a raw MDTuple. The former has code to handle null as a 0-element array and
therefore avoids the crash.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234875 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify n-ary adds by reassociation
Jingyue Wu [Tue, 14 Apr 2015 04:59:22 +0000 (04:59 +0000)]
Simplify n-ary adds by reassociation

This transformation reassociates a n-ary add so that the add can partially reuse
existing instructions. For example, this pass can simplify

  void foo(int a, int b) {
    bar(a + b);
    bar((a + 2) + b);


  void foo(int a, int b) {
    int t = a + b;
    bar(t + 2);

saving one add instruction.

Fixes PR22357 (https://llvm.org/bugs/show_bug.cgi?id=22357).

Test Plan: nary-add.ll

Reviewers: broune, dberlin, hfinkel, meheff, sanjoy, atrick

Reviewed By: sanjoy, atrick

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234855 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Update signature of DICompileUnit::replace*()
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 03:51:36 +0000 (03:51 +0000)]
DebugInfo: Update signature of DICompileUnit::replace*()

Change `DICompileUnit::replaceSubprograms()` and
`DICompileUnit::replaceGlobalVariables()` to match the `MDCompileUnit`
equivalents that they're wrapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234852 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLinkAllPasses.h: also link in parts of libLLVMSupport
Dmitri Gribenko [Tue, 14 Apr 2015 03:49:53 +0000 (03:49 +0000)]
LinkAllPasses.h: also link in parts of libLLVMSupport

When a loadable (.so or .dylib) pass is built with assertions enabled and
loaded into the 'opt' tool, we need to ensure that the extra symbols that such
passes depend on are linked into the tool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234851 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Gut DISubprogram and DILexicalBlock*
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 03:40:37 +0000 (03:40 +0000)]
DebugInfo: Gut DISubprogram and DILexicalBlock*

Gut the `DIDescriptor` wrappers around `MDLocalScope` subclasses.  Note
that `DILexicalBlock` wraps `MDLexicalBlockBase`, not `MDLexicalBlock`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234850 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEVExpander] Fix comments for functions. NFC.
Sanjoy Das [Tue, 14 Apr 2015 03:20:40 +0000 (03:20 +0000)]
[SCEVExpander] Fix comments for functions. NFC.

Bring function documentation for ScalarEvolutionExpander up to code by
not repeating the function name in the comment documenting
functionality.  Reflow the edited comments where needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234847 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopUnrollRuntime] Avoid high-cost trip count computation.
Sanjoy Das [Tue, 14 Apr 2015 03:20:38 +0000 (03:20 +0000)]
[LoopUnrollRuntime] Avoid high-cost trip count computation.

Runtime unrolling of loops needs to emit an expression to compute the
loop's runtime trip-count.  Avoid runtime unrolling if this computation
will be expensive.

Depends on D8993.

Reviewers: atrick

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234846 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEV] Strengthen SCEVExpander::isHighCostExpansion.
Sanjoy Das [Tue, 14 Apr 2015 03:20:32 +0000 (03:20 +0000)]
[SCEV] Strengthen SCEVExpander::isHighCostExpansion.


Teach `isHighCostExpansion` to consider divisions by power-of-two
constants as cheap and add a test case.  This change is needed for a new
user of `isHighCostExpansion` that will be added in a subsequent change.

Depends on D8995.

Reviewers: atrick

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234845 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEV] Refactor out isHighCostExpansion. NFCI.
Sanjoy Das [Tue, 14 Apr 2015 03:20:28 +0000 (03:20 +0000)]
[SCEV] Refactor out isHighCostExpansion. NFCI.

Move isHighCostExpansion from IndVarSimplify to SCEVExpander.  This
exposed function will be used in a subsequent change.

Reviewers: bogner, atrick

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234844 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Gut DINamespace and DITemplate*Parameter
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 03:01:27 +0000 (03:01 +0000)]
DebugInfo: Gut DINamespace and DITemplate*Parameter

Continue gutting `DIDescriptor` subclasses, turning them into
as-bare-as-possible pointer wrappers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234843 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Add MDLexicalBlockBase::getLine(), etc.
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 02:50:07 +0000 (02:50 +0000)]
DebugInfo: Add MDLexicalBlockBase::getLine(), etc.

Add a few functions from `DILexicalBlock` to `MDLexicalBlockBase`,
leaving `DILexicalBlock` a simple wrapper.

IMO, the new functions (`getLine()` and `getColumn()`) don't really
belong in the base class, but to simplify transitioning old code it
seems like the right incremental step.  I've explicitly deleted them in
`MDLexicalBlockFile`, and eventually the callers should be updated to
downcast to `MDLexicalBlock` directly and the forwarding functions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234842 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Gut DIVariable and DIGlobalVariable
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 02:22:36 +0000 (02:22 +0000)]
DebugInfo: Gut DIVariable and DIGlobalVariable

Gut all the non-pointer API from the variable wrappers, except an
implicit conversion from `DIGlobalVariable` to `DIDescriptor`.  Note
that if you're updating out-of-tree code, `DIVariable` wraps
`MDLocalVariable` (`MDVariable` is a common base class shared with

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234840 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RuntimeDyldELF] Improve GOT support
Keno Fischer [Tue, 14 Apr 2015 02:10:35 +0000 (02:10 +0000)]
[RuntimeDyldELF] Improve GOT support

This is the first in a series of patches to eventually add support for TLS relocations to RuntimeDyld. This patch resolves an issue in the current GOT handling, where GOT entries would be reused between object files, which leads to the same situation that necessitates the GOT in the first place, i.e. that the 32-bit offset can not cover all of the address space. Thus this patch makes the GOT object-file-local.
Unfortunately, this still isn't quite enough, because the MemoryManager does not yet guarantee that sections are allocated sufficiently close to each other, even if they belong to the same object file. To address this concern, this patch also adds a small API abstraction on top of the GOT allocation mechanism that will allow (temporarily, until the MemoryManager is improved) using the stub mechanism instead of allocating a different section. The actual switch from separate section to stub mechanism will be part of a follow-on commit, so that it can be easily reverted independently at the appropriate time.

Test Plan: Includes a test case where the GOT of two object files is artificially forced to be apart by several GB.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234839 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Move DIVariable::printExtendedName() to its only caller
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 02:09:32 +0000 (02:09 +0000)]
DebugInfo: Move DIVariable::printExtendedName() to its only caller

Move the local function `printDebugLoc()` along with it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234838 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Inline DIVariable::isBlockByrefVariable() into its callers
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 01:59:58 +0000 (01:59 +0000)]
DebugInfo: Inline DIVariable::isBlockByrefVariable() into its callers

I don't think this API is helping much.  Change the callers to call
`MDType::isBlockByrefStruct()` directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234837 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Gut DIObjCProperty and DIImportedEntity
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 01:46:44 +0000 (01:46 +0000)]
DebugInfo: Gut DIObjCProperty and DIImportedEntity

Gut a couple more classes in the DIDescriptor hierarchy.  Leave behind
an implicit conversion to `DIDescriptor`, the old base class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234836 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Gut DILocation
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 01:35:55 +0000 (01:35 +0000)]
DebugInfo: Gut DILocation

This is along the same lines as r234832, but for `DILocation`.  Clean
out all accessors from `DILocation`.  Any callers should be using
`MDLocation` directly (e.g., via `operator->()`).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234835 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopAccesses] Properly print whether memchecks are needed
Adam Nemet [Tue, 14 Apr 2015 01:12:55 +0000 (01:12 +0000)]
[LoopAccesses] Properly print whether memchecks are needed

Fix oversight in -analyze output.  PtrRtCheck contains the pointers that
need to be checked against each other and not whether memchecks are

For instance in the testcase PtrRtCheck has four elements but all
no-alias so no checking is necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234833 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Gut DIExpression
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 01:12:42 +0000 (01:12 +0000)]
DebugInfo: Gut DIExpression

Completely gut `DIExpression`, turning it into a simple wrapper around
`MDExpression *`.  There are two bits of magic left:

  - It's constructed from `const MDExpression*` but convertible to
  - It's default-constructed to `nullptr`.

Otherwise, it should behave quite like a raw pointer.  Once I've done
the same to the rest of the `DIDescriptor` subclasses, I'll come back to
delete them entirely (and update call sites as necessary to deal with
the missing magic).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234832 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Move an assertion into MDCompositeTypeBase
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 00:57:50 +0000 (00:57 +0000)]
DebugInfo: Move an assertion into MDCompositeTypeBase

In the name of gutting the `DIDescriptor` hierarchy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234829 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RewriteStatepointsForGC] Delete dead code [NFC]
Philip Reames [Tue, 14 Apr 2015 00:41:34 +0000 (00:41 +0000)]
[RewriteStatepointsForGC] Delete dead code [NFC]

Before we had real liveness, we needed to track every value that base pointer
insertion code created because these now might be live.  We now just rerun
the data flow liveness algorithm (which is actually faster!) and no longer
need the associated code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234827 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Move DILocation::computeNewDiscriminators()
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 00:35:42 +0000 (00:35 +0000)]
DebugInfo: Move DILocation::computeNewDiscriminators()

As documented in PR23200 (and the FIXMEs I've added to the code here),
this logic is fairly broken: it modifies the `LLVMContext` in a way that
affects other modules and cannot be serialized to assembly/bitcode.  For
now, move it over to `MDLocation::computeNewDiscriminators()` anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234825 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAddDiscriminators: Create new MDLocation directly
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 00:34:30 +0000 (00:34 +0000)]
AddDiscriminators: Create new MDLocation directly

I don't see a reason to add the `copyWithNewScope()` API over to
`MDLocation` -- it seems to be a holdover from when creating locations
required knowing details of operand layout -- so change
`AddDiscriminators` to call `MDLocation::get()` directly.  Should be no
functionality change here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234824 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Orc] Revert 234815. Still haven't quite got this test figured out apparently.
Lang Hames [Tue, 14 Apr 2015 00:27:47 +0000 (00:27 +0000)]
[Orc] Revert 234815. Still haven't quite got this test figured out apparently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234822 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Move DILocation::getDiscriminator() to MDLocation
Duncan P. N. Exon Smith [Tue, 14 Apr 2015 00:05:13 +0000 (00:05 +0000)]
DebugInfo: Move DILocation::getDiscriminator() to MDLocation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234819 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Remove DIObjCProperty attribute accessors, NFC
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 23:55:01 +0000 (23:55 +0000)]
DebugInfo: Remove DIObjCProperty attribute accessors, NFC

There's only one user of the various `DIObjCProperty::is*Property()`
accessors -- `DwarfUnit::constructTypeDIE()` -- and it's just using the
reverse logic to reconstruct the bitfield.  Drop this API and simplify
the only caller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234818 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Move DIDerivedType accessors to MDDerivedType, NFC
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 23:36:36 +0000 (23:36 +0000)]
DebugInfo: Move DIDerivedType accessors to MDDerivedType, NFC

Add accessors in `MDDerivedType` to downcast `getExtraData()`, matching
those in `DIDerivedType`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234816 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Orc] Make the OrcLazy hello.ll regression test output via stderr.
Lang Hames [Mon, 13 Apr 2015 23:28:46 +0000 (23:28 +0000)]
[Orc] Make the OrcLazy hello.ll regression test output via stderr.

This keeps the program and JIT output in sync, enabling FileCheck to test the
order of target program and JIT events.

In particular we can now test that main is not compiled until after the global
constructor has run.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234815 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd new getModRefInfo API to determine whether an Instruction and a call modify the...
Daniel Berlin [Mon, 13 Apr 2015 23:25:41 +0000 (23:25 +0000)]
Add new getModRefInfo API to determine whether an Instruction and a call modify the same memory

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234814 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCommon some code from MemoryDependenceAnalysis that will be used in MemorySSA
Daniel Berlin [Mon, 13 Apr 2015 23:20:13 +0000 (23:20 +0000)]
Common some code from MemoryDependenceAnalysis that will be used in MemorySSA

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234813 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Make DIDerivedType accessors more strict
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 23:13:18 +0000 (23:13 +0000)]
DebugInfo: Make DIDerivedType accessors more strict

These accessors in `DIDerivedType` should only be called when `DbgNode`
really is a `MDDerivedType`, not just a `MDDerivedTypeBase`.  Assume
that it is.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234812 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake getModRefInfo with a default location not crash.
Daniel Berlin [Mon, 13 Apr 2015 23:05:45 +0000 (23:05 +0000)]
Make getModRefInfo with a default location not crash.
Add getModRefInfo that works without location.
Add unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234811 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Orc] Back out r234805 for hello.ll until I can figure out how to sync up the
Lang Hames [Mon, 13 Apr 2015 22:58:39 +0000 (22:58 +0000)]
[Orc] Back out r234805 for hello.ll until I can figure out how to sync up the

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234810 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen] Combine concat_vectors of scalars into build_vector.
Ahmed Bougacha [Mon, 13 Apr 2015 22:57:21 +0000 (22:57 +0000)]
[CodeGen] Combine concat_vectors of scalars into build_vector.

Combine something like:
  (v8i8 concat_vectors (v2i8 bitcast (i16)) x4)
  (v8i8 (bitcast (v4i16 BUILD_VECTOR (i16) x4)))

If any of the scalars are floating point, use that throughout.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234809 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAllow printing functions with an optional annotationwriter
Daniel Berlin [Mon, 13 Apr 2015 22:36:38 +0000 (22:36 +0000)]
Allow printing functions with an optional annotationwriter

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234807 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Orc] Disambiguate call to make_unique. This should fix the builders broken by
Lang Hames [Mon, 13 Apr 2015 22:33:05 +0000 (22:33 +0000)]
[Orc] Disambiguate call to make_unique. This should fix the builders broken by

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234806 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Orc] Add an Orc layer for applying arbitrary transforms to IR, use it to add
Lang Hames [Mon, 13 Apr 2015 22:12:54 +0000 (22:12 +0000)]
[Orc] Add an Orc layer for applying arbitrary transforms to IR, use it to add
debugging output to the LLI orc-lazy JIT, and update the orc-lazy "hello.ll"
test to actually test for lazy compilation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234805 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Simplify a few more wrappers
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 21:58:26 +0000 (21:58 +0000)]
DebugInfo: Simplify a few more wrappers

This is almost NFC, but I'm removing some assertions against `nullptr`.
The assertions aren't worth all that much since we'll typically get
segfaults at the same site (and I imagine ASan catches this sort of
thing), and besides: the whole idea is to replace the `DIDescriptor`
hierarchy with raw pointers to the new one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234802 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSettle on a specific triple for the aarch64 testcase
Krzysztof Parzyszek [Mon, 13 Apr 2015 21:55:21 +0000 (21:55 +0000)]
Settle on a specific triple for the aarch64 testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234801 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSelectionDAG: Stop using DIVariable::isInlinedFnArgument()
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 21:38:48 +0000 (21:38 +0000)]
SelectionDAG: Stop using DIVariable::isInlinedFnArgument()

Instead of calling the somewhat confusingly-named
`DIVariable::isInlinedFnArgument()`, do the check directly here.
There's possibly a small functionality change here: instead of
`dyn_cast<>`'ing `DV->getScope()` to `MDSubprogram`, I'm looking up the
scope chain for the actual subprogram.  I suspect that this is a no-op
for function arguments so in practise there isn't a real difference.

I've also added a `FIXME` to check the `inlinedAt:` chain instead, since
I wonder if that would be more reliable than the
`MDSubprogram::describes()` function.

Since this was the only user of `DIVariable::isInlinedFnArgument()`,
delete it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234799 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Updates to llvm-shlib to support overriding exports list and added an option...
Chris Bieneman [Mon, 13 Apr 2015 21:29:46 +0000 (21:29 +0000)]
[CMake] Updates to llvm-shlib to support overriding exports list and added an option to export all symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234798 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAlso add mtriple to the aarch64 testcase
Krzysztof Parzyszek [Mon, 13 Apr 2015 20:49:08 +0000 (20:49 +0000)]
Also add mtriple to the aarch64 testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234797 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Remove DIGlobalVariable::getGlobal()
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 20:39:25 +0000 (20:39 +0000)]
DebugInfo: Remove DIGlobalVariable::getGlobal()

`DIGlobalVariable::getGlobal()` isn't really helpful, it just does a
`dyn_cast_or_null<>`.  Simplify its only user by doing the cast directly
and delete the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234796 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoExpand ADDO/SUBO on Hexagon
Krzysztof Parzyszek [Mon, 13 Apr 2015 20:37:01 +0000 (20:37 +0000)]
Expand ADDO/SUBO on Hexagon

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234795 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd mtriple to test case to avoid problems with different naming schemes
Krzysztof Parzyszek [Mon, 13 Apr 2015 20:24:40 +0000 (20:24 +0000)]
Add mtriple to test case to avoid problems with different naming schemes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234793 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStripSymbols: Use DIGlobalVariable::getConstant() instead of getGlobal()
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 20:13:30 +0000 (20:13 +0000)]
StripSymbols: Use DIGlobalVariable::getConstant() instead of getGlobal()

The only difference between the two is a `dyn_cast<>` to
`GlobalVariable`.  If optimizations have left anything behind when a
global gets replaced, then it doesn't seem like the debug info is dead.

I can't seem to find an optimization that would leave behind a
non-`GlobalVariable` without nulling the reference entirely, so I
haven't added a testcase (but I'll be deleting `getGlobal()` in a future

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234792 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGCC complains thusly: "attributes at the beginning of statement are ignored [-Werror...
Nick Lewycky [Mon, 13 Apr 2015 20:03:08 +0000 (20:03 +0000)]
GCC complains thusly: "attributes at the beginning of statement are ignored [-Werror=attributes]". Very well then! NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234788 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RwriteStatepointsForGC] Minor indentation and naming [NFC]
Philip Reames [Mon, 13 Apr 2015 20:00:30 +0000 (20:00 +0000)]
[RwriteStatepointsForGC] Minor indentation and naming [NFC]

Use early-return style that's preferred in LLVM and updating the naming in places I touched with other changes in the last few days.  Hopefully, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234785 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Remove a few unnecessary wrappers
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 19:44:31 +0000 (19:44 +0000)]
DebugInfo: Remove a few unnecessary wrappers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234783 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Assume valid pointer in DISubprogram::replaceFunction()
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 19:41:30 +0000 (19:41 +0000)]
DebugInfo: Assume valid pointer in DISubprogram::replaceFunction()

Other accessors assume this already; not sure how `replaceFunction()`
got left behind.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234782 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSubtraction is not commutative. Fixes PR23212!
Nick Lewycky [Mon, 13 Apr 2015 19:17:37 +0000 (19:17 +0000)]
Subtraction is not commutative. Fixes PR23212!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234780 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RewriteStatepointsForGC] Avoid inserting empty holder
Philip Reames [Mon, 13 Apr 2015 19:07:47 +0000 (19:07 +0000)]
[RewriteStatepointsForGC] Avoid inserting empty holder

We use dummy calls to adjust the liveness of values over statepoints in the midst of the insertion.  If there are no values which need held live, there's no point in actually inserting the holder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234779 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Migrate DISubprogram::describes() to new hierarchy, NFC
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 19:07:27 +0000 (19:07 +0000)]
DebugInfo: Migrate DISubprogram::describes() to new hierarchy, NFC

I don't really like this function at all -- I think it should be as
simple as `return getFunction() == F` -- but for now this seems like the
best we can do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234778 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove this test until I figure out why it fails
Krzysztof Parzyszek [Mon, 13 Apr 2015 18:57:50 +0000 (18:57 +0000)]
Remove this test until I figure out why it fails

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234777 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReapply "Verifier: Check for incompatible bit piece expressions"
Duncan P. N. Exon Smith [Mon, 13 Apr 2015 18:53:11 +0000 (18:53 +0000)]
Reapply "Verifier: Check for incompatible bit piece expressions"

This reverts commit r234717, reapplying r234698 (in spirit).

As described in r234717, the original `Verifier` check had a
use-after-free.  Instead of storing pointers to "interesting" debug info
intrinsics whose bit piece expressions should be verified once we have
typerefs, do a second traversal.  I've added a testcase to catch the
`llc` crasher.

Original commit message:

    Verifier: Check for incompatible bit piece expressions

    Convert an assertion into a `Verifier` check.  Bit piece expressions
    must fit inside the variable, and mustn't be the entire variable.
    Catching this in the verifier will help us find bugs sooner, and makes
    `DIVariable::getSizeInBits()` dead code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234776 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse FileCheck for test
Matthias Braun [Mon, 13 Apr 2015 18:47:19 +0000 (18:47 +0000)]
Use FileCheck for test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234774 91177308-0d34-0410-b5e6-96231b3b80d8