platform/upstream/llvm.git
7 years ago[ADT] Make Twine's copy constructor private.
Zachary Turner [Wed, 11 Oct 2017 23:33:06 +0000 (23:33 +0000)]
[ADT] Make Twine's copy constructor private.

There's a lot of misuse of Twine scattered around LLVM.  This
ranges in severity from benign (returning a Twine from a function
by value that is just a string literal) to pretty sketchy (storing
a Twine by value in a class).  While there are some uses for
copying Twines, most of the very compelling ones are confined
to the Twine class implementation itself, and other uses are
either dubious or easily worked around.

This patch makes Twine's copy constructor private, and fixes up
all callsites.

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

llvm-svn: 315530

7 years agolld: Reorder libdeps.
NAKAMURA Takumi [Wed, 11 Oct 2017 23:18:43 +0000 (23:18 +0000)]
lld: Reorder libdeps.

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

llvm-svn: 315529

7 years agoMC Helpers for llvm-cfi-verify.
Vlad Tsyrklevich [Wed, 11 Oct 2017 23:17:29 +0000 (23:17 +0000)]
MC Helpers for llvm-cfi-verify.

Add instruction analysis and machinecode traversal helpers in
preparation for control flow graph generation implementation.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: mgorny, llvm-commits, pcc, kcc

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

llvm-svn: 315528

7 years agoMachineOptimizationRemarkEmitter.h: Appease g++-4.8.2. See also rL313715.
NAKAMURA Takumi [Wed, 11 Oct 2017 23:03:05 +0000 (23:03 +0000)]
MachineOptimizationRemarkEmitter.h: Appease g++-4.8.2. See also rL313715.

llvm-svn: 315527

7 years agoAMDGPU/NFC: Minor clean ups in HSA metadata
Konstantin Zhuravlyov [Wed, 11 Oct 2017 22:59:35 +0000 (22:59 +0000)]
AMDGPU/NFC: Minor clean ups in HSA metadata

  - Use HSA metadata streamer directly from AMDGPUAsmPrinter
  - Make naming consistent with PAL metadata

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

llvm-svn: 315526

7 years agoDefine RelType to represent relocation types.
Rui Ueyama [Wed, 11 Oct 2017 22:49:24 +0000 (22:49 +0000)]
Define RelType to represent relocation types.

We were using uint32_t as the type of relocation kind. It has a
readability issue because what Type really means in `uint32_t Type`
is not obvious. It could be a section type, a symbol type or a
relocation type.

