platform/upstream/llvm.git
7 years ago[ELF] - Do not produce broken .dynsym with --no-rosegment.
George Rimar [Fri, 6 Oct 2017 09:56:24 +0000 (09:56 +0000)]
[ELF] - Do not produce broken .dynsym with --no-rosegment.

We produce broken output currently.
Code that writes .dynsym assumes output buffer is zero-filled,
though that is not always true. When --no-rosegment is given,
buffer can be filled with trap instructions. Patch fixes the issue.

It is relative with PR34705.

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

llvm-svn: 315053

7 years ago[ELF] - Fix BB after r315051.
George Rimar [Fri, 6 Oct 2017 09:46:04 +0000 (09:46 +0000)]
[ELF] - Fix BB after r315051.

Testcase has "zlib" requirement, which is unsupported on
windows, so that it was not run locally for me.

llvm-svn: 315052

7 years ago[ELF] - Do --hash-style=both by default.
George Rimar [Fri, 6 Oct 2017 09:37:44 +0000 (09:37 +0000)]
[ELF] - Do --hash-style=both by default.

Its PR34712,

GNU linkers recently changed default values to "both" of "sysv".
Patch do the same for all targets except MIPS, where .gnu.hash
section is not yet supported.

Code suggested by Rui Ueyama.

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

llvm-svn: 315051

7 years ago[TableGen] : CodeGenInsrtuction modify to range loop. NFC.
Javed Absar [Fri, 6 Oct 2017 09:32:45 +0000 (09:32 +0000)]
[TableGen] : CodeGenInsrtuction modify to range loop. NFC.

llvm-svn: 315050

7 years agoFix one more check string after r315045.
Akira Hatanaka [Fri, 6 Oct 2017 08:19:31 +0000 (08:19 +0000)]
Fix one more check string after r315045.

llvm-svn: 315049

7 years agoRefine generation of TBAA information in clang
Ivan A. Kosarev [Fri, 6 Oct 2017 08:17:48 +0000 (08:17 +0000)]
Refine generation of TBAA information in clang

This patch is an attempt to clarify and simplify generation and
propagation of TBAA information. The idea is to pack all values
that describe a memory access, namely, base type, access type and
offset, into a single structure. This is supposed to make further
changes, such as adding support for unions and array members,
easier to prepare and review.

DecorateInstructionWithTBAA() is no more responsible for
converting types to tags. These implicit conversions not only
complicate reading the code, but also suggest assigning scalar
access tags while we generally prefer full-size struct-path tags.

TBAAPathTag is replaced with TBAAAccessInfo; the latter is now
the type of the keys of the cache map that translates access
descriptors to metadata nodes.

Fixed a bug with writing to a wrong map in
getTBAABaseTypeMetadata() (former getTBAAStructTypeInfo()).

We now check for valid base access types every time we
dereference a field. The original code only checks the top-level
base type. See isValidBaseType() / isTBAAPathStruct() calls.

Some entities have been renamed to sound more adequate and less
confusing/misleading in presence of path-aware TBAA information.

Now we do not lookup twice for the same cache entry in
getAccessTagInfo().

Refined relevant comments and descriptions.

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

llvm-svn: 315048

7 years agoFix one more check string after r315045.
Akira Hatanaka [Fri, 6 Oct 2017 08:05:34 +0000 (08:05 +0000)]
Fix one more check string after r315045.

llvm-svn: 315047

7 years agoFix check strings in test case and use llvm::to_string instead of
Akira Hatanaka [Fri, 6 Oct 2017 07:47:47 +0000 (07:47 +0000)]
Fix check strings in test case and use llvm::to_string instead of
std::to_string.

These changes were needed to fix bots that started failing after
r315045.

llvm-svn: 315046

7 years ago[CodeGen] Emit a helper function for __builtin_os_log_format to reduce
Akira Hatanaka [Fri, 6 Oct 2017 07:12:46 +0000 (07:12 +0000)]
[CodeGen] Emit a helper function for __builtin_os_log_format to reduce
code size.

Currently clang expands a call to __builtin_os_log_format into a long
sequence of instructions at the call site, causing code size to
increase in some cases.

This commit attempts to reduce code size by emitting a helper function
that can be shared by calls to __builtin_os_log_format with similar
formats and arguments. The helper function has linkonce_odr linkage to
enable the linker to merge identical functions across translation units.
Attribute 'noinline' is attached to the helper function at -Oz so that
the inliner doesn't inline functions that can potentially be merged.

This commit also fixes a bug where the generated IR writes past the end
of the buffer when "%m" is the last specifier appearing in the format
string passed to __builtin_os_log_format.

Original patch by Duncan Exon Smith.

rdar://problem/34065973
rdar://problem/34196543

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

llvm-svn: 315045

7 years agoRoll forward r314928
Xinliang David Li [Fri, 6 Oct 2017 05:15:25 +0000 (05:15 +0000)]
Roll forward r314928

Fixed ThinLTO bootstrap failure : track new
bitcast per incomingVal. Added new tests.

llvm-svn: 315044

7 years ago[PM] Retire disable unit-at-a-time switch.
Davide Italiano [Fri, 6 Oct 2017 04:39:40 +0000 (04:39 +0000)]
[PM] Retire disable unit-at-a-time switch.

This is a vestige from the GCC-3 days, which disables IPO passes
when set. I don't think anybody actually uses it as there are
several IPO passes which still run with this flag set and
nobody complained/noticed. This reduces the delta between
current and new pass manager and allows us to easily review
the difference when we decide to flip the switch (or audit
which passes should run, FWIW).

llvm-svn: 315043

7 years agoFix typo.
Rui Ueyama [Fri, 6 Oct 2017 04:32:08 +0000 (04:32 +0000)]
Fix typo.

llvm-svn: 315042

7 years ago[CodeExtractor] Fix multiple bugs under certain shape of extracted region
Jakub Kuderski [Fri, 6 Oct 2017 03:37:06 +0000 (03:37 +0000)]
[CodeExtractor] Fix multiple bugs under certain shape of extracted region

Summary:
If the extracted region has multiple exported data flows toward the same BB which is not included in the region, correct resotre instructions and PHI nodes won't be generated inside the exitStub. The solution is simply put the restore instructions right after the definition of output values instead of putting in exitStub.
Unittest for this bug is included.

Author: myhsu

Reviewers: chandlerc, davide, lattner, silvas, davidxl, wmi, kuhar

