platform/upstream/llvm.git
6 years agoChange bool_constant to integral_constant.
Zachary Turner [Fri, 20 Jul 2018 16:51:55 +0000 (16:51 +0000)]
Change bool_constant to integral_constant.

bool_constant is C++17.

llvm-svn: 337576

6 years ago[ARM] Add new feature to enable optimizing the VFP registers
Evandro Menezes [Fri, 20 Jul 2018 16:49:28 +0000 (16:49 +0000)]
[ARM] Add new feature to enable optimizing the VFP registers

Enable the optimization of operations on DPR and SPR via a feature instead
of checking the target.

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

llvm-svn: 337575

6 years agoAdd llvm::Any.
Zachary Turner [Fri, 20 Jul 2018 16:39:32 +0000 (16:39 +0000)]
Add llvm::Any.

This is analogous to std::any which is only available in C++17.

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

llvm-svn: 337573

6 years agoRewrite the VS integration scripts.
Zachary Turner [Fri, 20 Jul 2018 16:30:02 +0000 (16:30 +0000)]
Rewrite the VS integration scripts.

This is a new modernized VS integration installer.  It adds a
Visual Studio .sln file which, when built, outputs a VSIX that can
be used to install ourselves as a "real" Visual Studio Extension.
We can even upload this extension to the visual studio marketplace.

This fixes a longstanding problem where we didn't support installing
into VS 2017 and higher.  In addition to supporting VS 2017, due
to the way this is written we now longer need to do anything special
to support future versions of VS as well.  Everything should
"just work".  This also fixes several bugs with our old integration,
such as MSBuild triggering full rebuilds when /Zi was used.

Finally, we add a new UI page called "LLVM" which becomes visible
when the LLVM toolchain is selected.  For now this only contains
one option which is the path to clang-cl.exe, but in the future
we can add more things here.

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

llvm-svn: 337572

6 years ago[MSan] run materializeChecks() before materializeStores()
Alexander Potapenko [Fri, 20 Jul 2018 16:28:49 +0000 (16:28 +0000)]
[MSan] run materializeChecks() before materializeStores()

When pointer checking is enabled, it's important that every pointer is
checked before its value is used.
For stores MSan used to generate code that calculates shadow/origin
addresses from a pointer before checking it.
For userspace this isn't a problem, because the shadow calculation code
is quite simple and compiler is able to move it after the check on -O2.
But for KMSAN getShadowOriginPtr() creates a runtime call, so we want the
check to be performed strictly before that call.

Swapping materializeChecks() and materializeStores() resolves the issue:
both functions insert code before the given IR location, so the new
insertion order guarantees that the code calculating shadow address is
between the address check and the memory access.

llvm-svn: 337571

6 years ago[X86][SSE] Use SplitOpsAndApply to improve HADD/HSUB lowering
Simon Pilgrim [Fri, 20 Jul 2018 16:20:45 +0000 (16:20 +0000)]
[X86][SSE] Use SplitOpsAndApply to improve HADD/HSUB lowering

Improve AVX1 256-bit vector HADD/HSUB matching by using SplitOpsAndApply to split into 128-bit instructions.

llvm-svn: 337568

6 years ago[llvm-objcopy, tests] Fix several llvm-objcopy tests
Stella Stamenova [Fri, 20 Jul 2018 16:19:36 +0000 (16:19 +0000)]
[llvm-objcopy, tests] Fix several llvm-objcopy tests

Summary: In Python 3, sys.stdout.write expects a string rather than bytes. In order to be able to write the bytes to stdout, we need to use the buffer directly instead. This change is borrowing the implementation for writing to stdout that cat.py uses. Note that we cannot use cat.py directly because the file we are trying to open is a gzip file.

Reviewers: asmith, bkramer, alexshap, jakehehrlich

Reviewed By: alexshap, jakehehrlich

Subscribers: jakehehrlich, llvm-commits

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

llvm-svn: 337567

6 years ago[X86][AVX] Add support for i16 256-bit vector horizontal op redundant shuffle removal
Simon Pilgrim [Fri, 20 Jul 2018 15:51:01 +0000 (15:51 +0000)]
[X86][AVX] Add support for i16 256-bit vector horizontal op redundant shuffle removal

llvm-svn: 337566

6 years ago[X86][AVX] Add v16i16 horizontal op redundant shuffle tests
Simon Pilgrim [Fri, 20 Jul 2018 15:41:15 +0000 (15:41 +0000)]
[X86][AVX] Add v16i16 horizontal op redundant shuffle tests

llvm-svn: 337565

6 years agoFix build breakage from r337562
Pavel Labath [Fri, 20 Jul 2018 15:40:24 +0000 (15:40 +0000)]
Fix build breakage from r337562

I changed a variable's type from pointer to reference, but forgot to
update the assert-only code.

llvm-svn: 337564

6 years ago[DAG] Avoid Node Update assertion due to AND simplification
Nirav Dave [Fri, 20 Jul 2018 15:27:24 +0000 (15:27 +0000)]
[DAG] Avoid Node Update assertion due to AND simplification

Check for construction-time folding for incomplete AND nodes in
BackwardsPropagateMask.

Fixes PR38185.

Reviewers: RKSimon, samparker

Reviewed By: samparker

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 337563

6 years agoDwarfDebug: Reduce duplication in addAccel*** methods
Pavel Labath [Fri, 20 Jul 2018 15:24:13 +0000 (15:24 +0000)]
DwarfDebug: Reduce duplication in addAccel*** methods

Summary:
Each of the four methods had a dozen lines and was doing almost exactly
the same thing: get the appropriate accelerator table kind and insert an
entry into it. I move this common logic to a helper function and make
these methods delegate to it.

This came up in the context of D49493, where I've needed to make adding
a string to a string pool slightly more complicated, and it seemed to
make sense to do it in one place instead of five.

To make this work I've needed to unify the interface of the AccelTable
data types, as some used to store DIE& and others DIE*. I chose to unify
to a reference as that's what the caller uses.

This technically isn't NFC, because it changes the StringPool used for
apple tables in the DWO case (now it uses the main file like DWARF v5
instead of the DWO file). However, that shouldn't matter, as DWO is not
a thing on apple targets (clang frontend simply ignores -gsplit-dwarf).

Reviewers: JDevlieghere, aprantl, probinson

Subscribers: llvm-commits

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

llvm-svn: 337562

6 years ago[X86][AVX] Add support for 32/64 bits 256-bit vector horizontal op redundant shuffle...
Simon Pilgrim [Fri, 20 Jul 2018 15:24:12 +0000 (15:24 +0000)]
[X86][AVX] Add support for 32/64 bits 256-bit vector horizontal op redundant shuffle removal

llvm-svn: 337561

