platform/upstream/llvm.git
4 years agoMigrate a couple of codegen tests to gc-live format
Philip Reames [Thu, 25 Jun 2020 19:33:32 +0000 (12:33 -0700)]
Migrate a couple of codegen tests to gc-live format

4 years ago[ARM] MVE VCVT lowering for f16->f32 extends
David Green [Thu, 25 Jun 2020 18:49:27 +0000 (19:49 +0100)]
[ARM] MVE VCVT lowering for f16->f32 extends

This adds code to lower f16 to f32 fp_exts's using an MVE VCVT
instructions, similar to a recent similar patch for fp_trunc. Again it
goes through the lowering of a BUILD_VECTOR, but is slightly simpler
only having to deal with interleaved indices. It adds a VCVTL node to
lower to, similar to VCVTN.

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

4 years ago[X86] Don't imply -mprfchw when -m3dnow is specified. Enable prefetchw in the backend...
Craig Topper [Thu, 25 Jun 2020 18:45:09 +0000 (11:45 -0700)]
[X86] Don't imply -mprfchw when -m3dnow is specified. Enable prefetchw in the backend with 3dnow feature.

The PREFETCHW instruction was originally part of the 3DNow. But
it was given its own CPUID bit on later CPUs just before 3DNow
was deprecated.

We were setting the -mprfchw flag if -m3dnow was passed or the CPU
supported 3dnow unless -mno-prfchw was passed. But -march=native
on a CPU without the PRFCHW CPUID bit set will pass -mno-prfchw.
So -march=k8 will behave differently than -march=native on a K8
for example.

So remove this implicit setting from the frontend and instead
enable the backend to use PREFETCHW if 3dnow OR prfchw is enabled.

Also enable PRFCHW flag on amdfam10/barcelona which seems to be
where this CPUID bit was introduced. That CPU also supported
3dnow.

4 years ago[NFC][Support] Add unit of measure to comment for PeakMemory
Hubert Tong [Thu, 25 Jun 2020 19:41:33 +0000 (15:41 -0400)]
[NFC][Support] Add unit of measure to comment for PeakMemory

4 years ago[NFC][Support] Make Unix/Program.inc separately compilable
Hubert Tong [Thu, 25 Jun 2020 19:41:17 +0000 (15:41 -0400)]
[NFC][Support] Make Unix/Program.inc separately compilable

To improve CI checks, make `Unix/Program.inc` separately compilable.

4 years ago[Support][AIX] Add declaration of wait4 to fix build
Hubert Tong [Thu, 25 Jun 2020 19:40:07 +0000 (15:40 -0400)]
[Support][AIX] Add declaration of wait4 to fix build

While `wait4` is not documented for AIX, it is available; however, even
on systems where it is available, the system headers do not always
provide a declaration of the function. This patch provides a declaration
of `wait4` for AIX.

Reviewed By: daltenty

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

4 years ago[libc++] Fix some typos in the comment header for <regex>
Arthur O'Dwyer [Thu, 25 Jun 2020 19:31:03 +0000 (15:31 -0400)]
[libc++] Fix some typos in the comment header for <regex>

No functional change because all the changed "code" is actually inside
comments.

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

4 years ago[builtins] Move more float128-related helpers to GENERIC_TF_SOURCES list
Anatoly Trosinenko [Thu, 25 Jun 2020 19:32:41 +0000 (22:32 +0300)]
[builtins] Move more float128-related helpers to GENERIC_TF_SOURCES list

There are two different _generic_ lists of source files in the compiler-rt/lib/builtins/CMakeLists.txt. Now there is no simple way to not use the tf-variants of helpers at all.

Since there exists a separate `GENERIC_TF_SOURCES` list, it seems quite natural to move all float128-related helpers there. If it is not possible for some reason, it would be useful to have an explanation of that reason somewhere near the `GENERIC_TF_SOURCES` definition.

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

4 years ago[lldb/ScriptInterpreter] Fix missing include on Windows
Jonas Devlieghere [Thu, 25 Jun 2020 19:19:00 +0000 (12:19 -0700)]
[lldb/ScriptInterpreter] Fix missing include on Windows

4 years ago[HIP] Improve check patterns to avoid test failures in case string "opt", etc. happen...
Hiroshi Yamauchi [Thu, 25 Jun 2020 17:49:55 +0000 (10:49 -0700)]
[HIP] Improve check patterns to avoid test failures in case string "opt", etc. happens to be in the command path.

Similarly to D82046.

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

4 years ago[openmp] Use config.test_extra_flags in archer and multiplex tests
Han Zhu [Thu, 25 Jun 2020 18:58:35 +0000 (11:58 -0700)]
[openmp] Use config.test_extra_flags in archer and multiplex tests

Summary:
`config.test_extra_flags` is passed in from `lit.site.cfg.in` files, but they're not used in the LIT configs. This variable can be useful for distros which don't have the standard c/c++ headers in the default search paths. Since the tests run clang on c/c++ source code, we rely on `test_extra_flags` to pass in the necessary header files.

This is a similar setup that's also done in litomptarget https://github.com/llvm/llvm-project/blob/master/openmp/libomptarget/test/lit.cfg#L42 and openmp/runtime.

Reviewers: jdoerfert, jdenny, protze.joachim

Reviewed By: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, openmp-commits

Tags: #openmp

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

4 years ago[flang] Replace ATTRIBUTE_UNUSED with LLVM_ATTRIBUTE_UNUSED
Mehdi Chinoune [Thu, 25 Jun 2020 17:38:08 +0000 (18:38 +0100)]
[flang] Replace ATTRIBUTE_UNUSED with LLVM_ATTRIBUTE_UNUSED

