platform/upstream/llvm.git
7 years ago[Hexagon] Cleanup and standardize vector load/store pseudo instructions
Krzysztof Parzyszek [Fri, 12 Aug 2016 21:05:05 +0000 (21:05 +0000)]
[Hexagon] Cleanup and standardize vector load/store pseudo instructions

Remove the following single-vector load/store pseudo instructions, use real
instructions instead:
  LDriv_pseudo_V6         STriv_pseudo_V6
  LDriv_pseudo_V6_128B    STriv_pseudo_V6_128B
  LDrivv_indexed          STrivv_indexed
  LDrivv_indexed_128B     STrivv_indexed_128B

Rename the double-vector load/store pseudo instructions, add unaligned
counterparts:

  -- old --               -- new --            -- unaligned --
  LDrivv_pseudo_V6        PS_vloadrw_io        PS_vloadrwu_io
  LDrivv_pseudo_V6_128B   PS_vloadrw_io_128B   PS_vloadrwu_io_128B
  STrivv_pseudo_V6        PS_vstorerw_io       PS_vstorerwu_io
  STrivv_pseudo_V6_128B   PS_vstorerw_io_128   PS_vstorerwu_io_128

llvm-svn: 278564

7 years ago[libFuzzer] fix typo in docs
Kostya Serebryany [Fri, 12 Aug 2016 20:42:24 +0000 (20:42 +0000)]
[libFuzzer] fix typo in docs

llvm-svn: 278563

7 years ago[AArch64LoadStoreOptimizer] Check aliasing correctly when creating paired loads/stores.
Eli Friedman [Fri, 12 Aug 2016 20:39:51 +0000 (20:39 +0000)]
[AArch64LoadStoreOptimizer] Check aliasing correctly when creating paired loads/stores.

The existing code accidentally skipped the aliasing check in edge cases.

Differential revision: https://reviews.llvm.org/D23372

llvm-svn: 278562

7 years ago[ELF] - Linkerscript: fix VA value assigned to sections when using constraints.
George Rimar [Fri, 12 Aug 2016 20:38:20 +0000 (20:38 +0000)]
[ELF] - Linkerscript: fix VA value assigned to sections when using constraints.

Previously we searched output section by name to assign VA. That did not
work in the case when multiple output sections with different constraints were defined in script.
Testcase shows the possible issue scenario, patch fixes the issue.

Differential revision: https://reviews.llvm.org/D23451

llvm-svn: 278561

7 years ago[AArch64] Registering default MCInstrAnalysis
Mike Aizatsky [Fri, 12 Aug 2016 20:28:05 +0000 (20:28 +0000)]
[AArch64] Registering default MCInstrAnalysis

Even in this form it is useful: it can detect branch instructions.

https://github.com/google/sanitizers/issues/706

Subscribers: aemerson, rengolin

Differential Revision: https://reviews.llvm.org/D23426

llvm-svn: 278560

7 years ago[AArch64LoadStoreOpt] Handle offsets correctly for post-indexed paired loads.
Eli Friedman [Fri, 12 Aug 2016 20:28:02 +0000 (20:28 +0000)]
[AArch64LoadStoreOpt] Handle offsets correctly for post-indexed paired loads.

Trunk would try to create something like "stp x9, x8, [x0], #512", which isn't actually a valid instruction.

Differential revision: https://reviews.llvm.org/D23368

llvm-svn: 278559

7 years agoRemove autoconf references from LICENSE.TXT
Chris Bieneman [Fri, 12 Aug 2016 20:11:03 +0000 (20:11 +0000)]
Remove autoconf references from LICENSE.TXT

Since we don't actually have the autoconf subdirectories anymore, we don't need this reference here.

llvm-svn: 278558

7 years agoNext set of additional error checks for invalid Mach-O files.
Kevin Enderby [Fri, 12 Aug 2016 20:10:25 +0000 (20:10 +0000)]
Next set of additional error checks for invalid Mach-O files.

This contains the two missing checks for LC_SEGMENT load command fields.
And checks for the Mach-O sections fields that would make them invalid.

With the new checks, some of the existing malformed file checks now trips one
of these instead of the issue it was having before so those tests were adjusted.

llvm-svn: 278557

7 years ago[sancov] test file cleanup
Mike Aizatsky [Fri, 12 Aug 2016 20:06:32 +0000 (20:06 +0000)]
[sancov] test file cleanup

llvm-svn: 278556

7 years ago[ELF] - Do not use mergeable sections when LS is used.
George Rimar [Fri, 12 Aug 2016 19:56:57 +0000 (19:56 +0000)]
[ELF] - Do not use mergeable sections when LS is used.

After latest changes we combine input sections with
different attributes into single output section.
Problem here is that regular output sections does not
support adding mergeable input sections (and vise versa).
Patch just temporarily disables merging for now at
the same way we do for -O0 for example.

This change helps for linking FreeBSD kernel.

Differential revision: https://reviews.llvm.org/D23447

llvm-svn: 278555

7 years ago[ELF] - Remove excessive loop in LinkerScript<ELFT>::assignAddresses()
George Rimar [Fri, 12 Aug 2016 19:32:45 +0000 (19:32 +0000)]
[ELF] - Remove excessive loop in LinkerScript<ELFT>::assignAddresses()

After 278461 "Create only one section for a name in LinkerScript."
this loop is excessive.
Patch also reorders code slightly to use early return.

Differential revision: https://reviews.llvm.org/D23442

llvm-svn: 278554

7 years ago[clang-tidy] MPIBufferDerefCheck
Alexander Droste [Fri, 12 Aug 2016 19:30:31 +0000 (19:30 +0000)]
[clang-tidy] MPIBufferDerefCheck
...
This check verifies if a buffer passed to an MPI (Message Passing Interface)
function is sufficiently dereferenced. Buffers should be passed as a single
pointer or array. As MPI function signatures specify void * for their buffer
types, insufficiently dereferenced buffers can be passed, like for example
as double pointers or multidimensional arrays, without a compiler warning
emitted.

Instructions on how to apply the check can be found at:
https://github.com/0ax1/MPI-Checker/tree/master/examples