Subscribers: dberlin, kuhar, mgorny, llvm-commits

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

llvm-svn: 315041

7 years agoNewGVN: Factor out duplicate parts of OpIsSafeForPHIOfOps
Daniel Berlin [Fri, 6 Oct 2017 01:33:06 +0000 (01:33 +0000)]
NewGVN: Factor out duplicate parts of OpIsSafeForPHIOfOps

llvm-svn: 315040

7 years ago[asan] Use gold linker in android tests.
Evgeniy Stepanov [Fri, 6 Oct 2017 00:00:53 +0000 (00:00 +0000)]
[asan] Use gold linker in android tests.

Replace a partial workaround for ld.bfd strangeness with the ultimate one: -fuse-ld=gold.
Reason: ld.bfd problem gets worse with libc++-based NDK toolchain.

llvm-svn: 315039

7 years ago[ELF] Add missing REQUIRES: mips to the test added in r315035
Alexander Richardson [Thu, 5 Oct 2017 23:48:29 +0000 (23:48 +0000)]
[ELF] Add missing REQUIRES: mips to the test added in r315035

llvm-svn: 315038

7 years agoImplement interactive command interruption
Leonard Mosescu [Thu, 5 Oct 2017 23:41:28 +0000 (23:41 +0000)]
Implement interactive command interruption

The core of this change is the new CommandInterpreter::m_command_state,
which models the state transitions for interactive commands, including
an "interrupted" state transition.

In general, command interruption requires cooperation from the code
executing the command, which needs to poll for interruption requests
through CommandInterpreter::WasInterrupted().

CommandInterpreter::PrintCommandOutput() implements an optionally
interruptible printing of the command output, which for large outputs
was likely the longest blocking part.
(ex. target modules dump symtab on a complex binary could take 10+ minutes)

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

llvm-svn: 315037

7 years ago[ELF] Don't crash when parsing a file with out-of-bounds version references
Alexander Richardson [Thu, 5 Oct 2017 23:28:34 +0000 (23:28 +0000)]
[ELF] Don't crash when parsing a file with out-of-bounds version references

Summary:
We were crashing when linking telnetd in FreeBSD because lld was emitting
corrupted output files for --norosegment. In this file the version index of some symbols
was set to 9 but lld only found 8 version definitions.

I am not sure how to create a minimal .so file that also exposes this behaviour so I just added the one that initially caused the error to Inputs/

This partially addresses https://bugs.llvm.org/show_bug.cgi?id=34705

Reviewers: ruiu, rafael, pcc, grimar

Reviewed By: ruiu

Subscribers: emaste, krytarowski

Tags: #lld

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

llvm-svn: 315036

7 years ago[ELF] Don't crash when parsing a file with external version definition references
Alexander Richardson [Thu, 5 Oct 2017 23:28:29 +0000 (23:28 +0000)]
[ELF] Don't crash when parsing a file with external version definition references

Summary:
We were crashing when linking telnetd in FreeBSD because lld was emitting
corrupted output files for --norosegment. In this file the version index of some symbols
was set to 9 but lld only found 8 version definitions.

I am not sure how to create a minimal .so file that also exposes this behaviour so I just added the one that initially caused the error to Inputs/

This partially addresses https://bugs.llvm.org/show_bug.cgi?id=34705

Reviewers: ruiu, rafael, pcc, grimar

Reviewed By: ruiu

Subscribers: emaste, krytarowski

Tags: #lld

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

llvm-svn: 315035

7 years agoRevert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
Francis Ricci [Thu, 5 Oct 2017 23:09:17 +0000 (23:09 +0000)]
Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"

Breaks aarch64 builders

This reverts commit r315014.

llvm-svn: 315034

7 years agoWait for all threads to terminate before exitting.
Rui Ueyama [Thu, 5 Oct 2017 23:01:11 +0000 (23:01 +0000)]
Wait for all threads to terminate before exitting.

I think it is not defined what would happen to detached threads
when the main thread tries to exit. That means it was not guaranteed
that unlinkAsync correctly removes a temporary file. It was also
reported that this unlinkAsync caused a crash on Windows.

This patch adds a few new functions so that the main thread always
waits for non-main threads before exitting.

I don't actually like the new two functions, runBackground and
waitForBackgroundThreads, because it looks like it is a bit
overdesigned. After all, what we are doing with these functions
is to just remove a file.

An alternative would be to do fork(2) and make the child process
remove a file asynchronously. However, it has its own problems.
Correctly forking and reclaiming a resource using waitpid(2) is not
doable unless we know our process-wide settings (such as signal mask),
but we can't make any assumption on it when lld is embedded to other
process. So I chose to stick with threads instead of multi-processes.

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

llvm-svn: 315033

7 years ago[MBP] Remove an invalid assert.
Xin Tong [Thu, 5 Oct 2017 23:00:04 +0000 (23:00 +0000)]
[MBP] Remove an invalid assert.

The patch that this assert comes with is fixing a bug in MBP. The assert is
invalid however.

Thanks to @sergey.k.okunev for finding this

Currently this fails SPECCPU2006 LTO. I will add a test case when I do more
investigation and have one.

llvm-svn: 315032

7 years agoRevert "[LSan] Detect dynamic loader by its base address."
Alex Shlyapnikov [Thu, 5 Oct 2017 22:53:17 +0000 (22:53 +0000)]
Revert "[LSan] Detect dynamic loader by its base address."

This reverts commit r315024.

Breaks sysconf_interceptor_bypass_test.cc

llvm-svn: 315031

7 years ago[CMake] Add install-distribution-toolchain to stage2 target list
Chris Bieneman [Thu, 5 Oct 2017 22:48:34 +0000 (22:48 +0000)]
[CMake] Add install-distribution-toolchain to stage2 target list

This allows generating toolchains with just the distribution components instead of toolchains with everything.

llvm-svn: 315030

7 years ago[libFuzzer] Disable experimental clang coverage support by default.
Max Moroz [Thu, 5 Oct 2017 22:41:03 +0000 (22:41 +0000)]
[libFuzzer] Disable experimental clang coverage support by default.

Summary:
It can be enabled via "-use_clang_coverage=1" flag. Reason for disabling:
libFuzzer resets Clang Counters and makes it impossible to generate coverage
report for a regular fuzz target (i.e. not standalone build).

Reviewers: kcc

Reviewed By: kcc

Subscribers: kcc

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

llvm-svn: 315029