ATTRIBUTE_UNUSED wasn't defined with MSVC.

Patch by: Mehdi Chinoune <chinoune.mehdi@hotmail.com>

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

4 years ago[libc++abi] NFCI: Minor refactoring of abort_message()
Louis Dionne [Thu, 25 Jun 2020 18:03:48 +0000 (14:03 -0400)]
[libc++abi] NFCI: Minor refactoring of abort_message()

Remove small code duplication and add comments explaining why we do things
in a given order.

4 years agoRevert "[X86] Don't imply -mprfchw when -m3dnow is specified. Enable prefetchw in...
Craig Topper [Thu, 25 Jun 2020 18:43:02 +0000 (11:43 -0700)]
Revert "[X86] Don't imply -mprfchw when -m3dnow is specified. Enable prefetchw in the backend with 3dnow feature."

This is failing on the bots.

This reverts commit 636d31a5c341ff2ca5eefd6075ff059eb60b5a80.

4 years ago[ARM] Add FP_ROUND handling to splitting MVE stores
David Green [Thu, 25 Jun 2020 15:02:36 +0000 (16:02 +0100)]
[ARM] Add FP_ROUND handling to splitting MVE stores

This splits MVE vector stores of a fp_trunc in the same way that we do
for standard trunc's. It extends PerformSplittingToNarrowingStores to
handle fp_round, splitting the store into pieces and adding a VCVTNb to
perform the actual fp_round. The actual store is then converted to an
integer store so that it can truncate bottom lanes of the result.

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

4 years ago[Coroutines] Handle dependent promise types for final_suspend non-throw check
Xun Li [Mon, 22 Jun 2020 21:38:41 +0000 (14:38 -0700)]
[Coroutines] Handle dependent promise types for final_suspend non-throw check

Summary:
Check that the co_await promise.final_suspend() does not potentially throw again after we have resolved dependent types.
This takes care of the cases where promises types are templated.
Added test cases for this scenario and confirmed that the checks happen now.
Also run libcxx tests locally to make sure all tests pass.

Reviewers: Benabik, lewissbaker, junparser, modocache

Reviewed By: modocache

Subscribers: modocache, cfe-commits

Tags: #clang

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

4 years ago[X86] Don't imply -mprfchw when -m3dnow is specified. Enable prefetchw in the backend...
Craig Topper [Thu, 25 Jun 2020 17:08:03 +0000 (10:08 -0700)]
[X86] Don't imply -mprfchw when -m3dnow is specified. Enable prefetchw in the backend with 3dnow feature.

The PREFETCHW instruction was originally part of the 3DNow. But
it was given its own CPUID bit on later CPUs just before 3DNow
was deprecated.

We were setting the -mprfchw flag if -m3dnow was passed or the CPU
supported 3dnow unless -mno-prfchw was passed. But -march=native
on a CPU without the PRFCHW CPUID bit set will pass -mno-prfchw.
So -march=k8 will behave differently than -march=native on a K8
for example.

So remove this implicit setting from the frontend and instead
enable the backend to use PREFETCHW if 3dnow OR prfchw is enabled.

Also enable PRFCHW flag on amdfam10/barcelona which seems to be
where this CPUID bit was introduced. That CPU also supported
3dnow.

4 years ago[gn build] Port 9878996c708
LLVM GN Syncbot [Thu, 25 Jun 2020 18:14:55 +0000 (18:14 +0000)]
[gn build] Port 9878996c708

4 years agoRevert "[PGO] Extend the value profile buckets for mem op sizes."
Hiroshi Yamauchi [Thu, 25 Jun 2020 17:58:13 +0000 (10:58 -0700)]
Revert "[PGO] Extend the value profile buckets for mem op sizes."

This reverts commit 63a89693f09f6b24ce4f2350d828150bd9c4f3e8.

Due to a build failure like http://lab.llvm.org:8011/builders/sanitizer-windows/builds/65386/steps/annotate/logs/stdio

4 years ago[InlineCost] GetElementPtr with constant operands
Kirill Naumov [Tue, 2 Jun 2020 19:22:41 +0000 (19:22 +0000)]
[InlineCost] GetElementPtr with constant operands

If the GEP instruction contanins only constants as its arguments,
then it should be recognized as a constant. For now, there was
also added a flag to turn off this simplification if it causes
any regressions ("disable-gep-const-evaluation") which is off
by default. Once I gather needed data of the effectiveness of
this simplification, the flag will be deleted.

Reviewers: apilipenko, davidxl, mtrofin

Reviewed By: mtrofin

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

4 years ago[gn build] Port 63a89693f09
LLVM GN Syncbot [Thu, 25 Jun 2020 17:59:53 +0000 (17:59 +0000)]
[gn build] Port 63a89693f09

4 years ago[Sema][CodeComplete][ObjC] Don't split the first selector fragment
David Goldman [Mon, 22 Jun 2020 14:50:54 +0000 (10:50 -0400)]
[Sema][CodeComplete][ObjC] Don't split the first selector fragment

Summary:
Standardize the formatting of selector fragments to include the ':',
e.g. for `- (void)foobar:(int)foobar;`, report `{foobar:}` instead of
`{foobar}{:}`. This was normally the case except for a couple of places
where it was split.

This also improves integration with clangd since it relies upon the `:`
to identify ObjC selectors.

NOTE: It is possible to have selector fragments that are just `:` with
no text, we now handle this properly for the first fragment.

