platform/upstream/llvm.git
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

9 years ago[FIX] 2 broken tests
Johannes Doerfert [Mon, 23 Feb 2015 16:34:20 +0000 (16:34 +0000)]
[FIX] 2 broken tests

llvm-svn: 230231

9 years agoUse ScalarEvolution to create tight bounds on the parameters
Johannes Doerfert [Mon, 23 Feb 2015 16:15:51 +0000 (16:15 +0000)]
Use ScalarEvolution to create tight bounds on the parameters

llvm-svn: 230230

9 years ago[X86] Add specific mtriple in order to appease builbots
Bruno Cardoso Lopes [Mon, 23 Feb 2015 15:33:40 +0000 (15:33 +0000)]
[X86] Add specific mtriple in order to appease builbots

llvm-svn: 230229

9 years agoExit early from DumpELFProgramHeaders if parse fails
Ed Maste [Mon, 23 Feb 2015 15:33:11 +0000 (15:33 +0000)]
Exit early from DumpELFProgramHeaders if parse fails

This matches the way DumpELFSectionHeaders is implemented and is
recommended by the LLVM coding conventions.

llvm-svn: 230228

9 years agoelf-core: correct "no sections" to "no segments."
Ed Maste [Mon, 23 Feb 2015 15:28:42 +0000 (15:28 +0000)]
elf-core: correct "no sections" to "no segments."

The error reported here is that there are no phdr entries, so it's
referring to segments, not sections.

llvm-svn: 230227

9 years ago[X86][MMX] Add MMX instructions to foldable tables
Bruno Cardoso Lopes [Mon, 23 Feb 2015 15:23:22 +0000 (15:23 +0000)]
[X86][MMX] Add MMX instructions to foldable tables

Teach the peephole optimizer to work with MMX instructions by adding
entries into the foldable tables. This covers folding opportunities not
handled during isel.

llvm-svn: 230226

9 years ago[X86][MMX] Support folding loads in psll, psrl and psra intrinsics
Bruno Cardoso Lopes [Mon, 23 Feb 2015 15:23:14 +0000 (15:23 +0000)]
[X86][MMX] Support folding loads in psll, psrl and psra intrinsics

llvm-svn: 230225

9 years ago[X86][MMX] Add tests for pslli, psrli and psrai intrinsics
Bruno Cardoso Lopes [Mon, 23 Feb 2015 15:23:06 +0000 (15:23 +0000)]
[X86][MMX] Add tests for pslli, psrli and psrai intrinsics

Add tests to cover the RR form of the pslli, psrli and psrai intrinsics.
In the next commit, the loads are going to be folded and the
instructions use the RM form.

llvm-svn: 230224

9 years agoAVX-512: recommitted 229837 + bugfix + test
Elena Demikhovsky [Mon, 23 Feb 2015 15:12:31 +0000 (15:12 +0000)]
AVX-512: recommitted 229837 + bugfix + test

llvm-svn: 230223

9 years ago[NFC] Unify the use of Context.CurRegion
Johannes Doerfert [Mon, 23 Feb 2015 14:18:28 +0000 (14:18 +0000)]
[NFC] Unify the use of Context.CurRegion

llvm-svn: 230222

9 years agorestructured X86 scalar unary operation templates
Elena Demikhovsky [Mon, 23 Feb 2015 14:14:02 +0000 (14:14 +0000)]
restructured X86 scalar unary operation templates

I made the templates general, no need to define pattern separately for each instruction/intrinsic.
Now only need to add r_Int pattern for AVX.

llvm-svn: 230221

9 years ago[REFACTOR] Replace Pass* from BlockGen by the DomTree
Johannes Doerfert [Mon, 23 Feb 2015 13:51:35 +0000 (13:51 +0000)]
[REFACTOR] Replace Pass* from BlockGen by the DomTree

llvm-svn: 230220

9 years ago[ELF][Writer] Use llvm::StringMap instead
Shankar Easwaran [Mon, 23 Feb 2015 13:50:23 +0000 (13:50 +0000)]
[ELF][Writer] Use llvm::StringMap instead

Cleanup.

llvm-svn: 230219

9 years ago[ELF] Add comments in the ELF reader
Shankar Easwaran [Mon, 23 Feb 2015 13:25:44 +0000 (13:25 +0000)]
[ELF] Add comments in the ELF reader

