platform/upstream/llvm.git
4 years ago[clangd] Don't traverse the AST within uninteresting files during indexing
Sam McCall [Wed, 20 May 2020 14:03:42 +0000 (16:03 +0200)]
[clangd] Don't traverse the AST within uninteresting files during indexing

Summary:
We already skip function bodies from these files while parsing, and drop symbols
found in them. However, traversing their ASTs still takes a substantial amount
of time.

Non-scientific benchmark on my machine:
  background-indexing llvm-project (llvm+clang+clang-tools-extra), wall time
  before: 7:46
  after: 5:13
  change: -33%

Indexer.cpp libclang should be updated too, I'm less familiar with that code,
and it's doing tricky things with the ShouldSkipFunctionBody callback, so it
needs to be done separately.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[AArch64] Set i32 ISD::MULHU/S to Expand instead of Legal.
Craig Topper [Tue, 26 May 2020 06:59:00 +0000 (23:59 -0700)]
[AArch64] Set i32 ISD::MULHU/S to Expand instead of Legal.

Looks like there are no isel patterns for these. A DAG combine
turns it into i64 multiply and a shift which hides this.

Extracted from D80485

4 years ago[CostModel] Check for free intrinsics in BasicTTI
Sam Parker [Tue, 26 May 2020 07:31:38 +0000 (08:31 +0100)]
[CostModel] Check for free intrinsics in BasicTTI

Recommitting part of "[CostModel] Unify Intrinsic Costs."
de71def3f59dc9f12f67141b5040d8e15c84d08a

Now that the 'free' intrinsic information has been sunk to the lowest
level, query the base implementation in BasicTTI before doing
anything else. I suspect this is the change that was causing the main
changes, particularly the large effects on debug builds.

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

4 years ago[lldb] s/dyn_cast/isa
Pavel Labath [Tue, 26 May 2020 07:21:54 +0000 (09:21 +0200)]
[lldb] s/dyn_cast/isa

The cast result is unused and produces a warning with gcc.

4 years ago[AsmPrinter] Don't generate .Lfoo$local for -fno-PIC and -fPIE
Fangrui Song [Tue, 26 May 2020 06:00:50 +0000 (23:00 -0700)]
[AsmPrinter] Don't generate .Lfoo$local for -fno-PIC and -fPIE

-fno-PIC and -fPIE code generally cannot be linked in -shared mode and there is no benefit accessing via local aliases.

Actually, a .Lfoo$local reference will be converted to a STT_SECTION (if no section relaxation) reference which will cause the section symbol (sizeof(Elf64_Sym)=24) to be generated.

4 years ago[FPEnv] Small fixes to implementation of flt.rounds
Serge Pavlov [Tue, 26 May 2020 06:19:01 +0000 (13:19 +0700)]
[FPEnv] Small fixes to implementation of flt.rounds

This change makes minor correction to the implementation of intrinsic
`llvm.flt.rounds`:
- Added documentation entry in LangRef,
- Attributes of the intrinsic changed to be in line with other functions
  dependent of floating-point environment.

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

4 years ago[NFC][PowerPC] Add a new case to test two-address verification
Kang Zhang [Tue, 26 May 2020 06:14:08 +0000 (06:14 +0000)]
[NFC][PowerPC] Add a new case to test two-address verification

4 years ago[clangd] Change PreambleOnlyAction with content truncation
Kadir Cetinkaya [Tue, 5 May 2020 15:55:11 +0000 (17:55 +0200)]
[clangd] Change PreambleOnlyAction with content truncation

Summary:
Lexing until the token location is past preamble bound could be wrong
in some cases as preprocessor lexer can lex multiple tokens in a single call.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clangd] Make use of SourceOrder to find first initializer in DefineOutline
Kadir Cetinkaya [Mon, 25 May 2020 15:25:55 +0000 (17:25 +0200)]
[clangd] Make use of SourceOrder to find first initializer in DefineOutline

Summary:
Constructors can have implicit initializers, this was crashing define
outline. Make sure we find the first "written" ctor initializer to figure out
`:` location.

Fixes https://github.com/clangd/clangd/issues/400

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clang][test] fix tests for external assemblers
Yuanfang Chen [Tue, 26 May 2020 05:14:05 +0000 (22:14 -0700)]
[clang][test] fix tests for external assemblers

The test depends on using the integrated assembler. Make it
explicit by specifying -fintegrated-as.

4 years agoMake explicit -fno-semantic-interposition (in -fpic mode) infer dso_local
Fangrui Song [Mon, 25 May 2020 22:05:35 +0000 (15:05 -0700)]
Make explicit -fno-semantic-interposition (in -fpic mode) infer dso_local

-fno-semantic-interposition is currently the CC1 default. (The opposite
disables some interprocedural optimizations.) However, it does not infer
dso_local: on most targets accesses to ExternalLinkage functions/variables
defined in the current module still need PLT/GOT.

This patch makes explicit -fno-semantic-interposition infer dso_local,
so that PLT/GOT can be eliminated if targets implement local aliases
for AsmPrinter::getSymbolPreferLocal (currently only x86).

Currently we check whether the module flag "SemanticInterposition" is 0.
If yes, infer dso_local. In the future, we can infer dso_local unless
"SemanticInterposition" is 1: frontends other than clang will also
benefit from the optimization if they don't bother setting the flag.
(There will be risks if they do want ELF interposition: they need to set
"SemanticInterposition" to 1.)