Reviewers: sammccall, doug.gregor

Subscribers: ilya-biryukov, dexonsmith, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[lldb/Docs] Add more details to the issues with custom Python installs on macOS
Jonas Devlieghere [Thu, 25 Jun 2020 17:51:59 +0000 (10:51 -0700)]
[lldb/Docs] Add more details to the issues with custom Python installs on macOS

Although this issue is not specific to macOS, Python (in)compatibility
comes up quite often and we've been linking users to this page. This
just adds more details for this particular scenario.

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

4 years ago[Coroutines] Special handle __builtin_coro_resume for final_suspend nothrow check
Xun Li [Tue, 23 Jun 2020 22:06:18 +0000 (15:06 -0700)]
[Coroutines] Special handle __builtin_coro_resume for final_suspend nothrow check

Summary:
In https://reviews.llvm.org/D82029 we added the conformance check that the expression co_await promise.final_suspend() should not potentially throw.
As part of this expression, in cases when the await_suspend() method of the final suspend awaiter returns a handle, __builtin_coro_resume could be called on the handle to immediately resume that coroutine.
__builtin_coro_resume is not declared with noexcept and it shouldn't. We need to special check this case here.

Reviewers: modocache, lewissbaker, junparser

Reviewed By: lewissbaker

Subscribers: modocache, cfe-commits

Tags: #clang

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

4 years ago[PGO] Extend the value profile buckets for mem op sizes.
Hiroshi Yamauchi [Tue, 2 Jun 2020 19:10:15 +0000 (12:10 -0700)]
[PGO] Extend the value profile buckets for mem op sizes.

Extend the memop value profile buckets to be more flexible (could accommodate a
mix of individual values and ranges) and to cover more value ranges (from 11 to
22 buckets).

Disabled behind a flag (to be enabled separately) and the existing code to be
removed later.

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

4 years ago[lldb][NFC] Use expect_expr in TestDollarInVariable
Raphael Isemann [Thu, 25 Jun 2020 15:51:43 +0000 (17:51 +0200)]
[lldb][NFC] Use expect_expr in TestDollarInVariable

4 years agoAdd `FloatingLiteral` to SyntaxTree
Eduardo Caldas [Mon, 22 Jun 2020 17:35:38 +0000 (17:35 +0000)]
Add `FloatingLiteral` to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

4 years agoAdd StringLiteral to SyntaxTree
Eduardo Caldas [Thu, 25 Jun 2020 16:25:42 +0000 (16:25 +0000)]
Add StringLiteral to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

4 years agoAdd `CharLiteral` to SyntaxTree
Eduardo Caldas [Thu, 25 Jun 2020 16:10:19 +0000 (16:10 +0000)]
Add `CharLiteral` to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[NewPM] Move debugging log printing after PassInstrumentation before-pass-callbacks
Yuanfang Chen [Thu, 25 Jun 2020 17:02:50 +0000 (10:02 -0700)]
[NewPM] Move debugging log printing after PassInstrumentation before-pass-callbacks

For passes got skipped, this is confusing because the log said it is `running pass`
but it is skipped later.

Reviewed By: asbirlea

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

4 years ago[Clang][SourceManager] optimize getFileIDLocal()
Nick Desaulniers [Thu, 25 Jun 2020 16:53:11 +0000 (09:53 -0700)]
[Clang][SourceManager] optimize getFileIDLocal()

Summary:
A recent Linux kernel commit exposed a performance cliff in Clang. Calls
to SourceManager::getFileIDLocal() when there's a cache miss against
LastFileIDLookup can be relatively expensive, as getFileIDLocal() tries
a few linear probes, then falls back to binary search.  The use of
SourceManager::isOffsetInFileID() is also relatively expensive (both
isOffsetInFileID and getFileIDLocal dominated a trace of the performance
cliff case).

As a FIXME notes (and as @kadircet helpfully noted in review of D80681),
there's a few optimizations we can do here since we've already
identified that an offset is local (as opposed to "loaded").

This patch was forked off of D80681, which additionally did this and
modified some caching behavior, as we expect this change to be less
controversial.

In terms of optimizations, we've already determined that the SLocOffset
parameter to SourceManager::getFileIDLocal() is local in the caller
SourceManager::getFileIDSlow(). Also, there's an early continue in the
binary search loop in getFileIDLocal() that are duplicated in
isOffsetInFileID() as pointed out by @kadircet.

Take advantage of these to optimize the binary search patch, and remove
the FIXME.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits, kadircet, srhines

Tags: #clang

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

4 years ago[lldb/Lua] Redirect Lua stdout/stderr to the CommandReturnObject
Jonas Devlieghere [Thu, 25 Jun 2020 16:55:19 +0000 (09:55 -0700)]
[lldb/Lua] Redirect Lua stdout/stderr to the CommandReturnObject

Redirect the output of stdout and stderr to the CommandReturnObject for
one line commands.

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

4 years ago[lldb/ScriptInterpreter] Let the IORedirect factory handle IO being disabled.
Jonas Devlieghere [Thu, 25 Jun 2020 16:51:55 +0000 (09:51 -0700)]
[lldb/ScriptInterpreter] Let the IORedirect factory handle IO being disabled.

Have one factory method that decides how to initialize the
ScriptInterpreterIORedirect object based on whether IO is enabled or
disabled.

4 years ago[llvm-readobj][COFF] add .llvm.call-graph-profile section dump
Zequan Wu [Mon, 15 Jun 2020 23:29:36 +0000 (16:29 -0700)]
[llvm-readobj][COFF] add .llvm.call-graph-profile section dump