6 years ago[DAG] Fix Memory ordering check in ReduceLoadOpStore.
Nirav Dave [Fri, 20 Jul 2018 15:20:50 +0000 (15:20 +0000)]
[DAG] Fix Memory ordering check in ReduceLoadOpStore.

When merging through a TokenFactor we need to check that the
load may be ordered such that no other aliasing memory operations may
happen. It is not sufficient to just check that the load is a member
of the chain token factor as it there may be a indirect chain. Require
the load's chain has only one use.

This fixes PR37826.

Reviewers: spatel, davide, efriedma, craig.topper, RKSimon

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 337560

6 years ago[analyzer] Rename DanglingInternalBufferChecker to InnerPointerChecker.
Reka Kovacs [Fri, 20 Jul 2018 15:14:49 +0000 (15:14 +0000)]
[analyzer] Rename DanglingInternalBufferChecker to InnerPointerChecker.

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

llvm-svn: 337559

6 years ago[X86][AVX] Add 256-bit vector horizontal op redundant shuffle tests
Simon Pilgrim [Fri, 20 Jul 2018 15:07:53 +0000 (15:07 +0000)]
[X86][AVX] Add 256-bit vector horizontal op redundant shuffle tests

llvm-svn: 337558

6 years ago[scudo] Simplify internal names (NFC)
Kostya Kortchinsky [Fri, 20 Jul 2018 15:07:17 +0000 (15:07 +0000)]
[scudo] Simplify internal names (NFC)

