oota-llvm.git
9 years ago[ConstantFoldTerminator] Preserve make.implicit metadata when converting SwitchInst...
Chen Li [Fri, 7 Aug 2015 19:30:12 +0000 (19:30 +0000)]
[ConstantFoldTerminator] Preserve make.implicit metadata when converting SwitchInst to BranchInst

Summary: llvm::ConstantFoldTerminator function can convert SwitchInst with single case (and default) to a conditional BranchInst. This patch adds support to preserve make.implicit metadata on this conversion.

Reviewers: sanjoy, weimingz, chenli

Subscribers: mcrosier, llvm-commits

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

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

9 years ago[MCDwarf] Use more idiomatic [u]int8_t types.
Frederic Riss [Fri, 7 Aug 2015 19:19:44 +0000 (19:19 +0000)]
[MCDwarf] Use more idiomatic [u]int8_t types.

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

9 years ago[InstCombine] Fix SSE2/AVX2 vector logical shift by constant
Simon Pilgrim [Fri, 7 Aug 2015 18:22:50 +0000 (18:22 +0000)]
[InstCombine] Fix SSE2/AVX2 vector logical shift by constant

This patch fixes the sse2/avx2 vector shift by constant instcombine call to correctly deal with the fact that the shift amount is formed from the entire lower 64-bit and not just the lowest element as it currently assumes.

e.g.

%1 = tail call <4 x i32> @llvm.x86.sse2.psrl.d(<4 x i32> %v, <4 x i32> <i32 15, i32 15, i32 15, i32 15>)

In this case, (V)PSRLD doesn't perform a lshr by 15 but in fact attempts to shift by 64424509455 ((15 << 32) | 15) - giving a zero result.

In addition, this review also recognizes shift-by-zero from a ConstantAggregateZero type (PR23821).

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

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

9 years agoNFC.
Cong Hou [Fri, 7 Aug 2015 18:04:17 +0000 (18:04 +0000)]
NFC.

Use a parent class to avoid reduncant code when specializing GraphTraits for T and const T.

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

9 years agoAdd functions to save and restore the PrettyStackTrace state.
Nico Weber [Fri, 7 Aug 2015 17:47:03 +0000 (17:47 +0000)]
Add functions to save and restore the PrettyStackTrace state.

PrettyStackTraceHead is a LLVM_THREAD_LOCAL, which means it's just a global
in LLVM_ENABLE_THREADS=NO builds.  If a CrashRecoveryContext is used with
code that uses PrettyStackEntries, and a crash happens, PrettyStackTraceHead is
currently not reset to its pre-crash value.  These functions make it possible
to add a cleanup to such code that does this.

(Not reseting the value then causes the assert in ~PrettyStackTraceEntry() to
fire if the code outside of the CrashRecoveryContext also uses
PrettyStackEntries -- for example, clang when building a module.)

Part of PR11974.

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

9 years agoAdd a comment.
Nico Weber [Fri, 7 Aug 2015 17:32:06 +0000 (17:32 +0000)]
Add a comment.

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

9 years agoDelete dead code. NFC.
Rafael Espindola [Fri, 7 Aug 2015 17:06:05 +0000 (17:06 +0000)]
Delete dead code. NFC.

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

9 years ago[ARM] Remove an unused reference to MachineRegisterInfo. NFC.
Chad Rosier [Fri, 7 Aug 2015 17:02:29 +0000 (17:02 +0000)]
[ARM] Remove an unused reference to MachineRegisterInfo. NFC.

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

9 years agoDon't use a DenseMap to handle SHT_SYMTAB_SHNDX.
Rafael Espindola [Fri, 7 Aug 2015 16:51:44 +0000 (16:51 +0000)]
Don't use a DenseMap to handle SHT_SYMTAB_SHNDX.

It is already a convenient table.

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

9 years agoAMDGPU/SI: Use correct encoding of vopc for VI in the assembler
Tom Stellard [Fri, 7 Aug 2015 16:45:33 +0000 (16:45 +0000)]
AMDGPU/SI: Use correct encoding of vopc for VI in the assembler

Summary: We were using the SI encoding for VI.

Reviewers: arsenm

Subscribers: llvm-commits

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

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

9 years agoAMDGPU/SI: Add VI checks to vop3 assembler tests
Tom Stellard [Fri, 7 Aug 2015 16:45:30 +0000 (16:45 +0000)]
AMDGPU/SI: Add VI checks to vop3 assembler tests

Reviewers: arsenm

Subscribers: llvm-commits

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

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

9 years agoWe're actually -Wmissing-field-initializers clean thanks to the cmake
Eric Christopher [Fri, 7 Aug 2015 16:44:47 +0000 (16:44 +0000)]
We're actually -Wmissing-field-initializers clean thanks to the cmake
build so check and turn on -Wmissing-field-initializers. While there,
reorganize the conditional warning code based on compiler to be a bit
more obvious and inside a switch statement.

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

9 years agoDelete dead typedef. NFC.
Rafael Espindola [Fri, 7 Aug 2015 16:36:47 +0000 (16:36 +0000)]
Delete dead typedef. NFC.

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