Summary: Dumping contents of `.llvm.call-graph-profile` section of COFF in the same format as ELF.

Reviewers: jhenderson, MaskRay, hans

Reviewed By: jhenderson

Subscribers: grimar, rupprecht, llvm-commits

Tags: #llvm

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

4 years agoEnsure that default value for -triple is correctly normalizedvalues
Daniel Grumberg [Thu, 25 Jun 2020 16:47:41 +0000 (17:47 +0100)]
Ensure that default value for -triple is correctly normalizedvalues

This fixes the build failure at http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/240/steps/test-check-clang/logs/FAIL%3A%20Clang-Unit%3A%3ACC1CommandLineGenerationTest.CanGenerateCC1CommandLineSeparateRequiredAbsent

4 years ago[analyzer] Enable constructor support in evalCall event.
Nithin Vadukkumchery Rajendrakumar [Thu, 25 Jun 2020 01:30:41 +0000 (18:30 -0700)]
[analyzer] Enable constructor support in evalCall event.

Pass EvalCallOptions via runCheckersForEvalCall into defaultEvalCall.
Update the AnalysisOrderChecker to support evalCall for testing.

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

4 years ago[lldb/ScriptInterpreter] Extract IO redirection logic
Jonas Devlieghere [Thu, 25 Jun 2020 16:43:17 +0000 (09:43 -0700)]
[lldb/ScriptInterpreter] Extract IO redirection logic

This patch takes the IO redirection logic from ScriptInterpreterPython
and moves it into the interpreter library so that it can be used by
other script interpreters. I've turned it into a RAII object so that we
don't have to worry about cleaning up in the calling code.

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

4 years ago[FileCheck][NFC] Remove redundant DumpInputDefault
Joel E. Denny [Thu, 25 Jun 2020 16:33:20 +0000 (12:33 -0400)]
[FileCheck][NFC] Remove redundant DumpInputDefault

Reviewed By: mehdi_amini, jhenderson

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

4 years ago[sve][acle] Add some C intrinsics for brain float types.
Francesco Petrogalli [Tue, 23 Jun 2020 22:06:13 +0000 (22:06 +0000)]
[sve][acle] Add some C intrinsics for brain float types.

Summary:
The following intrinsics has been added:

svuint16_t svcnt[_bf16]_m(svuint16_t inactive, svbool_t pg, svbfloat16_t op)
svuint16_t svcnt[_bf16]_x(svbool_t pg, svbfloat16_t op)
svuint16_t svcnt[_bf16]_z(svbool_t pg, svbfloat16_t op)

svbfloat16_t svtbl[_bf16](svbfloat16_t data, svuint16_t indices)

svbfloat16_t svtbl2[_bf16](svbfloat16x2_t data, svuint16_t indices)

svbfloat16_t svtbx[_bf16](svbfloat16_t fallback, svbfloat16_t data, svuint16_t indices)

Reviewers: c-rhodes, kmclaughlin, efriedma, sdesmalen, ctetreau

Subscribers: tschuett, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years agoChange while to do-while
Seija Kijin [Thu, 25 Jun 2020 16:29:50 +0000 (09:29 -0700)]
Change while to do-while

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

4 years ago[libunwind] Allow specifying custom Lit config files
Louis Dionne [Thu, 25 Jun 2020 16:02:43 +0000 (12:02 -0400)]
[libunwind] Allow specifying custom Lit config files

This is the libunwind counterpart of 0c66af970c80.

4 years ago[libc++abi] Allow specifying custom Lit config files
Louis Dionne [Thu, 25 Jun 2020 15:46:00 +0000 (11:46 -0400)]
[libc++abi] Allow specifying custom Lit config files

This is the libc++abi counterpart of 0c66af970c80.

4 years agoGVN.h - reduce AliasAnalysis.h include to forward declaration. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 15:37:06 +0000 (16:37 +0100)]
GVN.h - reduce AliasAnalysis.h include to forward declaration. NFC.

Cleanup MemoryDependenceAnalysis.h as well - GVN.h was also implicitly including AliasAnalysis.h via this.

Fix implicit include dependencies in source files and replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years ago[NewPM] Separate out alias analysis passes in opt
Arthur Eubanks [Tue, 23 Jun 2020 23:11:59 +0000 (16:11 -0700)]
[NewPM] Separate out alias analysis passes in opt

Summary:
This somewhat matches the --aa-pipeline option, which separates out any
AA analyses to make sure they run before other passes.

Makes check-llvm failures under new PM go from 2356 -> 2303.

AA passes are not handled by PassBuilder::parsePassPipeline() but rather
PassBuilder::parseAAPipeline(), which is why this fixes some failures.

Reviewers: asbirlea, hans, ychen, leonardchan

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Clang] Add support for -Wno-inline-namespace-reopened-noninline
Elvina Yakubova [Thu, 25 Jun 2020 13:53:23 +0000 (16:53 +0300)]
[Clang] Add support for -Wno-inline-namespace-reopened-noninline

This patch adds the option for disabling warn_inline_namespace_reopened_noninline
warning described here: https://bugs.llvm.org/show_bug.cgi?id=46106

Patch by Elvina Yakubova

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

4 years ago[FPEnv] PowerPC-specific builtin constrained FP enablement
Andrew Wock [Mon, 22 Jun 2020 16:16:03 +0000 (12:16 -0400)]
[FPEnv] PowerPC-specific builtin constrained FP enablement

This change enables PowerPC compiler builtins to generate constrained
floating point operations when clang is indicated to do so.