Reviewers: Haojian Wu
Differential revision: https://reviews.llvm.org/D22729

llvm-svn: 278553

7 years agofix lldb-gtest target of Xcode build
Todd Fiala [Fri, 12 Aug 2016 19:27:05 +0000 (19:27 +0000)]
fix lldb-gtest target of Xcode build

Change r278527 was filtering out too many libraries.
The Xcode lldb-gtest target depends on linking libgtest*.a,
but those were not being included.  This caused the lldb-gtest
linkage step to fail to find a main entry point that is present
in the filtered out libs.

This change restores the libgtest* libraries to the link list
by whitelisting them in the filter.

llvm-svn: 278552

7 years ago[sancov] MachO indirect symbols support.
Mike Aizatsky [Fri, 12 Aug 2016 19:25:59 +0000 (19:25 +0000)]
[sancov] MachO indirect symbols support.

Differential Revision: https://reviews.llvm.org/D23338

llvm-svn: 278551

7 years ago[ELF] - Fix for: error "invalid section index: xxx" when linking FreeBSD kernel.
George Rimar [Fri, 12 Aug 2016 19:25:54 +0000 (19:25 +0000)]
[ELF] - Fix for: error "invalid section index: xxx" when linking FreeBSD kernel.

We found that GNU assembler 2.17.50 [FreeBSD] 2007-07-03
could generate broken objects. STT_SECTION symbols can be
associated with SHT_REL[A]/SHT_SYMTAB/SHT_STRTAB sections.

This is PR28868, patch fixes handling of such files.

Differential revision: https://reviews.llvm.org/D23201

llvm-svn: 278550

7 years ago[CUDA] Place GPU binary into .nv_fatbin section and align it by 8.
Artem Belevich [Fri, 12 Aug 2016 18:44:01 +0000 (18:44 +0000)]
[CUDA] Place GPU binary into .nv_fatbin section and align it by 8.

This matches the way nvcc encapsulates GPU binaries into host object file.
Now cuobjdump can deal with clang-compiled object files.

Differential Revision: https://reviews.llvm.org/D23429

llvm-svn: 278549

7 years ago[PPC] Memoize getValueBits. NFC.
Tim Shen [Fri, 12 Aug 2016 18:40:04 +0000 (18:40 +0000)]
[PPC] Memoize getValueBits. NFC.

Summary: It triggers exponential behavior when the DAG has many branches.

Reviewers: hfinkel, kbarton

Subscribers: iteratee, nemanjai, echristo

Differential Revision: https://reviews.llvm.org/D23428

llvm-svn: 278548

7 years agoRemove accidentally committed file.
Zachary Turner [Fri, 12 Aug 2016 18:39:05 +0000 (18:39 +0000)]
Remove accidentally committed file.

llvm-svn: 278547

7 years agoAnalyze include order on a per-file basis.
Zachary Turner [Fri, 12 Aug 2016 18:38:26 +0000 (18:38 +0000)]
Analyze include order on a per-file basis.

The include order check would get notified of all include
directives in a depth-first manner.  This created the
possibility of an include directive from a header file
interfering with the sort order of a set of two distinct
blocks from the top level cpp file, if that include directive
was on just the right line.

With this patch we bucket the include directives by the file
in which they appear in and process one bucket at a time,
so that directives from different files do not get mixed
together into the same list.

Reviewed By: alexfh
Differential Revision: https://reviews.llvm.org/D23434

llvm-svn: 278546

7 years ago[WebAssembly] Plug MachineMemOperand leaks.
Benjamin Kramer [Fri, 12 Aug 2016 18:33:50 +0000 (18:33 +0000)]
[WebAssembly] Plug MachineMemOperand leaks.

llvm-svn: 278545

7 years ago[LibFuzzer] Fix `-jobs=<N>` where <N> > 1 and the number of workers is > 1 on macOS.
Dan Liew [Fri, 12 Aug 2016 18:29:36 +0000 (18:29 +0000)]
[LibFuzzer] Fix `-jobs=<N>` where <N> > 1 and the number of workers is > 1 on macOS.

The original `ExecuteCommand()` called `system()` from the C library.
The C library implementation of this on macOS contains a mutex which
serializes calls to `system()`. This prevented the `-jobs=` flag
from running copies of the fuzzing binary in parallel which is
the opposite of what is intended.

To fix this on macOS an alternative implementation of `ExecuteCommand()`
is provided that can be used concurrently. This is provided in
`FuzzerUtilDarwin.cpp` which is guarded to only compile code on Apple
platforms. The existing implementation has been moved to a new file
`FuzzerUtilLinux.cpp` which is guarded to only compile code on Linux.

This commit includes a simple test to check that LibFuzzer is being
executed in parallel when requested.

Differential Revision: https://reviews.llvm.org/D22742

llvm-svn: 278544

7 years agoReapply [VFS] Skip non existent files from the VFS tree
Bruno Cardoso Lopes [Fri, 12 Aug 2016 18:18:24 +0000 (18:18 +0000)]
Reapply [VFS] Skip non existent files from the VFS tree

Reapply r278457 with test fixed to not abouse fs case sensitivity.

When the VFS uses a YAML file, the real file path for a
virtual file is described in the "external-contents" field. Example:

  ...
  {
     'type': 'file',
     'name': 'a.h',
     'external-contents': '/a/b/c/a.h'
  }

Currently, when parsing umbrella directories, we use
vfs::recursive_directory_iterator to gather the header files to generate the
equivalent modules for. If the external contents for a header does not exist,
we currently are unable to build a module, since the VFS
vfs::recursive_directory_iterator will fail when it finds an entry without a
reliable real path.

Since the YAML file could be prepared ahead of time and shared among
different compiler invocations, an entry might not yet have a reliable
path in 'external-contents', breaking the iteration.

Give the VFS the capability to skip such entries whenever
'ignore-non-existent-contents' property is set in the YAML file.

rdar://problem/27531549

llvm-svn: 278543

7 years agoADT: Remove stale header comments about next/prev after r278532
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 18:14:42 +0000 (18:14 +0000)]
ADT: Remove stale header comments about next/prev after r278532

