platform/upstream/llvm.git
9 years ago[Hexagon] Updating call/jump instruction patterns.
Colin LeMahieu [Fri, 16 Jan 2015 17:05:27 +0000 (17:05 +0000)]
[Hexagon] Updating call/jump instruction patterns.

llvm-svn: 226288

9 years agoSimplify. No functionality change.
Rui Ueyama [Fri, 16 Jan 2015 16:58:58 +0000 (16:58 +0000)]
Simplify. No functionality change.

llvm-svn: 226287

9 years agoAdd comdats to dynamic init functions in the microsoft abi.
Rafael Espindola [Fri, 16 Jan 2015 16:04:45 +0000 (16:04 +0000)]
Add comdats to dynamic init functions in the microsoft abi.

llvm-svn: 226286

9 years agoMake this test a bit stricter. NFC.
Rafael Espindola [Fri, 16 Jan 2015 16:02:03 +0000 (16:02 +0000)]
Make this test a bit stricter. NFC.

llvm-svn: 226285

9 years ago[PECOFF] Improve parallelism.
Rui Ueyama [Fri, 16 Jan 2015 15:58:36 +0000 (15:58 +0000)]
[PECOFF] Improve parallelism.

llvm-svn: 226284

9 years agofew fixes for ittnotify iterface (used by Intel(R) VTune Amplifier)
Andrey Churbanov [Fri, 16 Jan 2015 15:58:03 +0000 (15:58 +0000)]
few fixes for ittnotify iterface (used by Intel(R) VTune Amplifier)

llvm-svn: 226283

9 years agoAttempt to fix the build with XCode 5.0.2 (and probably 5.1.1).
Alexander Kornienko [Fri, 16 Jan 2015 15:57:15 +0000 (15:57 +0000)]
Attempt to fix the build with XCode 5.0.2 (and probably 5.1.1).

llvm-svn: 226282

9 years agoRun the resolver in parallel with the reader.
Rui Ueyama [Fri, 16 Jan 2015 15:54:13 +0000 (15:54 +0000)]
Run the resolver in parallel with the reader.

This patch makes File::parse() multi-thread safe. If one thread is running
File::parse(), other threads will block if they try to call the same method.
File::parse() is idempotent, so you can safely call  multiple times.

With this change, we don't have to wait for all worker threads to finish
in Driver::link(). Previously, Driver::link() calls TaskGroup::sync() to
wait for all threads running File::parse(). This was not ideal because
we couldn't start the resolver until we parse all files.

This patch increase parallelism by making Driver::link() to not wait for
worker threads. The resolver calls parse() to make sure that the file
being read has been parsed, and then uses the file. In this approach,
the resolver can run with the parser threads in parallel.

http://reviews.llvm.org/D6994

llvm-svn: 226281

9 years agoAdd comdats to constructs and destructor in the microsoft abi.
Rafael Espindola [Fri, 16 Jan 2015 15:37:11 +0000 (15:37 +0000)]
Add comdats to constructs and destructor in the microsoft abi.

llvm-svn: 226280

9 years ago[sanitizer] Additional error checking.
Evgeniy Stepanov [Fri, 16 Jan 2015 15:25:16 +0000 (15:25 +0000)]
[sanitizer] Additional error checking.

llvm-svn: 226279

9 years agorestore fix for 18645, buildbot apparently gave a false positive.
Nathan Sidwell [Fri, 16 Jan 2015 15:20:14 +0000 (15:20 +0000)]
restore fix for 18645, buildbot apparently gave a false positive.
Correct logic concerning 'T &&' deduction against lvalues.

llvm-svn: 226278

9 years ago[X86][DAG] Disable target specific combine on INSERTPS dag nodes at -O0.
Andrea Di Biagio [Fri, 16 Jan 2015 14:55:26 +0000 (14:55 +0000)]
[X86][DAG] Disable target specific combine on INSERTPS dag nodes at -O0.

This patch disables target specific combine on X86ISD::INSERTPS dag nodes
if optlevel is CodeGenOpt::None.

The backend currently implements a target specific combine rule that converts
a vector load used by an INSERTPS dag node into a scalar load plus a
scalar_to_vector. This allows ISel to select a single INSERTPSrm instead of
two instructions (i.e. a vector load plus INSERTPSrr).

However, the existing target combine rule on INSERTPS nodes only works under
the assumption that ISel will always be able to match an INSERTPSrm. This is
not true in general at -O0, since the backend only allows folding a load into
the memory operand of an instruction if the optimization level is not
CodeGenOpt::None.

In the example below:

//
__m128 test(__m128 a, __m128 *b) {
  __m128 c = _mm_insert_ps(a, *b, 1 << 6);
  return c;
}
//

Before this patch, at -O0, the backend would have canonicalized the load to 'b'
into a scalar load plus scalar_to_vector. Later on, ISel would have selected an
INSERTPSrr leaving the insertps mask in an inconsistent state:

  movss 4(%rdi), %xmm1
  insertps  $64, %xmm1, %xmm0 # xmm0 = xmm1[1],xmm0[1,2,3].

With this patch, the backend avoids folding the vector load into the operand of
the INSERTPS. The new codegen at -O0 is:

  movaps (%rdi), %xmm1
  insertps  $64, %xmm1, %xmm0 # %xmm1[1],xmm0[1,2,3].