A couple of possibly unexpected backend divergences between constrained
floating point and regular behavior are highlighted under the test tag
FIXME-CHECK. This may be something for those on the PPC backend to look
at.

Patch by: Drew Wock <drew.wock@sas.com>

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

4 years agoAdd `BoolLiteralExpression` to SyntaxTree
Eduardo Caldas [Mon, 22 Jun 2020 16:04:54 +0000 (16:04 +0000)]
Add `BoolLiteralExpression` to SyntaxTree

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[InstCombine] fold fmul/fdiv with fabs operands
Sanjay Patel [Thu, 25 Jun 2020 15:28:04 +0000 (11:28 -0400)]
[InstCombine] fold fmul/fdiv with fabs operands

fabs(X) * fabs(Y) --> fabs(X * Y)
fabs(X) / fabs(Y) --> fabs(X / Y)

If both operands of fmul/fdiv are positive, then the result must be positive.

There's a NAN corner-case that prevents removing the more specific fold just
above this one:
fabs(X) * fabs(X) -> X * X
That fold works even with NAN because the sign-bit result of the multiply is
not specified if X is NAN.

We can't remove that and use the more general fold that is proposed here
because once we convert to this:
fabs (X * X)
...it is not legal to simplify the 'fabs' out of that expression when X is NAN.
That's because fabs() guarantees that the sign-bit is always cleared - even
for NAN values.

So this patch has the potential to lose information, but it seems unlikely if
we do the more specific fold ahead of this one.

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

4 years ago[ARM] Fixup for signed comparison warning. NFC
David Green [Thu, 25 Jun 2020 15:22:09 +0000 (16:22 +0100)]
[ARM] Fixup for signed comparison warning. NFC

4 years ago[mlir][EDSC] Add divis and diviu and vector.extractelement
Diego Caballero [Thu, 25 Jun 2020 15:06:19 +0000 (08:06 -0700)]
[mlir][EDSC] Add divis and diviu and vector.extractelement

Reviewed By: ftynse

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

4 years agoRemove orphan AMDGPUAAResult::Aliases and AMDGPUAAResult::PathAliases declarations...
Simon Pilgrim [Thu, 25 Jun 2020 14:47:56 +0000 (15:47 +0100)]
Remove orphan AMDGPUAAResult::Aliases and AMDGPUAAResult::PathAliases declarations. NFC.

4 years agoRemove orphan TypeBasedAAResult::PathAliases declaration. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 14:45:05 +0000 (15:45 +0100)]
Remove orphan TypeBasedAAResult::PathAliases declaration. NFC.

4 years agoGlobalsModRef.h - reduce CallGraph.h include to forward declarations. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 14:29:07 +0000 (15:29 +0100)]
GlobalsModRef.h - reduce CallGraph.h include to forward declarations. NFC.

Fix implicit include dependencies in source files.

4 years agoLoopAccessAnalysis.h - reduce AliasAnalysis.h include to forward declaration. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 13:53:34 +0000 (14:53 +0100)]
LoopAccessAnalysis.h - reduce AliasAnalysis.h include to forward declaration. NFC.

Fix implicit include dependencies in source files and replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years ago[ARM] MVE VCVT lowering for f32->f16 truncs
David Green [Thu, 25 Jun 2020 12:25:38 +0000 (13:25 +0100)]
[ARM] MVE VCVT lowering for f32->f16 truncs

This adds code to lower f32 to f16 fp_trunc's using a pair of MVE VCVT
instructions. Due to v4f16 not being legal, fp_round are often split up
fairly early. So this reconstructs the vcvt's from a buildvector of
fp_rounds from two vector inputs. Something like:

BUILDVECTOR(FP_ROUND(EXTRACT_ELT(X, 0),
            FP_ROUND(EXTRACT_ELT(Y, 0),
            FP_ROUND(EXTRACT_ELT(X, 1),
            FP_ROUND(EXTRACT_ELT(Y, 1), ...)

It adds a VCVTN node to handle this, which like VMOVN or VQMOVN lowers
into the top/bottom lanes of an MVE instruction.

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

4 years ago[AArch64] Emit warning when disassembling unpredictable LDRAA and LDRAB
Victor Campos [Wed, 24 Jun 2020 13:25:29 +0000 (14:25 +0100)]
[AArch64] Emit warning when disassembling unpredictable LDRAA and LDRAB

Summary:
LDRAA and LDRAB in their writeback variant should softfail when the same
register is used as result and base.

This patch adds a custom decoder that catches such case and emits a
warning when it occurs.

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

4 years ago[MC] Fix PR45805: infinite recursion in assembler
Thomas Preud'homme [Tue, 5 May 2020 18:11:04 +0000 (19:11 +0100)]
[MC] Fix PR45805: infinite recursion in assembler

Give up folding an expression if the fragment of one of the operands
would require laying out a fragment already being laid out. This
prevents hitting an infinite recursion when a fill size expression
refers to a later fragment since computing the offset of that fragment
would require laying out the fill fragment and thus computing its size
expression.

Reviewed By: echristo

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

4 years ago[ObjectYAML][DWARF] Format codes. NFC.
Xing GUO [Thu, 25 Jun 2020 13:51:22 +0000 (21:51 +0800)]
[ObjectYAML][DWARF] Format codes. NFC.

4 years ago[NFC][PPC][AIX] Add stack frame layout diagram to PPCISelLowering.cpp
Zarko Todorovski [Thu, 25 Jun 2020 13:40:44 +0000 (09:40 -0400)]
[NFC][PPC][AIX] Add stack frame layout diagram to PPCISelLowering.cpp

Summary:
This NFC patch adds a diagram of the AIX ABI stack frame layout.

Based on https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/assembler/idalangref_runtime_process.html

Reviewers: sfertile, cebowleratibm, hubert.reinterpretcast, Xiangling_L

Reviewed By: sfertile

Subscribers: wuzish, nemanjai, hiraditya, kbarton, llvm-commits

Tags: #powerpc, #llvm

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

4 years ago[PhaseOrdering] delete test for vectorization; NFC
Sanjay Patel [Thu, 25 Jun 2020 13:34:11 +0000 (09:34 -0400)]
[PhaseOrdering] delete test for vectorization; NFC

As requested in D81416, I'm deleting the file that I added with:
rGdf79443

4 years ago[lldb] Rewrite Scalar::GetBytes
Pavel Labath [Thu, 25 Jun 2020 13:18:02 +0000 (15:18 +0200)]
[lldb] Rewrite Scalar::GetBytes

This function was modifying and returning pointers to static storage,
which meant that any two accesses to different Scalar objects could
potentially race (depending on which types the objects were storing and
the host endianness).

In the new version the user is responsible for providing a buffer into
which this method will store its binary representation. The main caller
(RegisterValue::GetBytes) already has one such buffer handy, so this did
not require any major rewrites.

To make that work, I've needed to mark the RegisterValue value buffer
mutable -- not an ideal solution, but definitely better than modifying
global storage. This could be further improved by changing
RegisterValue::GetBytes to take a buffer too.

4 years ago[Alignment][NFC] Conform X86, ARM and AArch64 TargetTransformInfo backends to the...
Guillaume Chatelet [Thu, 25 Jun 2020 13:23:12 +0000 (13:23 +0000)]
[Alignment][NFC] Conform X86, ARM and AArch64 TargetTransformInfo backends to the public API

The main interface has been migrated to Align already but a few backends where broadening the type from Align to MaybeAlign.
This patch makes sure all implementations conform to the public API.

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

4 years agoLiveIntervals.h.h - reduce AliasAnalysis.h include to forward declaration. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 13:06:04 +0000 (14:06 +0100)]
LiveIntervals.h.h - reduce AliasAnalysis.h include to forward declaration. NFC.

Fix implicit include dependencies in source files and replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years agoAttributes.cpp - fix include sorting order. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 11:48:36 +0000 (12:48 +0100)]
Attributes.cpp - fix include sorting order. NFC.

4 years agoIRBuilder.cpp - fix include sorting order. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 11:48:14 +0000 (12:48 +0100)]
IRBuilder.cpp - fix include sorting order. NFC.

4 years agoCodeGenPrepare.cpp - remove unused IntrinsicsX86.h header. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 11:29:52 +0000 (12:29 +0100)]
CodeGenPrepare.cpp - remove unused IntrinsicsX86.h header. NFC.

4 years agoFix typos in CodeGenPrepare::splitLargeGEPOffsets comments.
Simon Pilgrim [Thu, 25 Jun 2020 10:52:55 +0000 (11:52 +0100)]
Fix typos in CodeGenPrepare::splitLargeGEPOffsets comments.

4 years ago[Alignment][NFC] Use Align for TargetCallingConv::OrigAlign
Guillaume Chatelet [Thu, 25 Jun 2020 13:21:07 +0000 (13:21 +0000)]
[Alignment][NFC] Use Align for TargetCallingConv::OrigAlign

This patch replaces D69249.

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

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

4 years ago[openmp] Use Directive_enumSize instead of OMPD_unknown position
Valentin Clement [Thu, 25 Jun 2020 13:17:15 +0000 (09:17 -0400)]
[openmp] Use Directive_enumSize instead of OMPD_unknown position

Summary:
Previously OMPD_unknown was last item in the Directive enumeration and its position was
used in various comparison and assertion. With the new Directive enumeration, this should be
change with  llvm::omp::Directive_enumSize. This patch fix two place where it was not done in
D81736.

Reviewers: vdmitrie, jdoerfert, jdenny

Reviewed By: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, cfe-commits

Tags: #clang

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

4 years ago[DSE,MSSA] Check if Def is removable only wen we try to remove it.
Florian Hahn [Thu, 25 Jun 2020 12:31:11 +0000 (13:31 +0100)]
[DSE,MSSA] Check if Def is removable only wen we try to remove it.

Non-removable MemoryDefs can still eliminate other defs. Update the
isRemovable checks to only candidates for removal.

4 years agoFix a crash with [[clang::acquire_handle]] when written as a type
Aaron Ballman [Thu, 25 Jun 2020 12:44:13 +0000 (08:44 -0400)]
Fix a crash with [[clang::acquire_handle]] when written as a type
attribute with no arguments provided.

4 years ago[MLIR][Shape] Canonicalize subsequent `size_to_index` and `index_to_size`
Frederik Gossen [Thu, 25 Jun 2020 11:59:19 +0000 (11:59 +0000)]
[MLIR][Shape] Canonicalize subsequent `size_to_index` and `index_to_size`

Eliminate the subsequent applications of `size_to_index` and `index_to_size`.

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

4 years ago[OPENMP]Dynamic globalization for parallel target regions.
Alexey Bataev [Mon, 22 Jun 2020 19:04:58 +0000 (15:04 -0400)]
[OPENMP]Dynamic globalization for parallel target regions.

Summary:
Added support for dynamic memory allocation for globalized variables in
case if execution of target regions in parallel is required.

Reviewers: jdoerfert