Thanks to Mehdi for noticing.

llvm-svn: 278542

7 years agoCodeGen: Replace ThinLTO backend implementation with a client of LTO/Resolution.
Teresa Johnson [Fri, 12 Aug 2016 18:12:08 +0000 (18:12 +0000)]
CodeGen: Replace ThinLTO backend implementation with a client of LTO/Resolution.

Summary:
This changes clang to use the llvm::lto::thinBackend function instead of
its own less comprehensive ThinLTO backend implementation.

Patch by Peter Collingbourne

Reviewers: tejohnson, mehdi_amini

Subscribers: cfe-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D21545

llvm-svn: 278541

7 years agoHide type trait from r278532 from MSVC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 18:10:29 +0000 (18:10 +0000)]
Hide type trait from r278532 from MSVC

The fixup from r278537 was insufficient.  Just #ifdef it out for MSVC.

llvm-svn: 278539

7 years agoTry to appease win7 bots after r278532 by cleaning up type trait
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 17:54:54 +0000 (17:54 +0000)]
Try to appease win7 bots after r278532 by cleaning up type trait

The HasGetNext type trait was cluttered with a few things it didn't
need.  Try to clean it up, hoping to fix windows bots:
  http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/38063

I may just have to delete the trait...

llvm-svn: 278537

7 years agoRemove whitespace
David Majnemer [Fri, 12 Aug 2016 17:53:06 +0000 (17:53 +0000)]
Remove whitespace

llvm-svn: 278536

7 years ago[Driver] Set the default driver mode based on the executable.
Zachary Turner [Fri, 12 Aug 2016 17:47:52 +0000 (17:47 +0000)]
[Driver] Set the default driver mode based on the executable.

Currently, if --driver-mode is not passed at all, it will default
to GCC style driver.  This is never an issue for clang because
it manually constructs a --driver-mode option and passes it.

However, we should still try to do as good as we can even if no
--driver-mode is passed.  LibTooling, for example, does not pass
a --driver-mode option and while it could, it seems like we should
still fallback to the best possible default we can.

This is one of two steps necessary to get clang-tidy working on Windows.

Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D23454

llvm-svn: 278535

7 years agoRevert test commit
Alexander Droste [Fri, 12 Aug 2016 17:46:23 +0000 (17:46 +0000)]
Revert test commit

llvm-svn: 278534

7 years agoTest commit - first LLVM repo commit
Alexander Droste [Fri, 12 Aug 2016 17:43:58 +0000 (17:43 +0000)]
Test commit - first LLVM repo commit

llvm-svn: 278533

7 years agoADT: Remove the ilist_nextprev_traits customization point
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 17:32:34 +0000 (17:32 +0000)]
ADT: Remove the ilist_nextprev_traits customization point

No one is using the capability to implement next and prev another way
(since lld stopped doing it in r278468).  Remove the customization point
by moving the API from ilist_nextprev_traits<T> to ilist_node_access.

The old traits class is still useful/necessary API as a target for
friends of node types that inherit privately from ilist_node.
Eventually I plan to either remove it entirely or move the template
parameters to the methods.

(Note: if there's desire to bring back customization of next/prev
pointers in the future (e.g., to pack some bits in there), I think a
traits class like this is an awkward way to accomplish it.  Instead, we
should change ilist<T> to be ilist<ilist_node<T>>, and give an extra
template parameter to ilist_node.)

llvm-svn: 278532

7 years ago[PM] Port LowerInvoke to the new pass manager
Michael Kuperstein [Fri, 12 Aug 2016 17:28:27 +0000 (17:28 +0000)]
[PM] Port LowerInvoke to the new pass manager

llvm-svn: 278531

7 years agoAdd compiler-rt side test for no_sanitize("cfi") attribute
Ivan Krasin [Fri, 12 Aug 2016 17:26:37 +0000 (17:26 +0000)]
Add compiler-rt side test for no_sanitize("cfi") attribute

Summary: Add a test case for __attribute__((no_sanitize("cfi"))) being effective.

Reviewers: kcc

Subscribers: dberris

Differential Revision: https://reviews.llvm.org/D23425

llvm-svn: 278530

7 years agoDisable TestThreadSpecificBpPlusCondition on Windows.
Zachary Turner [Fri, 12 Aug 2016 17:15:38 +0000 (17:15 +0000)]
Disable TestThreadSpecificBpPlusCondition on Windows.

Test frequently times out stalling the test runner.

llvm-svn: 278529

7 years agoconstify InstCombine::foldAllocaCmp. NFC.
Pete Cooper [Fri, 12 Aug 2016 17:13:28 +0000 (17:13 +0000)]
constify InstCombine::foldAllocaCmp.  NFC.

This is part of an effort to constify ValueTracking.cpp.  This change is
to methods which need const Value* instead of Value* to go with the upcoming
changes to ValueTracking.

llvm-svn: 278528

7 years agoLink LLDB only against libclang and libLLVM .a files to fix macOS build
Todd Fiala [Fri, 12 Aug 2016 17:01:19 +0000 (17:01 +0000)]
Link LLDB only against libclang and libLLVM .a files to fix macOS build

The Xcode macOS build of LLDB is currently broken after
https://reviews.llvm.org/D23232 landed, see
http://lab.llvm.org:8080/green/job/lldb_build_test/20014/console,
because we’re trying to link against all .a files found in the
llvm-build/lib directory. Let’s be more specific in what we link
against. This patch applies a regexp to only use “libclang.*”,
“libLLVM.*” and not “libclang_rt.*” static archives.

Change by Kuba Mracek (formerly Kuba Brecka)

See review here:
https://reviews.llvm.org/D23444

Reviewers: tfiala, compnerd
llvm-svn: 278527

7 years agoFix build on Windows.
Zachary Turner [Fri, 12 Aug 2016 16:52:31 +0000 (16:52 +0000)]
Fix build on Windows.

llvm-svn: 278526

