oota-llvm.git
9 years agoDebugInfo: Gut DIScope, DIEnumerator and DISubrange
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:37:00 +0000 (01:37 +0000)]
DebugInfo: Gut DIScope, DIEnumerator and DISubrange

The only class the still has API left is `DIDescriptor` itself.

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

9 years agoDebugInfo: Gut DIType and subclasses
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:01:28 +0000 (01:01 +0000)]
DebugInfo: Gut DIType and subclasses

Continuing PR23080, gut `DIType` and its various subclasses, leaving
behind thin wrappers around the pointer types in the new debug info
hierarchy.

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

9 years agoRevert r234809 because it caused PR23246.
Nick Lewycky [Thu, 16 Apr 2015 00:56:20 +0000 (00:56 +0000)]
Revert r234809 because it caused PR23246.

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

9 years ago[SEH] Deal with users of the old lpad for SEH catch-all blocks
Reid Kleckner [Thu, 16 Apr 2015 00:02:04 +0000 (00:02 +0000)]
[SEH] Deal with users of the old lpad for SEH catch-all blocks

The way we split SEH catch-all blocks can leave some dead EH values
behind at -O0. Try to remove them, and if we fail, replace them all with
undef.

Fixes a crash when removing the old unreachable landingpad which is
still used by extractvalue instructions in the catch-all block.

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

9 years ago[RuntimeDyldELF] Fold Placeholder into Addend
Keno Fischer [Wed, 15 Apr 2015 23:49:29 +0000 (23:49 +0000)]
[RuntimeDyldELF] Fold Placeholder into Addend

Summary:

This allows us to get rid of the original unrelocated object file after
we're done processing relocations (but before applying them).
MachO and COFF already do not require this (currently we have temporary hacks
to prevent ownership from being released, but those are brittle and should be
removed soon).

The placeholder mechanism allowed the relocation resolver to look at original
object file to obtain more information that are required to apply the
relocations. This is usually necessary in two cases:

- For relocations targetting sub-word memory locations, there may be pieces
  of the instruction at the target address which we should not override.
- Some relocations on some platforms allow an extra addend to be encoded in
  their immediate fields.

The problem is that in the second case the information cannot be recovered
after the relocations have been applied once because they will have been
overridden. In the first case we also need to be careful to not use any bits
that aren't fixed and may have been overriden by applying a first relocation.

In the past both have been fixed by just looking at original object file. This
patch attempts to recover the information from the first by looking at the
relocated object file, while the extra addend in the second case is read
upon relocation processing and addend to the regular addend.

I have tested this on X86. Other platforms represent my best understanding
of how those relocations should work, but I may have missed something because
I do not have access to those platforms.
We will keep the ugly workarounds in place for a couple of days, so this commit
can be reverted if it breaks the bots.

Reviewers: petarj, t.p.northover, lhames

Reviewed By: lhames

Subscribers: aemerson, llvm-commits

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

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

9 years agoDebugInfo: Remove unnecessary API from DIDerivedType and DIType
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:49:09 +0000 (23:49 +0000)]
DebugInfo: Remove unnecessary API from DIDerivedType and DIType

Remove the accessors of `DIDerivedType` that downcast to
`MDDerivedType`, shifting the `cast<MDDerivedType>` into the callers.
Also remove `DIType::isValid()`, which is really just a check against
`nullptr` at this point.

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

9 years agoDebugInfo: Gut DICompileUnit and DIFile
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:19:27 +0000 (23:19 +0000)]
DebugInfo: Gut DICompileUnit and DIFile

Continuing gutting `DIDescriptor` subclasses; this edition,
`DICompileUnit` and `DIFile`.  In the name of PR23080.

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

9 years agoDebugInfo: factor out dead variable in NDEBUG from r235050
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 22:42:43 +0000 (22:42 +0000)]
DebugInfo: factor out dead variable in NDEBUG from r235050

Caught by the lld bot:

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/9832

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