4 years ago[PowerPC] Prevent legalization loop from promoting SELECT_CC from v4i32 to v4i32
Nemanja Ivanovic [Tue, 26 May 2020 01:07:22 +0000 (20:07 -0500)]
[PowerPC] Prevent legalization loop from promoting SELECT_CC from v4i32 to v4i32

As reported in https://bugs.llvm.org/show_bug.cgi?id=45709 we can hit an
infinite loop in legalization since we set the legalization action for
ISD::SELECT_CC for all fixed length vector types to Promote. Without some
different legalization action for the type being promoted to, the legalizer
simply loops. Since we don't have patterns to match the node, the right
legalization action should be Expand.

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

4 years ago[clang][test] fix tests for external assemblers
Yuanfang Chen [Tue, 26 May 2020 00:36:28 +0000 (17:36 -0700)]
[clang][test] fix tests for external assemblers

These three tests depend on using the integrated assembler. Make it
explicit by specifying -fintegrated-as.

4 years ago[Clang][test] fix tests when using external assembler.
Yuanfang Chen [Fri, 22 May 2020 19:33:33 +0000 (12:33 -0700)]
[Clang][test] fix tests when using external assembler.

Summary:
The test assume using integraed-as, so make it explicit.

Reviewered by: aganea

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

4 years ago[Inlining] Set inline-deferral-scale to 2.
Kazu Hirata [Mon, 25 May 2020 22:43:28 +0000 (15:43 -0700)]
[Inlining] Set inline-deferral-scale to 2.

Summary:
This patch sets inline-deferral-scale to 2.

Both internal and SPEC benchmarking show that 2 is the best number
among -1, 2, 3, and 4.

inline-deferral-scale  SPECint2006
------------------------------------------------------------
                   -1  38.0 (the default without this patch)
                    2  38.5
                    3  38.1
                    4  38.1

With the new default number, shouldBeDeferred returns true if:

  TotalCost < IC.getCost() * 2

where

  TotalCost is TotalSecondaryCost + IC.getCost() * NumCallerUsers.

If TotalCost >= 0 and NumCallerUsers >= 2, then
TotalCost >= IC.getCost() * 2, so shouldBeDeferred returns true only
when NumCallerUsers is 1.

Now, if TotalSecondaryCost < 0, which can happen if
InlineConstants::LastCallToStaticBonus, a huge number, has been
subtracted from TotalSecondaryCost, then TotalCost may be negative.
In this case, shouldBeDeferred may return true even when
NumCallerUsers >= 2.

Reviewers: davidxl, nikic

Reviewed By: davidxl

Subscribers: xbolva00, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[LoopUnroll] Remove dead NextBlocks argument (NFC).
Florian Hahn [Mon, 25 May 2020 19:44:38 +0000 (20:44 +0100)]
[LoopUnroll] Remove dead NextBlocks argument (NFC).

4 years ago[Transforms] Fix typos. NFC
Marek Kurdej [Mon, 25 May 2020 20:34:08 +0000 (22:34 +0200)]
[Transforms] Fix typos. NFC

4 years ago[libc++] [LWG3201] Update status page: lerp should be marked noexcept.
Marek Kurdej [Mon, 25 May 2020 20:26:50 +0000 (22:26 +0200)]
[libc++] [LWG3201] Update status page: lerp should be marked noexcept.

Summary: Update status page and test synopsis. Add synopsis in <cmath>.

Reviewed By: ldionne, #libc

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

4 years ago[X86] Teach combineTruncatedArithmetic to push truncate through subtracts where only...
Craig Topper [Mon, 25 May 2020 18:34:09 +0000 (11:34 -0700)]
[X86] Teach combineTruncatedArithmetic to push truncate through subtracts where only one of the inputs is free to truncate.

Fix combineSubToSubus to handle the new DAG to avoid a regression.

There are still regressions in test14/test15/test16. Where it
looks like were trying to set up cases we could match to
umin+trunc+subus but the handling was never finished. The
regression here isn't unique to sub. Its a lost opportunity for
taking an AND with two truncated inputs and producing a larger
AND with a single truncate. The same thing could happen with
any other node we handle in combineTruncatedArithmetic since we
are moving the truncate up the DAG.

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

4 years ago[libcxx] Fix C++14 and up constexpr members in MoveOnly.
zoecarver [Sat, 23 May 2020 21:43:12 +0000 (14:43 -0700)]
[libcxx] Fix C++14 and up constexpr members in MoveOnly.

Summary: a4b8ee6 made all MoveOnly members constexpr but, some members and constructors contain expressions that are only valid in C++14 and later. This patch prefixes those methods and constructors with TEST_CONSTEXPR_CXX14.

Reviewers: ldionne, #libc!

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[gn build] Port ba92b274225
LLVM GN Syncbot [Mon, 25 May 2020 18:14:50 +0000 (18:14 +0000)]
[gn build] Port ba92b274225

4 years agoRevert "[PGO] Fix computation of function Hash"
Benjamin Kramer [Mon, 25 May 2020 18:13:03 +0000 (20:13 +0200)]
Revert "[PGO] Fix computation of function Hash"

This reverts commit 7c298c104bfe725d4315926a656263e8a5ac3054.
Fails make check-clang.

Failing Tests (8):
Clang :: Profile/c-counter-overflows.c
Clang :: Profile/c-general.c
Clang :: Profile/c-unprofiled-blocks.c
Clang :: Profile/cxx-rangefor.cpp
Clang :: Profile/cxx-throws.cpp
Clang :: Profile/misexpect-switch-default.c
Clang :: Profile/misexpect-switch-nonconst.c
Clang :: Profile/misexpect-switch.c