7 years ago[clangd] Attempt to fix compilation with MSVC.
Ilya Biryukov [Thu, 5 Oct 2017 22:15:15 +0000 (22:15 +0000)]
[clangd] Attempt to fix compilation with MSVC.

llvm-svn: 315028

7 years ago[cfi] Disable tests with lld on i386.
Evgeniy Stepanov [Thu, 5 Oct 2017 22:07:21 +0000 (22:07 +0000)]
[cfi] Disable tests with lld on i386.

bin/ld.lld: error: ubsan_handlers.cc:(.debug_info+0x80D5D): has non-ABS reloc

Bug pending.

llvm-svn: 315027

7 years agoModuleUtils: Stop using comdat members to generate unique module ids.
Peter Collingbourne [Thu, 5 Oct 2017 21:54:53 +0000 (21:54 +0000)]
ModuleUtils: Stop using comdat members to generate unique module ids.

It is possible for two modules to define the same set of external
symbols without causing a duplicate symbol error at link time,
as long as each of the symbols is a comdat member. So we cannot
use them as part of a unique id for the module.

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

llvm-svn: 315026

7 years agoFor dllexport class templates, export specializations of member functions (PR34849)
Hans Wennborg [Thu, 5 Oct 2017 21:45:27 +0000 (21:45 +0000)]
For dllexport class templates, export specializations of member functions (PR34849)

llvm-svn: 315025

7 years ago[LSan] Detect dynamic loader by its base address.
Alex Shlyapnikov [Thu, 5 Oct 2017 21:38:33 +0000 (21:38 +0000)]
[LSan] Detect dynamic loader by its base address.

Summary:
Relanding D33859, which was reverted because it has "broken LOTS of
ARM/AArch64 bots for two days".

If it breaks something again, please provide some pointers to broken
bots, not just revert it, otherwise it's very hard to reason what's
wrong with this commit.

Whenever possible (Linux + glibc 2.16+), detect dynamic loader module by
its base address, not by the module name matching. The current name
matching approach fails on some configurations.

Reviewers: eugenis

Subscribers: aemerson, kubamracek, kristof.beyls, llvm-commits

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

llvm-svn: 315024

7 years ago[X86] Extract CATCHRET handling from emitEpilogue, NFC
Reid Kleckner [Thu, 5 Oct 2017 21:37:39 +0000 (21:37 +0000)]
[X86] Extract CATCHRET handling from emitEpilogue, NFC

llvm-svn: 315023

7 years ago[WebAssembly] Add the rest of the atomic loads
Derek Schuff [Thu, 5 Oct 2017 21:18:42 +0000 (21:18 +0000)]
[WebAssembly] Add the rest of the atomic loads

Add extending loads and constant offset patterns
A bit more refactoring of the tablegen to make the patterns fairly nice and
uniform between the regular and atomic loads.

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

llvm-svn: 315022

7 years ago[InstCombine] improve folds for icmp gt/lt (shr X, C1), C2
Sanjay Patel [Thu, 5 Oct 2017 21:11:49 +0000 (21:11 +0000)]
[InstCombine] improve folds for icmp gt/lt (shr X, C1), C2

We can always eliminate the shift in: icmp gt/lt (shr X, C1), C2 --> icmp gt/lt X, C'
This patch was supposed to just be an efficiency improvement because we were doing this 3-step process to fold:

IC: Visiting:   %c = icmp ugt i4 %s, 1
IC: ADD:   %s = lshr i4 %x, 1
IC: ADD:   %1 = udiv i4 %x, 2
IC: Old =   %c = icmp ugt i4 %1, 1
    New =   <badref> = icmp uge i4 %x, 4
IC: ADD:   %c = icmp uge i4 %x, 4
IC: ERASE   %2 = icmp ugt i4 %1, 1
IC: Visiting:   %c = icmp uge i4 %x, 4
IC: Old =   %c = icmp uge i4 %x, 4
    New =   <badref> = icmp ugt i4 %x, 3
IC: ADD:   %c = icmp ugt i4 %x, 3
IC: ERASE   %2 = icmp uge i4 %x, 4
IC: Visiting:   %c = icmp ugt i4 %x, 3
IC: DCE:   %1 = udiv i4 %x, 2
IC: ERASE   %1 = udiv i4 %x, 2
IC: DCE:   %s = lshr i4 %x, 1
IC: ERASE   %s = lshr i4 %x, 1
IC: Visiting:   ret i1 %c

When we could go directly to canonical icmp form:

IC: Visiting:   %c = icmp ugt i4 %s, 1
IC: Old =   %c = icmp ugt i4 %s, 1
    New =   <badref> = icmp ugt i4 %x, 3
IC: ADD:   %c = icmp ugt i4 %x, 3
IC: ERASE   %1 = icmp ugt i4 %s, 1
IC: ADD:   %s = lshr i4 %x, 1
IC: DCE:   %s = lshr i4 %x, 1
IC: ERASE   %s = lshr i4 %x, 1
IC: Visiting:   %c = icmp ugt i4 %x, 3

...but then I noticed that the folds were incomplete too:
https://godbolt.org/g/aB2hLE

Here are attempts to prove the logic with Alive:
https://rise4fun.com/Alive/92o

Name: lshr_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr i8 %x, C1
%r = icmp ult i8 %sh, C2
  =>
%r = icmp ult i8 %x, (C2 << C1)

Name: ashr_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr i8 %x, C1
%r = icmp slt i8 %sh, C2
  =>
%r = icmp slt i8 %x, (C2 << C1)

Name: lshr_ugt
Pre: (((C2+1) << C1) u>> C1) == (C2+1)
%sh = lshr i8 %x, C1
%r = icmp ugt i8 %sh, C2
  =>
%r = icmp ugt i8 %x, ((C2+1) << C1) - 1

Name: ashr_sgt
Pre: (C2 != 127) && ((C2+1) << C1 != -128) && (((C2+1) << C1) >> C1) == (C2+1)
%sh = ashr i8 %x, C1
%r = icmp sgt i8 %sh, C2
  =>
%r = icmp sgt i8 %x, ((C2+1) << C1) - 1

Name: ashr_exact_sgt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp sgt i8 %sh, C2
  =>
%r = icmp sgt i8 %x, (C2 << C1)

Name: ashr_exact_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp slt i8 %sh, C2
  =>
%r = icmp slt i8 %x, (C2 << C1)

Name: lshr_exact_ugt
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ugt i8 %sh, C2
  =>