9 years agoDebugInfo: Remove 'inlinedAt:' field from MDLocalVariable
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 22:29:27 +0000 (22:29 +0000)]
DebugInfo: Remove 'inlinedAt:' field from MDLocalVariable

Remove 'inlinedAt:' from MDLocalVariable.  Besides saving some memory
(variables with it seem to be single largest `Metadata` contributer to
memory usage right now in -g -flto builds), this stops optimization and
backend passes from having to change local variables.

The 'inlinedAt:' field was used by the backend in two ways:

 1. To tell the backend whether and into what a variable was inlined.
 2. To create a unique id for each inlined variable.

Instead, rely on the 'inlinedAt:' field of the intrinsic's `!dbg`
attachment, and change the DWARF backend to use a typedef called
`InlinedVariable` which is `std::pair<MDLocalVariable*, MDLocation*>`.
This `DebugLoc` is already passed reliably through the backend (as
verified by r234021).

This commit removes the check from r234021, but I added a new check
(that will survive) in r235048, and changed the `DIBuilder` API in
r235041 to require a `!dbg` attachment whose 'scope:` is in the same
`MDSubprogram` as the variable's.

If this breaks your out-of-tree testcases, perhaps the script I used
(mdlocalvariable-drop-inlinedat.sh) will help; I'll attach it to PR22778
in a moment.

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

9 years agoVerifier: Check that @llvm.dbg.* intrinsics have a !dbg attachment
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 22:15:46 +0000 (22:15 +0000)]
Verifier: Check that @llvm.dbg.* intrinsics have a !dbg attachment

Before we start to rely on valid `!dbg` attachments, add a check to the
verifier that `@llvm.dbg.*` intrinsics always have one.  Also check that
the `scope:` fields point at the same `MDSubprogram`.

This is in the context of PR22778.  The check that the `inlinedAt:`
fields agree has baked for a while (since r234021), so I'll kill [1] the
`MDLocalVariable::getInlinedAt()` field soon.

[1]: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150330/269387.html

Unfortunately, that means it's impossible to keep the current `Verifier`
checks, which rely on comparing `inlinedAt:` fields.  We'll be able to
keep the checks I'm adding here.

If this breaks your out-of-tree testcases, the upgrade script
(add-dbg-to-intrinsics.sh) attached to PR22778 that I used for r235040
might fix them for you.

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

9 years agoOne more -Wrange-loop-analysis cleanup.
Richard Trieu [Wed, 15 Apr 2015 21:40:50 +0000 (21:40 +0000)]
One more -Wrange-loop-analysis cleanup.

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

9 years ago[RuntimeDyld] Work around a bug in RuntimeDyldELF exposed by r234839.
Lang Hames [Wed, 15 Apr 2015 21:18:41 +0000 (21:18 +0000)]
[RuntimeDyld] Work around a bug in RuntimeDyldELF exposed by r234839.

Hopefully this will fix the failures on the windows builders that started with
r234839.

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

9 years agoDebugInfo: Require a DebugLoc in DIBuilder::insertDeclare()
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 21:18:07 +0000 (21:18 +0000)]
DebugInfo: Require a DebugLoc in DIBuilder::insertDeclare()

Change `DIBuilder::insertDeclare()` and `insertDbgValueIntrinsic()` to
take an `MDLocation*`/`DebugLoc` parameter which it attaches to the
created intrinsic.  Assert at creation time that the `scope:` field's
subprogram matches the variable's.  There's a matching `clang` commit to
use the API.

The context for this is PR22778, which is removing the `inlinedAt:`
field from `MDLocalVariable`, instead deferring to the `!dbg` location
attached to the debug info intrinsic.  The best way to ensure we always
have a `!dbg` attachment is to require one at creation time.  I'll be
adding verifier checks next, but this API change is the best way to
shake out frontend bugs.

Note: I added an `llvm_unreachable()` in `bindings/go` and passed in
`nullptr` for the `DebugLoc`.  The `llgo` folks will eventually need to
pass a valid `DebugLoc` here.

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

9 years agoDebugInfo: Add missing !dbg attachments to intrinsics
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 21:04:10 +0000 (21:04 +0000)]
DebugInfo: Add missing !dbg attachments to intrinsics