7 years agoBugReporter: Use ilist_half_embedded_sentinel_traits, NFC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 16:46:25 +0000 (16:46 +0000)]
BugReporter: Use ilist_half_embedded_sentinel_traits, NFC

This avoids duplicated code with llvm/ADT/ilist.h.  No functionality
change.

llvm-svn: 278525

7 years agoSwitch over to using socketpair for local debugserver connections as they are twice...
Greg Clayton [Fri, 12 Aug 2016 16:46:18 +0000 (16:46 +0000)]
Switch over to using socketpair for local debugserver connections as they are twice as fast as TCP sockets (on macOS at least).

This change opens a socket pair and passes the second socket pair file descriptor down to the debugserver binary using a new option: "--fd=N" where N is the file descriptor. This file descriptor gets passed via posix_spawn() so that there is no need to do any bind/listen or bind/accept calls and eliminates the hanshake unix socket that is used to pass the result of the actual port that ends up being used so it can save time on launch as well as being faster.

This is currently only enabled on __APPLE__ builds. Other OSs should try modifying the #define from ProcessGDBRemote.cpp but the first person will need to port the --fd option over to lldb-server. Any OSs that enable USE_SOCKETPAIR_FOR_LOCAL_CONNECTION in their native builds can use the socket pair stuff. The #define is Apple only right now, but looks like:

#if defined (__APPLE__)
#define USE_SOCKETPAIR_FOR_LOCAL_CONNECTION 1
#endif

<rdar://problem/27814880>

llvm-svn: 278524

7 years agoMachO: Use ilist_half_embedded_sentinel_traits, NFC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 16:25:04 +0000 (16:25 +0000)]
MachO: Use ilist_half_embedded_sentinel_traits, NFC

Use ilist_half_embedded_sentinel_traits for the list of
lld::mach_o::normalized::TrieEdge, rather than duplicating the code.

llvm-svn: 278523

7 years agoFine tuning of sample profile propagation algorithm.
Dehao Chen [Fri, 12 Aug 2016 16:22:12 +0000 (16:22 +0000)]
Fine tuning of sample profile propagation algorithm.

Summary: The refined propagation algorithm is more accurate and robust.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23224

llvm-svn: 278522

7 years agoCore: Use ilist_full_embedded_sentinel_traits for SimpleReference
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 16:19:34 +0000 (16:19 +0000)]
Core: Use ilist_full_embedded_sentinel_traits for SimpleReference

Avoid custom code for sentinel traits in SimpleReference (the ilist node
for references to a SimpleDefinedAtom), since they'll soon/eventually
disappear from ilist entirely.

Rather than using a BumpPtrAllocator, this drops the lazy sentinel
characteristics and stores the sentinel directly in the ilist.  This
unconditionally allocates the sentinel.

At first glance, this looks like it might increase memory usage
slightly, since an unreferenced SimpleDefinedAtom pays for a
6-pointer-sized sentinel even when its list of references is empty.  In
practice, the sentinel was being lazily allocated at the first call to
DefinedAtom::begin/end anyway.  I don't expect any real memory effects
here.

Moreover, this is an intermediate state.  The ilist_*sentinel_traits are
being phased out.

As a preview of the final state: in lieu of a NodeTy sentinel, the ilist
will have a single, untemplated list_node_base that has next/prev
pointers.  This base node will serve both as a sentinel and as a pointer
to the head of the list (the same memory layout as
ilist_half_embedded_sentinel_traits, but without the UB).

llvm-svn: 278521

7 years ago[x86] X86ISelLowering zext(add_nuw(x, C)) --> add(zext(x), C_zext)
Artur Pilipenko [Fri, 12 Aug 2016 16:08:30 +0000 (16:08 +0000)]
[x86] X86ISelLowering zext(add_nuw(x, C)) --> add(zext(x), C_zext)

Currently X86ISelLowering has a similar transformation for sexts:
sext(add_nsw(x, C)) --> add(sext(x), C_sext)

In this change I extend this code to handle zexts as well.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D23359

llvm-svn: 278520

7 years ago[BasicAA] Avoid calling GetUnderlyingObject, when the result of a previous call can...
Ehsan Amiri [Fri, 12 Aug 2016 16:05:03 +0000 (16:05 +0000)]
[BasicAA] Avoid calling GetUnderlyingObject, when the result of a previous call can be reused.

Recursive calls to aliasCheck from alias[GEP|Select|PHI] may result in a second call to GetUnderlyingObject for a Value, whose underlying object is already computed. This patch ensures that in this situations, the underlying object is not computed again, and the result of the previous call is resued.

https://reviews.llvm.org/D22305

llvm-svn: 278519

7 years ago[LVI] Take guards into account
Artur Pilipenko [Fri, 12 Aug 2016 15:52:23 +0000 (15:52 +0000)]
[LVI] Take guards into account

Teach LVI to gather control dependant constraints from guards.

Reviewed By: sanjoy

Differential Revision: https://reviews.llvm.org/D23358

llvm-svn: 278518

7 years agoAdd move ops to satisfy MSVC.
Teresa Johnson [Fri, 12 Aug 2016 15:39:26 +0000 (15:39 +0000)]
Add move ops to satisfy MSVC.

Try to appease Windows bots after r278508:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/27250
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/14776

llvm-svn: 278517

7 years ago[mips] Remove obstack.cc XFAIL added in r278504 since it broke X86 and PPC somehow.
Daniel Sanders [Fri, 12 Aug 2016 15:34:35 +0000 (15:34 +0000)]
[mips] Remove obstack.cc XFAIL added in r278504 since it broke X86 and PPC somehow.

Adding the XFAIL has caused msan to report a different line number in the call
stack (@LINE-3 rather than @LINE-30). The new line number looks more correct
at first glance since it's the line that uses uninitialized memory rather than
the first non-whitespace line of the file but this needs investigating.

llvm-svn: 278516