llvm-svn: 226277

9 years ago[Sanitizers] Intercept clock_gettime() on FreeBSD
Viktor Kutuzov [Fri, 16 Jan 2015 14:54:39 +0000 (14:54 +0000)]
[Sanitizers] Intercept clock_gettime() on FreeBSD
Committed unreviewed with permission.

llvm-svn: 226276

9 years ago[Sanitizers] Intercept lgamma_r() on FreeBSD
Viktor Kutuzov [Fri, 16 Jan 2015 14:52:17 +0000 (14:52 +0000)]
[Sanitizers] Intercept lgamma_r() on FreeBSD
Committed unreviewed with permission.

llvm-svn: 226275

9 years ago[ELF] Add --as-needed.
Rui Ueyama [Fri, 16 Jan 2015 14:27:01 +0000 (14:27 +0000)]
[ELF] Add --as-needed.

The previous default behavior of LLD is --as-needed. LLD linked
against a DSO only if the DSO file was actually used to link an
executable (i.e. at least one symbol was resolved using the shared
library file.)

In this patch I added a boolean flag to FileNode for --as-needed.
I also added an accessor to DSO name to shared library file class.

llvm-svn: 226274

9 years ago[asan] Change detection of allow_user_segv_handler on Android.
Evgeniy Stepanov [Fri, 16 Jan 2015 13:12:22 +0000 (13:12 +0000)]
[asan] Change detection of allow_user_segv_handler on Android.

llvm-svn: 226273

9 years agocleanup changes of cmake-building for Intel(R) Many Integrated Core Architecture
Andrey Churbanov [Fri, 16 Jan 2015 13:05:23 +0000 (13:05 +0000)]
cleanup changes of cmake-building for Intel(R) Many Integrated Core Architecture

llvm-svn: 226272

9 years agocleanup changes of building for Intel(R) Many Integrated Core Architecture
Andrey Churbanov [Fri, 16 Jan 2015 12:54:51 +0000 (12:54 +0000)]
cleanup changes of building for Intel(R) Many Integrated Core Architecture

llvm-svn: 226271

9 years ago[asan] More verbose output from one of the tests.
Evgeniy Stepanov [Fri, 16 Jan 2015 12:08:32 +0000 (12:08 +0000)]
[asan] More verbose output from one of the tests.

Trying to debug a buildbot-only failure.

llvm-svn: 226270

9 years ago[mips] Remove a redundant semicolon and add space before curly brackets. NFC.
Toma Tabacu [Fri, 16 Jan 2015 10:45:15 +0000 (10:45 +0000)]
[mips] Remove a redundant semicolon and add space before curly brackets. NFC.

llvm-svn: 226269

9 years ago[asan] Fix asan_options-include test.
Evgeniy Stepanov [Fri, 16 Jan 2015 10:30:53 +0000 (10:30 +0000)]
[asan] Fix asan_options-include test.

Wrong include order.

llvm-svn: 226268

9 years ago[sanitizer] Fix bashism in check_lint.sh.
Evgeniy Stepanov [Fri, 16 Jan 2015 10:20:49 +0000 (10:20 +0000)]
[sanitizer] Fix bashism in check_lint.sh.

llvm-svn: 226267

9 years ago[sanitizer] Cleanup linter temporary files.
Evgeniy Stepanov [Fri, 16 Jan 2015 10:09:56 +0000 (10:09 +0000)]
[sanitizer] Cleanup linter temporary files.

llvm-svn: 226266

9 years ago[ELF] Remove TargetHandler and DefaultTargetHandler constructors
Simon Atanasyan [Fri, 16 Jan 2015 09:40:21 +0000 (09:40 +0000)]
[ELF] Remove TargetHandler and DefaultTargetHandler constructors

These classes contain only abstract virtual functions. Explicit
constructors are redundant.

llvm-svn: 226265

9 years ago[X86] Refactored stack memory folding tests to explicitly force register spilling
Simon Pilgrim [Fri, 16 Jan 2015 09:32:54 +0000 (09:32 +0000)]
[X86] Refactored stack memory folding tests to explicitly force register spilling

The current 'big vectors' stack folded reload testing pattern is very bulky and makes it difficult to test all instructions as big vectors will tend to use only the ymm instruction implementations.

This patch changes the tests to use a nop call that lists explicit xmm registers as sideeffects, with this we can force a partial register spill of the relevant registers and then check that the reload is correctly folded. The asm generated only adds the forced spill, a nop instruction and a couple of extra labels (a fraction of the current approach).

More exhaustive tests will follow shortly, I've added some extra tests (the xmm versions of some of the existing folding tests) as a starting point.

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

llvm-svn: 226264

9 years ago[sanitizer] Fix compiler warning in the flag parser code.
Evgeniy Stepanov [Fri, 16 Jan 2015 09:32:31 +0000 (09:32 +0000)]
[sanitizer] Fix compiler warning in the flag parser code.

llvm-svn: 226263

9 years ago[ELF] Remove unused class field
Simon Atanasyan [Fri, 16 Jan 2015 08:58:14 +0000 (08:58 +0000)]
[ELF] Remove unused class field