Summary:
There is currently too much redundancy in the class/variable/* names in Scudo:
- we are in the namespace `__scudo`, so there is no point in having something
  named `ScudoX` to end up with a final name of `__scudo::ScudoX`;
- there are a lot of types/* that have `Allocator` in the name, given that
  Scudo is an allocator I figure this doubles up as well.

So change a bunch of the Scudo names to make them shorter, less redundant, and
overall simpler. They should still be pretty self explaining (or at least it
looks so to me).

The TSD part will be done in another CL (eg `__scudo::ScudoTSD`).

Reviewers: alekseyshl, eugenis

Reviewed By: alekseyshl

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 337557

6 years ago[www] Add CodeCompass and CodeChecker to Clang Related Projects page
Bruno Cardoso Lopes [Fri, 20 Jul 2018 14:46:10 +0000 (14:46 +0000)]
[www] Add CodeCompass and CodeChecker to Clang Related Projects page

llvm-svn: 337555

6 years ago[IPSCCP] Fix for bot failure caused by r337548
Florian Hahn [Fri, 20 Jul 2018 14:37:10 +0000 (14:37 +0000)]
[IPSCCP] Fix for bot failure caused by r337548

llvm-svn: 337554

6 years agoImplement cpu_dispatch/cpu_specific Multiversioning
Erich Keane [Fri, 20 Jul 2018 14:13:28 +0000 (14:13 +0000)]
Implement cpu_dispatch/cpu_specific Multiversioning

As documented here: https://software.intel.com/en-us/node/682969 and
https://software.intel.com/en-us/node/523346. cpu_dispatch multiversioning
is an ICC feature that provides for function multiversioning.

This feature is implemented with two attributes: First, cpu_specific,
which specifies the individual function versions. Second, cpu_dispatch,
which specifies the location of the resolver function and the list of
resolvable functions.

This is valuable since it provides a mechanism where the resolver's TU
can be specified in one location, and the individual implementions
each in their own translation units.

The goal of this patch is to be source-compatible with ICC, so this
implementation diverges from the ICC implementation in a few ways:
1- Linux x86/64 only: This implementation uses ifuncs in order to
properly dispatch functions. This is is a valuable performance benefit
over the ICC implementation. A future patch will be provided to enable
this feature on Windows, but it will obviously more closely fit ICC's
implementation.
2- CPU Identification functions: ICC uses a set of custom functions to identify
the feature list of the host processor. This patch uses the cpu_supports
functionality in order to better align with 'target' multiversioning.
1- cpu_dispatch function def/decl: ICC's cpu_dispatch requires that the function
marked cpu_dispatch be an empty definition. This patch supports that as well,
however declarations are also permitted, since the linker will solve the
issue of multiple emissions.

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

llvm-svn: 337552

6 years agoRegenerate partial vector fold test. NFCI.
Simon Pilgrim [Fri, 20 Jul 2018 13:58:57 +0000 (13:58 +0000)]
Regenerate partial vector fold test. NFCI.

llvm-svn: 337551

6 years agoesan: fix shadow setup
Dmitry Vyukov [Fri, 20 Jul 2018 13:40:08 +0000 (13:40 +0000)]
esan: fix shadow setup

r337531 changed return type of MmapFixedNoReserve, but esan wasn't updated.
As the result esan shadow setup always fails.
We probably need to make MmapFixedNoAccess signature consistent
with MmapFixedNoReserve. But this is just to unbreak tests.

llvm-svn: 337550

6 years ago[NFC][testcases] fold sdiv if two operands are negated and non-overflow
Chen Zheng [Fri, 20 Jul 2018 13:38:59 +0000 (13:38 +0000)]
[NFC][testcases] fold sdiv if two operands are negated and non-overflow

llvm-svn: 337549

6 years agoRecommit r328307: [IPSCCP] Use constant range information for comparisons of parameters.
Florian Hahn [Fri, 20 Jul 2018 13:29:12 +0000 (13:29 +0000)]
Recommit r328307: [IPSCCP] Use constant range information for comparisons of parameters.

This version contains a fix to add values for which the state in ParamState change
to the worklist if the state in ValueState did not change. To avoid adding the
same value multiple times, mergeInValue returns true, if it added the value to
the worklist. The value is added to the worklist depending on its state in
ValueState.

Original message:
For comparisons with parameters, we can use the ParamState lattice
elements which also provide constant range information. This improves
the code for PR33253 further and gets us closer to use
ValueLatticeElement for all values.

Also, as we are using the range information in the solver directly, we
do not need tryToReplaceWithConstantRange afterwards anymore.

Reviewers: dberlin, mssimpso, davide, efriedma

Reviewed By: mssimpso

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

llvm-svn: 337548

6 years ago[X86][AVX] Convert X86ISD::VBROADCAST demanded elts combine to use SimplifyDemandedVe...
Simon Pilgrim [Fri, 20 Jul 2018 13:26:51 +0000 (13:26 +0000)]
[X86][AVX] Convert X86ISD::VBROADCAST demanded elts combine to use SimplifyDemandedVectorElts

This is an early step towards using SimplifyDemandedVectorElts for target shuffle combining - this merely moves the existing X86ISD::VBROADCAST simplification code to use the SimplifyDemandedVectorElts mechanism.

Adds X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode to handle X86ISD::VBROADCAST - in time we can support all target shuffles (and other ops) here.

llvm-svn: 337547

6 years agoRegenerate remainder test.
Simon Pilgrim [Fri, 20 Jul 2018 13:14:29 +0000 (13:14 +0000)]
Regenerate remainder test.

llvm-svn: 337546

6 years ago[InstSimplify] fold srem instruction if its two operands are negated.
Chen Zheng [Fri, 20 Jul 2018 13:00:47 +0000 (13:00 +0000)]
[InstSimplify] fold srem instruction if its two operands are negated.

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

llvm-svn: 337545

6 years ago[DebugInfo] Generate .debug_names section when it makes sense
Pavel Labath [Fri, 20 Jul 2018 12:59:05 +0000 (12:59 +0000)]
[DebugInfo] Generate .debug_names section when it makes sense

Summary:
This patch makes us generate the debug_names section in response to some
user-facing commands (previously it was only generated if explicitly
selected via the -accel-tables option).

My goal was to make this work for DWARF>=5 (as it's an official part of
that standard), and also, as an extension, for DWARF<5 if one is
explicitly tuning for lldb as a debugger (because it brings a large
performance improvement there).

This is slightly complicated by the fact that the debug_names tables are
incompatible with the DWARF v4 type units (they assume that the type
units are in the debug_info section), and unfortunately, right now we
generate DWARF v4-style type units even for -gdwarf-5. For this reason,
I disable all accelerator tables if the user requested type unit
generation. I do this even for apple tables, as they have the same
problem (in fact generating type units for apple targets makes us crash
even before we get around to emitting the accelerator tables).

Reviewers: JDevlieghere, aprantl, dblaikie, echristo, probinson

Subscribers: llvm-commits

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

llvm-svn: 337544

6 years ago[NFC][testcases] more testcases for folding srem if its two operands are negatived.
Chen Zheng [Fri, 20 Jul 2018 12:53:45 +0000 (12:53 +0000)]
[NFC][testcases] more testcases for folding srem if its two operands are negatived.

llvm-svn: 337543

6 years ago[SystemZ] Test case formatting fixes
Ulrich Weigand [Fri, 20 Jul 2018 12:12:10 +0000 (12:12 +0000)]
[SystemZ] Test case formatting fixes

Fix systematically wrong whitespace from a prior automated change.

NFC.

llvm-svn: 337542

6 years agoRevert "[LSV] Refactoring + supporting bitcasts to a type of different size"
Sam McCall [Fri, 20 Jul 2018 12:03:00 +0000 (12:03 +0000)]
Revert "[LSV] Refactoring + supporting bitcasts to a type of different size"

This reverts commit r337489.
It causes asserts to fire in some TensorFlow tests, e.g.
tensorflow/compiler/tests/gather_test.py on GPU.

Example stack trace:
Start test case: GatherTest.testHigherRank
assertion failed at third_party/llvm/llvm/lib/Support/APInt.cpp:819 in llvm::APInt llvm::APInt::trunc(unsigned int) const: width && "Can't truncate to 0 bits"
    @     0x5559446ebe10  __assert_fail
    @     0x55593ef32f5e  llvm::APInt::trunc()
    @     0x55593d78f86e  (anonymous namespace)::Vectorizer::lookThroughComplexAddresses()
    @     0x55593d78f2bc  (anonymous namespace)::Vectorizer::areConsecutivePointers()
    @     0x55593d78d128  (anonymous namespace)::Vectorizer::isConsecutiveAccess()
    @     0x55593d78c926  (anonymous namespace)::Vectorizer::vectorizeInstructions()
    @     0x55593d78c221  (anonymous namespace)::Vectorizer::vectorizeChains()
    @     0x55593d78b948  (anonymous namespace)::Vectorizer::run()
    @     0x55593d78b725  (anonymous namespace)::LoadStoreVectorizer::runOnFunction()
    @     0x55593edf4b17  llvm::FPPassManager::runOnFunction()
    @     0x55593edf4e55  llvm::FPPassManager::runOnModule()
    @     0x55593edf563c  (anonymous namespace)::MPPassManager::runOnModule()
    @     0x55593edf5137  llvm::legacy::PassManagerImpl::run()
    @     0x55593edf5b71  llvm::legacy::PassManager::run()
    @     0x55593ced250d  xla::gpu::IrDumpingPassManager::run()
    @     0x55593ced5033  xla::gpu::(anonymous namespace)::EmitModuleToPTX()
    @     0x55593ced40ba  xla::gpu::(anonymous namespace)::CompileModuleToPtx()
    @     0x55593ced33d0  xla::gpu::CompileToPtx()
    @     0x55593b26b2a2  xla::gpu::NVPTXCompiler::RunBackend()
    @     0x55593b21f973  xla::Service::BuildExecutable()
    @     0x555938f44e64  xla::LocalService::CompileExecutable()
    @     0x555938f30a85  xla::LocalClient::Compile()
    @     0x555938de3c29  tensorflow::XlaCompilationCache::BuildExecutable()
    @     0x555938de4e9e  tensorflow::XlaCompilationCache::CompileImpl()
    @     0x555938de3da5  tensorflow::XlaCompilationCache::Compile()
    @     0x555938c5d962  tensorflow::XlaLocalLaunchBase::Compute()
    @     0x555938c68151  tensorflow::XlaDevice::Compute()
    @     0x55593f389e1f  tensorflow::(anonymous namespace)::ExecutorState::Process()
    @     0x55593f38a625  tensorflow::(anonymous namespace)::ExecutorState::ScheduleReady()::$_1::operator()()
*** SIGABRT received by PID 7798 (TID 7837) from PID 7798; ***

llvm-svn: 337541

6 years agoSema: Fix explicit address space cast in C++
Yaxun Liu [Fri, 20 Jul 2018 11:32:51 +0000 (11:32 +0000)]
Sema: Fix explicit address space cast in C++

Currently clang does not allow implicit cast of a pointer to a pointer type
in different address space but allows C-style cast of a pointer to a pointer
type in different address space. However, there is a bug in Sema causing
incorrect Cast Expr in AST for the latter case, which in turn results in
invalid LLVM IR in codegen.

This is because Sema::IsQualificationConversion returns true for a cast of
pointer to a pointer type in different address space, which in turn allows
a standard conversion and results in a cast expression with no op in AST.

This patch fixes that by let Sema::IsQualificationConversion returns false
for a cast of pointer to a pointer type in different address space, which
in turn disallows standard conversion, implicit cast, and static cast.
Finally it results in an reinterpret cast and correct conversion kind is set.

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

llvm-svn: 337540

6 years ago[UBSan] Also use blacklist for 'Address; Undefined' setting
Florian Hahn [Fri, 20 Jul 2018 10:12:31 +0000 (10:12 +0000)]
[UBSan] Also use blacklist for 'Address; Undefined' setting

It looks like currently the UBSan blacklist is only applied when "Undefined" is selected.
This patch updates the cmake file to apply it whenever Undefined is selected
 (e.g. 'Address; Undefined' ). This  allows us to use the workaround added in
rL335525 when using AddressSan and UBSan together.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

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

llvm-svn: 337539

6 years ago[SystemZ] Reimplent SchedModel IssueWidth and WriteRes/ReadAdvance mappings.
Jonas Paulsson [Fri, 20 Jul 2018 09:40:43 +0000 (09:40 +0000)]
[SystemZ] Reimplent SchedModel IssueWidth and WriteRes/ReadAdvance mappings.

As a consequence of recent discussions
(http://lists.llvm.org/pipermail/llvm-dev/2018-May/123164.html), this patch
changes the SystemZ SchedModels so that the IssueWidth is 6, which is the
decoder capacity, and NumMicroOps become the number of decoder slots needed
per instruction.

In addition, the SchedWrite latencies now match the MachineInstructions
def-operand indexes, and ReadAdvances have been added on instructions with
one register operand and one memory operand.

Review: Ulrich Weigand
https://reviews.llvm.org/D47008

llvm-svn: 337538

6 years agoImproved sched model for X86 BSWAP* instrs.
Andrew V. Tischenko [Fri, 20 Jul 2018 09:39:14 +0000 (09:39 +0000)]
Improved sched model for X86 BSWAP* instrs.
Differential Revision: https://reviews.llvm.org/D49477

llvm-svn: 337537

6 years ago[Xray] fix c99 warning build about flexible array semantics
David Carlier [Fri, 20 Jul 2018 09:22:22 +0000 (09:22 +0000)]
[Xray] fix c99 warning build about flexible array semantics

Reviewers: dberris

Reviewed By: dberris

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

llvm-svn: 337536

6 years agoReapply "AMDGPU: Fix handling of alignment padding in DAG argument lowering"
Matt Arsenault [Fri, 20 Jul 2018 09:05:08 +0000 (09:05 +0000)]
Reapply "AMDGPU: Fix handling of alignment padding in DAG argument lowering"

Reverts r337079 with fix for msan error.

llvm-svn: 337535

6 years ago[AArch64][SVE] Asm: Support for bit/byte reverse operations.
Sander de Smalen [Fri, 20 Jul 2018 09:00:44 +0000 (09:00 +0000)]
[AArch64][SVE] Asm: Support for bit/byte reverse operations.

This patch adds the following instructions:

  RBIT      reverse bits within each active elemnt (predicated), e.g.
                rbit z0.d, p0/m, z1.d

            for 8, 16, 32 and 64 bit elements.

  REV       reverse order of elements in data/predicate vector
            (unpredicated), e.g.
                rev z0.d, z1.d
                rev p0.d, p1.d

            for 8, 16, 32 and 64 bit elements.

  REVB      reverse order of bytes within each active element, e.g.
                revb z0.d, p0/m, z1.d

            for 16, 32 and 64 bit elements.

  REVH      reverse order of 16-bit half-words within each active
            element, e.g.
                revh z0.d, p0/m, z1.d

            for 32 and 64 bit elements.

  REVW      reverse order of 32-bit words within each active element,
            e.g.
                revw z0.d, p0/m, z1.d

            for 64 bit elements.

llvm-svn: 337534

6 years ago[AArch64][SVE] Asm: Support for FTMAD instruction.
Sander de Smalen [Fri, 20 Jul 2018 08:47:26 +0000 (08:47 +0000)]
[AArch64][SVE] Asm: Support for FTMAD instruction.

Floating-point trigonometric multiply-add coefficient,
e.g.

  ftmad z0.h, z0.h, z1.h, #7

with variants for 16, 32 and 64-bit elements.

llvm-svn: 337533

6 years agoadjust incorrect comment
Eric Fiselier [Fri, 20 Jul 2018 08:36:45 +0000 (08:36 +0000)]
adjust incorrect comment

llvm-svn: 337532

6 years agosanitizers: consistently check result of MmapFixedNoReserve
Dmitry Vyukov [Fri, 20 Jul 2018 08:33:41 +0000 (08:33 +0000)]
sanitizers: consistently check result of MmapFixedNoReserve

MmapFixedNoReserve does not terminate process on failure.
Failure to check its result and die will always lead to harder
to debug crashes later in execution. This was observed in Go
processes due to some address space conflicts.

Consistently check result of MmapFixedNoReserve.
While we are here also add warn_unused_result attribute
to prevent such bugs in future and change return type to bool
as that's what all callers want.

Reviewed in https://reviews.llvm.org/D49367

llvm-svn: 337531

6 years agoChange \t to spaces
Fangrui Song [Fri, 20 Jul 2018 08:19:20 +0000 (08:19 +0000)]
Change \t to spaces

llvm-svn: 337530

6 years ago[Index] Set OrigD before D is changed.
Eric Liu [Fri, 20 Jul 2018 08:08:56 +0000 (08:08 +0000)]
[Index] Set OrigD before D is changed.

Reviewers: akyrtzi, arphaman

Reviewed By: akyrtzi

Subscribers: cfe-commits

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

llvm-svn: 337529

6 years ago[ELF] - Fix mistypes in test cases.
George Rimar [Fri, 20 Jul 2018 08:07:33 +0000 (08:07 +0000)]
[ELF] - Fix mistypes in test cases.

llvm-svn: 337528

6 years ago[clangd] FuzzyMatch exposes an API for its word segmentation. NFC
Sam McCall [Fri, 20 Jul 2018 08:01:37 +0000 (08:01 +0000)]
[clangd] FuzzyMatch exposes an API for its word segmentation. NFC

Summary: This is intended to be used for indexing, e.g. in D49417

Reviewers: ioeric, omtcyfz

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 337527

6 years ago[COFF] Write the debug directory and build id to a separate section for MinGW
Martin Storsjo [Fri, 20 Jul 2018 05:44:34 +0000 (05:44 +0000)]
[COFF] Write the debug directory and build id to a separate section for MinGW

For dwarf debug info, an executable normally either contains the debug
info, or it is stripped out. To reduce the storage needed (slightly)
for the debug info kept separately from the released, stripped binaries,
one can choose to only copy the debug data from the original executable
(essentially the reverse of the strip operation), producing a file with
only debug info.

When copying the debug data from an executable with GNU objcopy,
the build id and debug directory need to reside in a separate section,
as this will be kept while the rest of the .rdata section is removed.

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

llvm-svn: 337526

6 years agoDocument -fobjc-weak as an extension.
John McCall [Fri, 20 Jul 2018 05:40:12 +0000 (05:40 +0000)]
Document -fobjc-weak as an extension.

Fixes rdar://24091053.

llvm-svn: 337525

6 years agoFix and improve the ARC spec's wording about unmanaged objects.
John McCall [Fri, 20 Jul 2018 05:40:09 +0000 (05:40 +0000)]
Fix and improve the ARC spec's wording about unmanaged objects.

llvm-svn: 337524

6 years agoAdd x86_64-unkown triple to llc for x86 test.
Stephen Canon [Fri, 20 Jul 2018 03:50:55 +0000 (03:50 +0000)]
Add x86_64-unkown triple to llc for x86 test.

llvm-svn: 337523

6 years ago[libFuzzer] Use separate test directory for each config
Joel E. Denny [Fri, 20 Jul 2018 02:39:01 +0000 (02:39 +0000)]
[libFuzzer] Use separate test directory for each config

Previously, check-all failed many tests for me.  It was running the
X86_64DefaultLinuxConfig, X86_64LibcxxLinuxConfig, and
X86_64StaticLibcxxLinuxConfig configs out of
llvm-build/projects/compiler-rt/test/fuzzer.  Now, it runs them out of
separate subdirectories there, and most tests pass.

Reviewed By: morehouse, george.karpenkov

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

llvm-svn: 337521

6 years agoFix two test failures in <experimental/filesystem>
Eric Fiselier [Fri, 20 Jul 2018 01:51:48 +0000 (01:51 +0000)]
Fix two test failures in <experimental/filesystem>

First, <experimental/filesystem> didn't correctly guard
against min/max macros. This adds the proper push/pop macro guards.

Second, an internal time helper had been renamed but the test for
it hadn't been updated. This patch updates those tests.

llvm-svn: 337520

6 years agoUse _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually always return
Eric Fiselier [Fri, 20 Jul 2018 01:44:33 +0000 (01:44 +0000)]
Use _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually always return

llvm-svn: 337519

6 years ago[DAGCombiner] Fold X - (-Y *Z) -> X + (Y * Z)
Craig Topper [Fri, 20 Jul 2018 01:40:03 +0000 (01:40 +0000)]
[DAGCombiner] Fold X - (-Y *Z) -> X + (Y * Z)

llvm-svn: 337518

6 years agocleanup test assertion inside library
Eric Fiselier [Fri, 20 Jul 2018 01:25:06 +0000 (01:25 +0000)]
cleanup test assertion inside library

llvm-svn: 337517

6 years ago[libc++] Implement Directory Entry Caching -- Sort of.
Eric Fiselier [Fri, 20 Jul 2018 01:22:32 +0000 (01:22 +0000)]
[libc++] Implement Directory Entry Caching -- Sort of.

Summary:
This patch implements directory_entry caching *almost* as specified in P0317r1. However, I explicitly chose to deviate from the standard as I'll explain below.

The approach I decided to take is a fully caching one. When `refresh()` is called, the cache is populated by calls to `stat` and `lstat` as needed.
During directory iteration the cache is only populated with the `file_type` as reported by `readdir`.
The cache can be in the following states:

* `_Empty`: There is nothing in the cache (likely due to an error)
* `_IterSymlink`: Created by directory iteration when we walk onto a symlink only the symlink file type is known.
* `_IterNonSymlink`: Created by directory iteration when we walk onto a non-symlink. Both the regular file type and symlink file type are known.
* `_RefreshSymlink` and `_RefreshNonSymlink`: A full cache created by `refresh()`.  This case includes dead symlinks.
* `_RefreshSymlinkUnresolved`: A partial cache created by refresh when we fail to resolve the file pointed to by a symlink (likely due to permissions). Symlink attributes are cached, but attributes about the linked entity are not.

As mentioned, this implementation purposefully deviates from the standard. According to some readings of the specification, and the Windows filesystem implementation, the constructors and modifiers which don't pass an `error_code` must throw when the `directory_entry` points to a entity which doesn't exist. or when attribute resolution fails for another reason.

@BillyONeal  has proposed a more reasonable set of requirements, where modifiers other than refresh ignore errors. This is the behavior libc++ currently implements, with the expectation some form of the new language will be accepted into the standard.

Some additional semantics which differ from the Windows implementation:

1. `refresh` will not throw when the entry doesn't exist. In this case we can still meet the functions specification, so we don't treat it as an error.
2. We don't clear the path name when a constructor fails via refresh (this will hopefully be changed in the standard as well).

It should be noted that libstdc++'s current implementation has the same behavior as libc++, except for point (2).

If the changes to the specification don't get accepted, we'll be able to make the changes later.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0317r1.html

Reviewers: mclow.lists, gromer, ldionne, aaron.ballman

Subscribers: BillyONeal, christof, cfe-commits

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

llvm-svn: 337516

6 years agoDefend LoadImageUsingPaths against a path list
Jim Ingham [Fri, 20 Jul 2018 01:20:18 +0000 (01:20 +0000)]
Defend LoadImageUsingPaths against a path list
with empty paths on it.

llvm-svn: 337515

6 years agoReapply "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"
Duncan P. N. Exon Smith [Fri, 20 Jul 2018 00:44:58 +0000 (00:44 +0000)]
Reapply "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"

I'm optimistically reverting commit r337511, effectively reapplying
r337504 *without* changes.

The failing bots that had `SmallVector` in the backtrace recovered after
the unrelated commit r337508.  The backtraces looked bogus anyway, with
`SmallVector::size()` calling (e.g.) `ConstantArray::get()`.

Here's the original commit message:

    ADT: Shrink size of SmallVector by 8B on 64-bit platforms

    Represent size and capacity directly as unsigned and calculate
    `end()` using `begin() + size()`.

    This limits the maximum size/capacity of a vector to UINT32_MAX.

    https://reviews.llvm.org/D48518

llvm-svn: 337514

6 years agoRevert "[docs] Add support for Markdown documentation in Sphinx"
Michael J. Spencer [Fri, 20 Jul 2018 00:24:36 +0000 (00:24 +0000)]
Revert "[docs] Add support for Markdown documentation in Sphinx"

The buildbots have an old version of Sphinx (need at least 1.3).  Revert until they are upgraded.

llvm-svn: 337513

6 years ago[WebAssembly] Disable a test that violates DR1696
Heejin Ahn [Fri, 20 Jul 2018 00:13:42 +0000 (00:13 +0000)]
[WebAssembly] Disable a test that violates DR1696

Summary:
lifetime2.C violates DR1696, which prevents reference members from being
initialized to temporaries, whose lifetime would end at the end of ctor.

Reviewers: sbc100

Subscribers: dschuff, sunfish, llvm-commits

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

llvm-svn: 337512

6 years agoRevert "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"
Duncan P. N. Exon Smith [Fri, 20 Jul 2018 00:09:56 +0000 (00:09 +0000)]
Revert "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"

This reverts commit r337504 while I investigate a TSan bot failure that
seems related:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/26526

    #8 0x000055581f2895d8 (/b/sanitizer-x86_64-linux-autoconf/build/tsan_debug_build/bin/clang-7+0x1eb45d8)
    #9 0x000055581f294323 llvm::ConstantAggrKeyType<llvm::ConstantArray>::create(llvm::ArrayType*) const /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:409:0
    #10 0x000055581f294323 llvm::ConstantUniqueMap<llvm::ConstantArray>::create(llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray>, std::pair<unsigned int, std::pair<llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray> > >&) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:635:0
    #11 0x000055581f294323 llvm::ConstantUniqueMap<llvm::ConstantArray>::getOrCreate(llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray>) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:654:0
    #12 0x000055581f2944cb llvm::ConstantArray::get(llvm::ArrayType*, llvm::ArrayRef<llvm::Constant*>) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/Constants.cpp:964:0
    #13 0x000055581fa27e19 llvm::SmallVectorBase::size() const /b/sanitizer-x86_64-linux-autoconf/build/llvm/include/llvm/ADT/SmallVector.h:53:0
    #14 0x000055581fa27e19 llvm::SmallVectorImpl<llvm::Constant*>::resize(unsigned long) /b/sanitizer-x86_64-linux-autoconf/build/llvm/include/llvm/ADT/SmallVector.h:347:0
    #15 0x000055581fa27e19 (anonymous namespace)::EmitArrayConstant(clang::CodeGen::CodeGenModule&, clang::ConstantArrayType const*, llvm::Type*, unsigned int, llvm::SmallVectorImpl<llvm::Constant*>&, llvm::Constant*) /b/sanitizer-x86_64-linux-autoconf/build/llvm/tools/clang/lib/CodeGen/CGExprConstant.cpp:669:0

llvm-svn: 337511

6 years ago[x86/SLH] Clean up helper naming for return instruction handling and
Chandler Carruth [Thu, 19 Jul 2018 23:46:24 +0000 (23:46 +0000)]
[x86/SLH] Clean up helper naming for return instruction handling and
remove dead declaration of a call instruction handling helper.

This moves to the 'harden' terminology that I've been trying to settle
on for returns. It also adds a really detailed comment explaining what
all we're trying to accomplish with return instructions and why.
Hopefully this makes it much more clear what exactly is being
"hardened".

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

llvm-svn: 337510

6 years ago[docs] Add support for Markdown documentation in Sphinx
Michael J. Spencer [Thu, 19 Jul 2018 23:40:58 +0000 (23:40 +0000)]
[docs] Add support for Markdown documentation in Sphinx

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

llvm-svn: 337509

6 years agoFix typo causing assert in self-host.
Richard Smith [Thu, 19 Jul 2018 23:24:41 +0000 (23:24 +0000)]
Fix typo causing assert in self-host.

llvm-svn: 337508

6 years ago[SCCP] Don't use markForcedConstant on branch conditions.
Eli Friedman [Thu, 19 Jul 2018 23:02:07 +0000 (23:02 +0000)]
[SCCP] Don't use markForcedConstant on branch conditions.

It's more aggressive than we need to be, and leads to strange
workarounds in other places like call return value inference. Instead,
just directly mark an edge viable.

Tests by Florian Hahn.

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

llvm-svn: 337507

6 years agoSkip out of SimplifyDemandedBits for BITCAST of f16 to i16
Stephen Canon [Thu, 19 Jul 2018 22:46:42 +0000 (22:46 +0000)]
Skip out of SimplifyDemandedBits for BITCAST of f16 to i16

Mirrors the existing exit path for f128, avoiding a crash later on.

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

llvm-svn: 337506

6 years ago[docs] Correct -fvisibility-inlines-hidden description
Fangrui Song [Thu, 19 Jul 2018 22:45:41 +0000 (22:45 +0000)]
[docs] Correct -fvisibility-inlines-hidden description

llvm-svn: 337505

6 years agoADT: Shrink size of SmallVector by 8B on 64-bit platforms
Duncan P. N. Exon Smith [Thu, 19 Jul 2018 22:29:47 +0000 (22:29 +0000)]
ADT: Shrink size of SmallVector by 8B on 64-bit platforms

Representing size and capacity directly as unsigned and calculate
`end()` using `begin() + size()`.

This limits the maximum size/capacity of a vector to UINT32_MAX.

https://reviews.llvm.org/D48518

llvm-svn: 337504

6 years ago[ThinLTO] Only emit referenced type id records in index files
Teresa Johnson [Thu, 19 Jul 2018 22:25:56 +0000 (22:25 +0000)]
[ThinLTO] Only emit referenced type id records in index files

Summary:
Currently all type ids are emitted into the index file when it is
written. For distributed ThinLTO, that meant that all type ids were
being duplicated into every single distributed index file, regardless of
whether they were referenced, leading to huge amounts of unnecessary
duplication and size bloat.

Keep track of the type id GUIDs actually referenced by the GV summary
records being emitted, and only emit those type IDs.

Add a new test, and fix test/Assembler/thinlto-summary.ll so that all
type ids are referenced to prevent deletion in that test.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, vitalybuka, llvm-commits

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

llvm-svn: 337503

6 years ago[DAGCombiner] Teach DAGCombiner that A-(-B) is A+B.
Craig Topper [Thu, 19 Jul 2018 22:24:43 +0000 (22:24 +0000)]
[DAGCombiner] Teach DAGCombiner that A-(-B) is A+B.

We already knew A+(-B) is A-B in visitAdd. This does the opposite for visitSub.

llvm-svn: 337502

6 years ago[libFuzzer] when -print_coverage=1 is given, print more stats (the number of seeds...
Kostya Serebryany [Thu, 19 Jul 2018 22:00:48 +0000 (22:00 +0000)]
[libFuzzer] when -print_coverage=1 is given, print more stats (the number of seeds that hit every given function)

llvm-svn: 337501

6 years ago[X86][AVX] Use extract_subvector to reduce vector op widths (PR36761)
Simon Pilgrim [Thu, 19 Jul 2018 21:52:06 +0000 (21:52 +0000)]
[X86][AVX] Use extract_subvector to reduce vector op widths (PR36761)

We have a number of cases where we fail to reduce vector op widths, performing the op in a larger vector and then extracting a subvector. This is often because by default it would create illegal types.

This peephole patch attempts to handle a few common cases detailed in PR36761, which typically involved extension+conversion to vX2f64 types.

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

llvm-svn: 337500

6 years ago[CStringSyntaxChecker] Check strlcpy sizeof syntax
David Carlier [Thu, 19 Jul 2018 21:50:03 +0000 (21:50 +0000)]
[CStringSyntaxChecker] Check strlcpy sizeof syntax

The last argument is expected to be the destination buffer size (or less).

    Detects if it points to destination buffer size directly or via a variable.
    Detects if it is an integral, try to detect if the destination buffer can receive the source length.

Updating bsd-string.c unit tests as it make it fails now.

Reviewers: george.karpenpov, NoQ

Reviewed By: george.karpenkov

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

llvm-svn: 337499

6 years agoWhen we choose to use zeroinitializer for a trailing portion of an array
Richard Smith [Thu, 19 Jul 2018 21:38:56 +0000 (21:38 +0000)]
When we choose to use zeroinitializer for a trailing portion of an array
constant, don't convert the rest into a packed struct.

If an array constant has a large non-zero portion and a large zero
portion, we want to emit the first part as an array and the rest as a
zeroinitializer if possible. This fixes a memory usage regression from
r333141 when compiling PHP.

llvm-svn: 337498

6 years ago[Sema] Diagnose an invalid dependent function template specialization
Erik Pilkington [Thu, 19 Jul 2018 20:40:20 +0000 (20:40 +0000)]
[Sema] Diagnose an invalid dependent function template specialization

Previously, clang marked the specialization as invalid without emitting a
diagnostic. This lead to an assert in CodeGen.

rdar://41806724

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

llvm-svn: 337497

6 years ago[llvm-mca][docs] Add Timeline and How MCA works.
Matt Davis [Thu, 19 Jul 2018 20:33:59 +0000 (20:33 +0000)]
[llvm-mca][docs] Add Timeline and How MCA works.

For the most part, these changes were from the RFC.  I made a few minor
word/structure changes, but nothing significant.  I also regenerated the
example output, and adjusted the text accordingly.

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

llvm-svn: 337496

6 years agoWork around bug in mingw-w64 GCC 8.1.0
Reid Kleckner [Thu, 19 Jul 2018 20:32:45 +0000 (20:32 +0000)]
Work around bug in mingw-w64 GCC 8.1.0

This particular version of GCC seems to break bitfields when a method
appears between two bitfield members.

Personally, I think it's nice to keep bitfields close together so that
it's easy to check how things are packed, so I moved the method after
SubClassData.

Fixes PR38168.

llvm-svn: 337495

6 years ago[ELF][HEXAGON] Add support for R_HEX_B15_PCREL
Sid Manning [Thu, 19 Jul 2018 20:27:43 +0000 (20:27 +0000)]
[ELF][HEXAGON] Add support for R_HEX_B15_PCREL

Add support and update the testcase.

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

llvm-svn: 337494

6 years ago[profile] Fix typo in test
Teresa Johnson [Thu, 19 Jul 2018 20:18:37 +0000 (20:18 +0000)]
[profile] Fix typo in test

Noticed that this was causing a compiler warning in the test.

llvm-svn: 337493

6 years agoDisable GCC's -Wclass-memaccess warning
Reid Kleckner [Thu, 19 Jul 2018 20:14:46 +0000 (20:14 +0000)]
Disable GCC's -Wclass-memaccess warning

It fires on things like SmallVector<std::pair<int, int>>, where we
intentionally use memcpy instead of calling the assignment operator.
This warning fires in practically every LLVM TU, so we have to do
something about it, even if we aren't interested in being 100% warning
clean with GCC.

Reported as PR37337

llvm-svn: 337492

6 years ago[X86] Fix some 'return SDValue()' after DCI.CombineTo instead return the output of...
Craig Topper [Thu, 19 Jul 2018 20:10:44 +0000 (20:10 +0000)]
[X86] Fix some 'return SDValue()' after DCI.CombineTo instead return the output of CombineTo

Returning SDValue() means nothing was changed. Returning the result of CombineTo returns the first argument of CombineTo. This is specially detected by DAGCombiner as meaning that something changed, but worklist management was already taken care of.

I think the only real effect of this change is that we now properly update the Statistic the counts the number of combines performed. That's the only thing between the check for null and the check for N in the DAGCombiner.

llvm-svn: 337491

6 years agoFix -Wsign-compare in llvm-readobj
Reid Kleckner [Thu, 19 Jul 2018 19:58:22 +0000 (19:58 +0000)]
Fix -Wsign-compare in llvm-readobj

llvm-svn: 337490

6 years ago[LSV] Refactoring + supporting bitcasts to a type of different size
Roman Tereshin [Thu, 19 Jul 2018 19:42:43 +0000 (19:42 +0000)]
[LSV] Refactoring + supporting bitcasts to a type of different size

This is mostly a preparation work for adding a limited support for
select instructions. It proved to be difficult to do due to size and
irregularity of Vectorizer::isConsecutiveAccess, this is fixed here I
believe.

It also turned out that these changes make it simpler to finish one of
the TODOs and fix a number of other small issues, namely:

1. Looking through bitcasts to a type of a different size (requires
careful tracking of the original load/store size and some math
converting sizes in bytes to expected differences in indices of GEPs).

2. Reusing partial analysis of pointers done by first attempt in proving
them consecutive instead of starting from scratch. This added limited
support for nested GEPs co-existing with difficult sext/zext
instructions. This also required a careful handling of negative
differences between constant parts of offsets.

3. Handing a case where the first pointer index is not an add, but
something else (a function parameter for instance).

I observe an increased number of successful vectorizations on a large
set of shader programs. Only few shaders are affected, but those that
are affected sport >5% less loads and stores than before the patch.

Reviewed By: rampitec

Differential-Revision: https://reviews.llvm.org/D49342
llvm-svn: 337489

6 years ago[Power9] Code Cleanup - Remove needsAggressiveScheduling()
Stefan Pintilie [Thu, 19 Jul 2018 19:34:18 +0000 (19:34 +0000)]
[Power9] Code Cleanup - Remove needsAggressiveScheduling()

As we already return true from needsAggressiveScheduling() for the most recent
hardware it would be cleaner to just return true for all PowerPC hardware.

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

llvm-svn: 337488

6 years agoBlock library shutdown until unreaped threads finish spin-waiting
Jonathan Peyton [Thu, 19 Jul 2018 19:17:00 +0000 (19:17 +0000)]
Block library shutdown until unreaped threads finish spin-waiting

This change fixes possibly invalid access to the internal data structure during
library shutdown.  In a heavily oversubscribed situation, the library shutdown
sequence can reach the point where resources are deallocated while there still
exist threads in their final spinning loop.  The added loop in
__kmp_internal_end() checks if there are such busy-waiting threads and blocks
the shutdown sequence if that is the case. Two versions of kmp_wait_template()
are now used to minimize performance impact.

Patch by Hansang Bae

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

llvm-svn: 337486

6 years ago[Analysis] Fix typo in assert. NFC
Shoaib Meenai [Thu, 19 Jul 2018 19:11:29 +0000 (19:11 +0000)]
[Analysis] Fix typo in assert. NFC

Test commit to see if my mailing list woes have been resolved.

llvm-svn: 337485

6 years agoAdd support for R_HEX_B32_PCREL_X, R_HEX_B22_PCREL_X relocations
Sid Manning [Thu, 19 Jul 2018 19:10:56 +0000 (19:10 +0000)]
Add support for R_HEX_B32_PCREL_X, R_HEX_B22_PCREL_X relocations

A couple more basic relocations plus testcase.

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

llvm-svn: 337484

6 years agoFix failing testcase to actually be valid.
Richard Smith [Thu, 19 Jul 2018 19:05:13 +0000 (19:05 +0000)]
Fix failing testcase to actually be valid.

llvm-svn: 337483

6 years ago[profile] Add interface to get profile filename
Teresa Johnson [Thu, 19 Jul 2018 19:03:50 +0000 (19:03 +0000)]
[profile] Add interface to get profile filename

Summary:
Add __llvm_profile_get_filename interface to get the profile filename,
which can be used for identifying which profile file belongs to an app
when multiple binaries are instrumented and dumping profiles into the
same directory. The filename includes the path.

Reviewers: davidxl

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 337482

6 years agoFix template argument deduction when a parameter pack has a value
Richard Smith [Thu, 19 Jul 2018 19:00:37 +0000 (19:00 +0000)]
Fix template argument deduction when a parameter pack has a value
provided by an outer template.

We made the incorrect assumption in various places that the only way we
can have any arguments already provided for a pack during template
argument deduction was from a partially-specified pack. That's not true;
we can also have arguments from an enclosing already-instantiated
template, and that can even result in the function template's own pack
parameters having a fixed length and not being packs for the purposes of
template argument deduction.

llvm-svn: 337481

6 years agofix typo in comment
Nico Weber [Thu, 19 Jul 2018 18:59:38 +0000 (18:59 +0000)]
fix typo in comment

llvm-svn: 337480

6 years ago[OpenEmbedded] Add a unittest for aarch64-oe-linux
Mandeep Singh Grang [Thu, 19 Jul 2018 18:10:03 +0000 (18:10 +0000)]
[OpenEmbedded] Add a unittest for aarch64-oe-linux

Summary: Added a unittest for aarch64-oe-linux which was missed in D48861.

Reviewers: compnerd, rengolin, javed.absar

Reviewed By: compnerd

Subscribers: kristof.beyls, dexonsmith, llvm-commits

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

llvm-svn: 337479

6 years ago[APInt] Keep the original bit width in quotient and remainder
Krzysztof Parzyszek [Thu, 19 Jul 2018 18:07:56 +0000 (18:07 +0000)]
[APInt] Keep the original bit width in quotient and remainder

Some trivial cases in udivrem were handled by directly assigning 0 or 1
to APInt objects. This would set the bit width to 1, instead of the bit
width of the inputs. A potentially undesirable side effect of that is
that with the bit width of 1, 1 equals -1.

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

llvm-svn: 337478

6 years ago[libc++] Allow running ABI list tests with different ABI versions
Louis Dionne [Thu, 19 Jul 2018 18:02:50 +0000 (18:02 +0000)]
[libc++] Allow running ABI list tests with different ABI versions

Summary:
Currently, the ABI list test only works for ABI version 1. This commit
allows running the ABI list test with ABI version 2. It also adds an
ABI list file for ABI v2 on Mac OS X.

Reviewers: EricWF

Subscribers: mgorny, christof, dexonsmith, llvm-commits, mclow.lists

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

llvm-svn: 337477

6 years ago[libFuzzer] Update documentation regarding MSan.
Matt Morehouse [Thu, 19 Jul 2018 17:59:11 +0000 (17:59 +0000)]
[libFuzzer] Update documentation regarding MSan.

Summary: -fsanitize=fuzzer,memory now works out-of-the-box.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

llvm-svn: 337476

6 years agoAdded unit tests for Flags
Raphael Isemann [Thu, 19 Jul 2018 17:45:51 +0000 (17:45 +0000)]
Added unit tests for Flags

Reviewers: labath

Reviewed By: labath

Subscribers: labath, mgorny, lldb-commits

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

llvm-svn: 337475

6 years ago[analyzer] Fix memory sanitizer error in MallocChecker.
Reka Kovacs [Thu, 19 Jul 2018 17:43:09 +0000 (17:43 +0000)]
[analyzer] Fix memory sanitizer error in MallocChecker.

StringRef's data() returns a string that may be non-null-terminated.
Switch to using StringRefs from const char pointers in visitor notes
to avoid problems.

llvm-svn: 337474

6 years agoFix unused variable warning.
Erich Keane [Thu, 19 Jul 2018 17:19:16 +0000 (17:19 +0000)]
Fix unused variable warning.

llvm-svn: 337473

6 years ago[analyzer] Memoize complexity of SymExpr
Mikhail R. Gadelha [Thu, 19 Jul 2018 17:03:12 +0000 (17:03 +0000)]
[analyzer] Memoize complexity of SymExpr

Summary:
This patch introduces a new member to SymExpr, which stores the symbol complexity, avoiding recalculating it every time computeComplexity() is called.

Also, increase the complexity of conjured Symbols by one, so it's clear that it has a greater complexity than its underlying symbols.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

llvm-svn: 337472

6 years ago[LoadStoreVectorizer] Use getMinusScev() to compute the distance between two pointers.
Farhana Aleen [Thu, 19 Jul 2018 16:50:27 +0000 (16:50 +0000)]
[LoadStoreVectorizer] Use getMinusScev() to compute the distance between two pointers.

Summary: Currently, isConsecutiveAccess() detects two pointers(PtrA and PtrB) as consecutive by
         comparing PtrB with BaseDelta+PtrA. This works when both pointers are factorized or
         both of them are not factorized. But isConsecutiveAccess() fails if one of the
         pointers is factorized but the other one is not.

         Here is an example:
         PtrA = 4 * (A + B)
         PtrB = 4 + 4A + 4B

         This patch uses getMinusSCEV() to compute the distance between two pointers.
         getMinusSCEV() allows combining the expressions and computing the simplified distance.

Author: FarhanaAleen

Reviewed By: rampitec

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

llvm-svn: 337471

6 years ago[Sema] Add a new warning, -Wmemset-transposed-args
Erik Pilkington [Thu, 19 Jul 2018 16:46:15 +0000 (16:46 +0000)]
[Sema] Add a new warning, -Wmemset-transposed-args

This diagnoses calls to memset that have the second and third arguments
transposed, for example:

  memset(buf, sizeof(buf), 0);

This is done by checking if the third argument is a literal 0, or if the second
is a sizeof expression (and the third isn't). The first check is also done for
calls to bzero.

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

llvm-svn: 337470