7 years ago[AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo.
Geoff Berry [Fri, 12 Aug 2016 15:26:00 +0000 (15:26 +0000)]
[AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo.

This re-factoring could cause the following slight changes in generated
code, though none were observed during testing:

- MachineScheduler could decide not to cluster some loads/stores if
  there are other load/stores with non-pairable opcodes that have the
  same base register and offset as a pairable set of load/stores.  One
  case of different MachineScheduler pairing did show up in my testing,
  but it wasn't due to this issue, but due
  BaseMemOpClusterMutation::clusterNeighboringMemOps() being unstable
  w.r.t. the order it considers memory operations.  See PR28942.

- The ImplicitNullChecks optimization could be done for more load/store
  opcodes.  This optimization isn't done for C/C++ code, so it didn't
  show up in my testing.

Reviewers: mcrosier, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D23365

llvm-svn: 278515

7 years ago[LVI] Fix potential memory corruption in getValueFromCondition
Artur Pilipenko [Fri, 12 Aug 2016 15:08:15 +0000 (15:08 +0000)]
[LVI] Fix potential memory corruption in getValueFromCondition

Rewrite Visited[Cond] = getValueFromConditionImpl(..., Visited) statement which can lead to a memory corruption since getValueFromConditionImpl changes Visited map and invalidates the iterators.

llvm-svn: 278514

7 years agoADT: Share code for embedded sentinel traits, NFC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 15:00:55 +0000 (15:00 +0000)]
ADT: Share code for embedded sentinel traits, NFC

Share code for the (mostly problematic) embedded sentinel traits.
- Move the LLVM_NO_SANITIZE("object-size") attribute to
  ilist_half_embedded_sentinel_traits and ilist_embedded_sentinel_traits
  (previously it spread throughout the code duplication).
- Add an ilist_full_embedded_sentinel_traits which has no UB (but has
  the downside of storing the complete node).
- Replace all the custom sentinel traits in LLVM with a declaration of
  ilist_sentinel_traits that inherits from one of the embedded sentinel
  traits classes.

There are still custom sentinel traits in other LLVM subprojects.  I'll
remove those in a follow-up.

Nothing at all should be changing here, this is just rearranging code.
Note that the final goal here is to remove the sentinel traits
altogether, settling on the memory layout of
ilist_half_embedded_sentinel_traits without the UB.  This intermediate
step moves the logic into ilist.h.

llvm-svn: 278513

7 years agoFix type to avoid problems on 32-bit builds
Teresa Johnson [Fri, 12 Aug 2016 14:55:43 +0000 (14:55 +0000)]
Fix type to avoid problems on 32-bit builds

lto::InputFile::Symbol::getCommonSize should return uint64_t instead of
size_t since it is returning the result of DataLayout::getTypeAllocSize
which returns uint64_t, and the result of getCommonSize is assigned to a
uint64_t variable. On 32-bit builds size_t is unsigned int and there are
type errors. This was introduced in r278338.

llvm-svn: 278512

7 years agoRevert "[Sparc] Leon errata fix passes."
James Y Knight [Fri, 12 Aug 2016 14:48:09 +0000 (14:48 +0000)]
Revert "[Sparc] Leon errata fix passes."
...and the two followup commits:
Revert "[Sparc][Leon] Missed resetting option flags from check-in 278489."
Revert "[Sparc][Leon] Errata fixes for various errata in different
versions of the Leon variants of the Sparc 32 bit processor."

This reverts commit r274856, r278489, and r278492.

llvm-svn: 278511

7 years agoSkip 2 android test what is broken because of debuggerd
Tamas Berghammer [Fri, 12 Aug 2016 14:17:05 +0000 (14:17 +0000)]
Skip 2 android test what is broken because of debuggerd

debuggerd is a crash reporting system on android what installs some
signal handler for SEGV to print a backtrace in the log. Its behavior
breaks tests where the test tries to continue after a SEGV so we skip
them as this behavior isn't required on android anyway.

llvm-svn: 278510

7 years ago[PM] Port NameAnonFunction pass to new pass manager
Teresa Johnson [Fri, 12 Aug 2016 14:03:36 +0000 (14:03 +0000)]
[PM] Port NameAnonFunction pass to new pass manager

Summary:
Port the NameAnonFunction pass and add a test.

Depends on D23439.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D23440

llvm-svn: 278509

7 years ago[PM] Port ModuleSummaryIndex analysis to new pass manager
Teresa Johnson [Fri, 12 Aug 2016 13:53:02 +0000 (13:53 +0000)]
[PM] Port ModuleSummaryIndex analysis to new pass manager

Summary:
Port the ModuleSummaryAnalysisWrapperPass to the new pass manager.
Use it in the ported BitcodeWriterPass (similar to how we use the
legacy ModuleSummaryAnalysisWrapperPass in the legacy WriteBitcodePass).

Also, pass the -module-summary opt flag through to the new pass
manager pipeline and through to the bitcode writer pass, and add
a test that uses it.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D23439

llvm-svn: 278508

7 years ago[ASTMatchers] Add templateTypeParmDecl() to Registry.cpp
Martin Bohme [Fri, 12 Aug 2016 13:51:00 +0000 (13:51 +0000)]
[ASTMatchers] Add templateTypeParmDecl() to Registry.cpp

Summary:
This appears to have been forgotten when templateTypeParmDecl() was initially
added.

Reviewers: alexfh, aaron.ballman

Subscribers: aaron.ballman, klimek, aemerson, rengolin, samparker, cfe-commits

Differential Revision: https://reviews.llvm.org/D23448

llvm-svn: 278507

7 years ago[Core] Retire yet another unused member function.
Davide Italiano [Fri, 12 Aug 2016 12:37:23 +0000 (12:37 +0000)]
[Core] Retire yet another unused member function.

The code in lib/ could use a lot of love :(

llvm-svn: 278506

7 years ago[Core] Simplify a bit. NFCI.
Davide Italiano [Fri, 12 Aug 2016 12:34:39 +0000 (12:34 +0000)]
[Core] Simplify a bit. NFCI.

llvm-svn: 278505

7 years ago[mips] XFAIL the new mips64el compiler-rt tests that fail on clang-cmake-mipsel.
Daniel Sanders [Fri, 12 Aug 2016 11:56:36 +0000 (11:56 +0000)]
[mips] XFAIL the new mips64el compiler-rt tests that fail on clang-cmake-mipsel.

The mips64el compiler-rt build has recently been enabled. XFAIL the failing
tests to make the buildbot green again.

The two asan tests require the integrated assembler. This will be fixed soon
for Debian mips64el but not for any other mips64el targets since doing so
requires triple-related issues to be fixed..
The msan tests are largely failing because caused by a kernel update (a patch
has already been posted for this).
I'm not sure why the dfsan test fails yet.

llvm-svn: 278504

7 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Fri, 12 Aug 2016 11:43:57 +0000 (11:43 +0000)]
Fix Wdocumentation unknown parameter warning

llvm-svn: 278503

7 years ago[X86][SSE] Add support for combining target shuffles to PSLLDQ/PSRLDQ byte shifts
Simon Pilgrim [Fri, 12 Aug 2016 11:24:34 +0000 (11:24 +0000)]
[X86][SSE] Add support for combining target shuffles to PSLLDQ/PSRLDQ byte shifts

llvm-svn: 278502

7 years agoFix For pr28288 - Error message in shift of vector values
Andrey Bokhanko [Fri, 12 Aug 2016 11:22:12 +0000 (11:22 +0000)]
Fix For pr28288 - Error message in shift of vector values

This fixes an error in type checking of shift of vector values.

Patch by Vladimir Yakovlev.

Differential Revision: https://reviews.llvm.org/D21678

llvm-svn: 278501

7 years agoFix-up r278299 for windows
Pavel Labath [Fri, 12 Aug 2016 11:20:21 +0000 (11:20 +0000)]
Fix-up r278299 for windows

FD_SETSIZE on windows limits the number of file descriptors, rather than their individual
magnitude (the underlying implementation uses an array rather than a bitset). This meant that the
assert in the SelectHelper was incorrect, and failing all the time. Fix that.

I am not sure whether this should be #ifdef MSVC, or #ifdef WINDOWS, but my feeling is that a
more posix-conforming implementation on windows would choose the bitset implementation, so I'm
sticking with the former.

llvm-svn: 278500

7 years ago[Hexagon] Standardize pseudo-instructions for calls and returns
Krzysztof Parzyszek [Fri, 12 Aug 2016 11:12:02 +0000 (11:12 +0000)]
[Hexagon] Standardize pseudo-instructions for calls and returns

- CALLv3nr        PS_call_nr
- CALLRv3nr       PS_callr_nr
- CALLstk         PS_call_stk

- TCRETURNi       PS_tailcall_i
- TCRETURNr       PS_tailcall_r

- JMPret          PS_jmpret
- JMPrett         PS_jmprett
- JMPretf         PS_jmpretf
- JMPrettnew      PS_jmprettnew
- JMPretfnew      PS_jmpretfnew
- JMPrettnewpt    PS_jmprettnewpt
- JMPretfnewpt    PS_jmpretfnewpt

llvm-svn: 278499

7 years ago[Hexagon] Treat non-returning indirect calls as scheduling boundaries
Krzysztof Parzyszek [Fri, 12 Aug 2016 11:01:10 +0000 (11:01 +0000)]
[Hexagon] Treat non-returning indirect calls as scheduling boundaries

llvm-svn: 278498

7 years agoFix cuda-detect.cu when CLANG_DEFAULT_CXX_STDLIB is set
Jonas Hahnfeld [Fri, 12 Aug 2016 10:36:04 +0000 (10:36 +0000)]
Fix cuda-detect.cu when CLANG_DEFAULT_CXX_STDLIB is set

Reported by Ismail Donmez!

llvm-svn: 278497

7 years ago[LVI] Take range metadata into account while calculating icmp condition constraints
Artur Pilipenko [Fri, 12 Aug 2016 10:14:11 +0000 (10:14 +0000)]
[LVI] Take range metadata into account while calculating icmp condition constraints

Take range metadata into account for conditions like this:

%length = load i32, i32* %length_ptr, !range !{i32 0, i32 2147483647}
%cmp = icmp ult i32 %a, %length

This is a common pattern for range checks where the length of the array is dynamically loaded.

Reviewed By: sanjoy

Differential Revision: https://reviews.llvm.org/D23267

llvm-svn: 278496

7 years ago[Webassembly] disable unstable test.
Benjamin Kramer [Fri, 12 Aug 2016 10:13:45 +0000 (10:13 +0000)]
[Webassembly] disable unstable test.

It reads uninitialized memory and crashes randomly.

llvm-svn: 278495

7 years ago[X86][SSE] Fixed PALIGNR target shuffle decode
Simon Pilgrim [Fri, 12 Aug 2016 10:10:51 +0000 (10:10 +0000)]
[X86][SSE] Fixed PALIGNR target shuffle decode

The PALIGNR target shuffle decode was not taking into account that DecodePALIGNRMask (rather oddly) expects the operands to be in reverse order, nor was it detecting unary patterns, causing combines to combine with the incorrect input.

The cgbuiltin, auto upgrade and instruction comments code correctly swap the operands so are not affected.

llvm-svn: 278494

7 years ago[LVI] Handle any predicate in comparisons like icmp <pred> (add Val, Offset), ...
Artur Pilipenko [Fri, 12 Aug 2016 10:05:11 +0000 (10:05 +0000)]
[LVI] Handle any predicate in comparisons like icmp <pred> (add Val, Offset), ...

Currently LVI can only gather value constraints from comparisons like:

* icmp <pred> Val, ...
* icmp ult (add Val, Offset), ...

In fact we can handle any predicate in latter comparisons.

Reviewed By: sanjoy

Differential Revision: https://reviews.llvm.org/D23357

llvm-svn: 278493

7 years ago[Sparc][Leon] Missed resetting option flags from check-in 278489.
Chris Dewhurst [Fri, 12 Aug 2016 09:54:39 +0000 (09:54 +0000)]
[Sparc][Leon] Missed resetting option flags from check-in 278489.

llvm-svn: 278492

7 years agoXFAIL TestNamespaceDefinitions on gcc-4.8 and below
Pavel Labath [Fri, 12 Aug 2016 09:52:14 +0000 (09:52 +0000)]
XFAIL TestNamespaceDefinitions on gcc-4.8 and below

llvm-svn: 278491

7 years agoMake TestCallStopAndContinue clang-format-resilient
Pavel Labath [Fri, 12 Aug 2016 09:39:22 +0000 (09:39 +0000)]
Make TestCallStopAndContinue clang-format-resilient

llvm-svn: 278490

7 years ago[Sparc][Leon] Errata fixes for various errata in different versions of the Leon varia...
Chris Dewhurst [Fri, 12 Aug 2016 09:34:26 +0000 (09:34 +0000)]
[Sparc][Leon] Errata fixes for various errata in different versions of the Leon variants of the Sparc 32 bit processor.

The nature of the errata are listed in the comments preceding the errata fix passes. Relevant unit tests are implemented for each of these.

These changes update older versions of these errata fixes with improvements to code and unit tests.

Differential Revision: https://reviews.llvm.org/D21960

llvm-svn: 278489

7 years agoPrune unused diagnostics. NFC.
Benjamin Kramer [Fri, 12 Aug 2016 09:23:14 +0000 (09:23 +0000)]
Prune unused diagnostics. NFC.

llvm-svn: 278488

7 years ago[C++1z] Fix crash when decomposing structs with anonymous members.
Benjamin Kramer [Fri, 12 Aug 2016 09:19:34 +0000 (09:19 +0000)]
[C++1z] Fix crash when decomposing structs with anonymous members.

The diagnostic format was invalid.

llvm-svn: 278487

7 years ago[ELF] - Linkerscript: reimplemented output sections constrains matching functionality.
George Rimar [Fri, 12 Aug 2016 09:07:57 +0000 (09:07 +0000)]
[ELF] - Linkerscript: reimplemented output sections constrains matching functionality.

Previously filtering that was used worked incorrectly.
For example for next script it would just remove both sections completely:

SECTIONS {
. = 0x1000;
.aaa : ONLY_IF_RW { *(.aaa.*) }
. = 0x2000;
.aaa : ONLY_IF_RO { *(.aaa.*) }
}

Patch fixes above issues and adds testcase showing the issue. Testcase is a subset of
FreeBSD script which has:

.eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
...
.eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }

Differential revision: https://reviews.llvm.org/D23326

llvm-svn: 278486

7 years ago[Coroutines] Move class into anonymous namespace.
Benjamin Kramer [Fri, 12 Aug 2016 08:47:13 +0000 (08:47 +0000)]
[Coroutines] Move class into anonymous namespace.

Hopefully fixes visibility warnings from GCC. No functionality change.

llvm-svn: 278485

7 years agoRevert "[BranchFolding] Restrict tail merging loop blocks after MBP"
Haicheng Wu [Fri, 12 Aug 2016 08:40:24 +0000 (08:40 +0000)]
Revert "[BranchFolding] Restrict tail merging loop blocks after MBP"

This reverts commit r278463 because it hits the bot.

llvm-svn: 278484

7 years agoThis patch implements PR#22821.
Roger Ferrer Ibanez [Fri, 12 Aug 2016 08:04:13 +0000 (08:04 +0000)]
This patch implements PR#22821.

Taking the address of a packed member is dangerous since the reduced
alignment of the pointee is lost. This can lead to memory alignment
faults in some architectures if the pointer value is dereferenced.

This change adds a new warning to clang emitted when taking the address
of a packed member. A packed member is either a field/data member
declared as attribute((packed)) or belonging to a struct/class
declared as such. The associated flag is -Waddress-of-packed-member.
Conversions (either implicit or via a valid casting) to pointer types
with lower or equal alignment requirements (e.g. void* or char*)
will silence the warning.