No functional changes.

llvm-svn: 226262

9 years ago[ELF] s/_context/_ctx/ and clang-format the code
Simon Atanasyan [Fri, 16 Jan 2015 08:58:09 +0000 (08:58 +0000)]
[ELF] s/_context/_ctx/ and clang-format the code

No functional changes.

llvm-svn: 226261

9 years ago[ELF] Make the unhandledReferenceType() protected method
Simon Atanasyan [Fri, 16 Jan 2015 08:58:03 +0000 (08:58 +0000)]
[ELF] Make the unhandledReferenceType() protected method

No functional changes.

llvm-svn: 226260

9 years ago[ELF] Make `TargetRelocationHandler` a regular non-template class
Simon Atanasyan [Fri, 16 Jan 2015 08:57:58 +0000 (08:57 +0000)]
[ELF] Make `TargetRelocationHandler` a regular non-template class

This class defines a relocation handler interface. The interface does
not depend on the template argument so the argument is redundant.

llvm-svn: 226259

9 years ago[PPC] Remove redundant `virtual` keyword
Simon Atanasyan [Fri, 16 Jan 2015 08:57:45 +0000 (08:57 +0000)]
[PPC] Remove redundant `virtual` keyword

No functional changes.

llvm-svn: 226258

9 years ago[PPC] Remove unused class field PPCTargetRelocationHandler::_ppcTargetLayout
Simon Atanasyan [Fri, 16 Jan 2015 08:57:39 +0000 (08:57 +0000)]
[PPC] Remove unused class field PPCTargetRelocationHandler::_ppcTargetLayout

No functional changes.

llvm-svn: 226257

9 years ago[Mips] Use ELFLinkingContext class instead of MipsLinkingContext where possible
Simon Atanasyan [Fri, 16 Jan 2015 08:57:33 +0000 (08:57 +0000)]
[Mips] Use ELFLinkingContext class instead of MipsLinkingContext where possible

No functional changes.

llvm-svn: 226256

9 years ago[Mips] Make MipsLinkingContext owner of MipsELFFlagsMerger
Simon Atanasyan [Fri, 16 Jan 2015 08:57:26 +0000 (08:57 +0000)]
[Mips] Make MipsLinkingContext owner of MipsELFFlagsMerger

That reduce class dependencies and simplify the code a bit.
No functional changes.

llvm-svn: 226255

9 years ago[Mips] Remove redundant namespace names
Simon Atanasyan [Fri, 16 Jan 2015 08:57:17 +0000 (08:57 +0000)]
[Mips] Remove redundant namespace names

No functional changes.

llvm-svn: 226254

9 years ago[Mips] Allow linking object files with MIPS32 and MIPS64 instructions
Simon Atanasyan [Fri, 16 Jan 2015 08:57:08 +0000 (08:57 +0000)]
[Mips] Allow linking object files with MIPS32 and MIPS64 instructions

If object files satisfy O32 ABI they can be linked together even if some
of them contains MIPS64 or MIPS64R2 instructions.

llvm-svn: 226253

9 years agoRevert r226242 - Revert Revert Don't create new comdats in CodeGen
Timur Iskhodzhanov [Fri, 16 Jan 2015 08:38:45 +0000 (08:38 +0000)]
Revert r226242 - Revert Revert Don't create new comdats in CodeGen

This breaks AddressSanitizer (ninja check-asan) on Windows

llvm-svn: 226251

9 years ago[OPENMP] Fixed data-sharing attributes processing for variables with global
Alexey Bataev [Fri, 16 Jan 2015 07:11:33 +0000 (07:11 +0000)]
[OPENMP] Fixed data-sharing attributes processing for variables with global
storage.
This fix allows to use non-constant global variables, static local variables and static data
members in data-sharing attribute clauses in parallel and task regions.

llvm-svn: 226250

9 years agominor refactoring to remove unneeded/unspecific header files
Vince Harron [Fri, 16 Jan 2015 06:47:43 +0000 (06:47 +0000)]
minor refactoring to remove unneeded/unspecific header files

Differential review: http://reviews.llvm.org/D6919

llvm-svn: 226249

9 years agoUse report_fatal_error instead of llvm_unreachable, so we don't crash on user input
Filipe Cabecinhas [Fri, 16 Jan 2015 04:54:12 +0000 (04:54 +0000)]
Use report_fatal_error instead of llvm_unreachable, so we don't crash on user input

llvm-svn: 226248

9 years ago[PowerPC] Adjust PatchPoints for ppc64le
Hal Finkel [Fri, 16 Jan 2015 04:40:58 +0000 (04:40 +0000)]
[PowerPC] Adjust PatchPoints for ppc64le

Bill Schmidt pointed out that some adjustments would be needed to properly
support powerpc64le (using the ELF V2 ABI). For one thing, R11 is not available
as a scratch register, so we need to use R12. R12 is also available under ELF
V1, so to maintain consistency, I flipped the order to make R12 the first
scratch register in the array under both ABIs.

llvm-svn: 226247

9 years agoPE/COFF: use dyn_cast for the check of the target
Saleem Abdulrasool [Fri, 16 Jan 2015 04:14:33 +0000 (04:14 +0000)]
PE/COFF: use dyn_cast for the check of the target

