platform/upstream/llvm.git
9 years ago[x32] Mark RBX as reserved when EBX is the base pointer.
Michael Kuperstein [Tue, 24 Feb 2015 16:13:16 +0000 (16:13 +0000)]
[x32] Mark RBX as reserved when EBX is the base pointer.

This should have gone into r230334.

llvm-svn: 230339

9 years agofix typo in comment; NFC
Sanjay Patel [Tue, 24 Feb 2015 16:11:05 +0000 (16:11 +0000)]
fix typo in comment; NFC

llvm-svn: 230338

9 years agoOmit a default argument
Johannes Doerfert [Tue, 24 Feb 2015 16:02:16 +0000 (16:02 +0000)]
Omit a default argument

llvm-svn: 230337

9 years ago[FIX] Silence warning
Johannes Doerfert [Tue, 24 Feb 2015 16:00:41 +0000 (16:00 +0000)]
[FIX] Silence warning

llvm-svn: 230336

9 years ago[FIX] Some comments
Johannes Doerfert [Tue, 24 Feb 2015 16:00:29 +0000 (16:00 +0000)]
[FIX] Some comments

llvm-svn: 230335

9 years ago[x32] x32 should use ebx as the base pointer.
Michael Kuperstein [Tue, 24 Feb 2015 15:27:13 +0000 (15:27 +0000)]
[x32] x32 should use ebx as the base pointer.

This fixes the original issue in PR22655, but not the secondary one.

llvm-svn: 230334

9 years agoCommit patch for PR19649. Set the correct sign of wide character for literals based...
Michael Wong [Tue, 24 Feb 2015 13:34:20 +0000 (13:34 +0000)]
Commit patch for PR19649. Set the correct sign of wide character for literals based on underlying type of wchar_t.
Reviewed:
http://reviews.llvm.org/D7559
Patch by Rachel Craig; Test cases by Hubert Tong.

llvm-svn: 230333

9 years ago[SDAG] Handle LowerOperation returning its input consistently
Hal Finkel [Tue, 24 Feb 2015 12:59:47 +0000 (12:59 +0000)]
[SDAG] Handle LowerOperation returning its input consistently

For almost all node types, if the target requested custom lowering, and
LowerOperation returned its input, we'd treat the original node as legal. This
did not work, however, for many loads and stores, because they follow
slightly different code paths, and we did not account for the possibility of
LowerOperation returning its input at those call sites.

I think that we now handle this consistently everywhere. At the call sites in
LegalizeDAG, we used to assert in this case, so there's no functional change
for any existing code there. For the call sites in LegalizeVectorOps, this
really only affects whether or not we set Changed = true, but I think makes the
semantics clearer.

No test case here, but it will be covered by an upcoming PowerPC commit adding
QPX support.

llvm-svn: 230332

9 years ago[OPENMP] Update codegen for 'omp flush' directive.
Alexey Bataev [Tue, 24 Feb 2015 12:55:09 +0000 (12:55 +0000)]
[OPENMP] Update codegen for 'omp flush' directive.
__kmpc_omp_flush() runtime library now has only one argument and is not a vararg
anymore. This update makes the codegen compatible with these changes.

llvm-svn: 230331

9 years agoMake the forward declaration for array swap have the same inline/visibility attribute...
Marshall Clow [Tue, 24 Feb 2015 12:46:39 +0000 (12:46 +0000)]
Make the forward declaration for array swap have the same inline/visibility attributes as the definition. Thanks to Steven Wu for the catch.

llvm-svn: 230330

9 years agoAllow non-affine control flow -- SCoP Modeling
Johannes Doerfert [Tue, 24 Feb 2015 12:00:50 +0000 (12:00 +0000)]
Allow non-affine control flow -- SCoP Modeling

  This allows us to model non-affine regions in the SCoP representation.
  SCoP statements can now describe either basic blocks or non-affine
  regions. In the latter case all accesses in the region are accumulated
  for the statement and write accesses, except in the entry, have to be
  marked as may-write.

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

llvm-svn: 230329

9 years agoAdd ScalarEvolution bounds to non-affine access functions
Johannes Doerfert [Tue, 24 Feb 2015 11:58:30 +0000 (11:58 +0000)]
Add ScalarEvolution bounds to non-affine access functions

llvm-svn: 230328

9 years ago[mips] Reformat some TableGen definitions. NFC.
Toma Tabacu [Tue, 24 Feb 2015 11:52:19 +0000 (11:52 +0000)]
[mips] Reformat some TableGen definitions. NFC.

Summary: Separated some instruction and pseudo-instruction definitions from InstAlias definitions, added banner for pseudo-instructions and removed a redundant whitespace from a pseudo-instruction definition. No functional change.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 230327

9 years ago[FIX] Create single exiting block
Johannes Doerfert [Tue, 24 Feb 2015 11:46:18 +0000 (11:46 +0000)]
[FIX] Create single exiting block

llvm-svn: 230326

9 years agoAllow non-affine control flow -- SCoP Detection
Johannes Doerfert [Tue, 24 Feb 2015 11:45:21 +0000 (11:45 +0000)]
Allow non-affine control flow -- SCoP Detection

  With this patch we allow the SCoP detection to detect regions as SCoPs
  which have non-affine control flow inside. All non-affine regions are
  tracked and later accessible to the ScopInfo.

  As there is no real difference, non-affine branches as well as
  floating point branches are covered (and both called non-affine
  control flow).  However, the detection is restricted to
  overapproximate only loop free regions.

llvm-svn: 230325

9 years agoAllow sanitizer to work with "old" kernel headers
Renato Golin [Tue, 24 Feb 2015 11:38:41 +0000 (11:38 +0000)]
Allow sanitizer to work with "old" kernel headers

