Commit Graph

179195 Commits

Author SHA1 Message Date
Chandler Carruth 9a0051cd59 [SDAG] Make the DAGCombine worklist not grow endlessly due to duplicate
insertions.

The old behavior could cause arbitrarily bad memory usage in the DAG
combiner if there was heavy traffic of adding nodes already on the
worklist to it. This commit switches the DAG combine worklist to work
the same way as the instcombine worklist where we null-out removed
entries and only add new entries to the worklist. My measurements of
codegen time shows slight improvement. The memory utilization is
unsurprisingly dominated by other factors (the IR and DAG itself
I suspect).

This change results in subtle, frustrating churn in the particular order
in which DAG combines are applied which causes a number of minor
regressions where we fail to match a pattern previously matched by
accident. AFAICT, all of these should be using AddToWorklist to directly
or should be written in a less brittle way. None of the changes seem
drastically bad, and a few of the changes seem distinctly better.

A major change required to make this work is to significantly harden the
way in which the DAG combiner handle nodes which become dead
(zero-uses). Previously, we relied on the ability to "priority-bump"
them on the combine worklist to achieve recursive deletion of these
nodes and ensure that the frontier of remaining live nodes all were
added to the worklist. Instead, I've introduced a routine to just
implement that precise logic with no indirection. It is a significantly
simpler operation than that of the combiner worklist proper. I suspect
this will also fix some other problems with the combiner.

I think the x86 changes are really minor and uninteresting, but the
avx512 change at least is hiding a "regression" (despite the test case
being just noise, not testing some performance invariant) that might be
looked into. Not sure if any of the others impact specific "important"
code paths, but they didn't look terribly interesting to me, or the
changes were really minor. The consensus in review is to fix any
regressions that show up after the fact here.

Thanks to the other reviewers for checking the output on other
architectures. There is a specific regression on ARM that Tim already
has a fix prepped to commit.

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

llvm-svn: 213727
2014-07-23 07:08:53 +00:00
Nick Lewycky aba900c252 We may visit a call that uses an alloca multiple times in callUsesLocalStack, sometimes with IsNocapture true and sometimes with IsNocapture false. We accidentally skipped work we needed to do in the IsNocapture=false case if we were called with IsNocapture=true the first time. Fixes PR20405!
llvm-svn: 213726
2014-07-23 06:24:49 +00:00
Nico Weber 9386c82d56 Improve diagnostic on default-initializing const variables (PR20208).
This tweaks the diagnostic wording slighly, and adds a fixit on a note.
An alternative would be to add the fixit directly on the diagnostic, see
the review thread linked to from the bug for a few notes on that approach.

llvm-svn: 213725
2014-07-23 05:16:10 +00:00
Renato Golin bb3d7b5e81 Revert "Include assembly files in builtins library build"
This reverts commit r213684, since it was breaking the compiler-rt
build and the sanitizers' bot.

llvm-svn: 213724
2014-07-23 04:46:23 +00:00
NAKAMURA Takumi 0a6af4391b Rework to let RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s pass on win32.
FIXME: "llvm-rtdyld -verify -check" is still sensitive to path separator.
Fix searching StubMap to be tolerant of both '/' and '\\' on Win32.

llvm-svn: 213723
2014-07-23 04:32:21 +00:00
Richard Smith a714469d02 Revert r213647; the added test triggers an assertion.
llvm-svn: 213722
2014-07-23 04:13:00 +00:00
NAKAMURA Takumi 24c0b46e18 Suppress a test on win32 for now, llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s.
FIXME: Fix searching StubMap with '/' and '\\' on Win32.
llvm-svn: 213721
2014-07-23 04:05:58 +00:00
NAKAMURA Takumi 7d79387981 RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s: Use %/T here, or sed(1) would be confused with dos path.
llvm-svn: 213720
2014-07-23 04:05:46 +00:00
Richard Smith a593419593 AST printer: fix double space before base class with no access specifier.
llvm-svn: 213719
2014-07-23 03:22:10 +00:00
Richard Smith a4bb292095 When pretty-printing a declaration of a pack, put the ellipsis before the name
being declared, not at the end. When pretty-printing a non-type template
parameter, put the name of the parameter in the middle of the type, not at the
end.