9 years agoUse 'signed char' instead of 'char'
Frederic Riss [Fri, 7 Aug 2015 16:31:59 +0000 (16:31 +0000)]
Use 'signed char' instead of 'char'

Hope this fixes the s390 and aarch64 bots.

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

9 years agoadd missing tests files
Rafael Espindola [Fri, 7 Aug 2015 15:35:49 +0000 (15:35 +0000)]
add missing tests files

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

9 years agoAMDGPU/SI: v_mac_legacy_f32 does not exist on VI
Tom Stellard [Fri, 7 Aug 2015 15:34:30 +0000 (15:34 +0000)]
AMDGPU/SI: v_mac_legacy_f32 does not exist on VI

Reviewers: arsenm

Subscribers: llvm-commits

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

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

9 years agoAMDGPU/SI: Remove unused outs parameter from VOPC TableGen classes
Tom Stellard [Fri, 7 Aug 2015 15:34:27 +0000 (15:34 +0000)]
AMDGPU/SI: Remove unused outs parameter from VOPC TableGen classes

Reviewers: arsenm

Subscribers: llvm-commits

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

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

9 years agoAdd dynamic_table iterators back to ELF.h.
Rafael Espindola [Fri, 7 Aug 2015 15:25:20 +0000 (15:25 +0000)]
Add dynamic_table iterators back to ELF.h.

In tree they are only used by llvm-readobj, but it is also used by
https://github.com/mono/CppSharp.

While at it, add some missing error checking.

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

9 years ago[dsymutil] Use the new MCDwarfLineTableParams customization to emit linetables
Frederic Riss [Fri, 7 Aug 2015 15:14:13 +0000 (15:14 +0000)]
[dsymutil] Use the new MCDwarfLineTableParams customization to emit linetables

llvm-dsymutil has to be able to process debug info produced by other compilers
which use different line table settings. The testcase wasn't generated by
another compiler, but by a modified clang.

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

9 years ago[MC/Dwarf] Allow to specify custom parameters for linetable emission.
Frederic Riss [Fri, 7 Aug 2015 15:14:08 +0000 (15:14 +0000)]
[MC/Dwarf] Allow to specify custom parameters for linetable emission.

NFC patch for current users, but llvm-dsymutil will use the new
functionality to adapt to the input linetable.

Based on a patch by Adrian Prantl.

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

9 years agoFix unused variable warning introduced in r244314
Silviu Baranga [Fri, 7 Aug 2015 12:05:46 +0000 (12:05 +0000)]
Fix unused variable warning introduced in r244314

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

9 years ago[ARM] Update ReconstructShuffle to handle mismatched types
Silviu Baranga [Fri, 7 Aug 2015 11:40:46 +0000 (11:40 +0000)]
[ARM] Update ReconstructShuffle to handle mismatched types

Summary:
Port the ReconstructShuffle function from AArch64 to ARM
to handle mismatched incoming types in the BUILD_VECTOR
node.

This fixes an outstanding FIXME in the ReconstructShuffle
code.

Reviewers: t.p.northover, rengolin

Subscribers: aemerson, llvm-commits, rengolin

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

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

9 years agoRevert "Make global aliases have symbol size equal to their type"
John Brawn [Fri, 7 Aug 2015 10:56:21 +0000 (10:56 +0000)]
Revert "Make global aliases have symbol size equal to their type"

This reverts r242520, as it caused pr24379. Also removes part of the test added
by r243874 that checks the size of alias symbols.

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

9 years agoTweak llvm/test/tools/dsymutil/arch-option.test to avoid globbing on mingw-w64.
NAKAMURA Takumi [Fri, 7 Aug 2015 08:38:22 +0000 (08:38 +0000)]
Tweak llvm/test/tools/dsymutil/arch-option.test to avoid globbing on mingw-w64.

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