The target may be a synthetic symbol like __ImageBase.  cast_or_null will ensure
that the atom is a DefinedAtom, which is not guaranteed, which was the original
reason for the cast_or_null.  Switch this to dyn_cast, which should enable
building of executables for WoA.  Unfortunately, the issue of missing base
relocations still needs to be investigated.

llvm-svn: 226246

9 years agoFix Reassociate handling of constant in presence of undef float
Mehdi Amini [Fri, 16 Jan 2015 03:00:58 +0000 (03:00 +0000)]
Fix Reassociate handling of constant in presence of undef float

http://reviews.llvm.org/D6993

llvm-svn: 226245

9 years agoFixes to DNBArchImpl in debugserver to correctly get/set
Jason Molenda [Fri, 16 Jan 2015 02:31:35 +0000 (02:31 +0000)]
Fixes to DNBArchImpl in debugserver to correctly get/set
the register state when debugging AArch32 programs (armv7
programs running on an armv8 processor).  Most notably,
there is no "fpscr" register in the register context -
there is an fpsr and an fpcr.

Also fix a bug where the floating point values could not
be written in armv7 processes.
<rdar://problem/18977767>

llvm-svn: 226244

9 years agoRemove triple detection from cmake.
Dan Albert [Fri, 16 Jan 2015 02:27:17 +0000 (02:27 +0000)]
Remove triple detection from cmake.

This isn't actually used for anything, and is broken on Darwin
(currently causing build failures now that the triple is passed to aid
cross compiling). Rather than fix unused code, just remove it.

llvm-svn: 226243

9 years agoRevert "Revert Don't create new comdats in CodeGen"
Rafael Espindola [Fri, 16 Jan 2015 02:22:55 +0000 (02:22 +0000)]
Revert "Revert Don't create new comdats in CodeGen"

This reverts commit r226173, adding r226038 back.

No change in this commit, but clang was changed to also produce trivial comdats for
costructors, destructors and vtables when needed.

Original message:

Don't create new comdats in CodeGen.

This patch stops the implicit creation of comdats during codegen.

Clang now sets the comdat explicitly when it is required. With this patch clang and gcc
now produce the same result in pr19848.

llvm-svn: 226242

9 years agoWork around to get the build bot clang-cmake-armv7-a15-full green by
Kevin Enderby [Fri, 16 Jan 2015 02:08:11 +0000 (02:08 +0000)]
Work around to get the build bot clang-cmake-armv7-a15-full green by
removing the macho-archive-headers.test added with r226228 that it is
failing on for now while I try to figure out what is going on.

llvm-svn: 226241

9 years agoLIBCXXABI_TARGET_TRIPLE won't always be set.
Dan Albert [Fri, 16 Jan 2015 01:10:09 +0000 (01:10 +0000)]
LIBCXXABI_TARGET_TRIPLE won't always be set.

Fixes issue with r226235. Build configuration difference between
libc++ and libc++abi.

llvm-svn: 226240

9 years agoAnother attempt to fix the build bot clang-cmake-armv7-a15-full failing on
Kevin Enderby [Fri, 16 Jan 2015 01:09:54 +0000 (01:09 +0000)]
Another attempt to fix the build bot clang-cmake-armv7-a15-full failing on
the macho-archive-headers.test added with r226228.

llvm-svn: 226239

9 years agoAdd a new pass "inductive range check elimination"
Sanjoy Das [Fri, 16 Jan 2015 01:03:22 +0000 (01:03 +0000)]
Add a new pass "inductive range check elimination"

IRCE eliminates range checks of the form

  0 <= A * I + B < Length

by splitting a loop's iteration space into three segments in a way
that the check is completely redundant in the middle segment.  As an
example, IRCE will convert

  len = < known positive >
  for (i = 0; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }

to

  len = < known positive >
  limit = smin(n, len)
  // no first segment
  for (i = 0; i < limit; i++) {
    if (0 <= i && i < len) { // this check is fully redundant
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }
  for (i = limit; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }

IRCE can deal with multiple range checks in the same loop (it takes
the intersection of the ranges that will make each of them redundant
individually).

Currently IRCE does not do any profitability analysis.  That is a
TODO.

Please note that the status of this pass is *experimental*, and it is
not part of any default pass pipeline.  Having said that, I will love
to get feedback and general input from people interested in trying
this out.

This pass was originally r226201.  It was reverted because it used C++
features not supported by MSVC 2012.

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

llvm-svn: 226238

9 years ago[libc++] Add support for cross compiling.
Dan Albert [Fri, 16 Jan 2015 00:55:15 +0000 (00:55 +0000)]
[libc++] Add support for cross compiling.

Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 226237

9 years agoUse std::recursive_mutex instead of llvm's SmartMutex.
Rui Ueyama [Fri, 16 Jan 2015 00:55:01 +0000 (00:55 +0000)]
Use std::recursive_mutex instead of llvm's SmartMutex.

llvm-svn: 226236

9 years ago[libc++abi] Add support for cross compiling.
Dan Albert [Fri, 16 Jan 2015 00:52:11 +0000 (00:52 +0000)]
[libc++abi] Add support for cross compiling.

Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 226235

9 years agoAdd Socket::Get[Remote/Local]IpAddress and unit tests
Vince Harron [Fri, 16 Jan 2015 00:47:08 +0000 (00:47 +0000)]
Add Socket::Get[Remote/Local]IpAddress and unit tests

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

llvm-svn: 226234

9 years agoGive lldb a clean null build.
Nico Weber [Fri, 16 Jan 2015 00:35:05 +0000 (00:35 +0000)]
Give lldb a clean null build.

`ninja lldb` used to always run "echo -n", which on OS X results in literally
echoing "-n" to the screen.  Just remove the command from add_custom_target,
then it only adds an alias and `ninja lldb` now reports "no work to do".

Other than that, no intended behavior change.

llvm-svn: 226233

9 years agoThis should fix the build bot clang-cmake-armv7-a15-full failing on
Kevin Enderby [Fri, 16 Jan 2015 00:27:31 +0000 (00:27 +0000)]
This should fix the build bot clang-cmake-armv7-a15-full failing on
the macho-archive-headers.test added with r226228.

llvm-svn: 226232

9 years agoAdd comment regarding which i386 registers are non-volatile instead of
Jason Molenda [Fri, 16 Jan 2015 00:27:25 +0000 (00:27 +0000)]
Add comment regarding which i386 registers are non-volatile instead of
just pointing to the standard document regarding this.

llvm-svn: 226231

9 years agoR600/SI: Add patterns for v_cvt_{flr|rpi}_i32_f32
Matt Arsenault [Thu, 15 Jan 2015 23:58:35 +0000 (23:58 +0000)]
R600/SI: Add patterns for v_cvt_{flr|rpi}_i32_f32

llvm-svn: 226230

9 years agoFix edge case when Start overflowed in 32 bit mode
Filipe Cabecinhas [Thu, 15 Jan 2015 23:50:44 +0000 (23:50 +0000)]
Fix edge case when Start overflowed in 32 bit mode

llvm-svn: 226229

9 years agoAdd the option, -archive-headers, used with -macho to print the Mach-O archive header...
Kevin Enderby [Thu, 15 Jan 2015 23:19:11 +0000 (23:19 +0000)]
Add the option, -archive-headers, used with -macho to print the Mach-O archive headers to llvm-objdump.

llvm-svn: 226228

9 years agoUse a trivial comdat for C++ tables.
Rafael Espindola [Thu, 15 Jan 2015 23:18:01 +0000 (23:18 +0000)]
Use a trivial comdat for C++ tables.

This produces comdats for vtables, typeinfo, typeinfo names, and vtts.

When combined with llvm not producing implicit comdats, not doing this would
cause code bloat on ELF and link errors on COFF.

llvm-svn: 226227

9 years agoR600/SI: Fix trailing comma with modifiers
Matt Arsenault [Thu, 15 Jan 2015 23:17:03 +0000 (23:17 +0000)]
R600/SI: Fix trailing comma with modifiers

Instructions with 1 operand can still use source modifiers,
so make sure we don't print an extra comma afterwards.

llvm-svn: 226226

9 years agoSimplify.
Rui Ueyama [Thu, 15 Jan 2015 23:15:09 +0000 (23:15 +0000)]
Simplify.

llvm-svn: 226225

9 years ago[Hexagon] Adding new-value store and bit reverse instructions.
Colin LeMahieu [Thu, 15 Jan 2015 23:10:29 +0000 (23:10 +0000)]
[Hexagon] Adding new-value store and bit reverse instructions.

llvm-svn: 226224

9 years agoPrint out environment in lit notes
Jonathan Roelofs [Thu, 15 Jan 2015 23:04:37 +0000 (23:04 +0000)]
Print out environment in lit notes

llvm-svn: 226223

9 years agoRemove the slashes so they don't fail in some Windows setups
Filipe Cabecinhas [Thu, 15 Jan 2015 23:04:15 +0000 (23:04 +0000)]
Remove the slashes so they don't fail in some Windows setups

llvm-svn: 226222

9 years agoSome fixes for thread stepping on Windows.
Zachary Turner [Thu, 15 Jan 2015 22:54:08 +0000 (22:54 +0000)]
Some fixes for thread stepping on Windows.

This hooks up the changes necessary to set the trap flag on the
CPU and properly manage the process and thread's resume state
and private state so that the ThreadPlan does its thing.

Stepping still doesn't work as of this change, because there are
some issues with stack frames where it doesn't update the thread's
frame list correctly when it breaks inside of a function, but
I will try to fix that separately.

llvm-svn: 226221

9 years agoDuring source manager test, write back the file using binary mode.
Zachary Turner [Thu, 15 Jan 2015 22:53:44 +0000 (22:53 +0000)]
During source manager test, write back the file using binary mode.

On Windows, opening with "w" opens it as text instead of binary.
This causes translation of newline characters, so that "\n" turns
into "\r\n", which in turn leads to git detecting that the file
has changed and wanting to commit it.

llvm-svn: 226220

9 years agoReport fatal errors instead of segfaulting/asserting on a few invalid accesses while...
Filipe Cabecinhas [Thu, 15 Jan 2015 22:52:38 +0000 (22:52 +0000)]
Report fatal errors instead of segfaulting/asserting on a few invalid accesses while reading MachO files.

Summary:
Shift an older “invalid file” test to get a consistent naming for these tests.

Bugs found by afl-fuzz

Reviewers: rafael

Subscribers: llvm-commits

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

llvm-svn: 226219

9 years agoFixed the regex test case after recent modifications to the "help" command output.
Greg Clayton [Thu, 15 Jan 2015 22:52:17 +0000 (22:52 +0000)]
Fixed the regex test case after recent modifications to the "help" command output.

<rdar://problem/18527567>

llvm-svn: 226218

9 years ago[Object] Add SF_Exported flag. This flag will be set on all symbols that would
Lang Hames [Thu, 15 Jan 2015 22:33:30 +0000 (22:33 +0000)]
[Object] Add SF_Exported flag. This flag will be set on all symbols that would
be exported from a dylib if their containing object file were linked into one.

No test case: No command line tools query this flag, and there are no Object
unit tests.

llvm-svn: 226217

9 years agoRevert r226201 (Add a new pass "inductive range check elimination")
Sanjoy Das [Thu, 15 Jan 2015 22:18:10 +0000 (22:18 +0000)]
Revert r226201 (Add a new pass "inductive range check elimination")

The change used C++11 features not supported by MSVC 2012.  I will fix
the change to use things supported MSVC 2012 and recommit shortly.

llvm-svn: 226216

9 years agoInductiveRangeCheckElimination: Remove extra ';'
David Majnemer [Thu, 15 Jan 2015 21:55:16 +0000 (21:55 +0000)]
InductiveRangeCheckElimination: Remove extra ';'

This silences a GCC warning.

llvm-svn: 226215

9 years agoFixing pedantic build warnings.
Andrew Kaylor [Thu, 15 Jan 2015 21:50:53 +0000 (21:50 +0000)]
Fixing pedantic build warnings.

llvm-svn: 226214

9 years agoUse a trivial comdat for inline ctor/dtor when not using C5/D5.
Rafael Espindola [Thu, 15 Jan 2015 21:36:08 +0000 (21:36 +0000)]
Use a trivial comdat for inline ctor/dtor when not using C5/D5.

When combined with llvm not producing implicit comdats, not doing this would
cause code bloat on ELF and link errors on COFF.

llvm-svn: 226211

9 years ago[Hexagon] Fix 226206 by uncommenting required pattern and changing patterns for simpl...
Colin LeMahieu [Thu, 15 Jan 2015 21:35:49 +0000 (21:35 +0000)]
[Hexagon] Fix 226206 by uncommenting required pattern and changing patterns for simple load-extends.

llvm-svn: 226210

9 years ago[PowerPC] Add a target option for invariant function descriptors
Hal Finkel [Thu, 15 Jan 2015 21:22:22 +0000 (21:22 +0000)]
[PowerPC] Add a target option for invariant function descriptors

The PPC backend will now assume that PPC64 ELFv1 function descriptors are
invariant. This must be true for well-defined C/C++ code, but I'm providing an
option to disable this assumption in case someone's JIT-engine needs it.

llvm-svn: 226209

9 years agoWarn about dllexported explicit class template instantiation declarations (PR22035)
Hans Wennborg [Thu, 15 Jan 2015 21:18:30 +0000 (21:18 +0000)]
Warn about dllexported explicit class template instantiation declarations (PR22035)

Clang would previously become confused and crash here.

It does not make a lot of sense to export these, so warning seems appropriate.

MSVC will export some member functions for this kind of specializations, whereas
MinGW ignores the dllexport-edness. The latter behaviour seems better.

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

llvm-svn: 226208

9 years ago[PowerPC] Loosen ELFv1 PPC64 func descriptor loads for indirect calls
Hal Finkel [Thu, 15 Jan 2015 21:17:34 +0000 (21:17 +0000)]
[PowerPC] Loosen ELFv1 PPC64 func descriptor loads for indirect calls

Function pointers under PPC64 ELFv1 (which is used on PPC64/Linux on the
POWER7, A2 and earlier cores) are really pointers to a function descriptor, a
structure with three pointers: the actual pointer to the code to which to jump,
the pointer to the TOC needed by the callee, and an environment pointer. We
used to chain these loads, and make them opaque to the rest of the optimizer,
so that they'd always occur directly before the call. This is not necessary,
and in fact, highly suboptimal on embedded cores. Once the function pointer is
known, the loads can be performed ahead of time; in fact, they can be hoisted
out of loops.

Now these function descriptors are almost always generated by the linker, and
thus the contents of the descriptors are invariant. As a result, by default,
we'll mark the associated loads as invariant (allowing them to be hoisted out
of loops). I've added a target feature to turn this off, however, just in case
someone needs that option (constructing an on-stack descriptor, casting it to a
function pointer, and then calling it cannot be well-defined C/C++ code, but I
can imagine some JIT-compilation system doing so).