Since we do not do any arithemetic operations on relocation types
(e.g. adding one to R_X86_64_PC32 doesn't make sense), it would be
more natural if they are represented as enums. Unfortunately, that
is not doable because relocation type definitions are spread into
multiple header files.

So I decided to use typedef. This still should be better than the
plain uint32_t because the intended type is now obvious.

llvm-svn: 315525

7 years agoAdd cases for new type DependentAddressSpace, added in r314649
Ted Woodward [Wed, 11 Oct 2017 22:42:21 +0000 (22:42 +0000)]
Add cases for new type DependentAddressSpace, added in r314649

llvm-svn: 315524

7 years agoAMDGPU/NFC: Minor clean ups in PAL metadata
Konstantin Zhuravlyov [Wed, 11 Oct 2017 22:41:09 +0000 (22:41 +0000)]
AMDGPU/NFC: Minor clean ups in PAL metadata

  - Move PAL metadata definitions to AMDGPUMetadata
  - Make naming consistent with HSA metadata

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

llvm-svn: 315523

7 years agoAMDGPU/NFC: Rename code object metadata as HSA metadata
Konstantin Zhuravlyov [Wed, 11 Oct 2017 22:18:53 +0000 (22:18 +0000)]
AMDGPU/NFC: Rename code object metadata as HSA metadata

  - Rename AMDGPUCodeObjectMetadata to AMDGPUMetadata (PAL metadata will be included in this file in the follow up change)
  - Rename AMDGPUCodeObjectMetadataStreamer to AMDGPUHSAMetadataStreamer
  - Introduce HSAMD namespace
  - Other minor name changes in function and test names

llvm-svn: 315522

7 years agoSupport: Work around missing SetFileInformationByHandle on Wine
Hans Wennborg [Wed, 11 Oct 2017 22:04:14 +0000 (22:04 +0000)]
Support: Work around missing SetFileInformationByHandle on Wine

In r315079, fs::rename was reimplemented in terms of CreateFile and
SetFileInformationByHandle. Unfortunately, the latter isn't supported by
Wine. This adds a fallback to MoveFileEx for that case.

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

llvm-svn: 315520

7 years ago[Transforms] Revert r315516 changes in PredicateInfo to fix Windows build bots ...
Eugene Zelenko [Wed, 11 Oct 2017 21:56:44 +0000 (21:56 +0000)]
[Transforms] Revert  r315516 changes in PredicateInfo to fix Windows build bots (NFC).

llvm-svn: 315519

7 years ago[Driver] Export symbols needed to use profile runtime
Vedant Kumar [Wed, 11 Oct 2017 21:54:09 +0000 (21:54 +0000)]
[Driver] Export symbols needed to use profile runtime

Apple's API verification tool (tapi) checks that the symbols exported
from a program match a whitelist. When the program uses the profile
runtime, some additional symbols which are typically not part of the
regular whitelist must be exported.

If we're using symbol export directives along with the profile runtime
on Darwin, the driver needs to export the additional symbols to avoid
verification failures.

rdar://problem/30067753

llvm-svn: 315518

7 years ago[X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.
Craig Topper [Wed, 11 Oct 2017 21:42:02 +0000 (21:42 +0000)]
[X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.

The compiler-rt implementation already supported it, it just wasn't exposed.

llvm-svn: 315517

7 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 11 Oct 2017 21:41:43 +0000 (21:41 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 315516

7 years agoReally fix llvm-rc include-paths.test
Reid Kleckner [Wed, 11 Oct 2017 21:27:54 +0000 (21:27 +0000)]
Really fix llvm-rc include-paths.test

llvm-svn: 315515

7 years agoAttempt to fix failing llvm-rc include-paths.text
Reid Kleckner [Wed, 11 Oct 2017 21:25:03 +0000 (21:25 +0000)]
Attempt to fix failing llvm-rc include-paths.text

llvm-svn: 315514

7 years ago[codeview] Implement FPO data assembler directives
Reid Kleckner [Wed, 11 Oct 2017 21:24:33 +0000 (21:24 +0000)]
[codeview] Implement FPO data assembler directives

Summary:
This adds a set of new directives that describe 32-bit x86 prologues.
The directives are limited and do not expose the full complexity of
codeview FPO data. They are merely a convenience for the compiler to
generate more readable assembly so we don't need to generate tons of
labels in CodeGen. If our prologue emission changes in the future, we
can change the set of available directives to suit our needs. These are
modelled after the .seh_ directives, which use a different format that
interacts with exception handling.

The directives are:
  .cv_fpo_proc _foo
  .cv_fpo_pushreg ebp/ebx/etc
  .cv_fpo_setframe ebp/esi/etc
  .cv_fpo_stackalloc 200
  .cv_fpo_endprologue
  .cv_fpo_endproc
  .cv_fpo_data _foo

I tried to follow the implementation of ARM EHABI CFI directives by
sinking most directives out of MCStreamer and into X86TargetStreamer.
This helps avoid polluting non-X86 code with WinCOFF specific logic.

I used cdb to confirm that this can show locals in parent CSRs in a few
cases, most importantly the one where we use ESI as a frame pointer,
i.e. the one in http://crbug.com/756153#c28

Once we have cdb integration in debuginfo-tests, we can add integration
tests there.

Reviewers: majnemer, hans

Subscribers: aemerson, mgorny, kristof.beyls, llvm-commits, hiraditya

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

llvm-svn: 315513

7 years agoDisable TSan tests on Android.
Evgeniy Stepanov [Wed, 11 Oct 2017 21:22:45 +0000 (21:22 +0000)]
Disable TSan tests on Android.

They never passed. This change excludes them from 'check-all'.

llvm-svn: 315512

7 years agoDisable profile tests on Android.
Evgeniy Stepanov [Wed, 11 Oct 2017 21:22:32 +0000 (21:22 +0000)]
Disable profile tests on Android.

They never actually worked, but this way they are not included in "check-all".

llvm-svn: 315511

7 years ago[Hexagon] Make sure that new-value jump is packetized with producer
Krzysztof Parzyszek [Wed, 11 Oct 2017 21:20:43 +0000 (21:20 +0000)]
[Hexagon] Make sure that new-value jump is packetized with producer

llvm-svn: 315510

7 years ago[sanitizer] Move the errno/ENOMEM allocator checks logic to separate .cc
Kostya Kortchinsky [Wed, 11 Oct 2017 21:20:04 +0000 (21:20 +0000)]
[sanitizer] Move the errno/ENOMEM allocator checks logic to separate .cc

Summary:
This is a new attempt at D38706, which had 2 issues.

The first one was that it broke TSan, because `sanitizer_errno.h` was not
directly included in `tsan_mman.cc`. This fixes the include.

The second one was that it broke the nolibc build, because `__errno_location`
couldn't be found. This adds the new .cc to the libcdep list instead of the
base one.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek, mgorny, llvm-commits

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

llvm-svn: 315509

7 years ago[Analyzer] Support bodyfarming libstdc++ implementation of std::call_once.
George Karpenkov [Wed, 11 Oct 2017 20:53:01 +0000 (20:53 +0000)]
[Analyzer] Support bodyfarming libstdc++ implementation of std::call_once.

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

llvm-svn: 315508

7 years ago[ubsan] Support ubsan-minimal tests on Android.
Evgeniy Stepanov [Wed, 11 Oct 2017 20:46:13 +0000 (20:46 +0000)]
[ubsan] Support ubsan-minimal tests on Android.

llvm-svn: 315507

7 years ago[clang-fuzzer] Build with newer protobuf-mutator.
Matt Morehouse [Wed, 11 Oct 2017 20:45:10 +0000 (20:45 +0000)]
[clang-fuzzer] Build with newer protobuf-mutator.

llvm-svn: 315506

7 years ago[X86] Add Knights Mill CPU to cpu_indicator support to match libgcc.
Craig Topper [Wed, 11 Oct 2017 20:35:43 +0000 (20:35 +0000)]
[X86] Add Knights Mill CPU to cpu_indicator support to match libgcc.

llvm-svn: 315505

7 years agoReland 'Classify llvm-cfi-verify.'
Vlad Tsyrklevich [Wed, 11 Oct 2017 20:35:01 +0000 (20:35 +0000)]
Reland 'Classify llvm-cfi-verify.'

Summary: Move llvm-cfi-verify into a class in preparation for CFI analysis to come.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: mgorny, llvm-commits, pcc, kcc

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

llvm-svn: 315504

7 years ago[libFuzzer] disable use_feature_frequency as it degrades some of the benchmarks too...
Kostya Serebryany [Wed, 11 Oct 2017 20:31:01 +0000 (20:31 +0000)]
[libFuzzer] disable use_feature_frequency as it degrades some of the benchmarks too much :(

llvm-svn: 315503

7 years ago[MachineCombiner] Fix initialisation of LastUpdate for incremental update.
Florian Hahn [Wed, 11 Oct 2017 20:25:58 +0000 (20:25 +0000)]
[MachineCombiner] Fix initialisation of LastUpdate for incremental update.

Summary:
Fixes a bogus iterator resulting from the removal of a block's first instruction at the point that incremental update is enabled.

Patch by Paul Walker.

Reviewers: fhahn, Gerolf, efriedma, MatzeB

Reviewed By: fhahn

Subscribers: aemerson, javed.absar, llvm-commits

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

llvm-svn: 315502

7 years agoFix incorrect integer literal suffix.
Zachary Turner [Wed, 11 Oct 2017 20:23:38 +0000 (20:23 +0000)]
Fix incorrect integer literal suffix.

llvm-svn: 315501

7 years ago[PowerPC] Utilize DQ-Form instructions for spill/restore and fix FrameIndex eliminati...
Lei Huang [Wed, 11 Oct 2017 20:20:58 +0000 (20:20 +0000)]
[PowerPC] Utilize DQ-Form instructions for spill/restore and fix FrameIndex elimination to only use `lis/addi` if necessary.

Currently we produce a bunch of unnecessary code when emitting the
prologue/epilogue for spills/restores.  Namely, if the load from stack
slot/store to stack slot instruction is an X-Form instruction, we will
always produce an LIS/ORI sequence for the stack offset.

Furthermore, we have not exploited the P9 vector D-Form loads/stores for this
purpose.

This patch address both issues.

Specifying the D-Form load as the instruction to use for stack spills/reloads
should be safe because:

1. The stack should be aligned according to the ABI
2. If the stack isn't aligned, PPCRegisterInfo::eliminateFrameIndex() will
   check for the offset being a multiple of 16 and will convert it to an
   X-Form instruction if it isn't.

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

llvm-svn: 315500

7 years ago[llvm-rc] Use proper search algorithm for finding resources.
Zachary Turner [Wed, 11 Oct 2017 20:12:09 +0000 (20:12 +0000)]
[llvm-rc] Use proper search algorithm for finding resources.

Previously we would only look in the current directory for a
resource, which might not be the same as the directory of the
rc file.  Furthermore, MSVC rc supports a /I option, and can
also look in the system environment.  This patch adds support
for this search algorithm.

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

llvm-svn: 315499

7 years agoSupport DWARF unwinding on i386 windows
Martin Storsjo [Wed, 11 Oct 2017 20:06:18 +0000 (20:06 +0000)]
Support DWARF unwinding on i386 windows

In practice, with code built with clang, there are still unresolved
issues with DW_CFA_GNU_args_size though.

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

llvm-svn: 315498

7 years ago[docs] Mention that linux/arm64 is supported with DWARF
Martin Storsjo [Wed, 11 Oct 2017 20:06:07 +0000 (20:06 +0000)]
[docs] Mention that linux/arm64 is supported with DWARF

llvm-svn: 315497

7 years agoRemove default case from switch.
Ted Woodward [Wed, 11 Oct 2017 19:38:35 +0000 (19:38 +0000)]
Remove default case from switch.
Add case to handle new event lldb::eBreakpointEventTypeAutoContinueChanged.

llvm-svn: 315496

7 years agoReturn early if it fails to parse a hex string.
Rui Ueyama [Wed, 11 Oct 2017 19:30:39 +0000 (19:30 +0000)]
Return early if it fails to parse a hex string.

This patch doesn't change the behavior of the program because it
would eventually return None at end of the function. But it is
better to return None early if we know it will eventually happen.

llvm-svn: 315495

7 years agoRevert "[sanitizer] Introduce ReservedAddressRange to sanitizer_common"
Petr Hosek [Wed, 11 Oct 2017 19:29:14 +0000 (19:29 +0000)]
Revert "[sanitizer] Introduce ReservedAddressRange to sanitizer_common"

This reverts commit r315493 which is failing to build on sanitizer-windows.

llvm-svn: 315494

7 years ago[sanitizer] Introduce ReservedAddressRange to sanitizer_common
Petr Hosek [Wed, 11 Oct 2017 19:17:35 +0000 (19:17 +0000)]
[sanitizer] Introduce ReservedAddressRange to sanitizer_common

In Fuchsia, MmapNoAccess/MmapFixedOrDie are implemented using a global
VMAR, which means that MmapNoAccess can only be called once. This works
for the sanitizer allocator but *not* for the Scudo allocator.

Hence, this changeset introduces a new ReservedAddressRange object to
serve as the new API for these calls. In this changeset, the object
still calls into the old Mmap implementations.

The next changeset two changesets will convert the sanitizer and scudo
allocators to use the new APIs, respectively. (ReservedAddressRange will
replace the SecondaryHeader in Scudo.)

Finally, a last changeset will update the Fuchsia implementation.

Patch by Julia Hansbrough

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

llvm-svn: 315493

7 years ago[Analyzer] Fix introduced regression: properly check for nullable attribute.
George Karpenkov [Wed, 11 Oct 2017 19:13:15 +0000 (19:13 +0000)]
[Analyzer] Fix introduced regression: properly check for nullable attribute.

llvm-svn: 315492

7 years ago[SCEV] Properly handle the case of a non-constant start with a zero accum in ScalarEv...
Daniel Neilson [Wed, 11 Oct 2017 19:05:14 +0000 (19:05 +0000)]
[SCEV] Properly handle the case of a non-constant start with a zero accum in ScalarEvolution::createAddRecFromPHIWithCastsImpl

Summary:
 This patch fixes an error in the patch to ScalarEvolution::createAddRecFromPHIWithCastsImpl
made in D37265. In that patch we handle the cases where the either the start or accum values can be
zero after truncation. But, we assume that the start value must be a constant if the accum is
zero. This is clearly an erroneous assumption. This change removes that assumption.

Reviewers: sanjoy, dorit, mkazantsev

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 315491

7 years ago[libFuzzer] make -use_feature_frequency less aggressive and enable by default
Kostya Serebryany [Wed, 11 Oct 2017 19:01:35 +0000 (19:01 +0000)]
[libFuzzer] make -use_feature_frequency less aggressive and enable by default

llvm-svn: 315490

7 years ago[Analyzer] Remove dead code from testing scripts
George Karpenkov [Wed, 11 Oct 2017 18:42:39 +0000 (18:42 +0000)]
[Analyzer] Remove dead code from testing scripts

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

llvm-svn: 315489

7 years ago[Analyzer] Assume that string-like const globals are non-nil.
George Karpenkov [Wed, 11 Oct 2017 18:39:40 +0000 (18:39 +0000)]
[Analyzer] Assume that string-like const globals are non-nil.

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

llvm-svn: 315488

7 years ago[ELF] Try to not emit weird diagnostics on undefined symbols.
Davide Italiano [Wed, 11 Oct 2017 18:37:24 +0000 (18:37 +0000)]
[ELF] Try to not emit weird diagnostics on undefined symbols.

Fixes PR34872.

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

llvm-svn: 315487

7 years ago[clang-fuzzer] Allow linking with any fuzzing engine.
Matt Morehouse [Wed, 11 Oct 2017 18:29:24 +0000 (18:29 +0000)]
[clang-fuzzer] Allow linking with any fuzzing engine.

Summary:
Makes clang-[proto-]fuzzer compatible with flags specified by OSS-Fuzz.

https://llvm.org/pr34314

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: cfe-commits, mgorny

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

llvm-svn: 315486

7 years ago[x86] avoid infinite loop from SoftenFloatOperand (PR34866)
Sanjay Patel [Wed, 11 Oct 2017 18:24:21 +0000 (18:24 +0000)]
[x86] avoid infinite loop from SoftenFloatOperand (PR34866)

Legalization of fp128 assumes things that we should have asserts for,
so that's another potential improvement.

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

llvm-svn: 315485

7 years agoReland "[llvm-objcopy] Add support for --strip-sections to remove all section headers...
Jake Ehrlich [Wed, 11 Oct 2017 18:09:18 +0000 (18:09 +0000)]
Reland "[llvm-objcopy] Add support for --strip-sections to remove all section headers leaving only program headers and loadable segment data"

ubsan caught an issue I made where I was converting a null pointer to a
reference.

elf utils implements a particularly extreme form of stripping that I'd
like to support. eu-strip has an option called "strip-sections" that
removes all section headers and leaves only program headers and the
segment data. I have implemented this option partly as a test but mainly
because in Fuchsia we would like to use this option to minimize the size
of our executables. The other strip options that are on my list include
--strip-all and --strip-debug. This is a preliminary implementation that
I'd like to start using in Fuchsia builds if possible. This change
implements such a stripping option for llvm-objcopy

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

llvm-svn: 315484

7 years agoConvert the last uses of ErrorOr in include/llvm/Object.
Rafael Espindola [Wed, 11 Oct 2017 18:07:18 +0000 (18:07 +0000)]
Convert the last uses of ErrorOr in include/llvm/Object.

llvm-svn: 315483

7 years ago[NFC] update test case so checks are not order dependent when not needed
Lei Huang [Wed, 11 Oct 2017 18:04:41 +0000 (18:04 +0000)]
[NFC] update test case so checks are not order dependent when not needed

llvm-svn: 315482

7 years agoRemove unused include.
Rafael Espindola [Wed, 11 Oct 2017 17:35:48 +0000 (17:35 +0000)]
Remove unused include.

llvm-svn: 315481

7 years agoConvert the last uses of ErrorOr in COFF.h.
Rafael Espindola [Wed, 11 Oct 2017 17:33:11 +0000 (17:33 +0000)]
Convert the last uses of ErrorOr in COFF.h.

llvm-svn: 315480

7 years ago[asan] Tweak test output to diagnose buildbot failures.
Evgeniy Stepanov [Wed, 11 Oct 2017 17:32:38 +0000 (17:32 +0000)]
[asan] Tweak test output to diagnose buildbot failures.

llvm-svn: 315479

7 years agoUpdate for llvm change.
Rafael Espindola [Wed, 11 Oct 2017 17:23:29 +0000 (17:23 +0000)]
Update for llvm change.

llvm-svn: 315478

7 years agoConvert a few ErrorOr to Expected.
Rafael Espindola [Wed, 11 Oct 2017 17:23:15 +0000 (17:23 +0000)]
Convert a few ErrorOr to Expected.

llvm-svn: 315477

7 years ago[NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure
Vivek Pandya [Wed, 11 Oct 2017 17:12:59 +0000 (17:12 +0000)]
[NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure
parameterized emit() calls

Summary: This is not functional change to adopt new emit() API added in r313691.

Reviewed By: anemet

Subscribers: llvm-commits

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

llvm-svn: 315476

7 years agoConvert a couple of ErrorOr to Expected. NFC.
Rafael Espindola [Wed, 11 Oct 2017 17:05:24 +0000 (17:05 +0000)]
Convert a couple of ErrorOr to Expected. NFC.

llvm-svn: 315475

7 years agoRemove an unused include.
Rafael Espindola [Wed, 11 Oct 2017 16:58:32 +0000 (16:58 +0000)]
Remove an unused include.

llvm-svn: 315474

7 years agoConvert an ErrorOr to Expected.
Rafael Espindola [Wed, 11 Oct 2017 16:56:33 +0000 (16:56 +0000)]
Convert an ErrorOr to Expected.

getRelocationAddend should never be called on non SHT_RELA sections,
but changing that requires changing RelocVisitor.h.

llvm-svn: 315473

7 years ago[Hexagon] Handle non-immediate operands to A2_addi in getIncrementValue
Krzysztof Parzyszek [Wed, 11 Oct 2017 16:15:31 +0000 (16:15 +0000)]
[Hexagon] Handle non-immediate operands to A2_addi in getIncrementValue

llvm-svn: 315472

7 years agoSpelling mistake in comment. NFCI.
Simon Pilgrim [Wed, 11 Oct 2017 16:10:05 +0000 (16:10 +0000)]
Spelling mistake in comment. NFCI.

llvm-svn: 315471

7 years ago[X86] Correct type for argument to clflushopt intrinsic.
Craig Topper [Wed, 11 Oct 2017 16:06:08 +0000 (16:06 +0000)]
[X86] Correct type for argument to clflushopt intrinsic.

Summary: According to Intel docs this should take void const *. We had char*. The lack of const is the main issue.

Reviewers: RKSimon, zvi, igorb

Reviewed By: igorb

Subscribers: llvm-commits

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

llvm-svn: 315470

7 years ago[X86] Remove MVT::i1 handling code from LowerTRUNCATE
Craig Topper [Wed, 11 Oct 2017 16:05:05 +0000 (16:05 +0000)]
[X86] Remove MVT::i1 handling code from LowerTRUNCATE

Summary: I don't think this is necessary with i1 being illegal now.

Reviewers: RKSimon, zvi, guyblank

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 315469

7 years ago[Pipeliner] Fix offset value for instrs dependent on post-inc load/stores
Krzysztof Parzyszek [Wed, 11 Oct 2017 15:59:51 +0000 (15:59 +0000)]
[Pipeliner] Fix offset value for instrs dependent on post-inc load/stores

The software pipeliner and the packetizer try to break dependence
between the post-increment instruction and the dependent memory
instructions by changing the base register and the offset value.
However, in some cases, the existing logic didn't work properly
and created incorrect offset value.

Patch by Jyotsna Verma.

llvm-svn: 315468

7 years ago[OPENMP] Remove extra if, NFC.
Alexey Bataev [Wed, 11 Oct 2017 15:56:38 +0000 (15:56 +0000)]
[OPENMP] Remove extra if, NFC.

llvm-svn: 315467

7 years ago[Pipeliner] Improve serialization order for post-increments
Krzysztof Parzyszek [Wed, 11 Oct 2017 15:51:44 +0000 (15:51 +0000)]
[Pipeliner] Improve serialization order for post-increments

The pipeliner is generating a serial sequence that causes poor
register allocation when a post-increment instruction appears
prior to the use of the post-increment register. This occurs when
there is a circular set of dependences involved with a sequence
of instructions in the same cycle. In this case, there is no
serialization of the parallel semantics that will not cause an
additional register to be allocated.

This patch fixes the problem by changing the instructions so that
the post-increment instruction is used by the subsequent
instruction, which enables the register allocator to make a
better decision and not require another register.

Patch by Brendon Cahoon.

llvm-svn: 315466

7 years agoReland "[clang-fuzzer] Allow building without coverage instrumentation."
Matt Morehouse [Wed, 11 Oct 2017 15:51:12 +0000 (15:51 +0000)]
Reland "[clang-fuzzer] Allow building without coverage instrumentation."

This relands r315336 after fixing bot breakage.

llvm-svn: 315465

7 years ago[OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.
Alexey Bataev [Wed, 11 Oct 2017 15:29:40 +0000 (15:29 +0000)]
[OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.

If both taskloop and task directives are used at the same time in one
program, we may ran into the situation when the particular type for task
directive is reused for taskloop directives. Patch fixes this problem.

llvm-svn: 315464

7 years ago[clang-fuzzer] Fix shared library dependencies.
Matt Morehouse [Wed, 11 Oct 2017 15:13:53 +0000 (15:13 +0000)]
[clang-fuzzer] Fix shared library dependencies.

llvm-svn: 315463

7 years ago[Analyzer] Clarify error messages for undefined result
Daniel Marjamaki [Wed, 11 Oct 2017 14:49:35 +0000 (14:49 +0000)]
[Analyzer] Clarify error messages for undefined result

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

llvm-svn: 315462

7 years ago[InstCombine] add baseline tests for D38531; NFC
Sanjay Patel [Wed, 11 Oct 2017 14:29:17 +0000 (14:29 +0000)]
[InstCombine] add baseline tests for D38531; NFC

llvm-svn: 315461

7 years ago[DAGCombiner] convert insertelement of bitcasted vector into shuffle
Sanjay Patel [Wed, 11 Oct 2017 14:12:16 +0000 (14:12 +0000)]
[DAGCombiner] convert insertelement of bitcasted vector into shuffle

Eg:
insert v4i32 V, (v2i16 X), 2 --> shuffle v8i16 V', X', {0,1,2,3,8,9,6,7}

This is a generalization of the IR fold in D38316 to handle insertion into a non-undef vector.
We may want to abandon that one if we can't find value in squashing the more specific pattern sooner.

We're using the existing legal shuffle target hook to avoid AVX512 horror with vXi1 shuffles.

There may be room for improvement in the shuffle lowering here, but that would be follow-up work.

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

llvm-svn: 315460

7 years ago[clang-rename] Add more unittest.
Haojian Wu [Wed, 11 Oct 2017 14:00:42 +0000 (14:00 +0000)]
[clang-rename] Add more unittest.

llvm-svn: 315459

7 years agoRevert "[dsymutil] Timestmap verification for __swift_ast"
Jonas Devlieghere [Wed, 11 Oct 2017 13:51:30 +0000 (13:51 +0000)]
Revert "[dsymutil] Timestmap verification for __swift_ast"

This reverts commit r315456.

llvm-svn: 315458

7 years ago[TargetLowering] Correctly track NumFixedArgs field of CallLoweringInfo
Alex Bradbury [Wed, 11 Oct 2017 13:48:45 +0000 (13:48 +0000)]
[TargetLowering] Correctly track NumFixedArgs field of CallLoweringInfo

The NumFixedArgs field of CallLoweringInfo is used by
TargetLowering::LowerCallTo to determine whether a given argument is passed
using the vararg calling convention or not (specifically, to set IsFixed for
each ISD::OutputArg).

Firstly, CallLoweringInfo::setLibCallee and CallLoweringInfo::setCallee both
incorrectly set NumFixedArgs based on the _previous_ args list. Secondly,
TargetLowering::LowerCallTo failed to increment NumFixedArgs when modifying
the argument list so a pointer is passed for the return value.

If your backend uses the IsFixed property or directly accesses NumFixedArgs,
it is _possible_ this change could result in codegen changes (although the
previous behaviour would have been incorrect). No such cases have been
identified during code review for any in-tree architecture.

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

llvm-svn: 315457

7 years ago[dsymutil] Timestmap verification for __swift_ast
Jonas Devlieghere [Wed, 11 Oct 2017 13:34:52 +0000 (13:34 +0000)]
[dsymutil] Timestmap verification for __swift_ast

This patch adds timestamp verification for swiftmodule files.

 - A new flag is provided to allows us to continue testing of the code
   for embedding the__swift_ast. (git doesn't maintain timestamps)
 - Adds a new test for fat (arm) binaries.

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

llvm-svn: 315456

7 years ago[RISCV] Fix build after r315327
Alex Bradbury [Wed, 11 Oct 2017 12:09:06 +0000 (12:09 +0000)]
[RISCV] Fix build after r315327

Differential Revision: https://reviews.llvm.org/D38779
Patch by Chih-Mao Chen.

llvm-svn: 315455

7 years ago[mips] Add missing tests from rL315451
Simon Dardis [Wed, 11 Oct 2017 11:45:06 +0000 (11:45 +0000)]
[mips] Add missing tests from rL315451

llvm-svn: 315454

7 years ago[OpenCL] Allow function declaration with empty argument list.
Alexey Bader [Wed, 11 Oct 2017 11:16:31 +0000 (11:16 +0000)]
[OpenCL] Allow function declaration with empty argument list.

Treat 'f()' as 'f(void)' rather than a function w/o a prototype.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia, yaxunl

Subscribers: cfe-commits, echuraev, chapuni

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

Re-apply revision 306653.

llvm-svn: 315453

7 years ago[clang-rename] Don't add prefix qualifiers to the declaration and definition of the...
Haojian Wu [Wed, 11 Oct 2017 11:15:48 +0000 (11:15 +0000)]
[clang-rename] Don't add prefix qualifiers to the declaration and definition of the renamed symbol.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, arphaman

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

llvm-svn: 315452

7 years ago[mips] Add support for parsing target specific flags for MIR
Simon Dardis [Wed, 11 Oct 2017 11:11:35 +0000 (11:11 +0000)]
[mips] Add support for parsing target specific flags for MIR

Reviewers: atanasyan

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

llvm-svn: 315451

7 years agollvm/module.modulemap: Create LLVM_MC_TableGen. It is used by llvm-tblgen.
NAKAMURA Takumi [Wed, 11 Oct 2017 11:08:52 +0000 (11:08 +0000)]
llvm/module.modulemap: Create LLVM_MC_TableGen. It is used by llvm-tblgen.

llvm-svn: 315450

7 years agollvm/module.modulemap: Move Support_TargetRegistry to let LLVMSupport free from MC.
NAKAMURA Takumi [Wed, 11 Oct 2017 11:08:50 +0000 (11:08 +0000)]
llvm/module.modulemap: Move Support_TargetRegistry to let LLVMSupport free from MC.

llvm-svn: 315449

7 years ago[NFC] Fix variables used only for assert in GVN
Max Kazantsev [Wed, 11 Oct 2017 10:31:49 +0000 (10:31 +0000)]
[NFC] Fix variables used only for assert in GVN

llvm-svn: 315448

7 years ago[llvm-rc] Fix spelling in message
Simon Dardis [Wed, 11 Oct 2017 10:14:22 +0000 (10:14 +0000)]
[llvm-rc] Fix spelling in message

llvm-svn: 315447

7 years ago[TableGen] Tidy up CodeGenSchedule.cpp
Javed Absar [Wed, 11 Oct 2017 09:33:23 +0000 (09:33 +0000)]
[TableGen] Tidy up CodeGenSchedule.cpp

Use range_loop where it simplifies.

llvm-svn: 315446

7 years ago[Asm] Add debug tracing in table-generated assembly matcher
Oliver Stannard [Wed, 11 Oct 2017 09:17:43 +0000 (09:17 +0000)]
[Asm] Add debug tracing in table-generated assembly matcher

This adds debug tracing to the table-generated assembly instruction matcher,
enabled by the -debug-only=asm-matcher option.

The changes in the target AsmParsers are to add an MCInstrInfo reference under
a consistent name, so that we can use it from table-generated code. This was
already being used this way for targets that use deprecation warnings, but 5
targets did not have it, and Hexagon had it under a different name to the other
backends.

llvm-svn: 315445

7 years agoFix dumping of characters with non-standard sizes
Petr Pavlu [Wed, 11 Oct 2017 08:48:18 +0000 (08:48 +0000)]
Fix dumping of characters with non-standard sizes

* Prevent dumping of characters in DumpDataExtractor() with
  item_byte_size bigger than 8 bytes. This case is not supported by the
  code and results in a crash because the code calls
  DataExtractor::GetMaxU64Bitfield() -> GetMaxU64() that asserts for
  byte size > 8 bytes.
* Teach DataExtractor::GetMaxU64(), GetMaxU32(), GetMaxS64() and
  GetMaxU64_unchecked() how to handle byte sizes that are not a multiple
  of 2. This allows DumpDataExtractor() to dump characters and booleans
  with item_byte_size in the interval of [1, 8] bytes. Values that are
  not a multiple of 2 would previously result in a crash because they
  were not handled by GetMaxU64().

llvm-svn: 315444

7 years ago[X86] Added tests for TESTM and TESTNM (NFC)
Uriel Korach [Wed, 11 Oct 2017 08:39:25 +0000 (08:39 +0000)]
[X86] Added tests for TESTM and TESTNM (NFC)

Adding this test files now so after another commit that will add a new pattern for
TESTM and TESTNM instructions will show the improvemnts that have been done.

Change-Id: If3908b7f91897d764053312365a2bc1de78b291d
llvm-svn: 315443

7 years ago[ELF] - Fix out of sync comment. NFC.
George Rimar [Wed, 11 Oct 2017 08:18:53 +0000 (08:18 +0000)]
[ELF] - Fix out of sync comment. NFC.

llvm-svn: 315442

7 years ago[ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}.
George Rimar [Wed, 11 Oct 2017 08:13:40 +0000 (08:13 +0000)]
[ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}.

This is PR34546.

Currently LLD creates output sections even if it has no input sections,
but its command contains an assignment.
Committed code just assigns the same flag that was used in previous
live section.
That does not work sometimes. For example if we have following script:

.ARM.exidx : { *(.ARM.exidx*) }
.foo : { _foo = 0; } }
Then first section has SHF_LINK_ORDER flag. But section foo should not.
That was a reason of crash in OutputSection::finalize(). LLD tried to calculate
Link value, calling front() on empty input sections list.
We should only keep access flags and omit all others when creating such sections.

Patch fixes the crash observed.

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

llvm-svn: 315441

7 years ago[GVN] Prevent LoadPRE from hoisting across instructions that don't pass control flow...
Max Kazantsev [Wed, 11 Oct 2017 08:10:43 +0000 (08:10 +0000)]
[GVN] Prevent LoadPRE from hoisting across instructions that don't pass control flow to successors

This patch fixes the miscompile that happens when PRE hoists loads across guards and
other instructions that don't always pass control flow to their successors. PRE is now prohibited
to hoist across such instructions because there is no guarantee that the load standing after such
instruction is still valid before such instruction. For example, a load from under a guard may be
invalid before the guard in the following case:
  int array[LEN];
  ...
  guard(0 <= index && index < LEN);
  use(array[index]);

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

llvm-svn: 315440

7 years agoRevert r314955: "Remove PendingBody mechanism for function and ObjC method deserializ...
Daniel Jasper [Wed, 11 Oct 2017 07:47:54 +0000 (07:47 +0000)]
Revert r314955: "Remove PendingBody mechanism for function and ObjC method deserialization."

This is breaking a build of https://github.com/abseil/abseil-cpp and so
likely not really NFC. Also reverted subsequent r314956/7.

I'll forward reproduction instructions to Richard.

llvm-svn: 315439

7 years ago[LICM] Disallow sinking of unordered atomic loads into loops
Max Kazantsev [Wed, 11 Oct 2017 07:26:45 +0000 (07:26 +0000)]
[LICM] Disallow sinking of unordered atomic loads into loops

Sinking of unordered atomic load into loop must be disallowed because it turns
a single load into multiple loads. The relevant section of the documentation
is: http://llvm.org/docs/Atomics.html#unordered, specifically the Notes for
Optimizers section. Here is the full text of this section:

> Notes for optimizers
> In terms of the optimizer, this **prohibits any transformation that
> transforms a single load into multiple loads**, transforms a store into
> multiple stores, narrows a store, or stores a value which would not be
> stored otherwise. Some examples of unsafe optimizations are narrowing
> an assignment into a bitfield, rematerializing a load, and turning loads
> and stores into a memcpy call. Reordering unordered operations is safe,
> though, and optimizers should take advantage of that because unordered
> operations are common in languages that need them.

Patch by Daniil Suchkov!

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D38392

llvm-svn: 315438

7 years ago[IRCE] Do not process empty safe ranges
Max Kazantsev [Wed, 11 Oct 2017 06:53:07 +0000 (06:53 +0000)]
[IRCE] Do not process empty safe ranges

IRCE should not apply when the safe iteration range is proved to be empty.
In this case we do unneeded job creating pre/post loops and then never
go to the main loop.

This patch makes IRCE not apply to empty safe ranges, adds test for this
situation and also modifies one of existing tests where it used to happen
slightly.

Reviewed By: anna
Differential Revision: https://reviews.llvm.org/D38577

llvm-svn: 315437

7 years agoDo not copy Sections vector.
Rui Ueyama [Wed, 11 Oct 2017 05:13:16 +0000 (05:13 +0000)]
Do not copy Sections vector.

llvm-svn: 315436

7 years agoReorder.
NAKAMURA Takumi [Wed, 11 Oct 2017 04:54:05 +0000 (04:54 +0000)]
Reorder.

llvm-svn: 315435

7 years agoSplit LinkerScript::computeInputSections into two functions.
Rui Ueyama [Wed, 11 Oct 2017 04:50:30 +0000 (04:50 +0000)]
Split LinkerScript::computeInputSections into two functions.

llvm-svn: 315434

7 years agoSwap parameters of getSymbolValue.
Rui Ueyama [Wed, 11 Oct 2017 04:34:34 +0000 (04:34 +0000)]
Swap parameters of getSymbolValue.

Usually, a function that does symbol lookup takes symbol name as
its first argument. Also, if a function takes a source location hint,
it is usually the last parameter. So the previous parameter order
was counter-intuitive.

llvm-svn: 315433

7 years agoDo not handle DefinedCommon in linker scripts.
Rui Ueyama [Wed, 11 Oct 2017 04:31:13 +0000 (04:31 +0000)]
Do not handle DefinedCommon in linker scripts.

Because of r314495, DefinedCommon symbols cannot reach to
getSymbolValue function. When they reach the fucntion, they have
already been converted to DefinedRegular symbols.

llvm-svn: 315432

7 years agoRename BytesDataCommand -> ByteCommand.
Rui Ueyama [Wed, 11 Oct 2017 04:22:09 +0000 (04:22 +0000)]
Rename BytesDataCommand -> ByteCommand.

llvm-svn: 315431

7 years agoInline LinkerScript::process.
Rui Ueyama [Wed, 11 Oct 2017 04:21:55 +0000 (04:21 +0000)]
Inline LinkerScript::process.

"process" was not a good name because everything can be named it.

llvm-svn: 315430