Address review comments from Ruiu, and add some more TODO's.

llvm-svn: 230218

9 years ago[llvm-pdbdump] Remove unused variables.
Benjamin Kramer [Mon, 23 Feb 2015 11:33:54 +0000 (11:33 +0000)]
[llvm-pdbdump] Remove unused variables.

llvm-svn: 230216

9 years agoDisable file descriptor leak tests on python >=2.7.8
Pavel Labath [Mon, 23 Feb 2015 11:14:28 +0000 (11:14 +0000)]
Disable file descriptor leak tests on python >=2.7.8

this version introduced an internal leak, which we cannot reasonably fix.

llvm-svn: 230215

9 years agoOrc/JITSymbol.h requires not "Compiler.h" but "DataTypes.h" due to uint64_t.
NAKAMURA Takumi [Mon, 23 Feb 2015 11:12:52 +0000 (11:12 +0000)]
Orc/JITSymbol.h requires not "Compiler.h" but "DataTypes.h" due to uint64_t.

llvm-svn: 230214

9 years agoFix the communication in qPlatform_[mkdir,chmod]
Tamas Berghammer [Mon, 23 Feb 2015 11:03:08 +0000 (11:03 +0000)]
Fix the communication in qPlatform_[mkdir,chmod]

With the previous implementation the protocol used by the client and the
server for the response was different and worked only by an accident.
With this change the communication is fixed and the return code from
mkdir and chmod correctly captured by lldb. The change also add
documentation for the qPlatform__[mkdir,chmod] packages.

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

llvm-svn: 230213

9 years agoSet error status when failed to catch stop after launch
Tamas Berghammer [Mon, 23 Feb 2015 10:59:54 +0000 (10:59 +0000)]
Set error status when failed to catch stop after launch

Process::Launch try to catch a stop signal after launching a process. If
it is unsuccessful it destroy the process but previously still reported
that the process launched successfully. This behavior caused a
deadlock. With thic change the process launch error reported correctly.

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

llvm-svn: 230212

9 years agoSupport evaluation of DWARF expressions setting CFA
Pavel Labath [Mon, 23 Feb 2015 10:29:01 +0000 (10:29 +0000)]
Support evaluation of DWARF expressions setting CFA

Summary:
This patch enables evaluation of DWARF expressions setting the CFA during stack unwinding.

This makes TestSigtrampUnwind "almost" pass on linux. I am not enabling the test yet since the
symbol name for the signal trampoline does not get resolved properly due to a different bug, but
apart from that, the backtrace is sane.

I am unsure how this change affects Mac. I think it makes the unwinder prefer the DWARF unwind
plan instead of some custom platform-dependant plan. However, it does not affect the end result
- the stack unwinding works as expected.

Reviewers: jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 230211

9 years agoUnwindPlan::Row refactor -- add support for CFA set by a DWARF expression
Pavel Labath [Mon, 23 Feb 2015 10:19:16 +0000 (10:19 +0000)]
UnwindPlan::Row refactor -- add support for CFA set by a DWARF expression

Summary:
This change refactors UnwindPlan::Row to be able to store the fact that the CFA is value is set
by evaluating a dwarf expression (DW_CFA_def_cfa_expression). This is achieved by creating a new
class CFAValue and moving all CFA setting/getting code there. Note that code using the new
CFAValue::isDWARFExpression is not yet present and will be added in a follow-up patch. Therefore,
this patch should not change the functionality in any way.

Test Plan: Ran tests on Mac and Linux. No regressions detected.

Reviewers: jasonmolenda, clayborg

Subscribers: lldb-commits

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

llvm-svn: 230210

9 years ago[TSan][Clang][MIPS] Enabled thread option for MIPS64 platform
Mohit K. Bhakkad [Mon, 23 Feb 2015 09:32:35 +0000 (09:32 +0000)]
[TSan][Clang][MIPS] Enabled thread option for MIPS64 platform

Reviewers: kcc, samsonov, petarj, eugenis

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

llvm-svn: 230209

9 years agoUse compiler provided endianness definitions if available.
Ed Schouten [Mon, 23 Feb 2015 09:27:49 +0000 (09:27 +0000)]
Use compiler provided endianness definitions if available.