Consider this simple test:
  $ cat call.c

  typedef void (*fp)();
  void bar(fp x) {
    for (int i = 0; i < 1600000000; ++i)
      x();
  }

  $ cat main.c

  typedef void (*fp)();
  void bar(fp x);
  void foo() {}
  int main() {
    bar(foo);
  }

On the PPC A2 (the BG/Q supercomputer), marking the function-descriptor loads
as invariant brings the execution time down to ~8 seconds from ~32 seconds with
the loads in the loop.

The difference on the POWER7 is smaller. Compiling with:

  gcc -std=c99 -O3 -mcpu=native call.c main.c : ~6 seconds [this is 4.8.2]

  clang -O3 -mcpu=native call.c main.c : ~5.3 seconds

  clang -O3 -mcpu=native call.c main.c -mno-invariant-function-descriptors : ~4 seconds
  (looks like we'd benefit from additional loop unrolling here, as a first
   guess, because this is faster with the extra loads)

The -mno-invariant-function-descriptors will be added to Clang shortly.

llvm-svn: 226207

9 years ago[Hexagon] Updating indexed load-extend patterns and changing test to new expected...
Colin LeMahieu [Thu, 15 Jan 2015 21:07:52 +0000 (21:07 +0000)]
[Hexagon] Updating indexed load-extend patterns and changing test to new expected output.