Sanitizers work on ancient kernels and were depending on types existing.
When those types were removed, the sanitizer build broke. See bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59009 for more information.

This patch fixes it by isolating the need for those types only when the
feature is actually needed, thus allowing one to compile the kernel with
or without that change, irrespective of its version.

Patch by Christophe Lyon.

llvm-svn: 230324

9 years agoTry to unbreak sanitizer-x86_64-linux-autoconf after r230318
Kuba Brecka [Tue, 24 Feb 2015 11:12:44 +0000 (11:12 +0000)]
Try to unbreak sanitizer-x86_64-linux-autoconf after r230318

The buildbot failed to build with

    error: variable ‘enable_fp’ set but not used [-Werror=unused-but-set-variable]

let's add a `(void)enable_fp;`.

llvm-svn: 230323

9 years agoRemove XFAIL on string view test for apples clang compiler. Thanks to Marshall for...
Eric Fiselier [Tue, 24 Feb 2015 10:52:07 +0000 (10:52 +0000)]
Remove XFAIL on string view test for apples clang compiler. Thanks to Marshall for the fix

llvm-svn: 230322

9 years agoAdd -exec-abort command (MI); Don't exit on eStateExited
Ilia K [Tue, 24 Feb 2015 10:40:45 +0000 (10:40 +0000)]
Add -exec-abort command (MI); Don't exit on eStateExited

Summary:
Add -exec-abort command + test.

Also, I had fixed an error, when lldb-mi exits on eStateExited. With current patch we can re-run target:
```
-file-exec-and-symbols hello
^done
-exec-run
^running
*stopped,reason="breakpoint-hit"...
-exec-abort
^done
*stopped,reason="exited-normally"...    <- program exits
-exec-run                               <- run again
^running
*stopped,reason="breakpoint-hit"...
```

All tests pass on OS X.

Reviewers: zturner, emaste, abidh, clayborg

Reviewed By: abidh, clayborg

Subscribers: lldb-commits, emaste, zturner, clayborg, abidh

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

llvm-svn: 230321

9 years agoFix MiSignalTestCase.test_lldbmi_stopped_when_stopatentry_xxx tests after r230237
Ilia K [Tue, 24 Feb 2015 10:34:34 +0000 (10:34 +0000)]
Fix MiSignalTestCase.test_lldbmi_stopped_when_stopatentry_xxx tests after r230237

llvm-svn: 230320

9 years agoCreate ScopedTimeout class for GDBRemoteCommunication
Tamas Berghammer [Tue, 24 Feb 2015 10:23:39 +0000 (10:23 +0000)]
Create ScopedTimeout class for GDBRemoteCommunication

This new class makes it easier to change the timeout of a
GDBRemoteCommunication instance for a short time and then restore it to
its original value.

Differential revision: http://reviews.llvm.org/D7826

llvm-svn: 230319

9 years agoFix the ASan ioctl.cc test when using COMPILER_RT_DEBUG=On
Kuba Brecka [Tue, 24 Feb 2015 10:10:25 +0000 (10:10 +0000)]
Fix the ASan ioctl.cc test when using COMPILER_RT_DEBUG=On

In debug mode (COMPILER_RT_DEBUG=On), we still build with -fomit-frame-pointer and wrap_ioctl doesn't set up a proper stack frame.  In release mode it does, because ioctl_common_pre gets inlined into wrap_ioctl and it uses the COMMON_INTERCEPTOR_READ_RANGE macro which in the end calls GET_CURRENT_FRAME and that forces the compiler to generate a stack frame for the function.

Not having a proper stack frame breaks the unwinder.  This patch forces to generate a frame pointer (via ENABLE_FRAME_POINTER macro).

Reviewed at http://reviews.llvm.org/D7815

llvm-svn: 230318