4 years ago[lldb/Test] Add a trace method to replace print statements.
Jonas Devlieghere [Mon, 25 May 2020 17:59:39 +0000 (10:59 -0700)]
[lldb/Test] Add a trace method to replace print statements.

Many tests use (commented out) print statement for debugging the test
itself. This patch adds a new trace method to lldbtest to reuse the
existing tracing infrastructure and replace these print statements.

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

4 years ago[AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions
stevewan [Mon, 25 May 2020 17:43:22 +0000 (13:43 -0400)]
[AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

Summary: On AIX, add '-bcdtors:all:0:s' to the linker implicitly through the driver so that we can collect all static constructor and destructor functions.

Reviewers: hubert.reinterpretcast, Xiangling_L, ZarkoCA, daltenty

Reviewed By: hubert.reinterpretcast

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[AMDGPU][MC][GFX8+] Enabled clamp for v_add_u16, v_sub_u16 and v_subrev_u16
Dmitry Preobrazhensky [Mon, 25 May 2020 16:55:38 +0000 (19:55 +0300)]
[AMDGPU][MC][GFX8+] Enabled clamp for v_add_u16, v_sub_u16 and v_subrev_u16

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

Reviewers: arsenm, rampitec, vpykhtin

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

4 years agoMake mlir::Value's bool conversion operator explicit
Benjamin Kramer [Sun, 24 May 2020 21:08:27 +0000 (23:08 +0200)]
Make mlir::Value's bool conversion operator explicit

This still allows `if (value)` while requiring an explicit cast when not
in a boolean context. This means things like `std::set<Value>` will no
longer compile.

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

4 years agoRe-commit "[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake"
Sergej Jaskiewicz [Tue, 5 May 2020 22:10:57 +0000 (01:10 +0300)]
Re-commit "[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake"

https://reviews.llvm.org/D78200 has been re-committed, so we can now
enable building std::filesystem and running tests for it.

4 years agoRe-commit "[libc++] [test] Generate static_test_env on the fly"
Sergej Jaskiewicz [Mon, 25 May 2020 16:08:49 +0000 (19:08 +0300)]
Re-commit "[libc++] [test] Generate static_test_env on the fly"

Don't use std::filesystem APIs for CWDGuard, use POSIX functions
instead. This way the tests don't rely on the correctness of
the functionality they're testing.

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

4 years ago[analyzer] Improved RangeSet::Negate support of unsigned ranges
Denys Petrov [Thu, 9 Apr 2020 13:20:07 +0000 (16:20 +0300)]
[analyzer] Improved RangeSet::Negate support of unsigned ranges

Summary:
This fixes https://bugs.llvm.org/show_bug.cgi?id=41588
RangeSet Negate function shall handle unsigned ranges as well as signed ones.
RangeSet getRangeForMinusSymbol function shall use wider variety of ranges, not only concrete value ranges.
RangeSet Intersect functions shall not produce assertions.

Changes:
Improved safety of RangeSet::Intersect function. Added isEmpty() check to prevent an assertion.
Added support of handling unsigned ranges to RangeSet::Negate and RangeSet::getRangeForMinusSymbol.
Extended RangeSet::getRangeForMinusSymbol to return not only range sets with single value [n,n], but with wide ranges [n,m].
Added unit test for Negate function.
Added regression tests for unsigned values.

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

4 years ago[PGO] Fix computation of function Hash
serge-sans-paille [Thu, 14 May 2020 05:23:10 +0000 (07:23 +0200)]
[PGO] Fix computation of function Hash

Previous implementation was incorrectly passing an uint64_t, that got converted
to an uint8_t, to finalize the hash computation. This led to different functions
having the same hash if they only differ by the remaining statements, which is
incorrect.

Added a new test case that trivially tests that a small function change is
reflected in the hash value.

Not that as this patch fixes the hash computation, it invalidates all hashes
computed before that patch applies, which could be an issue for large build
system that pre-compute the profile data and let client download them as part of
the build process.

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

4 years ago[AMDGPU] Added 'A' constraint for inline assembler
Dmitry Preobrazhensky [Mon, 25 May 2020 14:45:18 +0000 (17:45 +0300)]
[AMDGPU] Added 'A' constraint for inline assembler

Summary: 'A' constraint requires an immediate int or fp constant that can be inlined in an instruction encoding.
This is the second part of the change. The llvm part has been committed as b087b91c9170.
See https://reviews.llvm.org/D78494

Reviewers: arsenm, rampitec

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

4 years agoMustExecute.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 25 May 2020 14:35:47 +0000 (15:35 +0100)]
MustExecute.h - remove unnecessary includes. NFC.

Reduce to forward declarations and fix implicit LoopInfo.h dependency in Attributor.h

4 years ago[X86] Add PTEST tests showing failure to extract allsign cases
Simon Pilgrim [Mon, 25 May 2020 14:33:44 +0000 (15:33 +0100)]
[X86] Add PTEST tests showing failure to extract allsign cases

As discussed on PR42035, we can often use MOVMSK to avoid a cmpgt/ashr by just analysing the extracted signbits.

4 years agoAdd AIX to the test macro-same-context XFAIL list
Shuhong Liu [Mon, 25 May 2020 14:11:55 +0000 (10:11 -0400)]
Add AIX to the test macro-same-context XFAIL list

Summary: Since the integrated assembly parser was not implemented yet for AIX and macro is not part of the native assembly dialect on AIX, the test macro-same-context is expected to fail for AIX; hence added AIX to XFAIL list.

Reviewers: hubert.reinterpretcast, daltenty, jasonliu

Reviewed By: daltenty

Subscribers: jasonliu, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Remove custom DWARF expression printing code
Pavel Labath [Mon, 25 May 2020 13:59:48 +0000 (15:59 +0200)]
[lldb] Remove custom DWARF expression printing code

The llvm DWARFExpression dump is nearly identical, but better -- for
example it does print a spurious space after zero-argument expressions.

Some parts of our code (variable locations) have been already switched
to llvm-based expression dumping. This switches the remainder: unwind
plans and some unit tests.

4 years ago[ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019...
Denys Petrov [Fri, 22 May 2020 10:10:37 +0000 (13:10 +0300)]
[ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019 v16.6

After updating MSVS19 from v16.4 to v16.6 I faced with a build errors compiling in Debug mode.
It complains on clang-tblgen.exe and llvm-tblgen.exe cmd line args.
VS compiler had a bug. It dynamically creates an object with constexpr ctor in Debug mode. This bug was fixed in VS2019 v16.5.
A workaround was implemented for that and everything works until v16.5 comes.
The workaround became irrelevant since v16.5 and caused build errors.
So I disabled the workaround for VS2019 v16.5 and higher.

This relates to http://llvm.org/PR41367.

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

4 years agoStack clash: update live-ins
serge-sans-paille [Mon, 25 May 2020 13:56:48 +0000 (15:56 +0200)]
Stack clash: update live-ins

This fixes http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/7150

4 years ago[LoopUtils] Use llvm::find
Whitney Tsang [Mon, 25 May 2020 13:31:57 +0000 (13:31 +0000)]
[LoopUtils] Use llvm::find

Summary: Fixes this build error:

llvm/lib/Transforms/Utils/LoopUtils.cpp:679:26: error: no matching
function for call to 'find'
      Loop::iterator I = find(ParentLoop->begin(), ParentLoop->end(),
L);
                         ^~~~
Authored By: orivej
Reviewer: Whitney
Reviewed By: Whitney
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80473

4 years agoMake FEATURE_AVX512VP2INTERSECT match between compiler-rt and LLVM
Benjamin Kramer [Mon, 25 May 2020 13:12:08 +0000 (15:12 +0200)]
Make FEATURE_AVX512VP2INTERSECT match between compiler-rt and LLVM

compiler-rt also doesn't support bits >= 64 as far as I know.

4 years agoMemoryLocation.h - reduce Instructions.h include to Instruction.h include. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:59:46 +0000 (13:59 +0100)]
MemoryLocation.h - reduce Instructions.h include to Instruction.h include. NFC.

Add forward declarations for the few Instr classes we reference.

4 years agoImprove stack-clash implementation on x86
serge-sans-paille [Wed, 6 May 2020 11:42:01 +0000 (13:42 +0200)]
Improve stack-clash implementation on x86

- test both 32 and 64 bit version
- probe the tail in dynamic-alloca
- generate more concise code

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

4 years agoMemoryBuiltins.h - remove unnecessary TargetLibraryInfo forward declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:44:27 +0000 (13:44 +0100)]
MemoryBuiltins.h - remove unnecessary TargetLibraryInfo forward declaration. NFC.

We already have to include TargetLibraryInfo.h

4 years agoLoopInfo.h - remove unnecessary PHINode forward declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:43:20 +0000 (13:43 +0100)]
LoopInfo.h - remove unnecessary PHINode forward declaration. NFC.