%r = icmp ugt i8 %x, (C2 << C1)

Name: lshr_exact_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ult i8 %sh, C2
  =>
%r = icmp ult i8 %x, (C2 << C1)

We did something similar for 'shl' in D28406.

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

llvm-svn: 315021

7 years ago[asan] Add --enable-new-dtags in tests on Android.
Evgeniy Stepanov [Thu, 5 Oct 2017 20:45:12 +0000 (20:45 +0000)]
[asan] Add --enable-new-dtags in tests on Android.

The dynamic loader does not accept DT_RPATH; it wants DT_RUNPATH.

This is a temporary fix until D38430 lands.

llvm-svn: 315020

7 years ago[Hexagon] Make PS_fi and PS_fia extendable (they both expand to A2_addi)
Krzysztof Parzyszek [Thu, 5 Oct 2017 20:20:06 +0000 (20:20 +0000)]
[Hexagon] Make PS_fi and PS_fia extendable (they both expand to A2_addi)

llvm-svn: 315019

7 years agoconfigure: Fix handling of directories with compats only source lists
Jan Vesely [Thu, 5 Oct 2017 20:16:28 +0000 (20:16 +0000)]
configure: Fix handling of directories with compats only source lists

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 315018

7 years ago[dsymutil] Fix typo in swift-ast.test
Francis Ricci [Thu, 5 Oct 2017 20:16:16 +0000 (20:16 +0000)]
[dsymutil] Fix typo in swift-ast.test

llvm-svn: 315017

7 years agoAnnotate VP prof on indirect call if it is ICPed in the profiled binary.
Dehao Chen [Thu, 5 Oct 2017 20:15:29 +0000 (20:15 +0000)]
Annotate VP prof on indirect call if it is ICPed in the profiled binary.

Summary: In SamplePGO, when an indirect call is promoted in the profiled binary, before profile annotation, it will be promoted and inlined. For the original indirect call, the current implementation will not mark VP profile on it. This is an issue when profile becomes stale. This patch annotates VP prof on indirect calls during annotation.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 315016

7 years agoCleanup and generalize -shared-libasan.
Evgeniy Stepanov [Thu, 5 Oct 2017 20:14:00 +0000 (20:14 +0000)]
Cleanup and generalize -shared-libasan.

Summary:
* Rename -shared-libasan to -shared-libsan, keeping the old name as alias.
* Add -static-libsan for targets that default to shared.
* Remove an Android special case. It is now possible (but untested) to use static compiler-rt libraries there.
* Support libclang_rt.ubsan_standalone as a shared library.

Unlike GCC, this change applies -shared-libsan / -static-libsan to all sanitizers.
I don't see a point in multiple flags like -shared-libubsan, considering that most sanitizers
are not compatible with each other, and each link has basically a single shared/static choice.

Reviewers: vitalybuka, kcc, rsmith

Subscribers: srhines, cfe-commits

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

llvm-svn: 315015