This makes int_endianness.h work on operating systems for which we
haven't written explicit constructs, as long as GCC or Clang are being
used.

llvm-svn: 230208

9 years agoAdd C11 *_DECIMAL_DIG.
Ed Schouten [Mon, 23 Feb 2015 09:12:31 +0000 (09:12 +0000)]
Add C11 *_DECIMAL_DIG.

Before C11 there was only the DECIMAL_DIG definition. As of C11, we now
have one definition per floating point type (e.g. DBL_DECIMAL_DIG).
Change the existing code to define the new versions. To remain backward
compatible, define __DECIMAL_DIG__ as __LDBL_DECIMAL_DIG__.

Also update the tests. It seems that some of the existing test vectors
were incorrect. Change all tests for __DECIMAL_DIG__ to expect
__LDBL_DECIMAL_DIG__. Add tests for *_DECIMAL_DIG for FreeBSD/amd64, as
I happen to have such a system laying around. I've validated that the
values are in sync with <float.h>.

llvm-svn: 230207

9 years agoAsmParser: Check ConstantExpr insertvalue operands for type correctness
David Majnemer [Mon, 23 Feb 2015 07:13:52 +0000 (07:13 +0000)]
AsmParser: Check ConstantExpr insertvalue operands for type correctness

llvm-svn: 230206

9 years ago[llvm-pdbdump] Fix builders again.
Zachary Turner [Mon, 23 Feb 2015 06:13:27 +0000 (06:13 +0000)]
[llvm-pdbdump] Fix builders again.

llvm-svn: 230205

9 years ago[llvm-pdbdump] Very minor code cleanup.
Zachary Turner [Mon, 23 Feb 2015 05:59:14 +0000 (05:59 +0000)]
[llvm-pdbdump] Very minor code cleanup.

This just removes some dead enums as well as some debug flushes
of stdout.

llvm-svn: 230204

9 years ago[llvm-pdbdump] Add an option to dump full class definitions.
Zachary Turner [Mon, 23 Feb 2015 05:58:34 +0000 (05:58 +0000)]
[llvm-pdbdump] Add an option to dump full class definitions.

This adds the --class-definitions flag.  If specified, when dumping
types, instead of "class Foo" you will see the full class definition,
with member functions, constructors, access specifiers.

NOTE: Using this option can be very slow, as generating a full class
definition requires accessing many different parts of the PDB.

llvm-svn: 230203

9 years ago[Orc][Kaleidoscope] Tidy up the lazy_irgen tutorial, touch up a couple of
Lang Hames [Mon, 23 Feb 2015 04:45:05 +0000 (04:45 +0000)]
[Orc][Kaleidoscope] Tidy up the lazy_irgen tutorial, touch up a couple of
comments in the fully_lazy tutorial to minimize the diff between the two.

llvm-svn: 230202

9 years ago[Orc][Kaleidoscope] Remove dead AST map in SessionContext.
Lang Hames [Mon, 23 Feb 2015 04:34:43 +0000 (04:34 +0000)]
[Orc][Kaleidoscope] Remove dead AST map in SessionContext.

llvm-svn: 230201

9 years agoTry to fix reST markup for an external link.
Nico Weber [Mon, 23 Feb 2015 03:31:29 +0000 (03:31 +0000)]
Try to fix reST markup for an external link.

llvm-svn: 230200

9 years agoRemove comment addressed by d0k in r229327.
Nico Weber [Mon, 23 Feb 2015 02:23:19 +0000 (02:23 +0000)]
Remove comment addressed by d0k in r229327.

llvm-svn: 230199

9 years agoFixed script name in the clang-tidy documentation.
Alexander Kornienko [Mon, 23 Feb 2015 01:12:41 +0000 (01:12 +0000)]
Fixed script name in the clang-tidy documentation.

llvm-svn: 230198

9 years agoFix Makefile build
David Blaikie [Mon, 23 Feb 2015 00:53:35 +0000 (00:53 +0000)]
Fix Makefile build

llvm-svn: 230197

9 years ago[orc] Add a trivial unit test to get the ball rolling
David Blaikie [Mon, 23 Feb 2015 00:36:25 +0000 (00:36 +0000)]
[orc] Add a trivial unit test to get the ball rolling

I made my best guess at the Makefile, since I don't have a make build.