This is directly defined in Instructions.h

4 years agoInstructionSimplify.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:27:10 +0000 (13:27 +0100)]
InstructionSimplify.h - remove unnecessary includes. NFC.

Remove unused User.h include.
Replace SetVector.h with forward declaration.
Sort the forward declarations + remove FastMathFlags (defined in Operator.h).
Fix implicit SetVector.h dependency in LowerConstantIntrinsics.cpp.

4 years agoInlineAdvisor.h - remove unnecessary PreservedAnalyses forward declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:09:30 +0000 (13:09 +0100)]
InlineAdvisor.h - remove unnecessary PreservedAnalyses forward declaration. NFC.

This is directly defined in PassManager.h

4 years ago[x86] favor vector constant load to avoid GPR to XMM transfer, part 2
Sanjay Patel [Mon, 25 May 2020 11:50:45 +0000 (07:50 -0400)]
[x86] favor vector constant load to avoid GPR to XMM transfer, part 2

This replaces the build_vector lowering code that was just added in
D80013
and matches the pattern later from the x86-specific "vzext_movl".
That seems to result in the same or better improvements and gets rid
of the 'TODO' items from that patch.

AFAICT, we always shrink wider constant vectors to 128-bit on these
patterns, so we still get the implicit zero-extension to ymm/zmm
without wasting space on larger vector constants. There's a trade-off
there because that means we miss potential load-folding.

Similarly, we could load scalar constants here with implicit
zero-extension even to 128-bit. That saves constant space, but it
means we forego load-folding, and so it increases register pressure.
This seems like a good middle-ground between those 2 options.

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

4 years agoFunctionLoweringInfo.h - move APInt.h dependency to FunctionLoweringInfo.cpp. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:56:44 +0000 (12:56 +0100)]
FunctionLoweringInfo.h - move APInt.h dependency to FunctionLoweringInfo.cpp. NFC.