Add missing `!dbg` attachments to `@llvm.dbg.*` intrinsics.  I updated
these using a script (add-dbg-to-intrinsics.sh) that I'll attach to
PR22778 for posterity.

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

9 years agoUpdate for post-commit review comments
Daniel Berlin [Wed, 15 Apr 2015 19:36:10 +0000 (19:36 +0000)]
Update for post-commit review comments

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

9 years ago[WinEH] Try to make the MachineFunction CFG more accurate
Reid Kleckner [Wed, 15 Apr 2015 18:48:15 +0000 (18:48 +0000)]
[WinEH] Try to make the MachineFunction CFG more accurate

This avoids emitting code for unreachable landingpad blocks that contain
calls to llvm.eh.actions and indirectbr.

It's also a first step towards unifying the SEH and WinEH lowering
codepaths. I'm keeping the old fan-in lowering of SEH around until the
preparation version works well enough that we can switch over without
breaking existing users.

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

9 years ago[Orc] Refactor the CompileOnDemandLayer to make its addModuleSet method
Lang Hames [Wed, 15 Apr 2015 18:26:24 +0000 (18:26 +0000)]
[Orc] Refactor the CompileOnDemandLayer to make its addModuleSet method
signature match the other layers.

This makes it possible to compose other layers (e.g. IRTransformLayer) on top
of CompileOnDemandLayer.

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

9 years agoReland "[WinEH] Use the parent function when computing frameescape labels"
Reid Kleckner [Wed, 15 Apr 2015 17:47:26 +0000 (17:47 +0000)]
Reland "[WinEH] Use the parent function when computing frameescape labels"

Fixed the test by removing extraneous quotes.

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

9 years agoRevert "[WinEH] Use the parent function when computing frameescape labels"
Reid Kleckner [Wed, 15 Apr 2015 17:43:54 +0000 (17:43 +0000)]
Revert "[WinEH] Use the parent function when computing frameescape labels"

This reverts commit r235025. The test isn't passing yet.

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

9 years agoAdd range iterators for post order and inverse post order. Use them
Daniel Berlin [Wed, 15 Apr 2015 17:41:42 +0000 (17:41 +0000)]
Add range iterators for post order and inverse post order. Use them

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

9 years ago[WinEH] Use the parent function when computing frameescape labels
Reid Kleckner [Wed, 15 Apr 2015 17:32:01 +0000 (17:32 +0000)]
[WinEH] Use the parent function when computing frameescape labels

Fixes assertions in MC when a local label wasn't defined.

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

9 years agoFix BXJ is undefined in AArch32.
Charlie Turner [Wed, 15 Apr 2015 17:28:23 +0000 (17:28 +0000)]
Fix BXJ is undefined in AArch32.

BXJ was incorrectly said to be unsupported in ARMv8-A. It is not
supported in the A64 instruction set, but it is supported in the T32
and A32 instruction sets, because it's listed as an instruction in the
ARM ARM section F7.1.28.

Using SP as an operand to BXJ changed from UNPREDICTABLE to
PREDICTABLE in v8-A. This patch reflects that update as well.

This was found by MCHammer.

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

9 years agoMake it explicit which sections these relocations are in.
Rafael Espindola [Wed, 15 Apr 2015 17:24:06 +0000 (17:24 +0000)]
Make it explicit which sections these relocations are in.

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

9 years ago[NFC] [SLSR] clean up some tests
Jingyue Wu [Wed, 15 Apr 2015 17:14:03 +0000 (17:14 +0000)]
[NFC] [SLSR] clean up some tests

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

9 years agoMake it clear in which sections these relocations are.
Rafael Espindola [Wed, 15 Apr 2015 16:59:47 +0000 (16:59 +0000)]
Make it clear in which sections these relocations are.

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

9 years ago[SLSR] handle candidate form (B + i * S)
Jingyue Wu [Wed, 15 Apr 2015 16:46:13 +0000 (16:46 +0000)]
[SLSR] handle candidate form (B + i * S)

