platform/upstream/llvm.git
5 years ago[DAGCombiner][X86] Pass the CmpOpVT to reduceSelectOfFPConstantLoads so X86 can exclu...
Craig Topper [Thu, 12 Sep 2019 21:30:18 +0000 (21:30 +0000)]
[DAGCombiner][X86] Pass the CmpOpVT to reduceSelectOfFPConstantLoads so X86 can exclude fp128 compares.

The X86 decision assumes the compare will produce a result in an XMM
register, but that can't happen for an fp128 compare since those
go to a libcall the returns an i32. Pass the VT so X86 can check
the type.

llvm-svn: 371775

5 years ago[ConstantFolding] Expand folding of some library functions
Evandro Menezes [Thu, 12 Sep 2019 21:23:22 +0000 (21:23 +0000)]
[ConstantFolding] Expand folding of some library functions

Expanding the folding of `nearbyint()`, `rint()` and `trunc()` to library
functions, in addition to the current support for intrinsics.

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

llvm-svn: 371774

5 years ago[ClangTidy] Adjust the name getCheckName to getCheckerName due to API change.
Tim Shen [Thu, 12 Sep 2019 21:18:44 +0000 (21:18 +0000)]
[ClangTidy] Adjust the name getCheckName to getCheckerName due to API change.

llvm-svn: 371773

5 years agoFix llvm-reduce tests so that they don't assume the source code is
Tim Shen [Thu, 12 Sep 2019 21:03:49 +0000 (21:03 +0000)]
Fix llvm-reduce tests so that they don't assume the source code is
writable.

Instead of copying over the original file permissions, just create
a new file and add the executable bit.

llvm-svn: 371772

5 years ago[SelectionDAGBuilder] Simplify loop in visitSelect back to how it was before r255558.
Craig Topper [Thu, 12 Sep 2019 21:00:32 +0000 (21:00 +0000)]
[SelectionDAGBuilder] Simplify loop in visitSelect back to how it was before r255558.

This code was changed to accomodate fp128 being softened to itself
during type legalization on x86-64. This was done in order to create
libcalls while having fp128 as a legal type. We're now doing the
libcall creation during LegalizeDAG and the type legalization changes
to enable the old behavior have been removed. So this change to
SelectionDAGBuilder is no longer needed.

llvm-svn: 371771

5 years ago[X86] Move negateFMAOpcode helper earlier to help future patch. NFCI.
Simon Pilgrim [Thu, 12 Sep 2019 20:39:56 +0000 (20:39 +0000)]
[X86] Move negateFMAOpcode helper earlier to help future patch. NFCI.

llvm-svn: 371770

5 years ago[LV] Update test case after r371768.
Florian Hahn [Thu, 12 Sep 2019 20:07:17 +0000 (20:07 +0000)]
[LV] Update test case after r371768.

llvm-svn: 371769

5 years ago[SCEV] Support SCEVUMinExpr in getRangeRef.
Florian Hahn [Thu, 12 Sep 2019 20:03:32 +0000 (20:03 +0000)]
[SCEV] Support SCEVUMinExpr in getRangeRef.

This patch adds support for SCEVUMinExpr to getRangeRef,
similar to the support for SCEVUMaxExpr.

Reviewers: sanjoy.google, efriedma, reames, nikic

Reviewed By: sanjoy.google

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

llvm-svn: 371768

5 years agoImprove code generation for thread_local variables:
Richard Smith [Thu, 12 Sep 2019 20:00:24 +0000 (20:00 +0000)]
Improve code generation for thread_local variables:

Summary:
 * Don't bother using a thread wrapper when the variable is known to
   have constant initialization.
 * Emit the thread wrapper as discardable-if-unused in TUs that don't
   contain a definition of the thread_local variable.
 * Don't emit the thread wrapper at all if the thread_local variable
   is unused and discardable; it will be emitted by all TUs that need
   it.

Reviewers: rjmccall, jdoerfert

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 371767

5 years ago[Clang][CodeGen] support alias attribute w/ gnu_inline
Nick Desaulniers [Thu, 12 Sep 2019 19:53:35 +0000 (19:53 +0000)]
[Clang][CodeGen] support alias attribute w/ gnu_inline

Summary:
r369705 did not consider the addition of gnu_inline on function
declarations of alias attributed functions. This resulted in a reported
regression in the clang-9-rc4 release from the Zig developers building
glibc, which was observable as a failed assertion:

llvm-project/clang/lib/AST/Decl.cpp:3336: bool
clang::FunctionDecl::isInlineDefinitionExternallyVisible() const:
Assertion `(doesThisDeclarationHaveABody() || willHaveBody()) && "Must
be a function definition"' failed.

Alias function declarations do not have bodies, so allow us to proceed
if we have the alias function attribute but no body/definition, and add
a test case.  The emitted symbols and their linkage matches GCC for the
added test case.

Link: https://bugs.llvm.org/show_bug.cgi?id=43268
Reviewers: aaron.ballman, rsmith, erichkeane, andrewrk

Reviewed By: andrewrk

Subscribers: cfe-commits, andrewrk, hans, srhines

Tags: #clang

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

llvm-svn: 371766

5 years ago[CFG] Add dumps for CFGElement and CFGElementRef
Kristof Umann [Thu, 12 Sep 2019 19:52:34 +0000 (19:52 +0000)]
[CFG] Add dumps for CFGElement and CFGElementRef

Seems like we never had these, so here we go! I also did some refactoring as I
was chasing a bug unrelated to this revision.

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

llvm-svn: 371765

5 years agollvm-reduce: For now, mark these tests as requiring a shell
David Blaikie [Thu, 12 Sep 2019 19:50:54 +0000 (19:50 +0000)]
llvm-reduce: For now, mark these tests as requiring a shell

(since they execute shell scripts/that's the only entry point at the
moment)

llvm-svn: 371764

5 years ago[libc++] Mark issue 2587 resolved by issue 2567
Zoe Carver [Thu, 12 Sep 2019 19:50:06 +0000 (19:50 +0000)]
[libc++] Mark issue 2587 resolved by issue 2567

Updates status. NFC.

llvm-svn: 371763

5 years agoPrecommit tests for D67514
Philip Reames [Thu, 12 Sep 2019 19:34:27 +0000 (19:34 +0000)]
Precommit tests for D67514

llvm-svn: 371762

5 years agoAMDGPU: Fix bug in r371671 on some builds.
Austin Kerbow [Thu, 12 Sep 2019 19:12:21 +0000 (19:12 +0000)]
AMDGPU: Fix bug in r371671 on some builds.

llvm-svn: 371761

5 years ago[analyzer][NFC] Fix inconsistent references to checkers as "checks"
Kristof Umann [Thu, 12 Sep 2019 19:09:24 +0000 (19:09 +0000)]
[analyzer][NFC] Fix inconsistent references to checkers as "checks"

Traditionally, clang-tidy uses the term check, and the analyzer uses checker,
but in the very early years, this wasn't the case, and code originating from the
early 2010's still incorrectly refer to checkers as checks.

This patch attempts to hunt down most of these, aiming to refer to checkers as
checkers, but preserve references to callback functions (like checkPreCall) as
checks.

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

llvm-svn: 371760

5 years agoNFC, add missing cl::cat option category to clang-scan-deps options to ensure they...
Alex Lorenz [Thu, 12 Sep 2019 19:00:32 +0000 (19:00 +0000)]
NFC, add missing cl::cat option category to clang-scan-deps options to ensure they show up in -help

llvm-svn: 371759

5 years agoAdd getauxval() compat for NetBSD
Kamil Rytarowski [Thu, 12 Sep 2019 18:57:58 +0000 (18:57 +0000)]
Add getauxval() compat for NetBSD

Summary:
getauxval() is not available on NetBSD and there is no a direct equivalent.

Add a function that implements the same semantics with NetBSD internals.

Reorder the GetPageSize() functions to prefer the sysctl approach for NetBSD.
It no longer makes a difference which approach is better. Avoid changing
conditional code path.

Reviewers: vitalybuka, dvyukov, mgorny, joerg

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

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

llvm-svn: 371758

5 years agoSplit many_tls_keys.cpp into two tests
Kamil Rytarowski [Thu, 12 Sep 2019 18:55:18 +0000 (18:55 +0000)]
Split many_tls_keys.cpp into two tests

Summary:
many_tls_keys_pthread.cpp for TSD
many_tls_keys_thread.cpp for TLS

The TSD test is unsupported on NetBSD as it assumes TLS used internally.
TSD on NetBSD does not use TLS.

Reviewers: joerg, vitalybuka, mgorny, dvyukov, kcc

Reviewed By: vitalybuka

Subscribers: jfb, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

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

llvm-svn: 371757

5 years ago[analyzer] Don't run the analyzer for -analyzer-list-enabled-checkers
Kristof Umann [Thu, 12 Sep 2019 18:53:48 +0000 (18:53 +0000)]
[analyzer] Don't run the analyzer for -analyzer-list-enabled-checkers

Short and sweet. Whenever I use -analyzer-list-enabled-checkers, I'm only
interested about the configuration, not about the analysis.

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

llvm-svn: 371756

5 years agollvm-reduce: Remove unused plugin support/requirements
David Blaikie [Thu, 12 Sep 2019 18:52:31 +0000 (18:52 +0000)]
llvm-reduce: Remove unused plugin support/requirements

llvm-svn: 371755

5 years agoUse host's executable suffix for clang when cross-compiling compiler-rt
Reid Kleckner [Thu, 12 Sep 2019 18:44:47 +0000 (18:44 +0000)]
Use host's executable suffix for clang when cross-compiling compiler-rt

When cross-compiling compiler-rt as part of LLVM e. g. for Linux on
a Windows host and using the just-built clang as cross-compiler, we set
the -DBUILTINS_CMAKE_ARGS="-DCMAKE_SYSTEM_NAME=Linux" flag in top-level
cmake invocation, which causes CMAKE_EXECUTABLE_SUFFIX to be an empty
string in the nested cmake invocation for building builtins.

But the compiler for compiling test cases is meant to be run on host,
therefore it may have the '.exe' suffix.

Handle this by asking cmake about the host system.

Patch by Sergej Jaskiewicz <jaskiewiczs@icloud.com>

Reviewed By: rnk

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

llvm-svn: 371754

5 years ago[MS] Warn when shadowing template parameters under -fms-compatibility
Reid Kleckner [Thu, 12 Sep 2019 18:26:34 +0000 (18:26 +0000)]
[MS] Warn when shadowing template parameters under -fms-compatibility

Summary:
C++ does not allow shadowing template parameters, but previously we
allowed it under -fms-extensions. Now this behavior is controlled by
-fms-compatibility, and we emit a -Wmicrosoft-template warning when it
happens.

Fixes PR43265

Reviewers: thakis, hans

Subscribers: amccarth, rsmith, STL_MSFT, cfe-commits

Tags: #clang

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

llvm-svn: 371753

5 years ago[LICM/AST] Check if the AliasAny set is removed from the tracker.
Alina Sbirlea [Thu, 12 Sep 2019 18:09:47 +0000 (18:09 +0000)]
[LICM/AST] Check if the AliasAny set is removed from the tracker.

Summary:
Resolves PR38513.
Credit to @bjope for debugging this.

Reviewers: hfinkel, uabelho, bjope

Subscribers: sanjoy.google, bjope, llvm-commits

Tags: #llvm

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

llvm-svn: 371752

5 years ago[clang-scan-deps] remove dots and dots dots from the reported file dependency paths
Alex Lorenz [Thu, 12 Sep 2019 18:03:24 +0000 (18:03 +0000)]
[clang-scan-deps] remove dots and dots dots from the reported file dependency paths

This resolves differences observed on LLVM + Clang when running the comparison between canonical
dependencies (full preprocessing, no file manager reused), and dependencies obtained
when the file manager was reused between the full preprocessing invocations.

llvm-svn: 371751

5 years ago[InstCombine] add tests for fptrunc; NFC
Sanjay Patel [Thu, 12 Sep 2019 18:00:11 +0000 (18:00 +0000)]
[InstCombine] add tests for fptrunc; NFC

llvm-svn: 371750

5 years agoDon't warn about selectany on implicitly inline variables
Reid Kleckner [Thu, 12 Sep 2019 17:55:48 +0000 (17:55 +0000)]
Don't warn about selectany on implicitly inline variables

Summary:
This avoids a -Wignored-attribute warning on the code pattern Microsoft
recommends for integral const static data members defined in headers
here:
https://docs.microsoft.com/en-us/cpp/build/reference/microsoft-extensions-to-c-and-cpp?view=vs-2019

The attribute is redundant, but it is necessary when compiling in C++14
modes with /Za, which disables MSVC's extension that treats such
variables as implicitly inline.

Fixes PR43270

Reviewers: epastor, thakis, hans

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 371749

5 years ago[MemorySSA] Pass (for update) MSSAU when hoisting instructions.
Alina Sbirlea [Thu, 12 Sep 2019 17:12:51 +0000 (17:12 +0000)]
[MemorySSA] Pass (for update) MSSAU when hoisting instructions.

Summary: Pass MSSAU to makeLoopInvariant in order to properly update MSSA.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, uabelho, llvm-commits

Tags: #llvm

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

llvm-svn: 371748

5 years agoPrecommit tests for generalization of load dereferenceability in loop
Philip Reames [Thu, 12 Sep 2019 17:09:01 +0000 (17:09 +0000)]
Precommit tests for generalization of load dereferenceability in loop

llvm-svn: 371747

5 years ago[InstCombine] reduce test noise and regenerate CHECK lines; NFC
Sanjay Patel [Thu, 12 Sep 2019 17:07:01 +0000 (17:07 +0000)]
[InstCombine] reduce test noise and regenerate CHECK lines; NFC

llvm-svn: 371746

5 years ago[LV] Support invariant addresses in speculation logic
Philip Reames [Thu, 12 Sep 2019 16:49:10 +0000 (16:49 +0000)]
[LV] Support invariant addresses in speculation logic

Implement a TODO from rL371452, and handle loop invariant addresses in predicated blocks. If we can prove that the load is safe to speculate into the header, then we can avoid using a masked.load in favour of a normal load.

This is mostly about vectorization robustness. In the common case, it's generally expected that LICM/LoadStorePromotion would have eliminated such loads entirely.

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

llvm-svn: 371745

5 years ago[ELF] ICF: change a dyn_cast<InputSection> to cast
Fangrui Song [Thu, 12 Sep 2019 16:46:19 +0000 (16:46 +0000)]
[ELF] ICF: change a dyn_cast<InputSection> to cast

ICF is performed after EhInputSections and MergeInputSections were
eliminated from inputSections. Every element of inputSections is an
InputSection.

llvm-svn: 371744

5 years ago[CGP] Ensure sinking multiple instructions does not invalidate dominance checks
David Green [Thu, 12 Sep 2019 16:00:07 +0000 (16:00 +0000)]
[CGP] Ensure sinking multiple instructions does not invalidate dominance checks

In MVE, as of rL371218, we are attempting to sink chains of instructions such as:
  %l1 = insertelement <8 x i8> undef, i8 %l0, i32 0
  %broadcast.splat26 = shufflevector <8 x i8> %l1, <8 x i8> undef, <8 x i32> zeroinitializer
In certain situations though, we can end up breaking the dominance relations of
instructions. This happens when we sink the instruction into a loop, but cannot
remove the originals. The Use is updated, which might in fact be a Use from the
second instruction to the first.

This attempts to fix that by reversing the order of instruction that are sunk,
and ensuring that we update the uses on new instructions if they have already
been sunk, not the old ones.

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

llvm-svn: 371743

5 years ago[Alignment] Move OffsetToAlignment to Alignment.h
Guillaume Chatelet [Thu, 12 Sep 2019 15:20:36 +0000 (15:20 +0000)]
[Alignment] Move OffsetToAlignment to Alignment.h

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, JDevlieghere, alexshap, rupprecht, jhenderson

Subscribers: sdardis, nemanjai, hiraditya, kbarton, jakehehrlich, jrtc27, MaskRay, atanasyan, jsji, seiya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 371742

5 years agotest-release.sh: Don't use chrpath on Solaris
Rainer Orth [Thu, 12 Sep 2019 14:50:32 +0000 (14:50 +0000)]
test-release.sh: Don't use chrpath on Solaris

When trying to run test-release.sh on Solaris 11.4 for 9.0.0 rc4, I failed initially
because Solaris lacks chrpath.  This patch accounts for that and allowed the run to
continue.

Tested on amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

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

llvm-svn: 371741

5 years ago[docs][llvm-strip] Remove unnecessary whitespace for consistency
James Henderson [Thu, 12 Sep 2019 14:24:04 +0000 (14:24 +0000)]
[docs][llvm-strip] Remove unnecessary whitespace for consistency

llvm-svn: 371739

5 years ago[lldb][NFC] Simplify makefiles also for breakpoint tests
Raphael Isemann [Thu, 12 Sep 2019 14:21:59 +0000 (14:21 +0000)]
[lldb][NFC] Simplify makefiles also for breakpoint tests

These tests were temporarily missing when the big Makefile
simplification patch landed, so this just applies the same change
to these tests.

llvm-svn: 371738

5 years ago[InstCombine][InstSimplify] Move constant-folding tests in result-of-usub-is-non...
Roman Lebedev [Thu, 12 Sep 2019 14:12:31 +0000 (14:12 +0000)]
[InstCombine][InstSimplify] Move constant-folding tests in result-of-usub-is-non-zero-and-no-overflow.ll

llvm-svn: 371737

5 years ago[NFC][InstCombine][InstSimplify] Add test for "add-of-negative is non-zero and no...
Roman Lebedev [Thu, 12 Sep 2019 14:12:20 +0000 (14:12 +0000)]
[NFC][InstCombine][InstSimplify] Add test for "add-of-negative is non-zero and no overflow" (PR43259)

https://rise4fun.com/Alive/ska
https://rise4fun.com/Alive/9iX

https://bugs.llvm.org/show_bug.cgi?id=43259

llvm-svn: 371736

5 years ago[ConstProp] allow folding for fma that produces NaN
Sanjay Patel [Thu, 12 Sep 2019 14:10:50 +0000 (14:10 +0000)]
[ConstProp] allow folding for fma that produces NaN

Folding for fma/fmuladd was added here:
rL202914
...and as seen in existing/unchanged tests, that works to propagate NaN
if it's already an input, but we should fold an fma() that creates NaN too.

From IEEE-754-2008 7.2 "Invalid Operation", there are 2 clauses that apply
to fma, so I added tests for those patterns:

  c) fusedMultiplyAdd: fusedMultiplyAdd(0, âˆž, c) or fusedMultiplyAdd(∞, 0, c)
     unless c is a quiet NaN; if c is a quiet NaN then it is implementation
     defined whether the invalid operation exception is signaled
  d) addition or subtraction or fusedMultiplyAdd: magnitude subtraction of
     infinities, such as: addition(+∞, âˆ’∞)

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

llvm-svn: 371735

5 years ago[lldb] Remove duplicated breakpoint tests
Raphael Isemann [Thu, 12 Sep 2019 14:07:16 +0000 (14:07 +0000)]
[lldb] Remove duplicated breakpoint tests

After reverting the deletion of the functionalities/breakpoint tests,
we now have some tests twice in the test/ folder which breaks dotest:

* commands/breakpoint/basic
* functionalities/breakpoint/breakpoint_command

After looking over these tests, I think it makes sense to only
keep the original functionalities/ folder. The commands/breakpoint/basic
test are not exclusively testing the breakpoint command itself, so
they shouldn't be in commands/ in the first place. Note that these
folders have identical contents (beside small adjustments regarding
the Makefile which landed after the restructuring).

llvm-svn: 371734

5 years ago[clang] [unittest] Import LLVMTestingSupport if necessary
Michal Gorny [Thu, 12 Sep 2019 13:06:12 +0000 (13:06 +0000)]
[clang] [unittest] Import LLVMTestingSupport if necessary

Add LLVMTestingSupport directory from LLVM_MAIN_SRC_DIR when building
clang stand-alone and LLVMTestingSupport library is not present.  This
is needed to fix stand-alone builds without clang-tools-extra.

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

llvm-svn: 371733

5 years agolld-link: Fix tests that do not run on macOS after r371729.
Nico Weber [Thu, 12 Sep 2019 12:35:34 +0000 (12:35 +0000)]
lld-link: Fix tests that do not run on macOS after r371729.

llvm-svn: 371732

5 years agoRemoved some questionable default arguments from setters
Dmitri Gribenko [Thu, 12 Sep 2019 12:16:43 +0000 (12:16 +0000)]
Removed some questionable default arguments from setters

Summary:
They can be confusing -- what does it mean to call a setter without a
value? Also, some setters, like `setPrintTemplateTree` had `false` as
the default value!

The callers are largely not using these default arguments anyway.

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 371731

5 years ago[MIPS GlobalISel] Select indirect branch
Petar Avramovic [Thu, 12 Sep 2019 11:44:36 +0000 (11:44 +0000)]
[MIPS GlobalISel] Select indirect branch

Select G_BRINDIRECT for MIPS32.

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

llvm-svn: 371730

5 years agolld-link: Make /linkrepro: take a filename, not a directory.
Nico Weber [Thu, 12 Sep 2019 11:44:13 +0000 (11:44 +0000)]
lld-link: Make /linkrepro: take a filename, not a directory.

This makes lld-link behave like ld.lld. I don't see a reason for
the two drivers to have different behavior here.

While here, also make lld-link add a version.txt to the tar, like
ld.lld does.

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

llvm-svn: 371729

5 years ago[MIPS GlobalISel] Lower G_DYN_STACKALLOC
Petar Avramovic [Thu, 12 Sep 2019 11:39:50 +0000 (11:39 +0000)]
[MIPS GlobalISel] Lower G_DYN_STACKALLOC

IRTranslator creates G_DYN_STACKALLOC instruction during expansion of
alloca when argument that tells number of elements to allocate on stack
is a virtual register. Use default lowering for MIPS32.

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

llvm-svn: 371728

5 years ago[MIPS GlobalISel] Select G_IMPLICIT_DEF
Petar Avramovic [Thu, 12 Sep 2019 11:32:38 +0000 (11:32 +0000)]
[MIPS GlobalISel] Select G_IMPLICIT_DEF

G_IMPLICIT_DEF is used for both integer and floating point implicit-def.
Handle G_IMPLICIT_DEF as ambiguous opcode in MipsRegisterBankInfo.
Select G_IMPLICIT_DEF for MIPS32.

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

llvm-svn: 371727

5 years agoSwitch "windows" to "system-windows" in some XFAILs
Jeremy Morse [Thu, 12 Sep 2019 11:19:12 +0000 (11:19 +0000)]
Switch "windows" to "system-windows" in some XFAILs

The test failure mode appears to be due to the host machine rather than the
target. The PS4 buildbots are windows-hosted targeting x86_64-scei-ps4,
and are currently reporting these as unexpected failures:

  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/28114

llvm-svn: 371726

5 years ago[DAGCombine] visitFDIV - Use isCheaperToUseNegatedFPOps helper for (fdiv (fneg X...
Simon Pilgrim [Thu, 12 Sep 2019 11:03:09 +0000 (11:03 +0000)]
[DAGCombine] visitFDIV - Use isCheaperToUseNegatedFPOps helper for (fdiv (fneg X), (fneg Y)) -> (fdiv X, Y). NFCI.

Minor cleanup to use equivalent helper code.

llvm-svn: 371724

5 years agoRemoved dead code from DiagnosticBuilder
Dmitri Gribenko [Thu, 12 Sep 2019 10:39:53 +0000 (10:39 +0000)]
Removed dead code from DiagnosticBuilder

llvm-svn: 371723

5 years agoAArch64: support arm64_32, an ILP32 slice for watchOS.
Tim Northover [Thu, 12 Sep 2019 10:22:23 +0000 (10:22 +0000)]
AArch64: support arm64_32, an ILP32 slice for watchOS.

This is the main CodeGen patch to support the arm64_32 watchOS ABI in LLVM.
FastISel is mostly disabled for now since it would generate incorrect code for
ILP32.

llvm-svn: 371722

5 years agoCodeGenPrep: add separate hook say when GEPs should be used for sinking. NFCI.
Tim Northover [Thu, 12 Sep 2019 10:21:00 +0000 (10:21 +0000)]
CodeGenPrep: add separate hook say when GEPs should be used for sinking. NFCI.

Up to now, we've decided whether to sink address calculations using GEPs or
normal arithmetic based on the useAA hook, but there are other reasons GEPs
might be preferred. So this patch splits the two questions, with a default
implementation falling back to useAA.

llvm-svn: 371721

5 years ago[clang-format] [PR43100] clang-format C# support does not add a space between "using...
Paul Hoad [Thu, 12 Sep 2019 10:18:53 +0000 (10:18 +0000)]
[clang-format] [PR43100] clang-format C#  support does not add a space between "using" and paren

Summary:
Addresses https://bugs.llvm.org/show_bug.cgi?id=43100

Formatting using statement in C# with clang-format removes the space between using and paren even when SpaceBeforeParens is !

```
using(FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize : 1))
```

this change simply overcomes this for when using C# settings in the .clang-format file

```
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize : 1))
```

All FormatTests pass..

```
[==========] 688 tests from 21 test cases ran. (88508 ms total)
[  PASSED  ] 688 tests.
```

Reviewers: djasper, klimek, owenpan

Reviewed By: owenpan

Subscribers: llvm-commits, cfe-commits

Tags: #clang

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

llvm-svn: 371720

5 years ago[clang-format] Add new style option IndentGotoLabels
Paul Hoad [Thu, 12 Sep 2019 10:07:14 +0000 (10:07 +0000)]
[clang-format] Add new style option IndentGotoLabels

Summary:
This option determines whether goto labels are indented according to scope. Setting this option to false causes goto labels to be flushed to the left.
This is mostly copied from [[ http://lists.llvm.org/pipermail/cfe-dev/2015-September/045014.html | this patch ]] submitted by Christian Neukirchen that didn't make its way into trunk.

```
     true:                                  false:
     int f() {                      vs.     int f() {
       if (foo()) {                           if (foo()) {
       label1:                              label1:
         bar();                                 bar();
       }                                      }
     label2:                                label2:
       return 1;                              return 1;
     }                                      }