4 years agoFunctionLoweringInfo.h - remove orphan addSEHHandlersForLPads declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:52:14 +0000 (12:52 +0100)]
FunctionLoweringInfo.h - remove orphan addSEHHandlersForLPads declaration. NFC.

4 years agoAdded pow intrinsic to LLVMIR dialect
George Mitenkov [Mon, 25 May 2020 11:42:17 +0000 (07:42 -0400)]
Added pow intrinsic to LLVMIR dialect

Added pow intrinsic to LLVMIR dialect. Added a roundrip test for it.

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

4 years ago[PowerPC][NFC] Split PPCELFStreamer::emitInstruction
Stefan Pintilie [Mon, 25 May 2020 11:32:51 +0000 (06:32 -0500)]
[PowerPC][NFC] Split PPCELFStreamer::emitInstruction

Split off PPCELFStreamer::emitPrefixedInstruction from
PPCELFStreamer::emitInstruction.

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

4 years ago[ARM] VMULH tests for when other parts are working. NFC
David Green [Mon, 25 May 2020 11:25:03 +0000 (12:25 +0100)]
[ARM] VMULH tests for when other parts are working. NFC

4 years ago[ObjectYAML][DWARF] Remove unimplemented function.
Xing GUO [Mon, 25 May 2020 11:42:15 +0000 (19:42 +0800)]
[ObjectYAML][DWARF] Remove unimplemented function.

```
StringMap<std::unique_ptr<MemoryBuffer>>
EmitDebugSections(llvm::DWARFYAML::Data &DI, bool ApplyFixups);
```
is unimplemented and unused.

4 years ago[DAG] Add SimplifyDemandedVectorElts binop SimplifyMultipleUseDemandedBits handling
Simon Pilgrim [Mon, 25 May 2020 11:41:08 +0000 (12:41 +0100)]
[DAG] Add SimplifyDemandedVectorElts binop SimplifyMultipleUseDemandedBits handling

For the supported binops (basic arithmetic, logicals + shifts), if we fail to simplify the demanded vector elts, then call SimplifyMultipleUseDemandedBits and try to peek through ops to remove unnecessary dependencies.

This helps with PR40502.

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

4 years agoSystemZInstrBuilder.h - remove unnecessary PseudoSourceValue.h include. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:20:58 +0000 (12:20 +0100)]
SystemZInstrBuilder.h - remove unnecessary PseudoSourceValue.h include. NFC.

4 years agoTargetInstrInfo.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:11:53 +0000 (12:11 +0100)]
TargetInstrInfo.h - remove unnecessary includes. NFC.

4 years ago[AMDGPU][CODEGEN] Added 'A' constraint for inline assembler
Dmitry Preobrazhensky [Mon, 25 May 2020 11:19:22 +0000 (14:19 +0300)]
[AMDGPU][CODEGEN] Added 'A' constraint for inline assembler

Summary: 'A' constraint requires an immediate int or fp constant that can be inlined in an instruction encoding.

Reviewers: arsenm, rampitec

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

4 years ago[lldb][NFC] Pass DeclarationName to NameSearchContext by value
Raphael Isemann [Mon, 25 May 2020 10:14:21 +0000 (12:14 +0200)]
[lldb][NFC] Pass DeclarationName to NameSearchContext by value

DeclarationName is usually passed around by value as it's just a pointer.

4 years agoPrevent GetNumChildren from transitively walking pointer chains
Jaroslav Sevcik [Mon, 25 May 2020 09:17:48 +0000 (11:17 +0200)]
Prevent GetNumChildren from transitively walking pointer chains

Summary:

This is an attempt to fix https://bugs.llvm.org/show_bug.cgi?id=45988,
where SBValue::GetNumChildren returns 2, but SBValue::GetChildAtIndex(1) returns
an invalid value sentinel.

The root cause of this seems to be that GetNumChildren can return the number of
children of a wrong value. In particular, for pointers GetNumChildren just
recursively calls itself on the pointee type, so it effectively walks chains of
pointers. This is different from the logic of GetChildAtIndex, which only
recurses if pointee.IsAggregateType() returns true (IsAggregateType is false for
pointers and references), so it never follows chain of pointers.

This patch aims to make GetNumChildren (more) consistent with GetChildAtIndex by
only recursively calling GetNumChildren for aggregate types.

Ideally, GetNumChildren and GetChildAtIndex would share the code that decides
which pointers/references are followed, but that is a bit more invasive change.

Reviewers: teemperor, jingham, clayborg

Reviewed By: teemperor, clayborg

Subscribers: clayborg, labath, shafik, lldb-commits

Tags: #lldb

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

4 years ago[clangd] Enable cross-file-rename by default.
Haojian Wu [Tue, 5 May 2020 15:11:30 +0000 (17:11 +0200)]
[clangd] Enable cross-file-rename by default.

Summary:
The cross-file rename feature is stable enough to enable it (has been
rolled out internally for a few weeks).

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[AST] default implementation is possible for non-member functions in C++20.
mydeveloperday [Wed, 20 May 2020 06:22:01 +0000 (07:22 +0100)]
[AST] default implementation is possible for non-member functions in C++20.

Summary:
Make RAV not visit the default function decl by default.
Also update some stale comments on FunctionDecl::isDefault.

Fixes https://github.com/clangd/clangd/issues/383

Reviewers: sammccall, rsmith

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[LV] Clamp MaxVF to power of 2.
Ayal Zaks [Sun, 24 May 2020 13:22:39 +0000 (16:22 +0300)]
[LV] Clamp MaxVF to power of 2.