Summary:
With this patch, SLSR may rewrite

S1: X = B + i * S
S2: Y = B + i' * S

to

S2: Y = X + (i' - i) * S

A secondary improvement: if (i' - i) is a power of 2, emit Y as X + (S << log(i' - i)). (S << log(i' -i)) is in a canonical form and thus more likely GVN'ed than (i' - i) * S.

Test Plan: slsr-add.ll

Reviewers: hfinkel, sanjoy, meheff, broune, eliben

Reviewed By: eliben

Subscribers: llvm-commits

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

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

9 years agoMake it clear where the relocations we are CHECKING are from.
Rafael Espindola [Wed, 15 Apr 2015 16:45:03 +0000 (16:45 +0000)]
Make it clear where the relocations we are CHECKING are from.

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

9 years agoUpdate tests to not be as dependent on section numbers.
Rafael Espindola [Wed, 15 Apr 2015 15:59:37 +0000 (15:59 +0000)]
Update tests to not be as dependent on section numbers.

Many of these predate llvm-readobj. With elf-dump we had to match
a relocation to symbol number and symbol number to symbol name or
section number.

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

9 years ago[X86] add an exedepfix entry for movq == movlps == movlpd
Sanjay Patel [Wed, 15 Apr 2015 15:47:51 +0000 (15:47 +0000)]
[X86] add an exedepfix entry for movq == movlps == movlpd

This is a 1-line patch (with a TODO for AVX because that will affect
even more regression tests) that lets us substitute the appropriate
64-bit store for the float/double/int domains.

It's not clear to me exactly what the difference is between the 0xD6 (MOVPQI2QImr) and
0x7E (MOVSDto64mr) opcodes, but this is apparently the right choice.

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

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

9 years ago[x86] Implement combineRepeatedFPDivisors
Sanjay Patel [Wed, 15 Apr 2015 15:22:55 +0000 (15:22 +0000)]
[x86] Implement combineRepeatedFPDivisors

Set the transform bar at 2 divisions because the fastest current
x86 FP divider circuit is in SandyBridge / Haswell at 10 cycle
latency (best case) relative to a 5 cycle multiplier.
So that's the worst case for this transform (no latency win),
but multiplies are obviously pipelined while divisions are not,
so there's still a big throughput win which we would expect to
show up in typical FP code.

These are the sequences I'm comparing:

  divss   %xmm2, %xmm0
  mulss   %xmm1, %xmm0
  divss   %xmm2, %xmm0

Becomes:

  movss   LCPI0_0(%rip), %xmm3    ## xmm3 = mem[0],zero,zero,zero
  divss   %xmm2, %xmm3
  mulss   %xmm3, %xmm0
  mulss   %xmm1, %xmm0
  mulss   %xmm3, %xmm0

[Ignore for the moment that we don't optimize the chain of 3 multiplies
into 2 independent fmuls followed by 1 dependent fmul...this is the DAG
version of: https://llvm.org/bugs/show_bug.cgi?id=21768 ...if we fix that,
then the transform becomes even more profitable on all targets.]

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

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

9 years ago[MBP] Spell the conditions the same way through out this if statement.
Chandler Carruth [Wed, 15 Apr 2015 13:39:42 +0000 (13:39 +0000)]
[MBP] Spell the conditions the same way through out this if statement.
NFC.

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

9 years ago[MBP] Sink a comment into the if block to which it pertains. This makes
Chandler Carruth [Wed, 15 Apr 2015 13:26:41 +0000 (13:26 +0000)]
[MBP] Sink a comment into the if block to which it pertains. This makes
the content of the comment make much more sense.

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

9 years ago[MBP] Fix a really misleading typo in a comment.
Chandler Carruth [Wed, 15 Apr 2015 13:19:54 +0000 (13:19 +0000)]
[MBP] Fix a really misleading typo in a comment.

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

9 years agoWrite section and section table entries in the same order.
Rafael Espindola [Wed, 15 Apr 2015 13:07:47 +0000 (13:07 +0000)]
Write section and section table entries in the same order.

We had two different orders, which has no value.

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

9 years ago[msp430] Only support the 'm' inline assembly memory constraint. NFC.
Daniel Sanders [Wed, 15 Apr 2015 12:51:28 +0000 (12:51 +0000)]
[msp430] Only support the 'm' inline assembly memory constraint. NFC.

Summary:
MSP430 doesn't seem to have any additional constraints. Therefore remove
the target hook.

No functional change intended.

Subscribers: llvm-commits

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

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

9 years agoClarify that Twine::toVector *appends* the Twine to the given SmallString.
Yaron Keren [Wed, 15 Apr 2015 11:27:32 +0000 (11:27 +0000)]
Clarify that Twine::toVector *appends* the Twine to the given SmallString.

That's the way it works now, since toVector does not clear the given
SmallString before printing to it.

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

9 years agoRevert "Verify sizes when trying to read a VBR"
Filipe Cabecinhas [Wed, 15 Apr 2015 11:10:17 +0000 (11:10 +0000)]
Revert "Verify sizes when trying to read a VBR"

This reverts r234984 since it seems to break some bots (most of them
seemed arm*-selfhost).

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

9 years ago[mips] [IAS] Refactor the function which checks for the availability of AT. NFC.
Toma Tabacu [Wed, 15 Apr 2015 10:48:56 +0000 (10:48 +0000)]
[mips] [IAS] Refactor the function which checks for the availability of AT. NFC.

Summary:
Refactor MipsAsmParser::getATReg to return an internal register number instead of a register index.
Also change all the int's to unsigned, seeing as the current AT register index is stored as an unsigned in MipsAssemblerOptions.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

9 years agoVerify sizes when trying to read a VBR
Filipe Cabecinhas [Wed, 15 Apr 2015 08:48:08 +0000 (08:48 +0000)]
Verify sizes when trying to read a VBR

Also added an assert to ReadVBR64.

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

9 years agoFix lib\support\Windows/TimeValue.inc(48): warning C4189:
Yaron Keren [Wed, 15 Apr 2015 07:45:52 +0000 (07:45 +0000)]
Fix lib\support\Windows/TimeValue.inc(48): warning C4189:

'Error' : local variable is initialized but not referenced.

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

9 years agoRe-apply r234898 and fix tests.
Daniel Jasper [Wed, 15 Apr 2015 06:24:07 +0000 (06:24 +0000)]
Re-apply r234898 and fix tests.

This commit makes LLVM not estimate branch probabilities when doing a
single bit bitmask tests.

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
information.

CodeGen/ARM/2013-10-11-select-stalls.ll started failing because the
changed probabilities changed the results of
ARMBaseInstrInfo::isProfitableToIfCvt() and led to an Ifcvt of the
diamond in the test. AFAICT, the test was never meant to test this and
thus changing the test input slightly to not change the probabilities
seems like the best way to preserve the meaning of the test.

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

9 years ago[RuntimeDyld] Add casts to make delta computation 64-bit.
Lang Hames [Wed, 15 Apr 2015 04:46:01 +0000 (04:46 +0000)]
[RuntimeDyld] Add casts to make delta computation 64-bit.

Hopefully this will fix the i686/msvc build failure described at:
http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/803

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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

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

Summary:
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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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

9 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
CallGraphNode::addCalledFunction().

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

9 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`

http://reviews.llvm.org/D8524

Patch by Richard Thomson!

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

9 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

9 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

9 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
information.

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

9 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

9 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

9 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

9 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

9 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

Summary:
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
BitcodeReader::MaterializeModule).

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

9 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

9 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

9 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
independently.

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

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

9 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

9 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

9 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

Summary:
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);
  }

to

  void foo(int a, int b) {
    int t = a + b;
    bar(t);
    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

9 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

9 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

9 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

9 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

9 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.

Summary:
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

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

Summary:

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

9 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.

Summary:
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

9 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

9 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
removed.

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

9 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
`MDGlobalVariable`).

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

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

Summary:
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

9 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