Subscribers: jholewinski, yaxunl, guansong, sstefan1, cfe-commits, caomhin

Tags: #clang

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

4 years ago[ARM] Split cast cost tests, and add masked load/store tests. NFC
David Green [Thu, 25 Jun 2020 10:10:19 +0000 (11:10 +0100)]
[ARM] Split cast cost tests, and add masked load/store tests. NFC

This file has grown quite large and could do with being split up. This
splits away the load/store + cast tests into a separate file. Some
masked load/store + cast tests have been added too, along with some
extra load/store + fpcast tests.

4 years ago[MLIR][Shape] Canonicalize subsequent `index_to_size` and `size_to_index`
Frederik Gossen [Fri, 19 Jun 2020 14:25:10 +0000 (14:25 +0000)]
[MLIR][Shape] Canonicalize subsequent `index_to_size` and `size_to_index`

Eliminate the subsequent applications of `index_to_size` and `size_to_index`.

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

4 years ago[llvm-readelf] - Report a warning instead of an error when dumping a broken section...
Georgii Rymar [Wed, 24 Jun 2020 13:51:42 +0000 (16:51 +0300)]
[llvm-readelf] - Report a warning instead of an error when dumping a broken section header.

There is no reason to report an error in `printSectionHeaders()`, we can report
a warning and continue dumping. This is what the patch does.

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

4 years agoRepair various issues with modernize-avoid-bind
Jeff Trull [Thu, 25 Jun 2020 11:29:53 +0000 (07:29 -0400)]
Repair various issues with modernize-avoid-bind

In the process of running this check on a large codebase I found a
number of limitations, and thought I would pass on my fixes for
possible integration upstream:

* Templated function call operators are not supported
* Function object constructors are always used directly in the lambda
  body, even if their arguments are not captured
* Placeholders with namespace qualifiers (std::placeholders::_1) are
  not detected
* Lambda arguments should be forwarded to the stored function
* Data members from other classes still get captured with this
* Expressions (as opposed to variables) inside std::ref are not captured
  properly
* Function object templates sometimes have their template arguments
  replaced with concrete types

This patch resolves all those issues and adds suitable unit tests.

4 years ago[AssumeBundles] Use operand bundles to encode alignment assumptions
Tyker [Wed, 24 Jun 2020 11:18:21 +0000 (13:18 +0200)]
[AssumeBundles] Use operand bundles to encode alignment assumptions

Summary:
NOTE: There is a mailing list discussion on this: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137632.html

Complemantary to the assumption outliner prototype in D71692, this patch
shows how we could simplify the code emitted for an alignemnt
assumption. The generated code is smaller, less fragile, and it makes it
easier to recognize the additional use as a "assumption use".

As mentioned in D71692 and on the mailing list, we could adopt this
scheme, and similar schemes for other patterns, without adopting the
assumption outlining.

Reviewers: hfinkel, xbolva00, lebedev.ri, nikic, rjmccall, spatel, jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: yamauchi, kuter, fhahn, merge_guards_bot, hiraditya, bollu, rkruppe, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[NFC] update test to make diff of the following commit clear
Tyker [Fri, 19 Jun 2020 13:45:27 +0000 (15:45 +0200)]
[NFC] update test to make diff of the following commit clear

4 years ago[Matrix] Use 1st/2nd instead of first/second in matrix diags.
Florian Hahn [Thu, 25 Jun 2020 10:48:07 +0000 (11:48 +0100)]
[Matrix] Use 1st/2nd instead of first/second in matrix diags.

This was suggested in D72782 and brings the diagnostics more in line
with how argument references are handled elsewhere.

Reviewers: rjmccall, jfb, Bigcheese

Reviewed By: rjmccall

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

4 years ago[ARM] Allow tail predication on sadd_sat and uadd_sat intrinsics
Sam Tebbs [Thu, 25 Jun 2020 10:53:11 +0000 (11:53 +0100)]
[ARM] Allow tail predication on sadd_sat and uadd_sat intrinsics

This patch stops the sadd_sat and uadd_sat intrinsics from blocking tail predication.

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

4 years ago[Matrix] Group matrix diagnostics together (NFC).
Florian Hahn [Wed, 24 Jun 2020 14:29:27 +0000 (15:29 +0100)]
[Matrix] Group matrix diagnostics together (NFC).

4 years agoFPEnv.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 10:40:25 +0000 (11:40 +0100)]
FPEnv.h - reduce includes to forward declarations. NFC.

Ensure FPEnv.cpp includes FPEnv.h first to check for hidden dependencies.

4 years agoMachineScheduler.h - reduce AliasAnalysis.h include to forward declaration. NFC.
Simon Pilgrim [Thu, 25 Jun 2020 10:14:12 +0000 (11:14 +0100)]
MachineScheduler.h - reduce AliasAnalysis.h include to forward declaration. NFC.

Replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years ago[AST] Fix a crash on accessing a class without definition in constexpr function context.
Haojian Wu [Thu, 25 Jun 2020 10:11:57 +0000 (12:11 +0200)]
[AST] Fix a crash on accessing a class without definition in constexpr function context.

Reviewed By: rsmith

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

4 years ago[libclang] Get rid of relience on SourceManager member signature
Kadir Cetinkaya [Thu, 25 Jun 2020 08:56:51 +0000 (10:56 +0200)]
[libclang] Get rid of relience on SourceManager member signature

Summary:
Libclang was enforcing a singature on SourceManager::getLocalSLocEntry
which isn't possible to satisfy as pointed out in
https://reviews.llvm.org/D80681#inline-751438.