9 years agoFix alloca_instruments_all_paddings.cc test to work under higher -O levels (compiler...
Kuba Brecka [Tue, 24 Feb 2015 09:47:33 +0000 (09:47 +0000)]
Fix alloca_instruments_all_paddings.cc test to work under higher -O levels (compiler-rt part)

When AddressSanitizer only a single dynamic alloca and no static allocas, due to an early exit from FunctionStackPoisoner::poisonStack we forget to unpoison the dynamic alloca.  This patch fixes that.

Reviewed at http://reviews.llvm.org/D7810

llvm-svn: 230317

9 years agoFix alloca_instruments_all_paddings.cc test to work under higher -O levels (llvm...
Kuba Brecka [Tue, 24 Feb 2015 09:47:05 +0000 (09:47 +0000)]
Fix alloca_instruments_all_paddings.cc test to work under higher -O levels (llvm part)

When AddressSanitizer only a single dynamic alloca and no static allocas, due to an early exit from FunctionStackPoisoner::poisonStack we forget to unpoison the dynamic alloca.  This patch fixes that.

Reviewed at http://reviews.llvm.org/D7810

llvm-svn: 230316

9 years ago[WinX86_64 ABI] Treat C99 _Complex as a struct
Michael Kuperstein [Tue, 24 Feb 2015 09:35:58 +0000 (09:35 +0000)]
[WinX86_64 ABI] Treat C99 _Complex as a struct

MSVC does not support C99 _Complex.
ICC, however, does support it on windows x86_64, and treats it, for purposes of parameter passing, as equivalent to a struct containing two fields (for the real and imaginary part).

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

llvm-svn: 230315

9 years agoFix codegen for virtual methods that are (re-) exported from multiple modules.
Manuel Klimek [Tue, 24 Feb 2015 09:06:28 +0000 (09:06 +0000)]
Fix codegen for virtual methods that are (re-) exported from multiple modules.

Fixes multiple crashes where a non-canonical decl would be used as key
in a lookup.

llvm-svn: 230314

9 years ago[X86] Remove the AbsMem32 type from the assembly parser. Only really need the 16...
Craig Topper [Tue, 24 Feb 2015 08:02:13 +0000 (08:02 +0000)]
[X86] Remove the AbsMem32 type from the assembly parser. Only really need the 16-bit version which will automatically get prioritized over AbsMem.

llvm-svn: 230313

9 years agoFix typo that breaks FileSystem::IsLocal
Vince Harron [Tue, 24 Feb 2015 05:24:12 +0000 (05:24 +0000)]
Fix typo that breaks FileSystem::IsLocal

llvm-svn: 230312

9 years agoCompile fix for FileSystem::IsLocal on Linux
Vince Harron [Tue, 24 Feb 2015 05:14:49 +0000 (05:14 +0000)]
Compile fix for FileSystem::IsLocal on Linux

llvm-svn: 230311

9 years agoRevert "Add clangCodeGen.a to the tools that need it after the clang module"
Adrian Prantl [Tue, 24 Feb 2015 05:14:37 +0000 (05:14 +0000)]
Revert "Add clangCodeGen.a to the tools that need it after the clang module"

llvm-svn: 230310

9 years agoRevert "Wrap clang module files in a Mach-O, ELF, or COFF container."
Adrian Prantl [Tue, 24 Feb 2015 05:14:17 +0000 (05:14 +0000)]
Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."

This reverts commit r230305.
Off to fix another round of missing dependencies on various platforms.

llvm-svn: 230309

9 years agoDon't load Framework module.map files when searching subdirectories
Ben Langmuir [Tue, 24 Feb 2015 04:58:15 +0000 (04:58 +0000)]
Don't load Framework module.map files when searching subdirectories

This would cause frameworks to have spurious "redefinition" errors if
they had both a (legacy) "module.map" and a (new) "module.modulemap" file and we
happened to do a sub-directory search in that directory using a
non-framework include path (e.g. -Ifoo/ -Ffoo/).  For migration
purposes it's very handy that the compiler will prefer the new spelling
of the filename and not look at the old one if it doesn't need to.

llvm-svn: 230308

9 years agoFix typo s/bitcodewriter/bitwriter
Adrian Prantl [Tue, 24 Feb 2015 04:49:13 +0000 (04:49 +0000)]
Fix typo s/bitcodewriter/bitwriter

llvm-svn: 230307

9 years agoAdd clangCodeGen.a to the tools that need it after the clang module
Adrian Prantl [Tue, 24 Feb 2015 04:26:29 +0000 (04:26 +0000)]
Add clangCodeGen.a to the tools that need it after the clang module
format change.

llvm-svn: 230306

9 years agoWrap clang module files in a Mach-O, ELF, or COFF container.
Adrian Prantl [Tue, 24 Feb 2015 04:25:59 +0000 (04:25 +0000)]
Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies. Take 3.

llvm-svn: 230305

9 years agoInstrProf: Make sure counts in lambdas don't escape to the parent scope
Justin Bogner [Tue, 24 Feb 2015 04:13:56 +0000 (04:13 +0000)]
InstrProf: Make sure counts in lambdas don't escape to the parent scope

When generating coverage maps, we were traversing the body as if it
were part of the parent function, but this doesn't make sense since
we're currently counting lambdas as separate functions.

llvm-svn: 230304

9 years ago[modules] Properly check whether a declaration is std::initializer_list. This
Richard Smith [Tue, 24 Feb 2015 03:30:14 +0000 (03:30 +0000)]
[modules] Properly check whether a declaration is std::initializer_list. This
bug is not actually modules-specific, but it's a little tricky to tickle it
outside of modules builds, so submitting with the reduced testcase I have.

llvm-svn: 230303

9 years agoMove the copy phases for the xpcservices bundles from the "LLDB"
Jason Molenda [Tue, 24 Feb 2015 03:21:38 +0000 (03:21 +0000)]
Move the copy phases for the xpcservices bundles from the "LLDB"
target to the "desktop" target.  They aren't used for iOS builds.

llvm-svn: 230302

9 years ago[modules] Ensure we've imported all declarations of a template before
Richard Smith [Tue, 24 Feb 2015 02:44:23 +0000 (02:44 +0000)]
[modules] Ensure we've imported all declarations of a template before
attempting to lazily deserialize its specializations; otherwise, there might be
pending specializations that we don't know about yet.

llvm-svn: 230301

9 years agoBeginning of alloca implementation for Mips fast-isel
Reed Kotler [Tue, 24 Feb 2015 02:36:45 +0000 (02:36 +0000)]
Beginning of alloca implementation for Mips fast-isel

Summary: Begin to add various address modes; including alloca.

Test Plan: Make sure there are no regressions in test-suite at O0/02 in mips32r1/r2

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: echristo, rfuhler, llvm-commits

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

llvm-svn: 230300

9 years agoUpdate LLDB to read a newer format of Objective-C class information from the dyld...
Enrico Granata [Tue, 24 Feb 2015 02:11:06 +0000 (02:11 +0000)]
Update LLDB to read a newer format of Objective-C class information from the dyld shared cache
Also, since most of the time the lack of such information is a serious problem that hinders productive debugging, emit an actual user visible warning when this occurs (once per process)

Fixes rdar://19898507

llvm-svn: 230299

9 years agoReword ELAST warning
JF Bastien [Tue, 24 Feb 2015 01:59:38 +0000 (01:59 +0000)]
Reword ELAST warning

Summary:
GCC emits a pretty amusing warning when there are apostrophes in a #warning:
```warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]```

Reword the warning to avoid this, and be more consistent with other warnings in libc++.

Reviewers: danalbert

Subscribers: llvm-commits

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

llvm-svn: 230298

9 years agoFix handling of negative offsets for AddrModeT2_i8s4 in rewriteT2FrameIndex.
Bob Wilson [Tue, 24 Feb 2015 01:37:31 +0000 (01:37 +0000)]
Fix handling of negative offsets for AddrModeT2_i8s4 in rewriteT2FrameIndex.

This is a follow up to r230233 to fix something that I noticed by
inspection. The AddrModeT2_i8s4 addressing mode does not support
negative offsets. I spent a good chunk of the day trying to come up with
a testcase for this but was not successful. This addressing mode is used
to spill and restore GPRPair registers in Thumb2 code and that does not
happen often. We also make very limited used of negative offsets when
lowering frame indexes. I am going ahead with the change anyway, because
I am pretty confident that it is correct. I also added a missing assertion
to check that the low bits of the scaled offset are zero.

llvm-svn: 230297

9 years agoRefactor *TemplateDecl::addSpecialization to reduce duplication and add some
Richard Smith [Tue, 24 Feb 2015 01:23:23 +0000 (01:23 +0000)]
Refactor *TemplateDecl::addSpecialization to reduce duplication and add some
more asserts.

llvm-svn: 230296

9 years agoCodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries.
Peter Collingbourne [Tue, 24 Feb 2015 01:12:53 +0000 (01:12 +0000)]
CodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries.

No two elements of this array should be the same, but the standard library
may pass the same element as both arguments to this function.

llvm-svn: 230293

9 years agoRestore the libc++ definition of max_align_t on Apple platforms
Dmitri Gribenko [Tue, 24 Feb 2015 01:06:22 +0000 (01:06 +0000)]
Restore the libc++ definition of max_align_t on Apple platforms

Clang has introduced ::max_align_t in stddef.h in r201729, but libc++ was
already defining std::max_align_t on Darwin because there was none in the
global namespace.  After that Clang commit though, libc++ started defining
std::max_align_t to be a typedef for ::max_align_t, which has a different
definition.  This changed the ABI.  This commit restores the previous
definition.

rdar://19919394 rdar://18557982

llvm-svn: 230292

9 years agoFix bug 22641
Sanjoy Das [Tue, 24 Feb 2015 01:02:42 +0000 (01:02 +0000)]
Fix bug 22641

The bug was a result of getPreStartForExtend interpreting nsw/nuw
flags on an add recurrence more strongly than is legal.  {S,+,X}<nsw>
implies S+X is nsw only if the backedge of the loop is taken at least
once.

NOTE: I had accidentally committed an unrelated change with the commit
message of this change in r230275 (r230275 was reverted in r230279).
This is the correct change for this commit message.

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

llvm-svn: 230291

9 years ago[LTO API] add lto_codegen_set_module to set the destination module.
Manman Ren [Tue, 24 Feb 2015 00:45:56 +0000 (00:45 +0000)]
[LTO API] add lto_codegen_set_module to set the destination module.

When debugging LTO issues with ld64, we use -save-temps to save the merged
optimized bitcode file, then invoke ld64 again on the single bitcode file to
speed up debugging code generation passes and ld64 stuff after code generation.

llvm linking a single bitcode file via lto_codegen_add_module will generate a
different bitcode file from the single input. With the newly-added
lto_codegen_set_module, we can make sure the destination module is the same as
the input.

lto_codegen_set_module will transfer the ownship of the module to code
generator.

rdar://19024554

llvm-svn: 230290

9 years ago[LoopAccesses] LAA::getInfo to use const reference for stride parameter
Adam Nemet [Tue, 24 Feb 2015 00:41:59 +0000 (00:41 +0000)]
[LoopAccesses] LAA::getInfo to use const reference for stride parameter

And other required const-correctness fixes to make this work.

llvm-svn: 230289

9 years ago[ASan] Disable strict init-order checking if dlopen() is called.
Alexey Samsonov [Tue, 24 Feb 2015 00:37:27 +0000 (00:37 +0000)]
[ASan] Disable strict init-order checking if dlopen() is called.

Revise the fix to https://code.google.com/p/address-sanitizer/issues/detail?id=178:
always disable strict init-order checking the first time dlopen() is
called: at this point shared library is allowed to access globals
defined in the main executable, as they are guaranteed to be
initialized. Revise the test cases:
* simplify init-order-dlopen.cc test case: make it Linux-specific
  (there's no strict init-order checking on other platforms anyway),
  and single-threaded.
* reinforce init-order-pthread-create.cc test case: make sure that
  init-order checker would produce a false positive unless we
  turn it off at the moment we call pthread_create().

llvm-svn: 230288

9 years agoX86: Only use 'lea' in Win64 epilogues if a frame pointer exists
David Majnemer [Tue, 24 Feb 2015 00:11:32 +0000 (00:11 +0000)]
X86: Only use 'lea' in Win64 epilogues if a frame pointer exists

We can only use 'add' in epilogues, 'lea' is not permitted unless we've
established a frame pointer in the prologue.

llvm-svn: 230286

9 years agoNew instcombine rule: max(~a,~b) -> ~min(a, b)
Sanjoy Das [Tue, 24 Feb 2015 00:08:41 +0000 (00:08 +0000)]
New instcombine rule: max(~a,~b) -> ~min(a, b)

This case is interesting because ScalarEvolutionExpander lowers min(a,
b) as ~max(~a,~b).  I think the profitability heuristics can be made
more clever/aggressive, but this is a start.

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

llvm-svn: 230285

9 years agoAvoid crashing by not mmap'ing files on network mounted file systems.
Greg Clayton [Mon, 23 Feb 2015 23:47:09 +0000 (23:47 +0000)]
Avoid crashing by not mmap'ing files on network mounted file systems.

This is implemented by making a new FileSystem function:

bool
FileSystem::IsLocal(const FileSpec &spec)

Then using this in a new function:

DataBufferSP
FileSpec::MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const;

This function only mmaps data if the file is a local file since that means we can reliably page in data. We were experiencing crashes where people would use debug info files on network mounted file systems and that mount would go away and cause the next access to a page that wasn't paged in to crash LLDB.

We now avoid this by just copying the data into a heap buffer and keeping a permanent copy to avoid the crash. Updated all previous users of FileSpec::MemoryMapFileContentsIfLocal() in ObjectFile subclasses over to use the new FileSpec::MemoryMapFileContentsIfLocal() function.

<rdar://problem/19470249>

llvm-svn: 230283

9 years agoBugfix: SCEVExpander incorrectly marks increment operations as no-wrap
Sanjoy Das [Mon, 23 Feb 2015 23:22:58 +0000 (23:22 +0000)]
Bugfix: SCEVExpander incorrectly marks increment operations as no-wrap

When emitting the increment operation, SCEVExpander marks the
operation as nuw or nsw based on the flags on the preincrement SCEV.
This is incorrect because, for instance, it is possible that {-6,+,1}
is <nuw> while {-6,+,1}+1 = {-5,+,1} is not.

This change teaches SCEV to mark the increment as nuw/nsw only if it
can explicitly prove that the increment operation won't overflow.

Apart from the attached test case, another (more realistic) manifestation
of the bug can be seen in Transforms/IndVarSimplify/pr20680.ll.

NOTE: this change was landed with an incorrect commit message in
rL230275 and was reverted for that reason in rL230279.  This commit
message is the correct one.

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

llvm-svn: 230280

9 years agoRevert 230275.
Sanjoy Das [Mon, 23 Feb 2015 23:13:22 +0000 (23:13 +0000)]
Revert 230275.

230275 got committed with an incorrect commit message due to a mixup
on my side.  Will re-land in a few moments with the correct commit
message.

llvm-svn: 230279

9 years agoFix based on post-commit comment on D7816 & rL230177 - BUILD_VECTOR operand truncatio...
Simon Pilgrim [Mon, 23 Feb 2015 23:04:28 +0000 (23:04 +0000)]
Fix based on post-commit comment on D7816 & rL230177 - BUILD_VECTOR operand truncation was using the the BV's output scalar type instead of the input type.

llvm-svn: 230278

9 years ago[X86] Teach how to custom lower double-to-half conversions under fast-math.
Andrea Di Biagio [Mon, 23 Feb 2015 22:59:02 +0000 (22:59 +0000)]
[X86] Teach how to custom lower double-to-half conversions under fast-math.

This patch teaches the backend how to expand a double-half conversion into
a double-float conversion immediately followed by a float-half conversion.
We do this only under fast-math, and if float-half conversions are legal
for the target.

Added test CodeGen/X86/fastmath-float-half-conversion.ll

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

llvm-svn: 230276

9 years agoFix bug 22641
Sanjoy Das [Mon, 23 Feb 2015 22:55:13 +0000 (22:55 +0000)]
Fix bug 22641

The bug was a result of getPreStartForExtend interpreting nsw/nuw
flags on an add recurrence more strongly than is legal.  {S,+,X}<nsw>
implies S+X is nsw only if the backedge of the loop is taken at least
once.

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

llvm-svn: 230275

9 years agoRevert "Improve declaration / expression disambiguation around ptr-operators, and...
Justin Bogner [Mon, 23 Feb 2015 22:36:28 +0000 (22:36 +0000)]
Revert "Improve declaration / expression disambiguation around ptr-operators, and use"

This seems to break mixing function-style and c-style casts, and is
breaking bootstrapping llvm.

This reverts r230261.

llvm-svn: 230274

9 years ago[ELF] Create a map from Reference to Symbol.
Shankar Easwaran [Mon, 23 Feb 2015 22:32:12 +0000 (22:32 +0000)]
[ELF] Create a map from Reference to Symbol.

In LLD's model, symbol is a property of the node (atom) and not a property of
edge (reference). Prior to this patch, we stored the symbol in the reference.
From post-commit comments, it seemed better to create a map from the reference
to the symbol instead and use this mapping wherever desired.

Address comments from Ruiu/Simon Atanasyan.

llvm-svn: 230273

9 years agoFix copy-paste errors in the test
Dmitri Gribenko [Mon, 23 Feb 2015 22:08:10 +0000 (22:08 +0000)]
Fix copy-paste errors in the test

llvm-svn: 230272

9 years agoFix invalid cast.
Rafael Espindola [Mon, 23 Feb 2015 21:51:06 +0000 (21:51 +0000)]
Fix invalid cast.

Fixes PR22525.

Patch by Ben Longbons with testcase by me.

llvm-svn: 230271

9 years agoX86: Use a smaller 'mov' instruction for stack probe calls
David Majnemer [Mon, 23 Feb 2015 21:50:30 +0000 (21:50 +0000)]
X86: Use a smaller 'mov' instruction for stack probe calls

Prologue emission, in some cases, requires calls to a stack probe helper
function.  The amount of stack to probe is passed as a register
argument in the Win64 ABI but the instruction sequence used is
pessimistic: it assumes that the number of bytes to probe is greater
than 4 GB.

Instead, select a more appropriate opcode depending on the number of
bytes we are going to probe.

llvm-svn: 230270

9 years agoX86: Use 'mov' instead of 'lea' in Win64 SEH prologues when possible
David Majnemer [Mon, 23 Feb 2015 21:50:27 +0000 (21:50 +0000)]
X86: Use 'mov' instead of 'lea' in Win64 SEH prologues when possible

'mov' and 'lea' are equivalent when the displacement applied with 'lea'
is zero.  However, 'mov' should encode smaller.

llvm-svn: 230269

9 years agoX86: Explain why we cannot use a 'mov' in a Win64 epilogue
David Majnemer [Mon, 23 Feb 2015 21:50:25 +0000 (21:50 +0000)]
X86: Explain why we cannot use a 'mov' in a Win64 epilogue

llvm-svn: 230268

9 years agoX86: Consistently use 'epilogue' instead of 'epilog'
David Majnemer [Mon, 23 Feb 2015 21:50:18 +0000 (21:50 +0000)]
X86: Consistently use 'epilogue' instead of 'epilog'

llvm-svn: 230267

9 years agoNewline after usage string for lldb-server.
Chaoren Lin [Mon, 23 Feb 2015 21:48:42 +0000 (21:48 +0000)]
Newline after usage string for lldb-server.

llvm-svn: 230266

9 years agoadd newline for easier reading; NFC
Sanjay Patel [Mon, 23 Feb 2015 21:32:09 +0000 (21:32 +0000)]
add newline for easier reading; NFC

llvm-svn: 230265

9 years ago[AsmPrinter] Access pointers to globals via pcrel GOT entries
Bruno Cardoso Lopes [Mon, 23 Feb 2015 21:26:18 +0000 (21:26 +0000)]
[AsmPrinter] Access pointers to globals via pcrel GOT entries

Front-ends could use global unnamed_addr to hold pointers to other
symbols, like @gotequivalent below:

@foo = global i32 42
@gotequivalent = private unnamed_addr constant i32* @foo

@delta = global i32 trunc (i64 sub (i64 ptrtoint (i32** @gotequivalent to i64),
                                    i64 ptrtoint (i32* @delta to i64))
                           to i32)

The global @delta holds a data "PC"-relative offset to @gotequivalent,
an unnamed pointer to @foo. The darwin/x86-64 assembly output for this follows:

 .globl  _foo
_foo:
 .long   42

 .globl  _gotequivalent
_gotequivalent:
 .quad   _foo

 .globl  _delta
_delta:
 .long   _gotequivalent-_delta

Since unnamed_addr indicates that the address is not significant, only
the content, we can optimize the case above by replacing pc-relative
accesses to "GOT equivalent" globals, by a PC relative access to the GOT
entry of the final symbol instead. Therefore, "delta" can contain a pc
relative relocation to foo's GOT entry and we avoid the emission of
"gotequivalent", yielding the assembly code below:

 .globl  _foo
_foo:
 .long   42

 .globl  _delta
_delta:
 .long   _foo@GOTPCREL+4

There are a couple of advantages of doing this: (1) Front-ends that need
to emit a great deal of data to store pointers to external symbols could
save space by not emitting such "got equivalent" globals and (2) IR
constructs combined with this opt opens a way to represent GOT pcrel
relocations by using the LLVM IR, which is something we previously had
no way to express.

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

rdar://problem/18534217

llvm-svn: 230264

9 years agoInstrProf: Teach llvm-cov to show the max count instead of the last
Justin Bogner [Mon, 23 Feb 2015 21:21:34 +0000 (21:21 +0000)]
InstrProf: Teach llvm-cov to show the max count instead of the last

When multiple regions start on the same line, llvm-cov was just
showing the count of the last one as the line count. This can be
confusing and misleading for things like one-liner loops, where the
count at the end isn't very interesting, or even "if" statements with
an opening brace at the end of the line.

Instead, use the maximum of all of the region start counts.

llvm-svn: 230263

9 years ago[CMake] On Windows, require manual specification of python libs.
Zachary Turner [Mon, 23 Feb 2015 21:20:59 +0000 (21:20 +0000)]
[CMake] On Windows, require manual specification of python libs.

Embedding python with MSVC is very finicky, for reasons having
to do with the operating system's CRT, the implementation of
python itself on Windows, and even bugs in CMake.

One side effect of this is that we cannot rely on FindPythonLibs
and FindPythonInterp CMake functions to locate the correct
version of Python.  We must instead manually specify the location
of PYTHON_LIBRARY and PYTHON_INCLUDE_DIR.

As a side effect, this fixes building LLDB in release mode by
specifying -DCMAKE_BUILD_TYPE=Release, which was previously
broken.

llvm-svn: 230262

9 years agoImprove declaration / expression disambiguation around ptr-operators, and use
Richard Smith [Mon, 23 Feb 2015 21:16:05 +0000 (21:16 +0000)]
Improve declaration / expression disambiguation around ptr-operators, and use
the presence of an abstract declarator with a ptr-operator as proof that a
construct cannot parse as an expression to improve diagnostics along error
recovery paths.

llvm-svn: 230261

9 years agoChange string_view::at to make it work with gcc and VC++. Thanks to K-ballo for the...
Marshall Clow [Mon, 23 Feb 2015 21:12:02 +0000 (21:12 +0000)]
Change string_view::at to make it work with gcc and VC++. Thanks to K-ballo for the bug report, and Jonathan Wakeley for the code review in the bar.

llvm-svn: 230260

9 years agoRemoving unused private field.
Andrew Kaylor [Mon, 23 Feb 2015 21:03:30 +0000 (21:03 +0000)]
Removing unused private field.

llvm-svn: 230259

9 years ago[X86][MMX] Fix test to reflect current codegen
Bruno Cardoso Lopes [Mon, 23 Feb 2015 20:57:46 +0000 (20:57 +0000)]
[X86][MMX] Fix test to reflect current codegen

This test failed in several buildbots, a bit unclear how that happen
since this was the previous behavior before r230248.

llvm-svn: 230258

9 years agoSecond attempt to fix WinEHCatchDirector build failures.
Andrew Kaylor [Mon, 23 Feb 2015 20:44:34 +0000 (20:44 +0000)]
Second attempt to fix WinEHCatchDirector build failures.

llvm-svn: 230257

9 years ago[asan] when registering globals, use the same unwinder as we use for malloc, instead...
Kostya Serebryany [Mon, 23 Feb 2015 20:40:53 +0000 (20:40 +0000)]
[asan] when registering globals, use the same unwinder as we use for malloc, instead of the one used for FATAL crash (which may be too slow)

llvm-svn: 230256

9 years agoOnly lower __builtin_setjmp / __builtin_longjmp to
Joerg Sonnenberger [Mon, 23 Feb 2015 20:23:47 +0000 (20:23 +0000)]
Only lower __builtin_setjmp / __builtin_longjmp to
llvm.eh.sjlj.setjmp / llvm.eh.sjlj.longjmp, if the backend is known to
support them outside the Exception Handling context. The default
handling in LLVM codegen doesn't work and will create incorrect code.
The ARM backend on the other hand will assert if the intrinsics are
used.

llvm-svn: 230255

9 years agoCFI: Improve design doc with larger virtual tables and asm examples.
Peter Collingbourne [Mon, 23 Feb 2015 20:22:17 +0000 (20:22 +0000)]
CFI: Improve design doc with larger virtual tables and asm examples.

llvm-svn: 230254

9 years agoFixed typo.
Zoran Jovanovic [Mon, 23 Feb 2015 20:20:49 +0000 (20:20 +0000)]
Fixed typo.

llvm-svn: 230253

9 years agoAttempting to fix WinEHCatchDirector destructor related build failures.
Andrew Kaylor [Mon, 23 Feb 2015 20:19:15 +0000 (20:19 +0000)]
Attempting to fix WinEHCatchDirector destructor related build failures.

llvm-svn: 230252

9 years agoRemove EOL whitespace from PlatformLinux
Ed Maste [Mon, 23 Feb 2015 20:18:37 +0000 (20:18 +0000)]
Remove EOL whitespace from PlatformLinux

This reduces the noise when diffing PlatformFreeBSD and PlatformLinux.

llvm-svn: 230251

9 years agoAdding test for Windows EH frame variable remapping.
Andrew Kaylor [Mon, 23 Feb 2015 20:04:51 +0000 (20:04 +0000)]
Adding test for Windows EH frame variable remapping.

llvm-svn: 230250

9 years agoRemap frame variables for native Windows exception handling.
Andrew Kaylor [Mon, 23 Feb 2015 20:01:56 +0000 (20:01 +0000)]
Remap frame variables for native Windows exception handling.

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

llvm-svn: 230249

9 years agoRevert "[X86][MMX] Add MMX instructions to foldable tables"
Bruno Cardoso Lopes [Mon, 23 Feb 2015 19:53:37 +0000 (19:53 +0000)]
Revert "[X86][MMX] Add MMX instructions to foldable tables"

This reverts commit r230226 since it breaks win buildbots.

llvm-svn: 230248

9 years agoRe-land part of r230171: fix GoTsanRuntimeCheck with ccache.
Alexey Samsonov [Mon, 23 Feb 2015 19:35:42 +0000 (19:35 +0000)]
Re-land part of r230171: fix GoTsanRuntimeCheck with ccache.

llvm-svn: 230247

9 years agoRevert "Revert "Raising minimum required CMake version to 2.8.12.2.""
Chad Rosier [Mon, 23 Feb 2015 19:34:04 +0000 (19:34 +0000)]
Revert "Revert "Raising minimum required CMake version to 2.8.12.2.""

This reverts commit r230240, which was an accidental commit.

llvm-svn: 230246

9 years agoRewrite the global merge pass to be subprogram agnostic for now.
Eric Christopher [Mon, 23 Feb 2015 19:28:45 +0000 (19:28 +0000)]
Rewrite the global merge pass to be subprogram agnostic for now.
It was previously using the subtarget to get values for the global
offset without actually checking each function as it was generating
code. Go ahead and solidify the current behavior and make the
existing FIXMEs more prominent.

As a note the ARM backend previously had a thumb1 and non-thumb1
set of defaults. Only the former was tested so I've changed the
behavior to only use that for now.

llvm-svn: 230245

9 years agoInstrProf: Run clang-format to fix some strange indentation (NFC)
Justin Bogner [Mon, 23 Feb 2015 19:27:00 +0000 (19:27 +0000)]
InstrProf: Run clang-format to fix some strange indentation (NFC)

Somehow this file ended up with a strange hybrid of the old "indent
inside a namespace" style and the new "don't", giving us a wonderful
two-space indent starting halfway through a namespace. Fix it.

llvm-svn: 230244

9 years ago-fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013
Reid Kleckner [Mon, 23 Feb 2015 19:25:48 +0000 (19:25 +0000)]
-fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013

VS 2013 is the minimum supported version, so it's reasonable for Clang
to simulate this by default. This also simplifies the clang-cl
self-host, since we have the 18.00 version check.

llvm-svn: 230243

9 years agoAdd -fdefine-sized-deallocation to ASan test case.
Alexey Samsonov [Mon, 23 Feb 2015 19:18:31 +0000 (19:18 +0000)]
Add -fdefine-sized-deallocation to ASan test case.

This flag is now needed to force Clang emit the weak definition
of sized delete if it's not present in the header.

llvm-svn: 230242

9 years agoPrevent hoisting fmul from THEN/ELSE to IF if there is fmsub/fmadd opportunity.
Chad Rosier [Mon, 23 Feb 2015 19:15:16 +0000 (19:15 +0000)]
Prevent hoisting fmul from THEN/ELSE to IF if there is fmsub/fmadd opportunity.

This patch adds the isProfitableToHoist API.  For AArch64, we want to prevent a
fmul from being hoisted in cases where it is more profitable to form a
fmsub/fmadd.

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

llvm-svn: 230241

9 years agoRevert "Raising minimum required CMake version to 2.8.12.2."
Chad Rosier [Mon, 23 Feb 2015 19:15:08 +0000 (19:15 +0000)]
Revert "Raising minimum required CMake version to 2.8.12.2."

This reverts commit 247aed4710e8befde76da42b27313661dea7cf66.

llvm-svn: 230240

9 years agocmake: Don't do the libstdc++ version check when clang simulates MSVC
Reid Kleckner [Mon, 23 Feb 2015 19:07:25 +0000 (19:07 +0000)]
cmake: Don't do the libstdc++ version check when clang simulates MSVC

If we're using clang-cl, that's a pretty good indication that we're
going to use MSVC's STL.

This simplifies the clang-cl ninja self-host configuration down to:
CC=clang-cl CXX=clang-cl cmake .. -GNinja

Modified version of zturner's patch:
Differential Revision: http://reviews.llvm.org/D7824

llvm-svn: 230239

9 years agoInstSimplify: simplify 0 / X if nnan and nsz
Mehdi Amini [Mon, 23 Feb 2015 18:30:25 +0000 (18:30 +0000)]
InstSimplify: simplify 0 / X if nnan and nsz

From: Fiona Glaser <fglaser@apple.com>
llvm-svn: 230238

9 years agoFix a problem where lldb-mi would not stop the debuggee after -exec-interrupt command.
Hafiz Abid Qadeer [Mon, 23 Feb 2015 18:27:17 +0000 (18:27 +0000)]
Fix a problem where lldb-mi would not stop the debuggee after -exec-interrupt command.

Summary:
This revision fixes a problem where lldb-mi would not stop the execution after exec-interrupt call.
On Linux, SIGSTOP is used to stop the debuggee process. LLDB stopped the debuggee alright. But when
lldb-mi received the notification of stopping with reason as SIGSTOP, it would resume the process.
This was heppening in CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal. This function aslo
used hard coded numbers for signal istead of symbolic names.

This revision changes code to treat SIGSTOP reason as SIGINT. Also used symbolic names for signals
instead of numbers.

Reviewers: ki.stfu, clayborg

Reviewed By: ki.stfu, clayborg

Subscribers: zturner, lldb-commits

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

llvm-svn: 230237

9 years agoAdd null RegisterContext assertions
Ed Maste [Mon, 23 Feb 2015 18:12:20 +0000 (18:12 +0000)]
Add null RegisterContext assertions

This makes these failures slightly more obvious, avoiding the need to
run LLDB under a debugger or rely on a LLDB core.  I encountered these
while bringing up a new OS/arch combination.

llvm-svn: 230236

9 years ago[mips] Honour -mno-odd-spreg for vector insert/extract when MSA is enabled.
Daniel Sanders [Mon, 23 Feb 2015 17:22:16 +0000 (17:22 +0000)]
[mips] Honour -mno-odd-spreg for vector insert/extract when MSA is enabled.

Summary:
-mno-odd-spreg prohibits the use of odd-numbered single-precision floating
point registers. However, vector insert/extract was still using them when
manipulating the subregisters of an MSA register. Fixed this by ensuring
that insertion/extraction is only performed on even-numbered vector
registers when -mno-odd-spreg is given.

Reviewers: vmedic, sstankovic

Reviewed By: sstankovic

Subscribers: llvm-commits

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

llvm-svn: 230235

9 years agoFix incorrect immediate size for AddrModeT2_i8s4 in rewriteT2FrameIndex.
Bob Wilson [Mon, 23 Feb 2015 16:57:19 +0000 (16:57 +0000)]
Fix incorrect immediate size for AddrModeT2_i8s4 in rewriteT2FrameIndex.

The natural way to handle this addressing mode would be to say that it has
8 bits and gets scaled by 4, but since the MC layer is expecting the scaling
to be already reflected in the immediate value, we have been setting the
Scale to 1. That's fine, but then NumBits needs to be adjusted to reflect
the effective increase in the range of the immediate. That adjustment was
missing.

The consequence is that the register scavenger can fail.
The estimateRSStackSizeLimit() function in ARMFrameLowering.cpp correctly
assumes that the AddrModeT2_i8s4 address mode can handle scaled offsets up to
1020. Under just the right circumstances, we fail to reserve space for the
scavenger because it thinks that nothing will be needed. However, the overly
pessimistic behavior in rewriteT2FrameIndex causes some frame indexes to be
out of range and require scavenged registers, and so the scavenger asserts.

Unfortunately I have not been able to come up with a testcase for this. I
can only reproduce it on an internal branch where the frame layout and
register allocation is slightly different than trunk. We really need a
way to serialize MachineInstr-level IR to write reasonable tests for things
like this.

rdar://problem/19909005

llvm-svn: 230233

9 years agoSync the __builtin_expects for our 3 quadratically probed hash table implementations.
Benjamin Kramer [Mon, 23 Feb 2015 16:41:36 +0000 (16:41 +0000)]
Sync the __builtin_expects for our 3 quadratically probed hash table implementations.

This assumes that
  a) finding the bucket containing the value is LIKELY
  b) finding an empty bucket is LIKELY
  c) growing the table is UNLIKELY

I also switched the a) and b) cases for SmallPtrSet as we seem to use
the set mostly more for insertion than for checking existence.

In a simple benchmark consisting of 2^21 insertions of 2^20 unique
pointers into a DenseMap or SmallPtrSet a few percent speedup on average,
but nothing statistically significant.

llvm-svn: 230232