Differential Revision: https://reviews.llvm.org/D20561

llvm-svn: 278483

7 years ago[ELF][MIPS] Support .MIPS.abiflags section
Simon Atanasyan [Fri, 12 Aug 2016 06:28:49 +0000 (06:28 +0000)]
[ELF][MIPS] Support .MIPS.abiflags section

This section supersedes .reginfo and .MIPS.options sections. But for now
we have to support all three sections for ABI transition period.

llvm-svn: 278482

7 years ago[Coroutines]: Part6b: Add coro.id intrinsic.
Gor Nishanov [Fri, 12 Aug 2016 05:45:49 +0000 (05:45 +0000)]
[Coroutines]: Part6b: Add coro.id intrinsic.

Summary:
1. Make coroutine representation more robust against optimization that may duplicate instruction by introducing coro.id intrinsics that returns a token that will get fed into coro.alloc and coro.begin. Due to coro.id returning a token, it won't get duplicated and can be used as reliable indicator of coroutine identify when a particular coroutine call gets inlined.
2. Move last three arguments of coro.begin into coro.id as they will be shared if coro.begin will get duplicated.
3. doc + test + code updated to support the new intrinsic.

Reviewers: mehdi_amini, majnemer

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D23412

llvm-svn: 278481

7 years ago[ELF][MIPS] Fix the comment
Simon Atanasyan [Fri, 12 Aug 2016 05:43:42 +0000 (05:43 +0000)]
[ELF][MIPS] Fix the comment

llvm-svn: 278480

7 years agoADT: Remove all ilist_iterator => pointer casts, NFC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 05:05:36 +0000 (05:05 +0000)]
ADT: Remove all ilist_iterator => pointer casts, NFC

Remove all ilist_iterator to pointer casts.  There were two reasons for
casts:

  - Checking for an uninitialized (i.e., null) iterator.  I added
    MachineInstrBundleIterator::isValid() to check for that case.

  - Comparing an iterator against the underlying pointer value while
    avoiding converting the pointer value to an iterator.  This is
    occasionally necessary in MachineInstrBundleIterator, since there is
    an assertion in the constructors that the underlying MachineInstr is
    not bundled (but we don't care about that if we're just checking for
    pointer equality).