This patch updates the libclang, hopefully without breaking API stability, to
not rely on member signature. To enable changing the signature in D82498.

Reviewers: sammccall, bkramer

Subscribers: arphaman, cfe-commits

Tags: #clang

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

4 years agoEnsure that CompilerInvocationTest normalizes default target triples
Daniel Grumberg [Thu, 25 Jun 2020 09:36:12 +0000 (10:36 +0100)]
Ensure that CompilerInvocationTest normalizes default target triples

This fixes a build failure. More details at http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/78/steps/test-check-clang/logs/FAIL%3A%20Clang-Unit%3A%3ACC1CommandLineGenerationTest.CanGenerateCC1CommandLineSeparateRequiredAbsent

4 years ago[MLIR][Shape] Fix ambiguous symbol
Frederik Gossen [Thu, 25 Jun 2020 09:39:35 +0000 (09:39 +0000)]
[MLIR][Shape] Fix ambiguous symbol

4 years ago[analyzer] SATest: Use logger in single-threaded mode as well
Valeriy Savchenko [Tue, 9 Jun 2020 09:33:56 +0000 (12:33 +0300)]
[analyzer] SATest: Use logger in single-threaded mode as well

Summary:
It generalizes the way the output looks across any -jN.
Additionally it solves the buffering problems.

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

4 years ago[analyzer] SATest: Fix package versions for test dependencies
Valeriy Savchenko [Mon, 8 Jun 2020 14:08:01 +0000 (17:08 +0300)]
[analyzer] SATest: Fix package versions for test dependencies

Summary:
Another possible difference between various users of the
testing system might be a change in dependencies installed on the
container.  This commit tries to prevent any problem related to
different versions of the libraries/headers used and fixes them to
currently installed versions.

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

4 years ago[analyzer] SATest: Add 5 more projects for testing
Valeriy Savchenko [Mon, 8 Jun 2020 13:27:04 +0000 (16:27 +0300)]
[analyzer] SATest: Add 5 more projects for testing

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

4 years ago[analyzer] SATest: Add an easy option to connect to docker for debugging
Valeriy Savchenko [Mon, 8 Jun 2020 09:49:31 +0000 (12:49 +0300)]
[analyzer] SATest: Add an easy option to connect to docker for debugging

Summary:
Docker on its own has a pretty convenient way to run shell.
This method, however, requires target container to be currently running,
which is not a usual scenario for the test system.  For this purpose,
it is better to have a simple way to run the container, shell it, and
clean up at the end of it all.  New option `--shell` does exactly this.

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

4 years ago[analyzer] SATest: Do not re-run CMake in Docker if not needed
Valeriy Savchenko [Mon, 8 Jun 2020 09:47:21 +0000 (12:47 +0300)]
[analyzer] SATest: Do not re-run CMake in Docker if not needed

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

4 years ago[analyzer] SATest: Make main script Python2 compatible
Valeriy Savchenko [Mon, 8 Jun 2020 09:45:47 +0000 (12:45 +0300)]
[analyzer] SATest: Make main script Python2 compatible

Summary:
If the user has only python2 installed and wants to use
the dockerized testing system, it is now totally OK.

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

4 years ago[analyzer] SATest: Make docker interfaces transparent
Valeriy Savchenko [Fri, 5 Jun 2020 08:47:35 +0000 (11:47 +0300)]
[analyzer] SATest: Make docker interfaces transparent

Summary:
Forward results of every command executed in docker.  The actual commands
and their error codes are more informative than python stacktraces.

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

4 years ago[analyzer] SATest: Add a set of initial projects for testing
Valeriy Savchenko [Thu, 4 Jun 2020 15:40:39 +0000 (18:40 +0300)]
[analyzer] SATest: Add a set of initial projects for testing

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

4 years ago[analyzer] SATest: Add convenience 'docker' command
Valeriy Savchenko [Thu, 4 Jun 2020 15:35:54 +0000 (18:35 +0300)]
[analyzer] SATest: Add convenience 'docker' command

Summary:
It provides a simpler interface for testing within docker.
This way the user is not required to no how to use `docker run` and
its options.

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

4 years ago[analyzer] SATest: Add initial docker infrastructure
Valeriy Savchenko [Thu, 4 Jun 2020 15:34:34 +0000 (18:34 +0300)]
[analyzer] SATest: Add initial docker infrastructure

Summary:
Static analysis is very sensitive to environment.
OS and libraries installed can affect the results.  This fact makes
it extremely hard to have a regression testing system that will
produce stable results.

For this very reason, this commit introduces a new dockerized testing
environment, so that every analyzer developer can check their changes
against previous analysis results.

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

4 years agoUse concrete natural type alignment for masked load/store operations instead of 0.
Guillaume Chatelet [Wed, 24 Jun 2020 21:26:03 +0000 (21:26 +0000)]
Use concrete natural type alignment for masked load/store operations instead of 0.

Summary: Alignment needs to be resolved at this point so we replace the
0 value with the ABI Type Alignment.

4 years ago[docs][llvm-dwarfdump] Fix the warnings during docs-llvm-html buil
Djordje Todorovic [Thu, 25 Jun 2020 08:54:37 +0000 (10:54 +0200)]
[docs][llvm-dwarfdump] Fix the warnings during docs-llvm-html buil

Before the fix the build of docs-llvm-html would fail.
The D80959 introduced options that are not recognized, so we have
warning as:

  llvm-project/llvm/docs/CommandGuide/llvm-dwarfdump.rst:40\
  :unknown option: --debug-info

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