If a loop has a constant trip count known to be a multiple of MaxVF (times user
UF), LV infers that no tail will be generated for any chosen VF. This relies on
the chosen VF's being powers of 2 bound by MaxVF, and assumes MaxVF is a power
of 2. Make sure the latter holds, in particular when MaxVF is set by a memory
dependence distance which may not be a power of 2.

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

4 years ago[OpenMP] Fix a race in task queue reallocation
Joachim Protze [Mon, 25 May 2020 08:19:35 +0000 (10:19 +0200)]
[OpenMP] Fix a race in task queue reallocation

__kmp_realloc_task_deque implicitly assumes, that the task queue is full
(ntasks == size), therefore tail = size in line 319.
An assertion is added to document this assumption.

The first check for a full queue is before the locking and might not hold
when the lock is taken. So, we need to check again for this condition when
we have the lock.

Reviewed By: AndreyChurbanov

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

4 years ago[clangd] Log use of heuristic go-to-def. NFC
Sam McCall [Mon, 25 May 2020 08:19:34 +0000 (10:19 +0200)]
[clangd] Log use of heuristic go-to-def. NFC

Generally:
 - found results using this method -> log
 - no results using this method -> vlog
 - method wasn't applied because ineligible -> no log

4 years ago[VE][NFC] Correct sjlj_expection test
Kazushi (Jam) Marukawa [Mon, 25 May 2020 07:48:51 +0000 (09:48 +0200)]
[VE][NFC] Correct sjlj_expection test

Summary: '|&' works with bash only, so it should not be used in regression
tests.

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

4 years ago[CMake] Properly handle the LTO cache arguments for MinGW
Tobias Hieta [Mon, 25 May 2020 07:28:17 +0000 (10:28 +0300)]
[CMake] Properly handle the LTO cache arguments for MinGW

We want to make sure that LINKER_IS_LLD_LINK is properly set - in
this case it shouldn't be set when building for MinGW.

Then we want to make the test for it correct and finally include
the option to build with thinlto cache since the MinGW driver now
supports that.

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

4 years ago[MCDwarf] Delete unneeded DW_AT_unspecified_parameters
Fangrui Song [Mon, 25 May 2020 05:30:59 +0000 (22:30 -0700)]
[MCDwarf] Delete unneeded DW_AT_unspecified_parameters

4 years ago[MCDwarf] Delete unneeded DW_AT_prototyped for DW_TAG_label
Fangrui Song [Mon, 25 May 2020 05:19:22 +0000 (22:19 -0700)]
[MCDwarf] Delete unneeded DW_AT_prototyped for DW_TAG_label

4 years ago[mlir] Expand operand adapter to take attributes
Jacques Pienaar [Mon, 25 May 2020 03:42:58 +0000 (20:42 -0700)]
[mlir] Expand operand adapter to take attributes

* Enables using with more variadic sized operands;
* Generate convenience accessors for attributes;
  - The accessor are named the same as their name in ODS and returns attribute
    type (not convenience type) and no derived attributes.

This is first step to changing adapter to support verifying argument
constraints before the op is even created. This does not change the name of
adaptor nor does it require it except for ops with variadic operands to keep this change smaller.

Considered creating separate adapter but decided against that given operands also require attributes in general (and definitely for verification of operands and attributes).

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

4 years ago[TargetLoweringObjectFileImpl] Use llvm::transform
Orivej Desh [Mon, 25 May 2020 03:55:08 +0000 (20:55 -0700)]
[TargetLoweringObjectFileImpl] Use llvm::transform

Fixes a build issue with libc++ configured with _LIBCPP_RAW_ITERATORS (ADL not effective)

```
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1602:3: error: no matching function for call to 'transform'
  transform(HexString.begin(), HexString.end(), HexString.begin(), tolower);
  ^~~~~~~~~
```

Reviewed By: MaskRay

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

4 years ago[clang-format][PR46043] Parse git config w/ implicit values
Jake Merdich [Sun, 24 May 2020 02:21:10 +0000 (22:21 -0400)]
[clang-format][PR46043] Parse git config w/ implicit values

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

Git's config is generally of the format 'key=val', but a setting
'key=true' can be written as just 'key'.  The git-clang-format script
expects a value and crashes in this case; this change handles implicit
'true' values in the script.

Reviewers: MyDeveloperDay, krasimir, sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years agoChange default traversal in AST Matchers to ignore invisible nodes
Stephen Kelly [Sun, 12 Jan 2020 09:38:11 +0000 (09:38 +0000)]
Change default traversal in AST Matchers to ignore invisible nodes

This makes many scenarios simpler by not requiring the user to write
ignoringImplicit() all the time, nor to account for non-visible
cxxConstructExpr() and cxxMemberCalExpr() nodes. This is also, in part,
inclusive of the equivalent of adding a use of ignoringParenImpCasts()
between all expr()-related matchers in an expression.

The pre-existing traverse(TK_AsIs, ...) matcher can be used to explcitly
match on implicit/invisible nodes. See

  http://lists.llvm.org/pipermail/cfe-dev/2019-December/064143.html

for more

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[X86] Remove isCommutable flag from MULX instructions.
Craig Topper [Sun, 24 May 2020 19:34:56 +0000 (12:34 -0700)]
[X86] Remove isCommutable flag from MULX instructions.

The fixed register constraint on EDX/RDX as an input
makes this not really commutable.