llvm-svn: 226206

9 years agoAdd "explicit".
Rui Ueyama [Thu, 15 Jan 2015 21:05:00 +0000 (21:05 +0000)]
Add "explicit".

llvm-svn: 226205

9 years agoUriParser - fixed potential buffer overrun
Vince Harron [Thu, 15 Jan 2015 20:57:01 +0000 (20:57 +0000)]
UriParser - fixed potential buffer overrun

Switched from ::strtoul to StringConvert::ToUInt32
Changed port output parameter to be -1 if port is unspecified

llvm-svn: 226204

9 years ago[asan] Loosen test for upcoming ppc64 change
Hal Finkel [Thu, 15 Jan 2015 20:48:38 +0000 (20:48 +0000)]
[asan] Loosen test for upcoming ppc64 change

This test casts 0x4 to a function pointer and calls it. Unfortunately, the
faulting address may not exactly be 0x4 on PPC64 ELFv1 systems. The LLVM PPC
backend used to always generate the loads "in order", so we'd fault at 0x4
anyway. However, at upcoming change to loosen that ordering, and we'll pick a
different order on some targets. As a result, as explained in the comment, we
need to allow for certain nearby addresses as well.

llvm-svn: 226202

9 years agoAdd a new pass "inductive range check elimination"
Sanjoy Das [Thu, 15 Jan 2015 20:45:46 +0000 (20:45 +0000)]
Add a new pass "inductive range check elimination"

IRCE eliminates range checks of the form

  0 <= A * I + B < Length

by splitting a loop's iteration space into three segments in a way
that the check is completely redundant in the middle segment.  As an
example, IRCE will convert

  len = < known positive >
  for (i = 0; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }

to

  len = < known positive >
  limit = smin(n, len)
  // no first segment
  for (i = 0; i < limit; i++) {
    if (0 <= i && i < len) { // this check is fully redundant
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }
  for (i = limit; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }

IRCE can deal with multiple range checks in the same loop (it takes
the intersection of the ranges that will make each of them redundant
individually).

Currently IRCE does not do any profitability analysis.  That is a
TODO.

Please note that the status of this pass is *experimental*, and it is
not part of any default pass pipeline.  Having said that, I will love
to get feedback and general input from people interested in trying
this out.

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

llvm-svn: 226201

9 years agoRevert "r226086 - Revert "r226071 - [RegisterCoalescer] Remove copies to reserved...
Hal Finkel [Thu, 15 Jan 2015 20:32:09 +0000 (20:32 +0000)]
Revert "r226086 - Revert "r226071 - [RegisterCoalescer] Remove copies to reserved registers""

Reapply r226071 with fixes. Two fixes:

 1. We need to manually remove the old and create the new 'deaf defs'
    associated with physical register definitions when we move the definition of
    the physical register from the copy point to the point of the original vreg def.

    This problem was picked up by the machinstr verifier, and could trigger a
    verification failure on test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll, so I've
    turned on the verifier in the tests.

 2. When moving the def point of the phys reg up, we need to make sure that it
    is neither defined nor read in between the two instructions. We don't, however,
    extend the live ranges of phys reg defs to cover uses, so just checking for
    live-range overlap between the pair interval and the phys reg aliases won't
    pick up reads. As a result, we manually iterate over the range and check for
    reads.

    A test soon to be committed to the PowerPC backend will test this change.

Original commit message:

[RegisterCoalescer] Remove copies to reserved registers

This allows the RegisterCoalescer to join "non-flipped" range pairs with a
physical destination register -- which allows the RegisterCoalescer to remove
copies like this:

<vreg> = something (maybe a load, for example)
... (things that don't use PHYSREG)
PHYSREG = COPY <vreg>

(with all of the restrictions normally applied by the RegisterCoalescer: having
compatible register classes, etc. )

Previously, the RegisterCoalescer handled only the opposite case (copying
*from* a physical register). I don't handle the problem fully here, but try to
get the common case where there is only one use of <vreg> (the COPY).

An upcoming commit to the PowerPC backend will make this pattern much more
common on PPC64/ELF systems.

llvm-svn: 226200

9 years agoMoved Args::StringToXIntYZ to StringConvert::ToXIntYZ
Vince Harron [Thu, 15 Jan 2015 20:08:35 +0000 (20:08 +0000)]
Moved Args::StringToXIntYZ to StringConvert::ToXIntYZ

The refactor was motivated by some comments that Greg made
http://reviews.llvm.org/D6918

and also to break a dependency cascade that caused functions linking
in string->int conversion functions to pull in most of lldb

llvm-svn: 226199

9 years agoStyle cleanup of old gc.root lowering code
Philip Reames [Thu, 15 Jan 2015 19:49:25 +0000 (19:49 +0000)]
Style cleanup of old gc.root lowering code

Use static functions for helpers rather than static member functions.  a) this changes the linking (minor at best), and b) this makes it obvious no object state is involved.