9 years agoShrinkWrap.cpp: Tweak r244235 for a non-functional member, PredicateFtor. [-Wdocument...
NAKAMURA Takumi [Fri, 7 Aug 2015 07:40:23 +0000 (07:40 +0000)]
ShrinkWrap.cpp: Tweak r244235 for a non-functional member, PredicateFtor. [-Wdocumentation]

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

9 years agoWebAssembly: textual emission uses expected opcode names
JF Bastien [Fri, 7 Aug 2015 01:57:03 +0000 (01:57 +0000)]
WebAssembly: textual emission uses expected opcode names

Summary: WebAssembly's tablegen instructions have the names WebAssembly expects, but by LLVM convention they're uppercase and suffixed with their type after an underscore. Leave the C++ code that way, but print outt he names WebAssembly expects (lowercase, no type). We could teach tablegen to do this later, maybe by using `!cast<string>(node)` in the .td files.

Reviewers: sunfish

Subscribers: jfb, llvm-commits

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

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

9 years agoELF: Add AMDGPU specific defintions
Tom Stellard [Fri, 7 Aug 2015 01:35:24 +0000 (01:35 +0000)]
ELF: Add AMDGPU specific defintions

Reviewers: rafael

Subscribers: llvm-commits

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

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

9 years agoValueMapper: Resolve uniquing cycles more aggressively
Duncan P. N. Exon Smith [Fri, 7 Aug 2015 00:44:55 +0000 (00:44 +0000)]
ValueMapper: Resolve uniquing cycles more aggressively

As a follow-up to r244181, resolve uniquing cycles underneath distinct
nodes on the fly.  This prevents uniquing cycles in early operands from
affecting later operands.  It also removes an iteration through distinct
nodes' operands.

No real functional change here, just more prompt resolution of temporary
nodes.

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

9 years agoValueMapper: Pull out helper to resolve cycles, NFC
Duncan P. N. Exon Smith [Fri, 7 Aug 2015 00:39:26 +0000 (00:39 +0000)]
ValueMapper: Pull out helper to resolve cycles, NFC

Pull out a helper for resolving uniquing cycles of `Metadata` to remove
the boiler-plate of downcasting to `MDNode`.

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

9 years ago[llvm-readobj] Convert to range-loops.
Davide Italiano [Fri, 7 Aug 2015 00:35:28 +0000 (00:35 +0000)]
[llvm-readobj] Convert to range-loops.

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

9 years agoMIR Serialization: Fix serialization of unnamed IR block references.
Alex Lorenz [Thu, 6 Aug 2015 23:57:04 +0000 (23:57 +0000)]
MIR Serialization: Fix serialization of unnamed IR block references.

The block address machine operands can reference IR blocks in other functions.
This commit fixes a bug where the references to unnamed IR blocks in other
functions weren't serialized correctly.

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

9 years agoMIR Parser: Simplify the token's string value handling.
Alex Lorenz [Thu, 6 Aug 2015 23:17:42 +0000 (23:17 +0000)]
MIR Parser: Simplify the token's string value handling.

This commit removes the 'StringOffset' and 'HasStringValue' fields from the
MIToken struct and simplifies the 'stringValue' method which now returns
the new 'StringValue' field.

This commit also adopts a different way of initializing the lexed tokens -
instead of constructing a new MIToken instance, the lexer resets the old token
using the new 'reset' method and sets its attributes using the new
'setStringValue', 'setOwnedStringValue', and 'setIntegerValue' methods.

Reviewers: Sean Silva

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

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

9 years ago[LangRef] Cleanup some stray whitespace inconsistencies.
Sean Silva [Thu, 6 Aug 2015 22:56:48 +0000 (22:56 +0000)]
[LangRef] Cleanup some stray whitespace inconsistencies.

Patch by Debora Setton Sanches! <setton.debora@gmail.com>

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

9 years ago[LangRef] Tiny editorial fixes.
Sean Silva [Thu, 6 Aug 2015 22:56:24 +0000 (22:56 +0000)]
[LangRef] Tiny editorial fixes.

Patch by Debora Setton Sanches! <setton.debora@gmail.com>

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

9 years agoAdd initial documentation for the MIR serialization format.
Alex Lorenz [Thu, 6 Aug 2015 22:55:19 +0000 (22:55 +0000)]
Add initial documentation for the MIR serialization format.

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

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

9 years ago[AArch64][FastISel] Always use AND before checking the branch flag.
Juergen Ributzka [Thu, 6 Aug 2015 22:44:15 +0000 (22:44 +0000)]
[AArch64][FastISel] Always use AND before checking the branch flag.

When we are not emitting the condition for the branch, because the condition is
in another BB or SDAG did the selection for us, then we have to mask the flag in
the register with AND.

This is required when the condition comes from a truncate, because SDAG only
truncates down to a legal size of i32.

This fixes rdar://problem/22161062.

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

9 years agoRevert "[AArch64][FastISel] Add more truncation tests." and "[AArch64][FastISel]...
Juergen Ributzka [Thu, 6 Aug 2015 22:13:48 +0000 (22:13 +0000)]
Revert "[AArch64][FastISel] Add more truncation tests." and "[AArch64][FastISel] Always use an AND instruction when truncating to non-legal types."

This reverts commit r243198 and 243304.

Turns out this wasn't the correct fix for this problem. It works only within
FastISel, but fails when the truncate is selected by SDAG.

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

9 years ago[compatibility.ll] Cover explicitly named comdats.
Sean Silva [Thu, 6 Aug 2015 22:04:21 +0000 (22:04 +0000)]
[compatibility.ll] Cover explicitly named comdats.

Patch by Vedant Kumar! <vsk@apple.com>

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

9 years agoDescribe the process better.
Sean Silva [Thu, 6 Aug 2015 22:03:54 +0000 (22:03 +0000)]
Describe the process better.

Patch by Vedant Kumar! <vsk@apple.com>

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

9 years agoMove to llvm-readobj code that is only used there.
Rafael Espindola [Thu, 6 Aug 2015 21:54:37 +0000 (21:54 +0000)]
Move to llvm-readobj code that is only used there.

lld might end up using a small part of this, but it will be in a much
refactored form. For now this unblocks avoiding the full section scan in the
ELFFile constructor.

This also has a (very small) error handling improvement.

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

9 years agoRevert accidentally committed WinEHPrepare changes
David Majnemer [Thu, 6 Aug 2015 21:13:51 +0000 (21:13 +0000)]
Revert accidentally committed WinEHPrepare changes

This reverts commit r244272, r244273, r244274, and r244275.

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

9 years ago[IR] Remove TerminateInst's "NameStr" argument
David Majnemer [Thu, 6 Aug 2015 21:08:36 +0000 (21:08 +0000)]
[IR] Remove TerminateInst's "NameStr" argument

TerminateInst can't have a name because it doesn't produce a result.  No
functionality change is intended, this is just a cleanup.

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

9 years agoPHIs don't need to be postprocessed
David Majnemer [Thu, 6 Aug 2015 21:08:34 +0000 (21:08 +0000)]
PHIs don't need to be postprocessed

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

9 years agoHandle PHI nodes prefacing EH pads too
David Majnemer [Thu, 6 Aug 2015 21:08:32 +0000 (21:08 +0000)]
Handle PHI nodes prefacing EH pads too

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

9 years agohandle phi nodes
David Majnemer [Thu, 6 Aug 2015 21:08:30 +0000 (21:08 +0000)]
handle phi nodes

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

9 years ago[WinEHPrepare] Add rudimentary support for the new EH instructions
David Majnemer [Thu, 6 Aug 2015 21:07:55 +0000 (21:07 +0000)]
[WinEHPrepare] Add rudimentary support for the new EH instructions

Summary:
This adds somewhat basic preparation functionality including:
- Formation of funclets via coloring basic blocks.
- Cloning of polychromatic blocks to ensure that funclets have unique
  program counters.
- Demotion of values used between different funclets.
- Some amount of cleanup once we have removed predecessors from basic
  blocks.
- Verification that we are left with a CFG that makes some amount of
  sense.

N.B. Arguments and numbering still need to be done.

Reviewers: rnk, JosephTremoulet

Subscribers: llvm-commits

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

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

9 years ago[dsymutil] Implement dSYM bundle creation
Frederic Riss [Thu, 6 Aug 2015 21:05:06 +0000 (21:05 +0000)]
[dsymutil] Implement dSYM bundle creation

A dSYM bundle is a file hierarchy that looks slike this:
 <bundle name>.dSYM/
     Contents/
        Info.plist
        Resources/
           DWARF/
              <DWARF file(s)>

This is the default output mode of dsymutil.

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

9 years ago[dsymutil] Add (unimplemented) --flat option
Frederic Riss [Thu, 6 Aug 2015 21:05:01 +0000 (21:05 +0000)]
[dsymutil] Add (unimplemented) --flat option

dsymutil should by default generate dSYM bundles which are filesystem
hierarchies containing the debug info and an additional Info.plist.
Currently llvm-dsymutil emits raw binaries containing the debug info.
This is what we call the 'flat mode'. Add a -f/-flat option that is
supposed to enable that flat mode, but don't wire it for now, only
pass it to the tests that will need it to stay functional once we
do bundle generation by default.
This basically makes this commit NFC and removes the noise from the
actual commit that adds support for bundle generation.

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

9 years agoThread premissions through sys::fs::create_director{y|ies}
Frederic Riss [Thu, 6 Aug 2015 21:04:55 +0000 (21:04 +0000)]
Thread premissions through sys::fs::create_director{y|ies}

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

9 years ago[WinEH] Add documentation motivating the new EH instructions
Reid Kleckner [Thu, 6 Aug 2015 21:01:32 +0000 (21:01 +0000)]
[WinEH] Add documentation motivating the new EH instructions

This adds documentation on how to use the new EH instructions added in
r243766.

Reviewers: majnemer, reames

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

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

9 years ago[IndVars] Fix PR24356.
Sanjoy Das [Thu, 6 Aug 2015 20:43:41 +0000 (20:43 +0000)]
[IndVars] Fix PR24356.

Unsigned predicates increase or decrease agnostic of the signs of their
increments.

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

9 years ago[IndVars] Improved logging under DEBUG(); NFC.
Sanjoy Das [Thu, 6 Aug 2015 20:43:28 +0000 (20:43 +0000)]
[IndVars] Improved logging under DEBUG(); NFC.

Before this, we'd print the modified comparision in the "Simplified
comparison" case.  That looked misleading.

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

9 years agoConvert a bunch of loops to foreach. NFC.
Pete Cooper [Thu, 6 Aug 2015 20:22:46 +0000 (20:22 +0000)]
Convert a bunch of loops to foreach.  NFC.

After r244074, we now have a successors() method to iterate over
all the successors of a TerminatorInst.  This commit changes a bunch
of eligible loops to use it.

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

9 years agoUpdate comments.
Rui Ueyama [Thu, 6 Aug 2015 20:05:27 +0000 (20:05 +0000)]
Update comments.

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

9 years agoAMDGPU/SI: Add Fiji support
Tom Stellard [Thu, 6 Aug 2015 19:43:02 +0000 (19:43 +0000)]
AMDGPU/SI: Add Fiji support

Patch by: Alex Deucher

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

9 years agoAMDGPU/SI: Add support for 32-bit immediate SMRD offsets on CI
Tom Stellard [Thu, 6 Aug 2015 19:28:38 +0000 (19:28 +0000)]
AMDGPU/SI: Add support for 32-bit immediate SMRD offsets on CI

Reviewers: arsenm

Subscribers: llvm-commits

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

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

9 years agoAMDGPU/SI: Use ComplexPatterns for SMRD addressing modes
Tom Stellard [Thu, 6 Aug 2015 19:28:30 +0000 (19:28 +0000)]
AMDGPU/SI: Use ComplexPatterns for SMRD addressing modes

Summary: This allows us to consolidate several of the TableGen patterns.

Reviewers: arsenm

Subscribers: llvm-commits

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

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

9 years agoFix memory leaks by avoiding extra manual dynamic allocation
David Blaikie [Thu, 6 Aug 2015 19:23:33 +0000 (19:23 +0000)]
Fix memory leaks by avoiding extra manual dynamic allocation

Improvement to r244212.

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

9 years agoFix nested CrashRecoveryContexts with LLVM_ENABLE_THREADS=OFF, allow them.
Nico Weber [Thu, 6 Aug 2015 19:21:25 +0000 (19:21 +0000)]
Fix nested CrashRecoveryContexts with LLVM_ENABLE_THREADS=OFF, allow them.

libclang uses a CrashRecoveryContext, and building a module does too. If a
module gets built through libclang, nested CrashRecoveryContexts are used.  They
work fine with threads as things are stored in ThreadLocal variables, but in
LLVM_ENABLE_THREADS=OFF builds the two recovery contexts would write to the
same globals.

To fix, keep active CrashRecoveryContextImpls in a list and have the global
point to the innermost one, and do something similar for
tlIsRecoveringFromCrash.

Necessary (but not sufficient) for PR11974 and PR20325

http://reviews.llvm.org/D11770

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

9 years ago[libFuzzer] move the mutators to public interface so that custom mutators may reuse...
Kostya Serebryany [Thu, 6 Aug 2015 19:19:55 +0000 (19:19 +0000)]
[libFuzzer] move the mutators to public interface so that custom mutators may reuse these functions directly

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

9 years agoRename inst_range() to instructions() for consistency. NFC
Nico Rieck [Thu, 6 Aug 2015 19:10:45 +0000 (19:10 +0000)]
Rename inst_range() to instructions() for consistency. NFC

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

9 years agoFix possible infinite loop in shrink wrapping when searching for save/restore
Kit Barton [Thu, 6 Aug 2015 19:01:57 +0000 (19:01 +0000)]
Fix possible infinite loop in shrink wrapping when searching for save/restore
points.

There is an infinite loop that can occur in Shrink Wrapping while searching
for the Save/Restore points.

Part of this search checks whether the save/restore points are located in
different loop nests and if so, uses the (post) dominator trees to find the
immediate (post) dominator blocks. However, if the current block does not have
any immediate (post) dominators then this search will result in an infinite
loop. This can occur in code containing an infinite loop.

The modification checks whether the immediate (post) dominator is different from
the current save/restore block. If it is not, then the search terminates and the
current location is not considered as a valid save/restore point for shrink wrapping.

Phabricator: http://reviews.llvm.org/D11607

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

9 years agoLibDriver: Replace references to lld-link2 with lld-link.
Peter Collingbourne [Thu, 6 Aug 2015 19:00:42 +0000 (19:00 +0000)]
LibDriver: Replace references to lld-link2 with lld-link.

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

9 years ago[Reassociation] Fix miscompile for va_arg arguments.
Quentin Colombet [Thu, 6 Aug 2015 18:44:34 +0000 (18:44 +0000)]
[Reassociation] Fix miscompile for va_arg arguments.

iisUnmovableInstruction() had a list of instructions hardcoded which are
considered unmovable. The list lacked (at least) an entry for the va_arg
and cmpxchg instructions.
Fix this by introducing a new Instruction::mayBeMemoryDependent()
instead of maintaining another instruction list.

Patch by Matthias Braun <matze@braunis.de>.

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

rdar://problem/22118647

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

9 years agoMIR Parser: Report an error when parsing duplicate memory operand flags.
Alex Lorenz [Thu, 6 Aug 2015 18:26:36 +0000 (18:26 +0000)]
MIR Parser: Report an error when parsing duplicate memory operand flags.

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

9 years agoRevert r244154 which causes some build failure. See https://llvm.org/bugs/show_bug...
Cong Hou [Thu, 6 Aug 2015 18:17:29 +0000 (18:17 +0000)]
Revert r244154 which causes some build failure. See https://llvm.org/bugs/show_bug.cgi?id=24377.

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

9 years agoUpdate docs for accessing !dbg attachments
Duncan P. N. Exon Smith [Thu, 6 Aug 2015 18:15:25 +0000 (18:15 +0000)]
Update docs for accessing !dbg attachments

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

9 years agoThis patch changes the interface to enable the shrink wrapping optimization.
Kit Barton [Thu, 6 Aug 2015 18:02:53 +0000 (18:02 +0000)]
This patch changes the interface to enable the shrink wrapping optimization.

It adds a new constructor, which takes a std::function predicate function that
is run at the beginning of shrink wrapping to determine whether the optimization
should run on the given machine function. The std::function can be overridden by
each target, allowing target-specific decisions to be made on each machine
function.

This is necessary for PowerPC, as the decision to run shrink wrapping is
partially based on the ABI. Futhermore, this operates nicely with the GCC iFunc
capability, which allows option overrides on a per-function basis.

Phabricator: http://reviews.llvm.org/D11421

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

9 years ago[AArch64] Use a static function and other minor cleanup for readability. NFC.
Chad Rosier [Thu, 6 Aug 2015 17:37:18 +0000 (17:37 +0000)]
[AArch64] Use a static function and other minor cleanup for readability. NFC.

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

9 years ago[cmake] Handle Dragonfly BSD like FreeBSD
Reid Kleckner [Thu, 6 Aug 2015 17:17:44 +0000 (17:17 +0000)]
[cmake] Handle Dragonfly BSD like FreeBSD

Fixes build break reported in PR24358.

Patch by John Marino.

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

9 years agodocs: Fix typo in Phabricator.rst
Reid Kleckner [Thu, 6 Aug 2015 16:57:49 +0000 (16:57 +0000)]
docs: Fix typo in Phabricator.rst

Summary: Fix a small typo in Phabricator.rst: s/your/you.

Reviewers: rnk

Subscribers: rnk, llvm-commits

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

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

9 years agoMIR Serialization: Serialize the 'invariant' machine memory operand flag.
Alex Lorenz [Thu, 6 Aug 2015 16:55:53 +0000 (16:55 +0000)]
MIR Serialization: Serialize the 'invariant' machine memory operand flag.

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

9 years agoFix an alignment error in `llvm::expandAtomicRMWToCmpXchg` without breaking the build...
Richard Diamond [Thu, 6 Aug 2015 16:55:03 +0000 (16:55 +0000)]
Fix an alignment error in `llvm::expandAtomicRMWToCmpXchg` without breaking the build where X86 isn't enabled.

Summary: Divide the primitive size in bits by eight so the initial load's alignment is in bytes as expected. Tested with the included unit test.

Reviewers: rengolin, jfb

Subscribers: llvm-commits

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

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

9 years agoMIR Serialization: Serialize the 'non-temporal' machine memory operand flag.
Alex Lorenz [Thu, 6 Aug 2015 16:49:30 +0000 (16:49 +0000)]
MIR Serialization: Serialize the 'non-temporal' machine memory operand flag.

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

9 years ago[AArch64] Improve the readability of the ld/st optimization pass. NFC.
Chad Rosier [Thu, 6 Aug 2015 15:50:12 +0000 (15:50 +0000)]
[AArch64] Improve the readability of the ld/st optimization pass. NFC.

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

9 years ago[SPARC] Don't compare arch name as a string, use the enum instead.
Douglas Katzman [Thu, 6 Aug 2015 15:44:12 +0000 (15:44 +0000)]
[SPARC] Don't compare arch name as a string, use the enum instead.

Fixes PR22695

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

9 years agoReuse variable. NFC.
Rafael Espindola [Thu, 6 Aug 2015 14:51:02 +0000 (14:51 +0000)]
Reuse variable. NFC.

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

9 years agoSilencing a -Wtype-limits warning; NFC.
Aaron Ballman [Thu, 6 Aug 2015 14:07:29 +0000 (14:07 +0000)]
Silencing a -Wtype-limits warning; NFC.

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

9 years agoPlug memory leaks in AsmWriterEmitter::EmitPrintAliasInstruction.
Yaron Keren [Thu, 6 Aug 2015 13:18:59 +0000 (13:18 +0000)]
Plug memory leaks in AsmWriterEmitter::EmitPrintAliasInstruction.

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

9 years agoFix minor typos. NFC.
Chad Rosier [Thu, 6 Aug 2015 12:49:40 +0000 (12:49 +0000)]
Fix minor typos. NFC.

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

9 years agoRevert "Divide the primitive size in bits by eight so the initial load's alignment...
Renato Golin [Thu, 6 Aug 2015 10:37:59 +0000 (10:37 +0000)]
Revert "Divide the primitive size in bits by eight so the initial load's alignment is in bytes as expected. Tested with the included unit test."

This reverts commit r244155, as it was breaking the buildbots for too long.
Should be reapplied with proper fix.

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

9 years agollvm/lib/IR/AttributeImpl.h: Move comment block not to cover typedef, introduced...
NAKAMURA Takumi [Thu, 6 Aug 2015 09:49:17 +0000 (09:49 +0000)]
llvm/lib/IR/AttributeImpl.h: Move comment block not to cover typedef, introduced in r244164. [-Wdocumentation]

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

9 years agoRemoving tailing whitespaces
Michael Liao [Thu, 6 Aug 2015 09:06:20 +0000 (09:06 +0000)]
Removing tailing whitespaces

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

9 years ago[X86] Improve EmitLoweredSelect for contiguous CMOV pseudo instructions.
Michael Kuperstein [Thu, 6 Aug 2015 08:45:34 +0000 (08:45 +0000)]
[X86] Improve EmitLoweredSelect for contiguous CMOV pseudo instructions.

This change improves EmitLoweredSelect() so that multiple contiguous CMOV pseudo
instructions with the same (or exactly opposite) conditions get lowered using a single
new basic-block. This eliminates unnecessary extra basic-blocks (and CFG merge points)
when contiguous CMOVs are being lowered.

Patch by: kevin.b.smith@intel.com
Differential Revision: http://reviews.llvm.org/D11428

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

9 years ago[PM/AA] Clean up and homogenize comments throughout basic-aa.
Chandler Carruth [Thu, 6 Aug 2015 08:17:06 +0000 (08:17 +0000)]
[PM/AA] Clean up and homogenize comments throughout basic-aa.

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

9 years agoFix Visual C++ error C2248:
Yaron Keren [Thu, 6 Aug 2015 07:59:26 +0000 (07:59 +0000)]
Fix Visual C++ error C2248:
'llvm::TrailingObjects<`anonymous-namespace'::Class1,short,llvm::NoTrailingTypeArg>::additionalSizeToAlloc' :
cannot access protected member declared in class
 'llvm::TrailingObjects<`anonymous-namespace'::Class1,short,llvm::NoTrailingTypeArg>'

 I'm not sure how this compiles with gcc.
 Aren't protecteded members accessible only with protected or public inheritance?

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

9 years ago[PM/AA] Run clang-format over all of basic-aa before making more
Chandler Carruth [Thu, 6 Aug 2015 07:57:58 +0000 (07:57 +0000)]
[PM/AA] Run clang-format over all of basic-aa before making more
substantive edits.

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

9 years ago[PM/AA] Hoist the interface for BasicAA into a header file.
Chandler Carruth [Thu, 6 Aug 2015 07:33:15 +0000 (07:33 +0000)]
[PM/AA] Hoist the interface for BasicAA into a header file.

This is the first mechanical step in preparation for making this and all
the other alias analysis passes available to the new pass manager. I'm
factoring out all the totally boring changes I can so I'm moving code
around here with no other changes. I've even minimized the formatting
churn.

I'll reformat and freshen comments on the interface now that its located
in the right place so that the substantive changes don't triger this.

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

9 years agoCOFF: Assign the correct symbol type to internal functions.
Peter Collingbourne [Thu, 6 Aug 2015 05:26:35 +0000 (05:26 +0000)]
COFF: Assign the correct symbol type to internal functions.

The COFFSymbolRef::isFunctionDefinition() function tests for several conditions
that are not related to whether a symbol is a function, but rather whether
the symbol meets the requirements for a function definition auxiliary record,
which excludes certain symbols such as internal functions and undefined
references. The test we need to determine the symbol type is much simpler:
we only need to compare the complex type against IMAGE_SYM_DTYPE_FUNCTION.

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

9 years ago[PM/AA] Simplify the AliasAnalysis interface by removing a wrapper
Chandler Carruth [Thu, 6 Aug 2015 02:05:46 +0000 (02:05 +0000)]
[PM/AA] Simplify the AliasAnalysis interface by removing a wrapper
around a DataLayout interface in favor of directly querying DataLayout.

This wrapper specifically helped handle the case where this no
DataLayout, but LLVM now requires it simplifynig all of this. I've
updated callers to directly query DataLayout. This in turn exposed
a bunch of places where we should have DataLayout readily available but
don't which I've fixed. This then in turn exposed that we were passing
DataLayout around in a bunch of arguments rather than making it readily
available so I've also fixed that.

No functionality changed.

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

9 years ago[libFuzzer] add one more mutation strategy: byte shuffling
Kostya Serebryany [Thu, 6 Aug 2015 01:29:13 +0000 (01:29 +0000)]
[libFuzzer] add one more mutation strategy: byte shuffling

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

9 years agoMIR Serialization: Initial serialization of the machine operand target flags.
Alex Lorenz [Thu, 6 Aug 2015 00:44:07 +0000 (00:44 +0000)]
MIR Serialization: Initial serialization of the machine operand target flags.

This commit implements the initial serialization of the machine operand target
flags. It extends the 'TargetInstrInfo' class to add two new methods that help
to provide text based serialization for the target flags.

This commit can serialize only the X86 target flags, and the target flags for
the other targets will be serialized in the follow-up commits.

Reviewers: Duncan P. N. Exon Smith

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

9 years ago[llvm-objdump] Add missing call to exit(1).
Davide Italiano [Thu, 6 Aug 2015 00:18:52 +0000 (00:18 +0000)]
[llvm-objdump] Add missing call to exit(1).

Reported by: Rafael Espindola.

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

9 years agoRevert "Make sure all temporary files get created under %T."
Frederic Riss [Wed, 5 Aug 2015 23:53:38 +0000 (23:53 +0000)]
Revert "Make sure all temporary files get created under %T."

This reverts commit r244163. The workaround shouldn't be necessary
after r244172, and moreover the commit was slightly buggy as it
dis a simple mkdir without removing the directory first, which could
cause 'File exists' errors.

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

9 years agoValueMapper: Rotate distinct node remapping algorithm
Duncan P. N. Exon Smith [Wed, 5 Aug 2015 23:52:42 +0000 (23:52 +0000)]
ValueMapper: Rotate distinct node remapping algorithm

Rotate the algorithm for remapping distinct nodes in order to simplify
how uniquing cycles get resolved.  This removes some of the recursion,
and, most importantly, exposes all uniquing cycles at the top-level.
Besides being a little more efficient -- temporary MDNodes won't live as
long -- the clearer logic should help protect against bugs like those
fixed in r243961 and r243976.

What are uniquing cycles?  Why do they present challenges when remapping
metadata?

    !0 = !{!1}
    !1 = !{!0}

!0 and !1 form a simple uniquing cycle.  When remapping from one
metadata graph to another, every uniquing cycle gets "duplicated"
through a dance:

    !0-temp = !{!1?}     ; map(!0): clone !0, VM[!0] = !0-temp
    !1-temp = !{!0?}     ; ..map(!1): clone !1, VM[!1] = !1-temp
    !1-temp = !{!0-temp} ; ..map(!1): remap !1's operands
    !2      = !{!0-temp} ; ..map(!1): uniquify: !1-temp => !2
    !0-temp = !{!2}      ; map(!0): remap !0's operands
    !3      = !{!2}      ; map(!0): uniquify: !0-temp => !3

    ; Result
    !2 = !{!3}
    !3 = !{!2}

(In the two "uniquify" steps above, the operands of !X-temp are compared
to the operands of !X.  If they're the same, then !X-temp gets RAUW'ed
to !X; if they're different, then !X-temp is promoted to a new unique
node.  The latter case always hits in for uniquing cycles, so we
duplicate all the nodes involved.)

Why is this a problem?  Uniquable Metadata nodes that have temporary
node as transitive operands keep RAUW support until the temporary nodes
get finalized.  With non-cycles, this happens automatically: when a
uniquable node's count of unresolved operands drops to zero, it
immediately sheds its own RAUW support (possibly triggering the same in
any node that references it).  However, uniquing cycles create a
reference cycle, and uniqued nodes that transitively reference a
uniquing cycle are "stuck" in an unresolved state until someone calls
`MDNode::resolveCycles()` on a node in the unresolved subgraph.

Distinct nodes should help here (and mostly do): since they aren't
uniqued anywhere, they are guaranteed not to be RAUW'ed.  They
effectively form a barrier between uniqued nodes, breaking some uniquing
cycles, and shielding uniqued nodes from uniquing cycles.

Unfortunately, with this barrier in place, the unresolved subgraph(s)
can be disjoint from the top-level node.  The mapping algorithm needs to
find at least one representative from each disjoint subgraph.  But which
nodes are *stuck*, and which will get resolved automatically?  And which
nodes are in the unresolved subgraph?  The old logic was conservative.

This commit rotates the logic for distinct nodes, so that we have access
to unresolved nodes at the top-level call to `llvm::MapMetadata()`.
Each time we return to the top-level, we know that all temporaries have
been RAUW'ed away.  Here, it's safe (and necessary) to call
`resolveCycles()` immediately on unresolved operands.

This should also perform better than the old algorithm.  The recursion
stack is shorter, temporary nodes don't live as long, and there are
fewer tracking references to unresolved nodes.  As the debug info graph
introduces more 'distinct' nodes, remapping should incrementally get
cheaper and cheaper.

Aside from possible performance improvements (and reduced cruft in the
`LLVMContext`), there should be no functionality change here.

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

9 years ago[libFuzzer] avoid build warnings in non-assert build (useful warning in this case)
Kostya Serebryany [Wed, 5 Aug 2015 23:44:42 +0000 (23:44 +0000)]
[libFuzzer] avoid build warnings in non-assert build (useful warning in this case)

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

9 years agoAdd a stat to show how often the limit to decompose GEPs in BasicAA is reached.
Wei Mi [Wed, 5 Aug 2015 23:40:30 +0000 (23:40 +0000)]
Add a stat to show how often the limit to decompose GEPs in BasicAA is reached.

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

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

9 years ago[dsymutil] Do not create temporary files in -no-output mode.
Frederic Riss [Wed, 5 Aug 2015 23:33:50 +0000 (23:33 +0000)]
[dsymutil] Do not create temporary files in -no-output mode.

The files were never written to and then deleted, but they were created
nonetheless. To prevent that, create a wrapper around the 2 variants of
createUniqueFile and use the one that only does an access(Exists) call
to check for name unicity in -no-output mode.

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

9 years ago[dsymutil] Update source used to generate test binary.
Frederic Riss [Wed, 5 Aug 2015 23:33:45 +0000 (23:33 +0000)]
[dsymutil] Update source used to generate test binary.

Forgot to include that in the last commit.

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

9 years agoValueMapper: Simplify remap() helper function, NFC
Duncan P. N. Exon Smith [Wed, 5 Aug 2015 23:22:34 +0000 (23:22 +0000)]
ValueMapper: Simplify remap() helper function, NFC

Rename `remap()` to `remapOperands()`, and restrict its contract to
remapping operands.  Previously, it also called `mapToMetadata()`, but
this logic is hard to reason about externally.  In particular, this
refactors `mapUniquedNode()` to avoid redundant mapping calls, taking
advantage of the RAUWs that are already in place.

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