I'm not sure if it should be valid to add an empty list of things, but
it seemed the sort of degenerate case.

llvm-svn: 230196

9 years ago[ELF] Add section group/COMDAT support.
Shankar Easwaran [Mon, 23 Feb 2015 00:30:00 +0000 (00:30 +0000)]
[ELF] Add section group/COMDAT support.

SHF_GROUP: Group Member Sections
----------------------------------
A section which is part of a group, and is to be retained or discarded with the
group as a whole, is identified by a new section header attribute: SHF_GROUP
This section is a member (perhaps the only one) of a group of sections, and the
linker should retain or discard all or none of the members. This section must be
referenced in a SHT_GROUP section. This attribute flag may be set in any section
header, and no other modification or indication is made in the grouped sections.
All additional information is contained in the associated SHT_GROUP section.

SHT_GROUP: Section Group Definition
-------------------------------------
Represents a group section.

The section group's sh_link field identifies a symbol table section, and its
sh_info field the index of a symbol in that section. The name of that symbol is
treated as the identifier of the section group.

More information: https://mentorembedded.github.io/cxx-abi/abi/prop-72-comdat.html

Added a lot of extensive tests, that tests functionality.

llvm-svn: 230195

9 years ago[ELF] Add .gnu.linkonce support.
Shankar Easwaran [Mon, 23 Feb 2015 00:04:49 +0000 (00:04 +0000)]
[ELF] Add .gnu.linkonce support.

When the GNU linker sees two input sections with the same name, and the name
starts with ".gnu.linkonce.", the linker will only keep one copy and discard the
other. Any section whose name starts with “.gnu.linkonce.” is a COMDAT section.

Some architectures like Hexagon use this section to store floating point constants,
that need be deduped.

This patch adds gnu.linkonce functionality to the ELFReader.

llvm-svn: 230194

9 years agoAsmParser: Call instructions can't have an alignment
David Majnemer [Mon, 23 Feb 2015 00:01:32 +0000 (00:01 +0000)]
AsmParser: Call instructions can't have an alignment

llvm-svn: 230193

9 years ago[Core,MachO,Test] Remove trailing whitespace.
Shankar Easwaran [Sun, 22 Feb 2015 23:54:38 +0000 (23:54 +0000)]
[Core,MachO,Test] Remove trailing whitespace.

llvm-svn: 230192

9 years ago[ELF] Add symbol to ELFReference.
Shankar Easwaran [Sun, 22 Feb 2015 23:46:21 +0000 (23:46 +0000)]
[ELF] Add symbol to ELFReference.

Relocation handling need more information about the Symbol that we are creating
references for.

No change in functionality.

llvm-svn: 230191

9 years ago[Core] Fix handling of Section Groups.
Shankar Easwaran [Sun, 22 Feb 2015 23:40:58 +0000 (23:40 +0000)]
[Core] Fix handling of Section Groups.

There is code(added by me) in the YAMLReader which isn't correct when it handles references
for section groups. The test case was also checking for wrong outputs.

This fixes the bug and the testcase so that they check for proper outputs.

llvm-svn: 230190

9 years ago[ELF][X86_64] R_X86_64_16 relocation support
Shankar Easwaran [Sun, 22 Feb 2015 23:32:34 +0000 (23:32 +0000)]
[ELF][X86_64] R_X86_64_16 relocation support

llvm-svn: 230189

9 years agoAsmParser: Check ConstantExpr GEP operands for validity
David Majnemer [Sun, 22 Feb 2015 23:14:52 +0000 (23:14 +0000)]
AsmParser: Check ConstantExpr GEP operands for validity

llvm-svn: 230188

9 years agollvm-pdbdump: Fix gcc/clang build
David Majnemer [Sun, 22 Feb 2015 22:33:57 +0000 (22:33 +0000)]
llvm-pdbdump: Fix gcc/clang build

llvm-svn: 230187

9 years ago[llvm-pdbdump] Fix a few compilation failures.
Zachary Turner [Sun, 22 Feb 2015 22:20:26 +0000 (22:20 +0000)]
[llvm-pdbdump] Fix a few compilation failures.

llvm-svn: 230186

9 years agoAdd missing header
David Blaikie [Sun, 22 Feb 2015 22:18:55 +0000 (22:18 +0000)]
Add missing header

llvm-svn: 230185