llvm-svn: 226198

9 years agoR600/SI: Improve fpext / fptrunc test coverage
Matt Arsenault [Thu, 15 Jan 2015 19:39:42 +0000 (19:39 +0000)]
R600/SI: Improve fpext / fptrunc test coverage

llvm-svn: 226197

9 years agoclang-format GCStrategy.cpp & GCRootLowering.cpp (NFC)
Philip Reames [Thu, 15 Jan 2015 19:39:17 +0000 (19:39 +0000)]
clang-format GCStrategy.cpp & GCRootLowering.cpp (NFC)

llvm-svn: 226196

9 years agoSplit GCStrategy.cpp into two files (NFC)
Philip Reames [Thu, 15 Jan 2015 19:29:42 +0000 (19:29 +0000)]
Split GCStrategy.cpp into two files (NFC)

This preparation for an update to http://reviews.llvm.org/D6811.  GCStrategy.cpp will hopefully be moving into IR/, where as the lowering logic needs to stay in CodeGen/

llvm-svn: 226195

9 years ago[Hexagon] Removing old versions of vsplice, valign, cl0, ct0 and updating references...
Colin LeMahieu [Thu, 15 Jan 2015 19:28:32 +0000 (19:28 +0000)]
[Hexagon] Removing old versions of vsplice, valign, cl0, ct0 and updating references to new versions.

llvm-svn: 226194

9 years agoUse set() instead of option() for string option.
Dan Albert [Thu, 15 Jan 2015 18:56:45 +0000 (18:56 +0000)]
Use set() instead of option() for string option.

Fixes issue in r226185.

llvm-svn: 226192

9 years agoR600/SI: Unify VOP2 instructions which are VOP3-only on VI
Marek Olsak [Thu, 15 Jan 2015 18:43:06 +0000 (18:43 +0000)]
R600/SI: Unify VOP2 instructions which are VOP3-only on VI

This removes some duplicated classes and definitions.

These instructions are defined:
  _e32 // pseudo
  _e32_si
  _e64 // pseudo
  _e64_si
  _e64_vi

llvm-svn: 226191

9 years agoR600/SI: Use 64-bit encoding by default for opcodes that are VOP3-only on VI
Marek Olsak [Thu, 15 Jan 2015 18:43:01 +0000 (18:43 +0000)]
R600/SI: Use 64-bit encoding by default for opcodes that are VOP3-only on VI

llvm-svn: 226190

9 years agoR600/SI: Add V_READLANE_B32 and V_WRITELANE_B32 for VI
Marek Olsak [Thu, 15 Jan 2015 18:42:55 +0000 (18:42 +0000)]
R600/SI: Add V_READLANE_B32 and V_WRITELANE_B32 for VI

These are VOP3-only on VI.

The new multiclass doesn't define VOP3 versions of VOP2 instructions.

llvm-svn: 226189

9 years agoR600/SI: Don't shrink instructions whose e32 encoding doesn't exist
Marek Olsak [Thu, 15 Jan 2015 18:42:51 +0000 (18:42 +0000)]
R600/SI: Don't shrink instructions whose e32 encoding doesn't exist

v2: modify hasVALU32BitEncoding instead
v3: - add pseudoToMCOpcode helper to AMDGPUInstInfo, which is used by both
      hasVALU32BitEncoding and AMDGPUMCInstLower::lower
    - report an error if a pseudo can't be lowered
llvm-svn: 226188

9 years agoR600/SI: Add common class VOPAnyCommon
Marek Olsak [Thu, 15 Jan 2015 18:42:44 +0000 (18:42 +0000)]
R600/SI: Add common class VOPAnyCommon

llvm-svn: 226187

9 years agoR600/SI: Don't select SI-only VOP3 opcodes on VI
Marek Olsak [Thu, 15 Jan 2015 18:42:40 +0000 (18:42 +0000)]
R600/SI: Don't select SI-only VOP3 opcodes on VI

llvm-svn: 226186

9 years agoAdd a cmake option for LIT configuration variant.
Dan Albert [Thu, 15 Jan 2015 18:35:04 +0000 (18:35 +0000)]
Add a cmake option for LIT configuration variant.

llvm-svn: 226185

9 years ago[Hexagon] Adding vmux instruction. Removing old transfer instructions and updating...
Colin LeMahieu [Thu, 15 Jan 2015 18:16:00 +0000 (18:16 +0000)]
[Hexagon] Adding vmux instruction.  Removing old transfer instructions and updating references.

llvm-svn: 226184