To support the latter case, I rewrote the == and != operators for
ilist_iterator and MachineInstrBundleIterator.

  - The implicit constructors now use enable_if to exclude
    const-iterator => non-const-iterator conversions from overload
    resolution (previously it was a compiler error on instantiation, now
    it's SFINAE).

  - The == and != operators are now global (friends), and are not
    templated.

  - MachineInstrBundleIterator has overloads to compare against both
    const_pointer and const_reference.  This avoids the implicit
    conversions to MachineInstrBundleIterator that assert, instead just
    checking the address (and I added unit tests to confirm this).

Notably, the only remaining uses of ilist_iterator::getNodePtrUnchecked
are in ilist.h, and no code outside of ilist*.h directly relies on this
UB end-iterator-to-pointer conversion anymore.  It's still needed for
ilist_*sentinel_traits, but I'll clean that up soon.

llvm-svn: 278478

7 years agoUse the range variant of transform instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:45 +0000 (04:32 +0000)]
Use the range variant of transform instead of unpacking begin/end

No functionality change is intended.

llvm-svn: 278477

7 years agoUse the range variant of transform instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:42 +0000 (04:32 +0000)]
Use the range variant of transform instead of unpacking begin/end

No functionality change is intended.

llvm-svn: 278476

7 years agoUse the range variant of remove_if instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:37 +0000 (04:32 +0000)]
Use the range variant of remove_if instead of unpacking begin/end

No functionality change is intended.

llvm-svn: 278475

7 years agoUse the range variant of count_if instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:29 +0000 (04:32 +0000)]
Use the range variant of count_if instead of unpacking begin/end

No functionality change is intended.

llvm-svn: 278474

7 years agoAdd comments.
Rui Ueyama [Fri, 12 Aug 2016 04:28:20 +0000 (04:28 +0000)]
Add comments.

llvm-svn: 278473

7 years ago[Sema] Fix the wording of a comment. NFC.
George Burgess IV [Fri, 12 Aug 2016 04:19:35 +0000 (04:19 +0000)]
[Sema] Fix the wording of a comment. NFC.

llvm-svn: 278472

7 years ago[Sema] Fix a crash on variadic enable_if functions.
George Burgess IV [Fri, 12 Aug 2016 04:12:31 +0000 (04:12 +0000)]
[Sema] Fix a crash on variadic enable_if functions.

Currently, when trying to evaluate an enable_if condition, we try to
evaluate all arguments a user passes to a function. Given that we can't
use variadic arguments from said condition anyway, not converting them
is a reasonable thing to do. So, this patch makes us ignore any varargs
when attempting to check an enable_if condition.

We'd crash because, in order to convert an argument, we need its
ParmVarDecl. Variadic arguments don't have ParmVarDecls.

llvm-svn: 278471

7 years agoRename getSizeOfHeaders -> getHeaderSize.
Rui Ueyama [Fri, 12 Aug 2016 04:00:22 +0000 (04:00 +0000)]
Rename getSizeOfHeaders -> getHeaderSize.

We have getSectionSize for SIZEOF command. So, I think
getHeaderSize is a better name for SIZEOF_HEADERS.

llvm-svn: 278470

7 years agoUse the range variant of find/find_if instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 03:55:06 +0000 (03:55 +0000)]
Use the range variant of find/find_if instead of unpacking begin/end

If the result of the find is only used to compare against end(), just
use is_contained instead.

No functionality change is intended.

llvm-svn: 278469

7 years agoCore: Remove custom next-prev traits from SimpleReference, NFC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 03:35:47 +0000 (03:35 +0000)]
Core: Remove custom next-prev traits from SimpleReference, NFC

There's nothing special about the _next/_prev pointers in
SimpleReference, so just use ilist_node to do the work.

llvm-svn: 278468

7 years agoADT: Add ilist_iterator conversions to/from ilist_node
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 03:35:33 +0000 (03:35 +0000)]
ADT: Add ilist_iterator conversions to/from ilist_node

Allow an ilist_iterator to be constructed from an ilist_node, and give
access to the underlying ilist_node as well.

This will be used immediately in lld to support a type-erasure use case.
Longer term, they'll stick around once the iterator is using
ilist_node<NodeTy>* instead of NodeTy*.

llvm-svn: 278467

7 years agoRecommit 'Remove the restriction that MachineSinking is now stopped by
Wei Mi [Fri, 12 Aug 2016 03:33:22 +0000 (03:33 +0000)]
Recommit 'Remove the restriction that MachineSinking is now stopped by
"insert_subreg, subreg_to_reg, and reg_sequence" instructions' after
adjusting some unittest checks.

This is to solve PR28852. The restriction was added at 2010 to make better register
coalescing. We assumed that it was not necessary any more. Testing results on x86
supported the assumption.

We will look closely to any performance impact it will bring and will be prepared
to help analyzing performance problem found on other architectures.

Differential Revision: https://reviews.llvm.org/D23210

llvm-svn: 278466

7 years agoEarly continue. NFC.
Rui Ueyama [Fri, 12 Aug 2016 03:33:04 +0000 (03:33 +0000)]
Early continue. NFC.

llvm-svn: 278465

7 years agoSimplify LinkerScript<ELFT>::createSections.
Rui Ueyama [Fri, 12 Aug 2016 03:31:09 +0000 (03:31 +0000)]
Simplify LinkerScript<ELFT>::createSections.

Previously, we were setting LayoutInputSection's OutputSection member
in createSections. Because when we create LayoutInputSectinos, we
don't know the output section for them, so we backfilled the member
in the function. This patch moves the code to backfill it to assignOffsets.

llvm-svn: 278464

7 years ago[BranchFolding] Restrict tail merging loop blocks after MBP
Haicheng Wu [Fri, 12 Aug 2016 03:30:23 +0000 (03:30 +0000)]
[BranchFolding] Restrict tail merging loop blocks after MBP

To fix PR28014, this patch restricts tail merging to blocks that belong to the
same loop after MBP.

Differential Revision: https://reviews.llvm.org/D23191

llvm-svn: 278463

7 years agoRemove excessive parentheses.
Rui Ueyama [Fri, 12 Aug 2016 03:25:25 +0000 (03:25 +0000)]
Remove excessive parentheses.

llvm-svn: 278462