```

Reviewers: klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang, #clang-tools-extra

Patch by: tetsuo-cpp

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

llvm-svn: 371719

5 years ago[InstSimplify] simplifyUnsignedRangeCheck(): handle more cases (PR43251)
Roman Lebedev [Thu, 12 Sep 2019 09:26:17 +0000 (09:26 +0000)]
[InstSimplify] simplifyUnsignedRangeCheck(): handle more cases (PR43251)

Summary:
I don't have a direct motivational case for this,
but it would be good to have this for completeness/symmetry.

This pattern is basically the motivational pattern from
https://bugs.llvm.org/show_bug.cgi?id=43251
but with different predicate that requires that the offset is non-zero.

The completeness bit comes from the fact that a similar pattern (offset != zero)
will be needed for https://bugs.llvm.org/show_bug.cgi?id=43259,
so it'd seem to be good to not overlook very similar patterns..

Proofs: https://rise4fun.com/Alive/21b

Also, there is something odd with `isKnownNonZero()`, if the non-zero
knowledge was specified as an assumption, it didn't pick it up (PR43267)

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 371718

5 years ago[PowerPC][MCP][NFC] Pre-commit test cases for https://reviews.llvm.org/D65267
Kai Luo [Thu, 12 Sep 2019 09:00:44 +0000 (09:00 +0000)]
[PowerPC][MCP][NFC] Pre-commit test cases for https://reviews.llvm.org/D65267

llvm-svn: 371717

5 years ago[ELF] Fix a common-page-size typo
Fangrui Song [Thu, 12 Sep 2019 08:59:17 +0000 (08:59 +0000)]
[ELF] Fix a common-page-size typo

llvm-svn: 371716

5 years ago[ELF] Support -z undefs
Fangrui Song [Thu, 12 Sep 2019 08:55:17 +0000 (08:55 +0000)]
[ELF] Support -z undefs

-z undefs is the inverse of -z defs. It allows unresolved references
from object files. This can be used to cancel --no-undefined or -z defs.

Reviewed By: ruiu

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

llvm-svn: 371715

5 years ago[DAGCombiner] Improve division estimation of floating points.
Qiu Chaofan [Thu, 12 Sep 2019 07:51:24 +0000 (07:51 +0000)]
[DAGCombiner] Improve division estimation of floating points.

Current implementation of estimating divisions loses precision since it
estimates reciprocal first and does multiplication.  This patch is to re-order
arithmetic operations in the last iteration in DAGCombiner to improve the
accuracy.

Reviewed By: Sanjay Patel, Jinsong Ji

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

llvm-svn: 371713

5 years ago[WebAssembly] Delete duplicate REQUIRES line
Heejin Ahn [Thu, 12 Sep 2019 06:56:17 +0000 (06:56 +0000)]
[WebAssembly] Delete duplicate REQUIRES line

r371710 and r371711 committed the same line, so this deletes one of
them.

llvm-svn: 371712

5 years ago[WebAssembly] Make wasm-eh.cpp requires WebAssembly
Heejin Ahn [Thu, 12 Sep 2019 06:52:24 +0000 (06:52 +0000)]
[WebAssembly] Make wasm-eh.cpp requires WebAssembly

D67208 added a new test line to wasm-eh.cpp that invokes the LLVM
backend and this test fails on bots that don't have WebAssembly target.
This makes wasm-eh.cpp explicitly require WebAssembly so this will be
skipped on those targets.

llvm-svn: 371711

5 years ago[WebAssembly] Add REQUIRES to test
David Zarzycki [Thu, 12 Sep 2019 06:50:33 +0000 (06:50 +0000)]
[WebAssembly] Add REQUIRES to test

llvm-svn: 371710

5 years ago[LegalizeTypes] Remove code for softening a float type to itself.
Craig Topper [Thu, 12 Sep 2019 05:55:14 +0000 (05:55 +0000)]
[LegalizeTypes] Remove code for softening a float type to itself.

This was previously used to turn fp128 operations into libcalls
on X86. This is now done through op legalization after r371672.

This restores much of this code to before r254653.

llvm-svn: 371709

5 years ago[WebAssembly] Add -fwasm-exceptions for wasm EH
Heejin Ahn [Thu, 12 Sep 2019 04:01:37 +0000 (04:01 +0000)]
[WebAssembly] Add -fwasm-exceptions for wasm EH

Summary:
This adds `-fwasm-exceptions` (in similar fashion with
`-fdwarf-exceptions` or `-fsjlj-exceptions`) that turns on everything
with wasm exception handling from the frontend to the backend.

We currently have `-mexception-handling` in clang frontend, but this is
only about the architecture capability and does not turn on other
necessary options such as the exception model in the backend. (This can
be turned on with `llc -exception-model=wasm`, but llc is not invoked
separately as a command line tool, so this option has to be transferred
from clang.)

Turning on `-fwasm-exceptions` in clang also turns on
`-mexception-handling` if not specified, and will error out if
`-mno-exception-handling` is specified.

Reviewers: dschuff, tlively, sbc100

Subscribers: aprantl, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

llvm-svn: 371708

5 years agoMake SwitchInstProfUpdateWrapper strict permanently
Yevgeny Rouban [Thu, 12 Sep 2019 03:41:34 +0000 (03:41 +0000)]
Make SwitchInstProfUpdateWrapper strict permanently

We have been using -switch-inst-prof-update-wrapper-strict
set to true by default for some time. It is time to remove
the safety stuff and make SwitchInstProfUpdateWrapper
intolerant to inconsistencies in !prof branch_weights
metadata of SwitchInst.

This patch gets rid of the Invalid state of
SwitchInstProfUpdateWrapper and the option
-switch-inst-prof-update-wrapper-strict. So there is only
two states: changed and unchanged.

Reviewers: davidx, nikic, eraman, reames, chandlerc
Reviewed By: davidx
Differential Revision: https://reviews.llvm.org/D67435

llvm-svn: 371707

5 years ago[clang-tidy] Fix build with -DBUILD_SHARED_LIB=ON
Heejin Ahn [Thu, 12 Sep 2019 03:10:57 +0000 (03:10 +0000)]
[clang-tidy] Fix build with -DBUILD_SHARED_LIB=ON

Summary: This fixes build failures with `-DBUILD_SHARED_LIB=ON` after D67419.

Reviewers: NoQ

Subscribers: mgorny, xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 371706

5 years ago[compiler-rt] cpplint of inc files in background
Vitaly Buka [Thu, 12 Sep 2019 02:20:37 +0000 (02:20 +0000)]
[compiler-rt] cpplint of inc files in background

llvm-svn: 371705

5 years ago[compiler-rt] Remove some cpplint filters
Vitaly Buka [Thu, 12 Sep 2019 02:20:36 +0000 (02:20 +0000)]
[compiler-rt] Remove some cpplint filters

llvm-svn: 371704

5 years ago[compiler-rt] Run cpplint only for check-sanitizer
Vitaly Buka [Thu, 12 Sep 2019 01:35:11 +0000 (01:35 +0000)]
[compiler-rt] Run cpplint only for check-sanitizer

llvm-svn: 371703

5 years ago[compiler-rt] Better lint output for .inc files
Vitaly Buka [Thu, 12 Sep 2019 01:35:09 +0000 (01:35 +0000)]
[compiler-rt] Better lint output for .inc files

llvm-svn: 371702

5 years agogn build: Merge r371700
Nico Weber [Thu, 12 Sep 2019 01:25:34 +0000 (01:25 +0000)]
gn build: Merge r371700

llvm-svn: 371701

5 years agoReapply llvm-reduce: Add pass to reduce parameters""
David Blaikie [Thu, 12 Sep 2019 01:20:48 +0000 (01:20 +0000)]
Reapply llvm-reduce: Add pass to reduce parameters""

Fixing a couple of asan-identified bugs
* use of an invalid "Use" iterator after the element was removed
* use of StringRef to Function name after the Function was erased

This reapplies r371567, which was reverted in r371580.

llvm-svn: 371700

5 years ago[clang-scan-deps] Add dependency targets
Jan Korous [Thu, 12 Sep 2019 00:48:45 +0000 (00:48 +0000)]
[clang-scan-deps] Add dependency targets

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

llvm-svn: 371697

5 years agoPR43278: llvm-reduce: Use temporary file names (and ToolOutputFile) rather than uniqu...
David Blaikie [Thu, 12 Sep 2019 00:31:57 +0000 (00:31 +0000)]
PR43278: llvm-reduce: Use temporary file names (and ToolOutputFile) rather than unique ones - to ensure they're cleaned up

This modifies the tool somewhat to only create files when about to run
the "interestingness" test, and delete them immediately after - this
means some more files will be created sometimes (when "double checking"
work - which should probably be fixed/avoided anyway).

This now creates temporary files, rather than only unique ones, and also
uses ToolOutputFile (without ever calling "keep") to ensure the files
are deleted as soon as the interestingness test is run.

llvm-svn: 371696

5 years ago[X86] Enable -mprefer-vector-width=256 by default for Skylake-avx512 and later Intel...
Craig Topper [Wed, 11 Sep 2019 23:54:36 +0000 (23:54 +0000)]
[X86] Enable -mprefer-vector-width=256 by default for Skylake-avx512 and later Intel CPUs.

AVX512 instructions can cause a frequency drop on these CPUs. This
can negate the performance gains from using wider vectors. Enabling
prefer-vector-width=256 will prevent generation of zmm registers
unless explicit 512 bit operations are used in the original source
code.

I believe gcc and icc both do something similar to this by default.

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

llvm-svn: 371694

5 years ago[AArch64][GlobalISel] Fall back on attempts to allocate split types on the stack.
Amara Emerson [Wed, 11 Sep 2019 23:53:23 +0000 (23:53 +0000)]
[AArch64][GlobalISel] Fall back on attempts to allocate split types on the stack.

First we were asserting that the ValNo of a VA was the wrong value. It doesn't actually
make a difference for us in CallLowering but fix that anyway to silence the assert.

The bigger issue was that after fixing the assert we were generating invalid MIR
because the merging/unmerging of values split across multiple registers wasn't
also implemented for memory locs. This happens when we run out of registers and
have to pass the split types like i128 -> i64 x 2 on the stack. This is do-able, but
for now just fall back.

llvm-svn: 371693

5 years ago[GlobalISel][AArch64] Check caller for swifterror params in tailcall eligibility
Jessica Paquette [Wed, 11 Sep 2019 23:44:16 +0000 (23:44 +0000)]
[GlobalISel][AArch64] Check caller for swifterror params in tailcall eligibility

Before, we only checked the callee for swifterror. However, we should also be
checking the caller to see if it has a swifterror parameter.

Since we don't currently handle outgoing arguments, this didn't show up in the
swifterror.ll testcase.

Also, remove the swifterror checks from call-translator-tail-call.ll, since
they are covered by the existing swifterror testing. Better to have it all in
one place.

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

llvm-svn: 371692

5 years ago[dfsan] Revert dfsan_set_label removal
Vitaly Buka [Wed, 11 Sep 2019 23:43:23 +0000 (23:43 +0000)]
[dfsan] Revert dfsan_set_label removal

It's part of interface, maybe it is used in external code.

llvm-svn: 371691

5 years ago[Reproducer] Move the command loader into the reproducer (NFC)
Jonas Devlieghere [Wed, 11 Sep 2019 23:27:12 +0000 (23:27 +0000)]
[Reproducer] Move the command loader into the reproducer (NFC)

This just moves the CommandLoader utility into the reproducer namespace
and makes it accessible outside the API layer. This is setting things up
for a bigger change.

llvm-svn: 371689

5 years ago[NFC] Reformat SBDebugger before making changes
Jonas Devlieghere [Wed, 11 Sep 2019 23:27:09 +0000 (23:27 +0000)]
[NFC] Reformat SBDebugger before making changes

llvm-svn: 371688

5 years agoRemove NOLINTs from compiler-rt
Vitaly Buka [Wed, 11 Sep 2019 23:19:48 +0000 (23:19 +0000)]
Remove NOLINTs from compiler-rt

llvm-svn: 371687

5 years ago[Reproducer] Move GDB Remote Provider into Reproducer (NFC)
Jonas Devlieghere [Wed, 11 Sep 2019 23:15:12 +0000 (23:15 +0000)]
[Reproducer] Move GDB Remote Provider into Reproducer (NFC)

Originally the idea was for providers to be defined close to where they
are used. While this helped designing the providers in such a way that
they don't depend on each other, it also means that it's not possible to
access them from a central place. This proved to be a problem for some
providers and resulted in them living in the reproducer class.

The ProcessGDBRemote provider is the last remaining exception. This
patch makes things consistent and moves it into the reproducer like the
other providers.

llvm-svn: 371685

5 years ago[TableGen] Skip CRLF conversion when writing output
Reid Kleckner [Wed, 11 Sep 2019 22:33:50 +0000 (22:33 +0000)]
[TableGen] Skip CRLF conversion when writing output

Doing the CRLF translation while writing the file defeats our
optimization to not update the file if it hasn't changed.

Fixes PR43271.

llvm-svn: 371683

5 years ago[InstCombine] rename variable for readability; NFC
Sanjay Patel [Wed, 11 Sep 2019 22:31:34 +0000 (22:31 +0000)]
[InstCombine] rename variable for readability; NFC

There's more that can be done here, but "OpI"
doesn't convey that we casted to BinaryOperator.

llvm-svn: 371682

5 years agoAdd some missing changes to GSYM that was addressing a gcc compilation error due...
David Blaikie [Wed, 11 Sep 2019 22:24:45 +0000 (22:24 +0000)]
Add some missing changes to GSYM that was addressing a gcc compilation error due to a type and variable with the same name

llvm-svn: 371681

5 years agoFix mac build
Vitaly Buka [Wed, 11 Sep 2019 22:19:18 +0000 (22:19 +0000)]
Fix mac build

llvm-svn: 371680

5 years agoPR43278: Temporarily disable llvm-reduce tests due to exhausting temp files
David Blaikie [Wed, 11 Sep 2019 22:15:16 +0000 (22:15 +0000)]
PR43278: Temporarily disable llvm-reduce tests due to exhausting temp files

llvm-svn: 371679

5 years ago[X86] Fix latent bugs in 32-bit CMPXCHG8B inserter
Reid Kleckner [Wed, 11 Sep 2019 21:56:17 +0000 (21:56 +0000)]
[X86] Fix latent bugs in 32-bit CMPXCHG8B inserter

I found three issues:
1. the loop over E[ABCD]X copies run over BB start
2. the direct address of cmpxchg8b could be a frame index
3. the displacement of cmpxchg8b could be a global instead of an
   immediate

These were all introduced together in r287875, and should be fixed with
this change.

Issue reported by Zachary Turner.

llvm-svn: 371678

5 years ago[ConstantFolding] Refactor math functions to use LLVM ones (NFC)
Evandro Menezes [Wed, 11 Sep 2019 21:46:57 +0000 (21:46 +0000)]
[ConstantFolding] Refactor math functions to use LLVM ones (NFC)

When possible, replace calls to library routines on the host with equivalent
ones in LLVM.

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

llvm-svn: 371677

5 years agoRevert [llvm-nm] Add tapi file support
Cyndy Ishida [Wed, 11 Sep 2019 21:35:28 +0000 (21:35 +0000)]
Revert [llvm-nm] Add tapi file support

This reverts r371576 (git commit f88f46358dbffa20af3b054a9346e5154789d50f)

llvm-svn: 371676

5 years agoUpdate compiler-rt cpplint.py
Vitaly Buka [Wed, 11 Sep 2019 21:33:06 +0000 (21:33 +0000)]
Update compiler-rt cpplint.py
https://github.com/cpplint/cpplint/commit/adb3500107f409ac5491188ae652ac3f4d03d9d3

llvm-svn: 371675

5 years agoRevert [Object][TextAPI] NFC, fix tapi lit tests
Cyndy Ishida [Wed, 11 Sep 2019 21:32:55 +0000 (21:32 +0000)]
Revert [Object][TextAPI] NFC, fix tapi lit tests

This reverts r371577 (git commit b2b0ccab2f76733679eeceecf31b21ebc1fe23ac)

llvm-svn: 371674

5 years ago[X86] Add test case for v16i64->v16i32 truncate on min-legal-vector-width=256.
Craig Topper [Wed, 11 Sep 2019 21:30:42 +0000 (21:30 +0000)]
[X86] Add test case for v16i64->v16i32 truncate on min-legal-vector-width=256.

I think this case would crash before I added back the -x86-experimental-vector-widening command line option. Adding this test case to prevent breaking it again when we remove the option.

llvm-svn: 371673

5 years ago[X86] Move x86_64 fp128 conversion to libcalls from type legalization to DAG legalization
Craig Topper [Wed, 11 Sep 2019 21:30:09 +0000 (21:30 +0000)]
[X86] Move x86_64 fp128 conversion to libcalls from type legalization to DAG legalization

fp128 is considered a legal type for a register, but has almost no legal operations so everything needs to be converted to a libcall. Previously this was implemented by tricking type legalization into softening the operations with various checks for "is legal in hardware register" to change the behavior to still use f128 as the resulting type instead of converting to i128.

This patch abandons this approach and instead moves the libcall conversions to LegalizeDAG. This is the approach taken by AArch64 where they also have a legal fp128 type, but no legal operations. I think this is more in spirit with how SelectionDAG's phases are supposed to work.

I had to make some hacks for STRICT_FP_ROUND because some of the strict FP handling checks if ISD::FP_ROUND is Legal for a given result type, but I had to make ISD::FP_ROUND Custom to allow making a libcall when the input is f128. For all other types the Custom handler just returns the original node. These hacks are incomplete and don't work for a strict truncate from f128, but I don't think it worked before either since LegalizeFloatTypes doesn't know about strict ops yet. I've also raised PR43209 against AArch64 which currently crashes on a strict ftrunc from f64->f32 because of FP_ROUND being marked Custom for the same reason there.

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

llvm-svn: 371672

5 years agoAMDGPU: Move m0 initializations earlier
Austin Kerbow [Wed, 11 Sep 2019 21:28:41 +0000 (21:28 +0000)]
AMDGPU: Move m0 initializations earlier

Summary:
After hoisting and merging m0 initializations schedule them as early as
possible in the MBB. This helps the scheduler avoid hazards in some
cases.

Reviewers: rampitec, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 371671

5 years agogn build: Merge r371661
Nico Weber [Wed, 11 Sep 2019 21:24:15 +0000 (21:24 +0000)]
gn build: Merge r371661

llvm-svn: 371670

5 years agogn build: Merge r371657
Nico Weber [Wed, 11 Sep 2019 21:24:11 +0000 (21:24 +0000)]
gn build: Merge r371657

llvm-svn: 371669

5 years ago[DWARF] Evaluate DW_OP_entry_value
Vedant Kumar [Wed, 11 Sep 2019 21:23:45 +0000 (21:23 +0000)]
[DWARF] Evaluate DW_OP_entry_value

Add support for evaluating DW_OP_entry_value. This involves parsing
DW_TAG_call_site_parameter and wiring the information through to the expression
evaluator.

rdar://54496008

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

llvm-svn: 371668

5 years ago[Status] Add a LLDB_ERRORF macro for error reporting (similar to LLDB_LOGF)
Vedant Kumar [Wed, 11 Sep 2019 21:23:42 +0000 (21:23 +0000)]
[Status] Add a LLDB_ERRORF macro for error reporting (similar to LLDB_LOGF)

llvm-svn: 371667