4 years agoAdd missing test
Stephen Kelly [Sun, 24 May 2020 21:49:00 +0000 (22:49 +0100)]
Add missing test

4 years agoFix ignore-traversal to call correct method
Stephen Kelly [Sun, 24 May 2020 21:28:24 +0000 (22:28 +0100)]
Fix ignore-traversal to call correct method

As is done by ignoreParenImpCasts(). We were not previously calling the
correct internal method.  Adjust tests to account for this.

4 years ago[X86][AVX] Fold extract_subvector(subv_broadcast(x),c) -> (x)
Simon Pilgrim [Sun, 24 May 2020 17:49:39 +0000 (18:49 +0100)]
[X86][AVX] Fold extract_subvector(subv_broadcast(x),c) -> (x)

If we're extracting an subvector from a broadcasted subvector of the same type then we can use the source vector directly.

4 years ago[X86][AVX] Fold extract_subvector(broadcast(x),c) -> extract_subvector(broadcast...
Simon Pilgrim [Sun, 24 May 2020 17:05:33 +0000 (18:05 +0100)]
[X86][AVX] Fold extract_subvector(broadcast(x),c) -> extract_subvector(broadcast(x),0) iff c != 0

If we're extracting an upper subvector from a broadcast we're better off extracting the lowest subvector instead as it avoids an actual extract instruction and might help SimplifyDemandedVectorElts further simplify the code.

4 years ago[Pass Manager] remove EarlyCSE as clean-up for VectorCombine
Sanjay Patel [Sun, 24 May 2020 16:20:22 +0000 (12:20 -0400)]
[Pass Manager] remove EarlyCSE as clean-up for VectorCombine

EarlyCSE was added with D75145, but the motivating test is
not regressed by removing the extra pass now. That might be
because VectorCombine altered the way it processes instructions,
or it might be from (re)moving VectorCombine in the pipeline.

The extra round of EarlyCSE appears to cost approximately
0.26% in compile-time as discussed in D80236, so we need some
evidence to justify its inclusion here, but we do not have
that (yet).

I suspect that between SLP and VectorCombine, we are creating
patterns that InstCombine and/or codegen are not prepared for,
but we will need to reduce those examples and include them as
PhaseOrdering and/or test-suite benchmarks.

4 years ago[LV] Either get invariant condition OR vector condition.
Florian Hahn [Sun, 24 May 2020 13:14:43 +0000 (14:14 +0100)]
[LV] Either get invariant condition OR vector condition.

Currently we unconditionally get the first lane of the condition
operand, even if we later use the full vector condition. This can result
in some unnecessary instructions being generated.

Suggested as follow-up in D80219.

4 years ago[PhaseOrdering] adjust test to use default alias analysis with new pass manager; NFC
Sanjay Patel [Sun, 24 May 2020 15:24:53 +0000 (11:24 -0400)]
[PhaseOrdering] adjust test to use default alias analysis with new pass manager; NFC

As discussed in D80236 - this test (like all PhaseOrdering tests?)
was intended to show that there is no difference with the new
pass manager, but the 'opt' command requires extra parameters
to make that happen.

4 years ago[X86] SimplifyMultipleUseDemandedBitsForTargetNode - add initial X86ISD::VSRAI handling.
Simon Pilgrim [Sun, 24 May 2020 15:07:46 +0000 (16:07 +0100)]
[X86] SimplifyMultipleUseDemandedBitsForTargetNode - add initial X86ISD::VSRAI handling.

This initial version only peeks through cases where we just demand the sign bit of an ashr shift, but we could generalize this further depending on how many sign bits we already have.

The pr18014.ll case is a minor annoyance - we've failed to to move the psrad/paddd after the blendvps which would have avoided the extra move, but we have still increased the ILP.

4 years agoAMDGPU.h - reduce TargetMachine.h include. NFC.
Simon Pilgrim [Sun, 24 May 2020 14:27:41 +0000 (15:27 +0100)]
AMDGPU.h - reduce TargetMachine.h include. NFC.

Replace TargetMachine.h include with forward declaration and CodeGen.h include in AMDGPU.h.

Exposes a couple of implicit dependencies that require additional forward declarations/includes.

4 years ago[PowerPC] Add some InstAlias definitions
Kang Zhang [Sun, 24 May 2020 14:05:28 +0000 (14:05 +0000)]
[PowerPC] Add some InstAlias definitions

Summary:
This patch add the InstAlias definitions for below instructions.

ADDI ADDIS ADDI8 ADDIS8
RLWINM8
ISEL ISEL8
OR OR_rec ORI ORI8 XORI8
CNTLZW8 CNTLZW8_rec
TEND TSR
RFEBB
NOR NOR_rec
MTCRF
SUBF SUBF_rec SUBFC SUBFC_rec
RLDICL_32_64
TW

Reviewed By: steven.zhang

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

4 years ago[clang-tidy] Fix potential assert in use-noexcept check
Nathan James [Sun, 24 May 2020 13:40:15 +0000 (14:40 +0100)]
[clang-tidy] Fix potential assert in use-noexcept check

Summary: Fix a potential assert in use-noexcept check if there is an issue getting the `TypeSourceInfo` as well as a small clean up.

Reviewers: aaron.ballman, alexfh, gribozavr2

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[InstCombine] fold FP trunc into exact itofp
Sanjay Patel [Sun, 24 May 2020 13:30:19 +0000 (09:30 -0400)]
[InstCombine] fold FP trunc into exact itofp

Similar to D79116 and rGbfd512160fe0 - if the 1st cast
is exact, then we can go directly to the destination
type because there is no double-rounding.

4 years ago[PatternMatch] abbreviate vector inst matchers; NFC
Sanjay Patel [Sat, 23 May 2020 14:13:50 +0000 (10:13 -0400)]
[PatternMatch] abbreviate vector inst matchers; NFC

Readability is not reduced with these opcodes/match lines,
so reduce odds of awkward wrapping from 80-col limit.

4 years agoAMDGPUInstPrinter.cpp - add CommandLine.h include. NFC.
Simon Pilgrim [Sun, 24 May 2020 13:16:03 +0000 (14:16 +0100)]
AMDGPUInstPrinter.cpp - add CommandLine.h include. NFC.

Fixes implicit dependency that will be exposed by a future patch.

4 years ago[VPlan] Use VPUser for VPWidenSelectRecipe operands (NFC).
Florian Hahn [Sun, 24 May 2020 12:36:42 +0000 (13:36 +0100)]
[VPlan] Use VPUser for VPWidenSelectRecipe operands (NFC).

VPWidenSelectRecipe already contains a VPUser, but it is not used. This
patch updates the code related to VPWidenSelectRecipe to use VPUser for
its operands.

Reviewers: Ayal, gilr, rengolin

Reviewed By: gilr

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

4 years agoAMDGPUTargetObjectFile.h - remove unnecessary includes. NFC.
Simon Pilgrim [Sun, 24 May 2020 12:57:02 +0000 (13:57 +0100)]
AMDGPUTargetObjectFile.h - remove unnecessary includes. NFC.

As we're inheriting from TargetLoweringObjectFileELF, TargetLoweringObjectFileImpl.h already declares all types we require in the overrides.

4 years agoAMDGPULibFunc - fix include order. NFC.
Simon Pilgrim [Sun, 24 May 2020 12:25:59 +0000 (13:25 +0100)]
AMDGPULibFunc - fix include order. NFC.

Ensure AMDGPULibFunc.h module header is first, and fix exposed missing forward declaration.

4 years agoLoopSimplify.h - reduce unnecessary includes to forward declarations. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:41:05 +0000 (12:41 +0100)]
LoopSimplify.h - reduce unnecessary includes to forward declarations. NFC.