llvm-svn: 213718
2014-07-23 03:17:06 +00:00
Alexey Bataev f98b00c33e [OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
llvm-svn: 213717
2014-07-23 02:27:21 +00:00
Saleem Abdulrasool 6310757568 Plugins: silence a few more signed comparision warnings
Address a few signed-compare warnings that were triggered on GCC 4.8.2.

llvm-svn: 213716
2014-07-23 01:53:54 +00:00
Saleem Abdulrasool b5c128b3c7 Target: silence a GCC warning
GCC emits a warning:
    warning: enumeral and non-enumeral type in conditional expression [enabled by default]
which does not seem to have a flag to control it.  Simply add an explicit cast
for the boolean value.

llvm-svn: 213715
2014-07-23 01:53:52 +00:00
Saleem Abdulrasool 7d69c25918 test: add an explicit target triple
Now that we support WoA, this test fails on ARM build bots as __va_start has a
different signature on different architectures.

llvm-svn: 213714
2014-07-23 01:32:32 +00:00
Rui Ueyama a27bb08e73 [PECOFF] Fix entry point functions selection
On Windows there are four "main" functions -- main, wmain, WinMain,
or wWinMain. Their parameter types are diffferent. The standard
library provides four different entry functions (i.e.
{w,}{WinMain,main}CRTStartup) for them. You need to use the right
entry routine for your "main" function.

If you give an /entry option, the specified name is used
unconditionally.

Otherwise, the linker needs to select the right one based on
user-supplied entry point function. This can be done after the
linker reads all the input files.

This patch moves the code to determine the entry point function
from the driver to a virtual input file. It also implements the
correct logic for the entry point function selection.

llvm-svn: 213713
2014-07-23 00:57:57 +00:00
Nick Kledzik 7e9808f7de [mach-o] add initial support for modes in arm code.
This patch just supports marking ranges that are thumb code (vs arm code).
Future patches will mark data and jump table ranges. The ranges are encoded
as References with offsetInAtom being the start of the range and the target
being the same atom.

llvm-svn: 213712
2014-07-23 00:51:37 +00:00
NAKAMURA Takumi 16d99f93a8 Trailing whitespace.
llvm-svn: 213711
2014-07-23 00:42:52 +00:00
NAKAMURA Takumi ea4a8dae83 RuntimeDyldMachOAArch64.h: Fix a warning. [-Wunused-variable]
llvm-svn: 213710
2014-07-23 00:17:44 +00:00
Richard Smith 7c237990f2 PR14615: add (passing) tests for this already-fixed bug
llvm-svn: 213709
2014-07-22 23:56:53 +00:00
Lang Hames 17e6b9e5ab [MCJIT] Make stub_addr functionality in RuntimeDyldChecker work in release mode.
There's no reason to restrict this particular piece of RuntimeDyldChecker
functionality to +Asserts builds.

This should fix failures in MachO_x86-64_PIC_relocations.s on release bots.

llvm-svn: 213708
2014-07-22 23:50:51 +00:00
Todd Fiala 015d818b59 Enable lldb-platform exe support for Linux.
This change enables lldb-platform for Linux.  In addition, it does the following:

* fixes Host::GetLLDBPath() to work on Linux/*BSD for ePathTypeSupportExecutableDir-relative paths.

* adds more logging and comments around lldb-platform startup and remote lldb-platform usage.

* refactors lldb-platform remote-* support for Darwin and Linux into PlatformPOSIX.  This, in theory, is the bulk of what is needed for *BSD to make remote connections to lldb-platform as well (although I haven't tested that yet).  FreeBSD can make similar changes to their Platform* as was made here for PlatformLinux to pick up the rest of the bits.

* teaches GDBRemoteCommunication to use lldb-gdbserver for non-Apple hosts.

llvm-svn: 213707
2014-07-22 23:41:36 +00:00
Lang Hames c90a85ff99 [MCJIT] Teach RuntimeDyldChecker to handle underscores at the start of symbols.
RuntimeDyldChecker had been testing isalpha(Expr[0]) to recognise symbol tokens,
and throwing unrecognized token errors when it hit symbols with leading
underscores. This fixes that.

llvm-svn: 213706
2014-07-22 23:17:21 +00:00
Juergen Ributzka 7325ac39b6 XFAIL the test on MIPS
Not sure how to debug this one without a MIPS machine. Any takers?

llvm-svn: 213705
2014-07-22 23:15:01 +00:00
Juergen Ributzka 2581fa505f [FastIsel][AArch64] Add support for the FastLowerCall and FastLowerIntrinsicCall target-hooks.
This commit modifies the existing call lowering functions to be used as the
FastLowerCall and FastLowerIntrinsicCall target-hooks instead.

This enables patchpoint intrinsic lowering for AArch64.

This fixes <rdar://problem/17733076>

llvm-svn: 213704
2014-07-22 23:14:58 +00:00
Juergen Ributzka 88f6faf1f4 [AArch64] Use CHECK-LABEL in ARM64 ABI unit tests.
llvm-svn: 213703
2014-07-22 23:14:54 +00:00
Alexey Samsonov ad63cfd7e5 [Sanitizer] Disable Wframe-larger-than on PowerPC hosts
llvm-svn: 213702
2014-07-22 23:10:13 +00:00
Lang Hames cce313b082 [MCJIT] Improve stub_addr file-not-found diagnostic to help track down a
buildbot failure.

llvm-svn: 213701
2014-07-22 23:07:52 +00:00
Nick Kledzik b78ad899e5 [mach-o] add support for round tripping all arm/thumb relocations
Update the parse-arm-relocs.yaml test case to run the linker back to back
to ensure all relocations round trip in and out of mach-o.

llvm-svn: 213700
2014-07-22 23:07:49 +00:00
Rui Ueyama 97d7c29fbc [PECOFF] Parameterize ResovalbeSymbols object.
So that it can be shared by multiple input files.

llvm-svn: 213699
2014-07-22 22:55:06 +00:00
Lang Hames f7acddde5b [MCJIT] Refactor and add stub inspection to the RuntimeDyldChecker framework.
This patch introduces a 'stub_addr' builtin that can be used to find the address
of the stub for a given (<file>, <section>, <symbol>) tuple. This address can be
used both to verify the contents of stubs (by loading from the returned address)
and to verify references to stubs (by comparing against the returned address).

Example (1) - Verifying stub contents:

Load 8 bytes (assuming a 64-bit target) from the stub for 'x' in the __text
section of f.o, and compare that value against the addres of 'x'.

# rtdyld-check: *{8}(stub_addr(f.o, __text, x) = x

Example (2) - Verifying references to stubs:

Decode the immediate of the instruction at label 'l', and verify that it's
equal to the offset from the next instruction's PC to the stub for 'y' in the
__text section of f.o (i.e. it's the correct PC-rel difference).

# rtdyld-check: decode_operand(l, 4) = stub_addr(f.o, __text, y) - next_pc(l)
l:
        movq    y@GOTPCREL(%rip), %rax

Since stub inspection requires cooperation with RuntimeDyldImpl this patch
pimpl-ifies RuntimeDyldChecker. Its implementation is moved in to a new class,
RuntimeDyldCheckerImpl, that has access to the definition of RuntimeDyldImpl.

llvm-svn: 213698
2014-07-22 22:47:39 +00:00
Rui Ueyama d0a480a6f2 [PECOFF] Remember /noentry option so that later passes can handle it.
This is a part of a larger change to move the entry point
processing to a later pass than the driver. On Windows the default
entry point function varies depending on user-provided functions.
That means the driver is not able to correctly know the entry point
function name. Only passes after the core linker can infer it.

llvm-svn: 213697
2014-07-22 22:19:42 +00:00
David Majnemer 12bb77ddd1 SBCommunication: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This fixes a diagnostic emitted by GCC.

llvm-svn: 213696
2014-07-22 22:12:58 +00:00
David Majnemer f57a430b90 ScriptInterpreterPython: %p should be used with void-pointer
printf's %p format specifier expects an argument of type void-pointer,
not type PyThreadState*.  Fix this with a static_cast.

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

llvm-svn: 213695
2014-07-22 22:02:48 +00:00
Juergen Ributzka 0e957cf714 Appease the buildbots.
llvm-svn: 213694
2014-07-22 22:02:19 +00:00
David Majnemer 8490da15a8 Host: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This silences a warning emitted by GCC when building LLDB.

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

llvm-svn: 213693
2014-07-22 22:00:42 +00:00
David Majnemer 702c1d0986 SBHostOS: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This fixes a warning emitted by GCC.

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

llvm-svn: 213692
2014-07-22 22:00:04 +00:00
David Majnemer 5ff0278b68 PluginManager: Don't cast from void-pointer to pointer-to-function
GCC warns on reinterpret_cast expressions involving a void-pointer
source and a pointer-to-function destination.  Take a detour through
intptr_t to silence it.

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

llvm-svn: 213691
2014-07-22 21:59:22 +00:00
Simon Atanasyan bcb865a8ce [Mips] Replace assembler code by YAML to make the 'entry-name.test' test target
independent.

llvm-svn: 213690
2014-07-22 21:47:34 +00:00
Juergen Ributzka f560928889 [RuntimeDyld][MachO][AArch64] Add a helper function for encoding addends in instructions.
Factor out the addend encoding into a helper function and simplify the
processRelocationRef.

Also add a few simple rtdyld tests. More tests to come once GOTs can be tested too.

Related to <rdar://problem/17768539>

llvm-svn: 213689
2014-07-22 21:42:55 +00:00
Juergen Ributzka b13b52efe0 [RuntimeDyld][MachO][AArch64] Implement the decodeAddend method.
This adds the required functionality to decode the immediate encoded in an
instruction that is referenced in a relocation entry.

llvm-svn: 213688
2014-07-22 21:42:51 +00:00
Juergen Ributzka dd19d33057 [RuntimeDyld][MachO][AArch64] Add assertion to check for duplicate addend definition.
In MachO for AArch64 it is possible to have an explicit addend defined by
the ARM64_RELOC_ADDEND relocation or having an addend encoded within the
instruction. Only one of them are allowed per relocation.

llvm-svn: 213687
2014-07-22 21:42:49 +00:00
Juergen Ributzka 175b78b02e [RuntimeDyld] Change the return type of decodeAddend to match the storage type.
llvm-svn: 213686
2014-07-22 21:42:46 +00:00
Renato Golin 8c714213d5 Fix incompatible assembly in ARM builtins library
Convert the CBNZ backward branch instruction to CMP and BNE
avoiding illegal backwards branch and making the assembly code
in synh-ops.h to be UAL compliant.

Patch by: Sumanth Gundapaneni

llvm-svn: 213685
2014-07-22 20:59:41 +00:00
Renato Golin aad0347c8b Include assembly files in builtins library build
The CMake assembler build system ignores the .S assembly files in builtins
library build. This patch fixes the issue.

Patch by: Sumanth Gundapaneni

llvm-svn: 213684
2014-07-22 20:59:38 +00:00
David Majnemer 695f0f1024 TypeSynthetic: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

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

llvm-svn: 213682
2014-07-22 20:40:01 +00:00
David Majnemer fba933f94b Mangled: Fix an 'unused variable' warning on GNU/Linux
Platforms which don't use LLDB's built-in demangler don't use the
'mangled_length' variable.  Instead, replace it's only use by an
expression it is equivalent to.

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

llvm-svn: 213681
2014-07-22 20:36:37 +00:00
Ehsan Akhgari c3ad3bab61 Use the correct from type in a SCS
Summary:
If during constructing a standard conversion sequence, we resolve an
overload, we need to adjust the from type in the SCS according to the
resolved operator.

I found this bug when debugging PR20218.  This doesn't seem to be
observable, so there is no good way of testing it.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 213680
2014-07-22 20:20:14 +00:00
Suyog Sarda 3a8c2c1e6c This patch implements optimization as mentioned in PR19753: Optimize comparisons with "ashr/lshr exact" of a constanst.
It handles the errors which were seen in PR19958 where wrong code was being emitted due to earlier patch.
Added code for lshr as well as non-exact right shifts.

It implements : 
(icmp eq/ne (ashr/lshr const2, A), const1)" ->
(icmp eq/ne A, Log2(const2/const1)) ->
(icmp eq/ne A, Log2(const2) - Log2(const1))

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

llvm-svn: 213678
2014-07-22 19:19:36 +00:00
Suyog Sarda b60ec909ca Added InstCombine transform for pattern "(A & B) ^ (A ^ B) -> (A | B)"
Patch idea by Ankit Jain !

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

llvm-svn: 213677
2014-07-22 18:30:54 +00:00
Suyog Sarda d64faf6cae Added InstCombine Transform for patterns:
"((~A & B) | A) -> (A | B)" and "((A & B) | ~A) -> (~A | B)"

Original Patch credit to Ankit Jain !!

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

llvm-svn: 213676
2014-07-22 18:09:41 +00:00