7 years ago[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Francis Ricci [Thu, 5 Oct 2017 20:03:01 +0000 (20:03 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section

Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

llvm-svn: 315014

7 years ago[Hexagon] Give uniform names to functions changing addressing modes, NFC
Krzysztof Parzyszek [Thu, 5 Oct 2017 20:01:38 +0000 (20:01 +0000)]
[Hexagon] Give uniform names to functions changing addressing modes, NFC

The new format is changeAddrMode_xx_yy, where xx is the current mode,
and yy is the new one.

Old name:               New name:
getBaseWithImmOffset    changeAddrMode_abs_io
getAbsoluteForm         changeAddrMode_io_abs
getBaseWithRegOffset    changeAddrMode_io_rr
xformRegToImmOffset     changeAddrMode_rr_io
getBaseWithLongOffset   changeAddrMode_rr_ur
getRegShlForm           changeAddrMode_ur_rr

llvm-svn: 315013

7 years agoAdded phdr upper bound checks to ElfObject.
Rafael Espindola [Thu, 5 Oct 2017 20:01:32 +0000 (20:01 +0000)]
Added phdr upper bound checks to ElfObject.

Ensure the program_headers call will fail correctly if the program
headers are larger than the underlying buffer.

Patch by Parker Thompson!

llvm-svn: 315012

7 years ago[asan] Use full binary path in the Android test runner.
Evgeniy Stepanov [Thu, 5 Oct 2017 20:00:19 +0000 (20:00 +0000)]
[asan] Use full binary path in the Android test runner.

Summary:
This prevents the confusion when there are similarly named tests in
different configurations (like in test/sanitizer_common).

Reviewers: vitalybuka

Subscribers: srhines, llvm-commits, kubamracek

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

llvm-svn: 315011

7 years ago[sanitizer] Move %ld_flags_rpath_exe to common and use it in more tests.
Evgeniy Stepanov [Thu, 5 Oct 2017 20:00:07 +0000 (20:00 +0000)]
[sanitizer] Move %ld_flags_rpath_exe to common and use it in more tests.

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 315010

7 years agoRevert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
Francis Ricci [Thu, 5 Oct 2017 19:47:13 +0000 (19:47 +0000)]
Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"

This reverts commit r315004, because of a failing test on non-apple platforms

llvm-svn: 315009

7 years agoEnable breakpoints and read/write GPRs for ppc64le
Eugene Zemtsov [Thu, 5 Oct 2017 19:44:05 +0000 (19:44 +0000)]
Enable breakpoints and read/write GPRs for ppc64le

Add support for ppc64le to create breakpoints and read/write
general purpose registers.
Other features for ppc64le and functions to read/write
other registers are being implemented.

Patch by Alexandre Yukio Yamashita (alexandreyy)
Differential Revision: https://reviews.llvm.org/D38323

llvm-svn: 315008

7 years ago[cfi] Mark a test as unsupported on darwin.
Evgeniy Stepanov [Thu, 5 Oct 2017 19:36:15 +0000 (19:36 +0000)]
[cfi] Mark a test as unsupported on darwin.

llvm-svn: 315007

7 years ago[dsymutil] Fix unused variable warning
Francis Ricci [Thu, 5 Oct 2017 19:35:55 +0000 (19:35 +0000)]
[dsymutil] Fix unused variable warning

llvm-svn: 315006

7 years agoFix two-phase name lookup for non-dependent overloaded operators.
Richard Smith [Thu, 5 Oct 2017 19:35:51 +0000 (19:35 +0000)]
Fix two-phase name lookup for non-dependent overloaded operators.

If we resolve an overloaded operator call to a specific function during
template definition, don't perform ADL during template instantiation.
Doing so finds overloads that we're not supposed to find.

llvm-svn: 315005

7 years ago[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Francis Ricci [Thu, 5 Oct 2017 19:17:28 +0000 (19:17 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section

Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

llvm-svn: 315004

7 years ago[NewPassManager] Run global dead code elimination after the inliner.
Davide Italiano [Thu, 5 Oct 2017 18:36:01 +0000 (18:36 +0000)]
[NewPassManager] Run global dead code elimination after the inliner.

This is the same exact change we did for the current pass manager
in rL314997, but the new pass manager pipeline already happened
to run GlobalOpt after the inliner, so we just insert a run of
GDCE here.

llvm-svn: 315003

7 years ago[ARM/AARCH64] Make test MachineBranchProb.ll more robust and re-enable for ARM/AArch64
Balaram Makam [Thu, 5 Oct 2017 18:33:34 +0000 (18:33 +0000)]
[ARM/AARCH64] Make test MachineBranchProb.ll more robust and re-enable for ARM/AArch64

Summary: Make test robust enough to not fail due to CFG changes and re-enable for ARM/AArch64.

Reviewers: rovka, fhahn

Reviewed By: fhahn

Subscribers: fhahn, aemerson, rengolin, mcrosier, llvm-commits, kristof.beyls

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

llvm-svn: 315002

7 years ago[cfi] Test on all available targets.
Evgeniy Stepanov [Thu, 5 Oct 2017 18:28:04 +0000 (18:28 +0000)]
[cfi] Test on all available targets.

Summary:
Run CFI tests on all targets current toolchain can target.
On multiarch Linux, this will run all CFI tests with -m32 and -m64.

Reviewers: pcc

Subscribers: mgorny, llvm-commits

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

llvm-svn: 315001

7 years ago[X86] Simplify X86 epilogue frame size calculation, NFC
Reid Kleckner [Thu, 5 Oct 2017 18:27:08 +0000 (18:27 +0000)]
[X86] Simplify X86 epilogue frame size calculation, NFC

Sink the insertion of "pop ebp" out of the frame size calculation
branches. They all check for HasFP.

Our handling of CLEANUPRET and CATCHRET was equivalent, both are
funclets and use the same frame size. We can eliminate the CLEANUPRET
case.

Hoist the hasFP(MF) query into a local bool.

Rename TargetMBB to CatchRetTarget to be more descriptive.

Eliminate the Optional<unsigned> RetOpcode local, now that it has one
use.

It's only a net savings of 10 lines, but hopefully it's *slightly* more
readable.

llvm-svn: 315000

7 years ago[PassManager] Improve the interaction between -O2 and ThinLTO.
Davide Italiano [Thu, 5 Oct 2017 18:23:25 +0000 (18:23 +0000)]
[PassManager] Improve the interaction between -O2 and ThinLTO.

Run GDCE slightly later so that we don't have to repeat it
twice when preparing for Thin. Thanks to Mehdi for the suggestion.

llvm-svn: 314999

7 years agoAdd vload_half helpers for ptx
Jeroen Ketema [Thu, 5 Oct 2017 18:17:40 +0000 (18:17 +0000)]
Add vload_half helpers for ptx

The removes the vload_half unresolved calls from the nvptx libraries.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314998

7 years ago[PassManager] Run global optimizations after the inliner.
Davide Italiano [Thu, 5 Oct 2017 18:06:37 +0000 (18:06 +0000)]
[PassManager] Run global optimizations after the inliner.

The inliner performs some kind of dead code elimination as it goes,
but there are cases that are not really caught by it. We might
at some point consider teaching the inliner about them, but it
is OK for now to run GlobalOpt + GlobalDCE in tandem as their
benefits generally outweight the cost, making the whole pipeline
faster.

This fixes PR34652.

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

llvm-svn: 314997

7 years ago[SparsePropagation] Move member definitions to header (NFC)
Matthew Simpson [Thu, 5 Oct 2017 18:03:30 +0000 (18:03 +0000)]
[SparsePropagation] Move member definitions to header (NFC)

AbstractLatticeFunction and SparseSolver are class templates parameterized by a
lattice value, so we need to move these member functions over to the header.

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

llvm-svn: 314996

7 years ago[OPENMP] Fix mapping|privatization of implicitly captured variables.
Alexey Bataev [Thu, 5 Oct 2017 17:51:39 +0000 (17:51 +0000)]
[OPENMP] Fix mapping|privatization of implicitly captured variables.

If the `defaultmap(tofrom:scalar)` clause is specified, the scalars must
be mapped with 'tofrom' modifiers, otherwise they must be captured as
firstprivates.

llvm-svn: 314995

7 years ago[mips] implement .set dspr2 directive
Petar Jovanovic [Thu, 5 Oct 2017 17:40:32 +0000 (17:40 +0000)]
[mips] implement .set dspr2 directive

Implement .set dspr2 directive with appropriate feature bits. This
directive is a counterpart of -mattr=dspr2 command line option with the
exception that it does not influence elf header flags.

Patch by Milos Stojanovic.

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

llvm-svn: 314994

7 years agoAMDGPU: Set v2i32 any_extend to expand
Matt Arsenault [Thu, 5 Oct 2017 17:38:30 +0000 (17:38 +0000)]
AMDGPU: Set v2i32 any_extend to expand

llvm-svn: 314993

7 years ago[Analyzer Tests] Run static analyzer integration tests until the end,
George Karpenkov [Thu, 5 Oct 2017 17:32:06 +0000 (17:32 +0000)]
[Analyzer Tests] Run static analyzer integration tests until the end,

Do not stop at the first failure.

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

llvm-svn: 314992

7 years ago[RDF] Simplify construction of maximal registers
Krzysztof Parzyszek [Thu, 5 Oct 2017 17:12:49 +0000 (17:12 +0000)]
[RDF] Simplify construction of maximal registers

The old algoritm was not correct, although it worked most of the time.
Avoid the complex reachability analysis and simply calculate the maximal
registers out of the set of all referenced registers.

llvm-svn: 314991

7 years ago[ProfileData] Fix data racing in merging indexed profiles
Rong Xu [Thu, 5 Oct 2017 17:05:20 +0000 (17:05 +0000)]
[ProfileData] Fix data racing in merging indexed profiles

There is data racing to the static variable RecordIndex in index profile reader
when merging in multiple threads. Make it a member variable in
IndexedInstrProfReader to fix this.

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

llvm-svn: 314990

7 years ago[clangd] Added async API to run code completion.
Ilya Biryukov [Thu, 5 Oct 2017 17:04:13 +0000 (17:04 +0000)]
[clangd] Added async API to run code completion.

Summary:
ClangdServer now provides async code completion API.
It is still used synchronously by ClangdLSPServer, more work is needed
to allow processing other requests in parallel while completion (or
any other request) is running.

Reviewers: klimek, bkramer, krasimir

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 314989

7 years ago[X86] Fix chains update when lowering BUILD_VECTOR to a vector load
Artur Pilipenko [Thu, 5 Oct 2017 16:28:21 +0000 (16:28 +0000)]
[X86] Fix chains update when lowering BUILD_VECTOR to a vector load

The code which lowers BUILD_VECTOR of consecutive loads into a single vector
load doesn't update chains properly. As a result the vector load can be
reordered with the store to the same location.

The current code in EltsFromConsecutiveLoads only updates the chain following
the first load. The fix is to update the chains following all the loads
comprising the vector.

This is a fix for PR10114.

Reviewed By: niravd

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

llvm-svn: 314988

7 years agoAMDGPU: Add and set AMDGPU-specific e_flags
Konstantin Zhuravlyov [Thu, 5 Oct 2017 16:19:18 +0000 (16:19 +0000)]
AMDGPU: Add and set AMDGPU-specific e_flags

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

llvm-svn: 314987

7 years ago[LV] Fix PR34743 - handle casts that sink after interleaved loads
Ayal Zaks [Thu, 5 Oct 2017 15:45:14 +0000 (15:45 +0000)]
[LV] Fix PR34743 - handle casts that sink after interleaved loads

When ignoring a load that participates in an interleaved group, make sure to
move a cast that needs to sink after it.

Testcase derived from reproducer of PR34743.

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

llvm-svn: 314986

7 years agoRevert "Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handl...
Clement Courbet [Thu, 5 Oct 2017 14:42:06 +0000 (14:42 +0000)]
Revert "Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."""

broken test on windows

This reverts commit c91479518344fd1fc071c5bd5848f6eb83e53dca.

llvm-svn: 314985

7 years agorevert r314698 - [InstCombine] remove one-use restriction for icmp (shr exact X,...
Sanjay Patel [Thu, 5 Oct 2017 14:26:15 +0000 (14:26 +0000)]
revert r314698 - [InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1)

There is a bot failure that appears to be related to this change:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/2117

...so reverting to confirm that and attempting to keep the bot green while investigating.

llvm-svn: 314984

7 years ago[ScopBuilder] Introduce -polly-stmt-granularity=scalar-indep option.
Michael Kruse [Thu, 5 Oct 2017 13:43:00 +0000 (13:43 +0000)]
[ScopBuilder] Introduce -polly-stmt-granularity=scalar-indep option.

The option splits BasicBlocks into minimal statements such that no
additional scalar dependencies are introduced.

The algorithm is based on a union-find structure, and unites sets if
putting them into separate statements would introduce a scalar
dependencies. As a consequence, instructions may be split into separate
statements such their relative order is different than the statements
they are in. This is accounted for instructions whose relative order
matters (e.g. memory accesses).

The algorithm is generic in that heuristic changes can be made
relatively easily. We might relax the order requirement for read-reads
or accesses to different base pointers. Forwardable instructions can be
made to not cause a join.

This implementation gives us a speed-up of 82% in SPEC 2006 456.hmmer
benchmark by allowing loop-distribution in a hot loop such that one of
the loops can be vectorized.

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

llvm-svn: 314983

7 years ago[TablgeGen] : Tidy up CodeGenSchedule. NFC.
Javed Absar [Thu, 5 Oct 2017 13:27:43 +0000 (13:27 +0000)]
[TablgeGen] : Tidy up CodeGenSchedule. NFC.

Reviewed by: @MatzeB
Differential Revision: https://reviews.llvm.org/D38534

llvm-svn: 314982

7 years ago[LV] Fix PR34711 - widen instruction ranges when sinking casts
Ayal Zaks [Thu, 5 Oct 2017 12:41:49 +0000 (12:41 +0000)]
[LV] Fix PR34711 - widen instruction ranges when sinking casts

Instead of trying to keep LastWidenRecipe updated after creating each recipe,
have tryToWiden() retrieve the last recipe of the current VPBasicBlock and check
if it's a VPWidenRecipe when attempting to extend its range. This ensures that
such extensions, optimized to maintain the original instruction order, do so
only when the instructions are to maintain their relative order. The latter does
not always hold, e.g., when a cast needs to sink to unravel first order
recurrence (r306884).

Testcase derived from reproducer of PR34711.

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

llvm-svn: 314981

7 years agoRe-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Thu, 5 Oct 2017 12:39:57 +0000 (12:39 +0000)]
Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion.""

llvm-svn: 314980

7 years ago[CodeGen] Unify generation of scalar and struct-path TBAA tags
Ivan A. Kosarev [Thu, 5 Oct 2017 11:08:17 +0000 (11:08 +0000)]
[CodeGen] Unify generation of scalar and struct-path TBAA tags

This patch makes it possible to produce access tags in a uniform
manner regardless whether the resulting tag will be a scalar or a
struct-path one. getAccessTagInfo() now takes care of the actual
translation of access descriptors to tags and can handle all
kinds of accesses. Facilities that specific to scalar accesses
are eliminated.

Some more details:
* DecorateInstructionWithTBAA() is not responsible for conversion
  of types to access tags anymore. Instead, it takes an access
  descriptor (TBAAAccessInfo) and generates corresponding access
  tag from it.
* getTBAAInfoForVTablePtr() reworked to
  getTBAAVTablePtrAccessInfo() that now returns the
  virtual-pointer access descriptor and not the virtual-point
  type metadata.
* Added function getTBAAMayAliasAccessInfo() that returns the
  descriptor for may-alias accesses.
* getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now
  it is the only way to generate access tag by a given access
  descriptor. It is capable of producing both scalar and
  struct-path tags, depending on options and availability of the
  base access type. getTBAAScalarTagInfo() and its cache
  ScalarTagMetadataCache are eliminated.
* Now that we do not need to care about whether the resulting
  access tag should be a scalar or struct-path one,
  getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
* Added function getTBAAAccessInfo() that constructs access
  descriptor by a given QualType access type.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

llvm-svn: 314979

7 years agoRevert r314977 "[CodeGen] Unify generation of scalar and struct-path TBAA tags"
Ivan A. Kosarev [Thu, 5 Oct 2017 11:05:43 +0000 (11:05 +0000)]
Revert r314977 "[CodeGen] Unify generation of scalar and struct-path TBAA tags"

D37826 has been mistakenly committed where it should be the patch from D38503.

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

llvm-svn: 314978

7 years ago[CodeGen] Unify generation of scalar and struct-path TBAA tags
Ivan A. Kosarev [Thu, 5 Oct 2017 10:47:51 +0000 (10:47 +0000)]
[CodeGen] Unify generation of scalar and struct-path TBAA tags

This patch makes it possible to produce access tags in a uniform
manner regardless whether the resulting tag will be a scalar or a
struct-path one. getAccessTagInfo() now takes care of the actual
translation of access descriptors to tags and can handle all
kinds of accesses. Facilities that specific to scalar accesses
are eliminated.

Some more details:
* DecorateInstructionWithTBAA() is not responsible for conversion
  of types to access tags anymore. Instead, it takes an access
  descriptor (TBAAAccessInfo) and generates corresponding access
  tag from it.
* getTBAAInfoForVTablePtr() reworked to
  getTBAAVTablePtrAccessInfo() that now returns the
  virtual-pointer access descriptor and not the virtual-point
  type metadata.
* Added function getTBAAMayAliasAccessInfo() that returns the
  descriptor for may-alias accesses.
* getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now
  it is the only way to generate access tag by a given access
  descriptor. It is capable of producing both scalar and
  struct-path tags, depending on options and availability of the
  base access type. getTBAAScalarTagInfo() and its cache
  ScalarTagMetadataCache are eliminated.
* Now that we do not need to care about whether the resulting
  access tag should be a scalar or struct-path one,
  getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
* Added function getTBAAAccessInfo() that constructs access
  descriptor by a given QualType access type.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

llvm-svn: 314977

7 years ago[mips] Place certain 64 bit FPU instructions in their own decoder namespace
Simon Dardis [Thu, 5 Oct 2017 10:27:37 +0000 (10:27 +0000)]
[mips] Place certain 64 bit FPU instructions in their own decoder namespace

Previously, instructions that were defined to use the FGR64 register class
were associated with the Mips64 table which was incorrect.

Reviewers: nitesh.jain, atanasyan

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

llvm-svn: 314976

7 years ago[analyzer] Fix leak false positives on stuff put in C++/ObjC initializer lists.
Artem Dergachev [Thu, 5 Oct 2017 08:43:32 +0000 (08:43 +0000)]
[analyzer] Fix leak false positives on stuff put in C++/ObjC initializer lists.

The analyzer now realizes that C++ std::initializer_list objects and
Objective-C boxed structure/array/dictionary expressions can potentially
maintain a reference to the objects that were put into them. This avoids
false memory leak posivites and a few other issues.

This is a conservative behavior; for now, we do not model what actually happens
to the objects after being passed into such initializer lists.

rdar://problem/32918288
Differential Revision: https://reviews.llvm.org/D35216

llvm-svn: 314975

7 years ago[DebugInfo] Insert DEBUG_VALUEs after each register redefinition
Karl-Johan Karlsson [Thu, 5 Oct 2017 08:37:31 +0000 (08:37 +0000)]
[DebugInfo] Insert DEBUG_VALUEs after each register redefinition

Summary:
When reinserting debug values after register allocation, make sure to
insert debug values after each redefinition of debug value register in
the slot index range. The reason for this is that DwarfDebug will end
the range of a debug variable when the physical reg is defined. For
instructions with e.g. tied operands this result in prematurely ended
debug range.

This resolves pr34545

Patch by Karl-Johan Karlsson and Bjorn Pettersson

Reviewers: rnk, aprantl

Reviewed By: rnk

Subscribers: bjope, llvm-commits

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

llvm-svn: 314974

7 years ago[MC] - llvm-mc hangs on non-english characters.
George Rimar [Thu, 5 Oct 2017 08:15:55 +0000 (08:15 +0000)]
[MC] - llvm-mc hangs on non-english characters.

Currently llvm-mc just hangs inside infinite loop
while trying to parse file which has ".section .с" inside,
where section name is non-english character.
Patch fixes the issue.

In this patch I also moved content of non-english-characters.s
to test/MC/AsmParser/Inputs folder  so that non-english-characters.s
becomes a single testcase for all invalid inputs containing non-english
symbols. That is convinent because llvm-mc otherwise tries
to parse and tokenize the whole testcase file with tools invocations and
it is harder to isolate the issue.

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

llvm-svn: 314973

7 years agoRevert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Thu, 5 Oct 2017 08:03:39 +0000 (08:03 +0000)]
Revert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."

Breaks
clang-stage1-cmake-RA-incremental/llvm/test/Transforms/MergeICmps/X86/tuple-four-int8.ll

This reverts commit 3038c459d67f8898ffa295d54a013b280690abfa.

llvm-svn: 314972

7 years ago[InstCombine] Fix a vector splat handling bug in transformZExtICmp.
Craig Topper [Thu, 5 Oct 2017 07:59:11 +0000 (07:59 +0000)]
[InstCombine] Fix a vector splat handling bug in transformZExtICmp.

We were using an i1 type and then zero extending to a vector. Instead just create the 0/1 directly as a ConstantInt with the correct type. No need to ask ConstantExpr to zero extend for us.

This bug is a bit tricky to hit because it requires us to visit a zext of an icmp that would normally be simplified to true/false, but that icmp hasnt' been visited yet. In the test case this zext and icmp were created by visiting a udiv and due to worklist ordering we got to the zext first.

Fixes PR34841.

llvm-svn: 314971

7 years ago[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion.
Clement Courbet [Thu, 5 Oct 2017 07:49:09 +0000 (07:49 +0000)]
[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion.

Summary: This is to avoid e.g. merging two cheap icmps if the target is not going to expand to something nice later.

Reviewers: dberlin, spatel

Subscribers: davide, nemanjai

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

llvm-svn: 314970

7 years agoMinor refactoring regarding Cast::isNoopCast(), NFC
Mikael Holmen [Thu, 5 Oct 2017 07:07:09 +0000 (07:07 +0000)]
Minor refactoring regarding Cast::isNoopCast(), NFC

Summary:
FastISel::hasTrivialKill() was the only user of the "IntPtrTy" version of
Cast::isNoopCast(). According to review comments in D37894 we could instead
use the "DataLayout" version of the method, and thus get rid of the
"IntPtrTy" versions of isNoopCast() completely.

With the above done, the remaining isNoopCast() could then be simplified
a bit more.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: wdng, llvm-commits

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

llvm-svn: 314969

7 years ago[XRay][compiler-rt] Write out arg1 payload in naive mode logging
Dean Michael Berris [Thu, 5 Oct 2017 05:45:51 +0000 (05:45 +0000)]
[XRay][compiler-rt] Write out arg1 payload in naive mode logging

Summary:
This change allows the XRay basic (naive) mode logging implementation to
start writing the payload entries through the arg1 logging handler. This
implementation writes out the records that the llvm-xray tool and the
trace reader library will start processing in D38550.

This introduces a new payload record type which logs the data through
the in-memory buffer. It uses the same size/alignment that the normal
XRay record entries use. We use a new record type to indicate these new
entries, so that the trace reader library in LLVM can start reading
these entries.

Depends on D38550.

Reviewers: pelikan

Subscribers: llvm-commits

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

llvm-svn: 314968

7 years ago[XRay][tools] Support arg1 logging entries in the basic logging mode
Dean Michael Berris [Thu, 5 Oct 2017 05:18:17 +0000 (05:18 +0000)]
[XRay][tools] Support arg1 logging entries in the basic logging mode

Summary:
The arg1 logging handler changed in compiler-rt to start writing a
different type for entries encountered when logging the first argument
of XRay-instrumented functions. This change allows the trace loader to
support reading these record types as well as prepare for when the
basic (naive) mode implementation starts writing down the argument
payloads.

Without this change, binaries with arg1 logging support enabled start
writing unreadable logs for any of the XRay tracing tools.

Reviewers: pelikan

Subscribers: llvm-commits

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

llvm-svn: 314967

7 years agoRemove dead code.
Rafael Espindola [Thu, 5 Oct 2017 03:01:05 +0000 (03:01 +0000)]
Remove dead code.

llvm-svn: 314966

7 years ago[libc++] Clarify names of ABI forcing macros
Shoaib Meenai [Thu, 5 Oct 2017 02:18:08 +0000 (02:18 +0000)]
[libc++] Clarify names of ABI forcing macros

Make it clear that these are intended only to force a specific ABI when
the autodetection would give the wrong result by renaming the cmake
options and adding separate forcing macros, as suggested by EricWF in
the post-commit review of r314949 and further discussed on IRC.

llvm-svn: 314965

7 years agoEnabling new pass manager in LTO (and thinLTO) link step.
Sean Fertile [Thu, 5 Oct 2017 01:50:48 +0000 (01:50 +0000)]
Enabling new pass manager in LTO (and thinLTO) link step.

Passes 'new-pass-manager' option to the linker plugin when the new pass
manager is enabled.

Patch by Graham Yiu.

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

llvm-svn: 314964

7 years agoEnabling new pass manager in LTO (and thinLTO) link step.
Sean Fertile [Thu, 5 Oct 2017 01:48:42 +0000 (01:48 +0000)]
Enabling new pass manager in LTO (and thinLTO) link step.

Adds the option 'new-pass-manager' to the gold pluggin to enable using the
new pass manager during the lto/thinlto link step.

Patch by Graham Yiu.

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

llvm-svn: 314963

7 years agoRevert r314928 to investigate thinLTO bootstrap failure
Xinliang David Li [Thu, 5 Oct 2017 01:40:13 +0000 (01:40 +0000)]
Revert r314928 to investigate thinLTO bootstrap failure

llvm-svn: 314961

7 years ago[Analyzer Tests] Fix misc bugs in analyzer reference results updater.
George Karpenkov [Thu, 5 Oct 2017 01:02:20 +0000 (01:02 +0000)]
[Analyzer Tests] Fix misc bugs in analyzer reference results updater.

llvm-svn: 314960

7 years agoWork around a bug in the C++ expression parser.
Jim Ingham [Thu, 5 Oct 2017 01:00:29 +0000 (01:00 +0000)]
Work around a bug in the C++ expression parser.

When the expression parser does name resolution for local
variables in C++ closures it doesn't give the local name
priority over other global symbols of the same name.  heap.py
uses "info" which is a fairly common name, and so the commands
in it fail.  This is a workaround, just use lldb_info not info.

<rdar://problem/34026140>

llvm-svn: 314959

7 years agoAnother silly little thing you can do with Python commands.
Jim Ingham [Thu, 5 Oct 2017 00:49:49 +0000 (00:49 +0000)]
Another silly little thing you can do with Python commands.

Sometimes you want to step along and print a local each time as you go.
You can do that with stop hooks, but that's a little heavy-weight.  This
is a sketch of a command that steps and then does "frame variable" on all
its arguments.

llvm-svn: 314958

7 years agoAdd testcase for r314956:
Richard Smith [Thu, 5 Oct 2017 00:48:18 +0000 (00:48 +0000)]
Add testcase for r314956:

PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.
llvm-svn: 314957

7 years agoPR33924: Merge block-scope anonymous declarations if there are multiple definitions...
Richard Smith [Thu, 5 Oct 2017 00:47:24 +0000 (00:47 +0000)]
PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.

llvm-svn: 314956

7 years agoRemove PendingBody mechanism for function and ObjC method deserialization.
Richard Smith [Thu, 5 Oct 2017 00:43:38 +0000 (00:43 +0000)]
Remove PendingBody mechanism for function and ObjC method deserialization.

In its place, track on the canonical function declaration whether there is a
declaration with a body (and if so, which one). This brings function definition
handling in line with what we do in all other contexts, and is necessary to
allow us to merge declarations within multiple definitions of the same function
(eg, PR33924).

No functionality change intended.

llvm-svn: 314955

7 years agoRefactor duplicated code.
Rafael Espindola [Thu, 5 Oct 2017 00:35:47 +0000 (00:35 +0000)]
Refactor duplicated code.

Since VisibleToRegularObj is weaker than LinkerRedefined, this should
have no functionality change.

llvm-svn: 314954

7 years ago[X86] Fix some Clang-tidy modernize-use-using and Include What You Use warnings;...
Eugene Zelenko [Thu, 5 Oct 2017 00:33:50 +0000 (00:33 +0000)]
[X86] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 314953