4 years agoFix return values of some matcher functions
Stephen Kelly [Sat, 23 May 2020 20:57:01 +0000 (21:57 +0100)]
Fix return values of some matcher functions

The old return values mean

* implicit conversion
* not being able to write sizeOfExpr().bind() for example

4 years agoFix skip-invisible with overloaded method calls
Stephen Kelly [Sun, 24 May 2020 11:27:03 +0000 (12:27 +0100)]
Fix skip-invisible with overloaded method calls

4 years agoAdd explicit traversal mode to matchers for implicit constructors
Stephen Kelly [Sun, 24 May 2020 10:49:13 +0000 (11:49 +0100)]
Add explicit traversal mode to matchers for implicit constructors

4 years agoX86Subtarget.h - remove unnecessary TargetMachine.h include. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:30:22 +0000 (12:30 +0100)]
X86Subtarget.h - remove unnecessary TargetMachine.h include. NFC.

By moving X86Subtarget::isPositionIndependent() into X86Subtarget.cpp we can remove the header dependency and move the few uses into source files.

4 years ago[X86] Pull out repeated DemandedBits signmask variable. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:01:58 +0000 (12:01 +0100)]
[X86] Pull out repeated DemandedBits signmask variable. NFC.

Both paths always create the same DemandedBits mask.

4 years ago[TargetLowering] Improve expandFunnelShift shift amount masking
Simon Pilgrim [Sun, 24 May 2020 10:25:09 +0000 (11:25 +0100)]
[TargetLowering] Improve expandFunnelShift shift amount masking

For the 'inverse shift', we currently always perform a subtraction of the original (masked) shift amount.

But for the case where we are handling power-of-2 type widths, we can replace:

(sub bw-1, (and amt, bw-1) ) -> (and (xor amt, bw-1), bw-1) -> (and ~amt, bw-1)

This allows x86 shifts to fold away the and-mask.

Followup to D77301 + D80466.

http://volta.cs.utah.edu:8080/z/Nod0Gr

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

4 years agoFix Wdocumentation warnings after argument renaming. NFC.
Simon Pilgrim [Sun, 24 May 2020 10:18:20 +0000 (11:18 +0100)]
Fix Wdocumentation warnings after argument renaming. NFC.

4 years ago[X86] Move CONCAT_VECTORS/INSERT_SUBVECTOR actions inside loop. NFC.
Simon Pilgrim [Sun, 24 May 2020 09:59:33 +0000 (10:59 +0100)]
[X86] Move CONCAT_VECTORS/INSERT_SUBVECTOR actions inside loop. NFC.

CONCAT_VECTORS/INSERT_SUBVECTOR both are custom on v32i1/v64i1 like the other ops in the loop.

4 years agoX86TargetMachine.h - remove unnecessary X86Subtarget forward declaration. NFC.
Simon Pilgrim [Sun, 24 May 2020 09:51:02 +0000 (10:51 +0100)]
X86TargetMachine.h - remove unnecessary X86Subtarget forward declaration. NFC.

We have to include X86Subtarget.h.

4 years ago[LLD/MinGW]: Expose --thinlto-cache-dir
Tobias Hieta [Sun, 24 May 2020 09:29:16 +0000 (12:29 +0300)]
[LLD/MinGW]: Expose --thinlto-cache-dir

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