platform/upstream/llvm.git
5 years ago[Testing] unbreak after r372963
David Zarzycki [Thu, 26 Sep 2019 11:32:02 +0000 (11:32 +0000)]
[Testing] unbreak after r372963

llvm-svn: 372967

5 years agoMetadataLoader lazyLoadOneMetadata - silence static analyzer dyn_cast<MDNode> null...
Simon Pilgrim [Thu, 26 Sep 2019 11:30:47 +0000 (11:30 +0000)]
MetadataLoader lazyLoadOneMetadata - silence static analyzer dyn_cast<MDNode> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MDNode> directly and if not assert will fire for us.

llvm-svn: 372966

5 years ago[lldb][modern-type-lookup] Add test for using the ClangModulesDeclVendor
Raphael Isemann [Thu, 26 Sep 2019 11:30:41 +0000 (11:30 +0000)]
[lldb][modern-type-lookup] Add test for using the ClangModulesDeclVendor

llvm-svn: 372965

5 years agoRemove local shadow constant. NFCI.
Simon Pilgrim [Thu, 26 Sep 2019 11:30:35 +0000 (11:30 +0000)]
Remove local shadow constant. NFCI.

ValueTracking.cpp already has a local static MaxDepth = 6 constant - this one seems to have been missed when rL124183 landed.

llvm-svn: 372964

5 years ago[libcxx] Do not implicitly #include assert.h
David Zarzycki [Thu, 26 Sep 2019 11:12:29 +0000 (11:12 +0000)]
[libcxx] Do not implicitly #include assert.h

Users should only get the assert() macros if they explicitly include
them.

Found after switching from the GNU C++ stdlib to the LLVM C++ stdlib.

llvm-svn: 372963

5 years ago[ValueTracking] Silence static analyzer dyn_cast<Operator> null dereference warnings...
Simon Pilgrim [Thu, 26 Sep 2019 11:09:08 +0000 (11:09 +0000)]
[ValueTracking] Silence static analyzer dyn_cast<Operator> null dereference warnings. NFCI.

The static analyzer is warning about a potential null dereferences, but since the pointer is only used in a switch statement for Operator::getOpcode() (with an empty default) then its easiest just to wrap this in a null test as the dyn_cast might return null here.

llvm-svn: 372962

5 years agoDon't stop execution in batch mode when process stops with SIGINT or SIGSTOP
Tatyana Krasnukha [Thu, 26 Sep 2019 10:57:11 +0000 (10:57 +0000)]
Don't stop execution in batch mode when process stops with SIGINT or SIGSTOP

Summary: Usually, SIGINT and SIGSTOP don't imply a crash, e.g. SIGSTOP is sent on process launch and attach on some platforms.

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

llvm-svn: 372961

5 years agoMemorySanitizer - silence static analyzer dyn_cast<> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 26 Sep 2019 10:56:14 +0000 (10:56 +0000)]
MemorySanitizer - silence static analyzer dyn_cast<> null dereference warnings. NFCI.

The static analyzer is warning about a potential null dereferences, but we should be able to use cast<> directly and if not assert will fire for us.

llvm-svn: 372960

5 years agoPGOMemOPSizeOpt - silence static analyzer dyn_cast<MemIntrinsic> null dereference...
Simon Pilgrim [Thu, 26 Sep 2019 10:56:07 +0000 (10:56 +0000)]
PGOMemOPSizeOpt - silence static analyzer dyn_cast<MemIntrinsic> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MemIntrinsic> directly and if not assert will fire for us.

llvm-svn: 372959

5 years ago[BPF] Remove unused variables. NFCI.
Simon Pilgrim [Thu, 26 Sep 2019 10:55:57 +0000 (10:55 +0000)]
[BPF] Remove unused variables. NFCI.

Fixes a dyn_cast<> null dereference warning.

llvm-svn: 372958

5 years ago[MIPS GlobalISel] Lower aggregate structure return arguments
Petar Avramovic [Thu, 26 Sep 2019 10:48:07 +0000 (10:48 +0000)]
[MIPS GlobalISel] Lower aggregate structure return arguments

Implement aggregate structure split to simpler types in splitToValueTypes.
splitToValueTypes is used for return values.
According to MipsABIInfo from clang/lib/CodeGen/TargetInfo.cpp,
aggregate structure arguments for O32 always get simplified and thus
will remain unsupported by the MIPS GlobalISel for the time being.
For O32, aggregate structures can be encountered only for complex number
returns e.g. 'complex float' or 'complex double' from <complex.h>.

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

llvm-svn: 372957

5 years agoHexagonAsmParser::ParseDirectiveFalign - silence static analyzer dyn_cast<MCConstantE...
Simon Pilgrim [Thu, 26 Sep 2019 10:35:19 +0000 (10:35 +0000)]
HexagonAsmParser::ParseDirectiveFalign - silence static analyzer dyn_cast<MCConstantExpr> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<MCConstantExpr> directly and if not assert will fire for us.

llvm-svn: 372956

5 years ago[SLPVectorizer][X86] Add SSE common check prefix to let us merge SSE2+SLM checks
Simon Pilgrim [Thu, 26 Sep 2019 10:23:57 +0000 (10:23 +0000)]
[SLPVectorizer][X86] Add SSE common check prefix to let us merge SSE2+SLM checks

llvm-svn: 372955

5 years ago[CostModel][X86] Fix SLM <2 x i64> icmp costs
Simon Pilgrim [Thu, 26 Sep 2019 10:14:38 +0000 (10:14 +0000)]
[CostModel][X86] Fix SLM <2 x i64> icmp costs

SLM is 2 x slower for <2 x i64> comparison ops than other vector types, we should account for this like we do for SLM <2 x i64> add/sub/mul costs.

This should remove some of the SLM codegen diffs in D43582

llvm-svn: 372954

5 years ago[clang-tidy] Make llvm-header-guard work on llvm git monorepo
Haojian Wu [Thu, 26 Sep 2019 09:56:37 +0000 (09:56 +0000)]
[clang-tidy] Make llvm-header-guard work on llvm git monorepo

Reviewers: gribozavr

Reviewed By: gribozavr

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

Tags: #clang

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

llvm-svn: 372953

5 years agoSystemInitializer: Use Targets.def to selectively initialize ABI plugins
Pavel Labath [Thu, 26 Sep 2019 09:47:32 +0000 (09:47 +0000)]
SystemInitializer: Use Targets.def to selectively initialize ABI plugins

This avoids having to define additional macros in the cmake file, and
and also makes the logic in the cpp files more compact. It is also
easily extendible to other plugin types (instruction emulation?) that
should only be initialized if the corresponding llvm target is built.

Thanks to Ilya Birukov for pointing me to this file.

llvm-svn: 372952

5 years ago[mips] Relax jalr/jr instructions using R_MIPS_JALR relocation
Simon Atanasyan [Thu, 26 Sep 2019 09:13:20 +0000 (09:13 +0000)]
[mips] Relax jalr/jr instructions using R_MIPS_JALR relocation

The R_MIPS_JALR relocation denotes jalr/jr instructions in position
independent code. Both these instructions take a target's address from
the $25 register. If offset to the target symbol fits into the 18-bits,
it's more efficient to replace jalr/jr by bal/b instructions.

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

llvm-svn: 372951

5 years ago[SystemZ] Recognize mnop-mcount in backend
Jonas Paulsson [Thu, 26 Sep 2019 08:38:07 +0000 (08:38 +0000)]
[SystemZ]  Recognize mnop-mcount in backend

With -pg -mfentry -mnop-mcount, a nop is emitted instead of the call to
fentry.

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

llvm-svn: 372950

5 years ago[Testing] Workaround libcxx bug when OS is "none"
David Zarzycki [Thu, 26 Sep 2019 08:19:44 +0000 (08:19 +0000)]
[Testing] Workaround libcxx bug when OS is "none"

If clang is configured to use libcxx as the default C++ standard
library, then using "none" for the OS in the target triple will cause
libcxx to #error needlessly. Passing -nostdinc++ is a workaround for
these tests. See also: https://reviews.llvm.org/D68075

Please note: this workaround will probably exist for a few years until
the installed version of libcxx is updated.

llvm-svn: 372949

5 years ago[clangd] Add a helper for extracting nonlocal decls in a FunctionDecl
Kadir Cetinkaya [Thu, 26 Sep 2019 07:27:43 +0000 (07:27 +0000)]
[clangd] Add a helper for extracting nonlocal decls in a FunctionDecl

Summary:
To be used by define-inline code action to determine whether the
function/method body will still be valid in another context.

Traverses clang-ast to find all decl nodes under the function decl and stores
the non-local ones.

Reviewers: hokein

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

Tags: #clang

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

llvm-svn: 372948

5 years ago[X86] Remove isCodeGenOnly from (V)ROUND.*_Int and put it on the non _Int form instead.
Craig Topper [Thu, 26 Sep 2019 07:27:26 +0000 (07:27 +0000)]
[X86] Remove isCodeGenOnly from (V)ROUND.*_Int and put it on the non _Int form instead.

This matches what's done for VRNDSCALE and most other instructions.

This mainly determines which instruction will be preferred by
disassembler and assembly parser. The printing and encoding
information is the same.

We prefer the _Int form since it uses the VR128 class due to
intrinsic interface. For some of EVEX features like embedded
rounding, we only select from intrinsics today. So there is
only a VR128 version. So making the VR128 version the preferred
is overally consistent.

llvm-svn: 372947

5 years ago[lldb][NFC] Use AppendEmptyArgument in CompletionRequest constructor
Raphael Isemann [Thu, 26 Sep 2019 07:06:05 +0000 (07:06 +0000)]
[lldb][NFC] Use AppendEmptyArgument in CompletionRequest constructor

We now have a utility function for this purpose.

(Also fixing the typo in the related comment while I'm at it.)

llvm-svn: 372946

5 years ago[analyzer] A speculative attempt to avoid gcc-7 crashes caused by r372942.
Artem Dergachev [Thu, 26 Sep 2019 07:01:31 +0000 (07:01 +0000)]
[analyzer] A speculative attempt to avoid gcc-7 crashes caused by r372942.

llvm-svn: 372945

5 years ago[SortIncludesTest] Add SortPriority fields to fix -Wmissing-field-initializers after...
Mikael Holmen [Thu, 26 Sep 2019 06:49:37 +0000 (06:49 +0000)]
[SortIncludesTest] Add SortPriority fields to fix -Wmissing-field-initializers after D64695/r372919

llvm-svn: 372944

5 years ago [IfConversion] Disallow TBB == FBB for valid triangles
Mikael Holmen [Thu, 26 Sep 2019 06:35:55 +0000 (06:35 +0000)]
 [IfConversion] Disallow TBB == FBB for valid triangles

Summary:
Previously the case

     EBB
     | \_
     |  |
     | TBB
     |  /
     FBB

was treated as a valid triangle also when TBB and FBB was the same basic
block. This could then lead to an invalid CFG when we removed the edge
from EBB to TBB, since that meant we would also remove the edge from EBB
to FBB.

Since TBB == FBB is quite a degenerated case of a triangle, we now
don't treat it as a valid triangle anymore, and thus we will avoid the
trouble with updating the CFG.

Reviewers: efriedma, dmgreen, kparzysz

Reviewed By: efriedma

Subscribers: bjope, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 372943

5 years ago[analyzer] Avoid small vectors of non-default-constructibles.
Artem Dergachev [Thu, 26 Sep 2019 06:33:21 +0000 (06:33 +0000)]
[analyzer] Avoid small vectors of non-default-constructibles.

Unconfuses certain compilers.

llvm-svn: 372942

5 years ago[X86] Mark the EVEX encoded PSADBW instructions as commutable to enable load folding...
Craig Topper [Thu, 26 Sep 2019 04:42:58 +0000 (04:42 +0000)]
[X86] Mark the EVEX encoded PSADBW instructions as commutable to enable load folding of the other operand.

The SSE and VEX versions are already correct.

llvm-svn: 372941

5 years ago[ConstantFolding] Use FoldBitCast correctly
Keno Fischer [Thu, 26 Sep 2019 02:07:51 +0000 (02:07 +0000)]
[ConstantFolding] Use FoldBitCast correctly

Previously we might attempt to use a BitCast to turn bits into vectors of pointers,
but that requires an inttoptr cast to be legal. Add an assertion to detect the formation of illegal bitcast attempts
early (in the tests, we often constant-fold away the result before getting to this assertion check),
while being careful to still handle the early-return conditions without adding extra complexity in the result.

Patch by Jameson Nash <jameson@juliacomputing.com>.

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

llvm-svn: 372940

5 years ago[clang-format] Add SortPriority fields to fix -Wmissing-field-initializers after...
Fangrui Song [Thu, 26 Sep 2019 02:02:17 +0000 (02:02 +0000)]
[clang-format] Add SortPriority fields to fix -Wmissing-field-initializers after D64695/r372919

llvm-svn: 372939

5 years agoImprove C API support for atomicrmw and cmpxchg.
Nick Lewycky [Thu, 26 Sep 2019 00:58:55 +0000 (00:58 +0000)]
Improve C API support for atomicrmw and cmpxchg.

atomicrmw and cmpxchg have a volatile flag, so allow them to be get and set with LLVM{Get,Set}Volatile. atomicrmw and fence have orderings, so allow them to be get and set with LLVM{Get,Set}Ordering. Add missing LLVMAtomicRMWBinOpFAdd and LLVMAtomicRMWBinOpFSub enum constants. AtomicCmpXchg also has a weak flag, add a getter/setter for that too. Add a getter/setter for the binary-op of an atomicrmw.

atomicrmw and cmpxchg have a volatile flag, so allow it to be set/get with LLVMGetVolatile and LLVMSetVolatile. Add missing LLVMAtomicRMWBinOpFAdd and LLVMAtomicRMWBinOpFSub enum constants. AtomicCmpXchg also has a weak flag, add a getter/setter for that too. Add a getter/setter for the binary-op of an atomicrmw.

Add LLVMIsA## for CatchSwitchInst, CallBrInst and FenceInst, as well as AtomicCmpXchgInst and AtomicRMWInst.

Update llvm-c-test to include atomicrmw and fence, and to copy volatile for the four applicable instructions.

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

llvm-svn: 372938

5 years ago[libFuzzer] [NFC] Fix grammar error with "it's"
Mitch Phillips [Thu, 26 Sep 2019 00:54:30 +0000 (00:54 +0000)]
[libFuzzer] [NFC] Fix grammar error with "it's"

llvm-svn: 372937

5 years ago[libTooling] Add `run` combinator to Stencils.
Yitzhak Mandelbaum [Thu, 26 Sep 2019 00:53:56 +0000 (00:53 +0000)]
[libTooling] Add `run` combinator to Stencils.

Summary:
This revision adds `run`, a StencilPart that runs a user-defined function that
computes a result over `MatchFinder::MatchResult`.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 372936

5 years ago[TargetLowering] Make allowsMemoryAccess methode virtual.
Thomas Raoux [Thu, 26 Sep 2019 00:16:01 +0000 (00:16 +0000)]
[TargetLowering] Make allowsMemoryAccess methode virtual.

Rename old function to explicitly show that it cares only about alignment.
The new allowsMemoryAccess call the function related to alignment by default
and can be overridden by target to inform whether the memory access is legal or
not.

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

llvm-svn: 372935

5 years ago[MC][WebAssembly] Error on data symbols in the text section.
Sam Clegg [Wed, 25 Sep 2019 23:33:16 +0000 (23:33 +0000)]
[MC][WebAssembly] Error on data symbols in the text section.

Previously we had an assert but this can actually occur in valid user
code so we need to handle this in release builds too.

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

llvm-svn: 372934

5 years ago[X86] Use VR512_0_15RegClass intead of VR512RegClass in X86VZeroUpper.
Craig Topper [Wed, 25 Sep 2019 23:25:15 +0000 (23:25 +0000)]
[X86] Use VR512_0_15RegClass intead of VR512RegClass in X86VZeroUpper.

This pass is only concerned with ZMM0-15 and YMM0-15. For YMM
we use VR256 which only contains YMM0-15, but for ZMM we were
using VR512 which contains ZMM0-31. Using VR512_0_15 is more
correct.

Given that the ABI and register allocator will use registers in
order, its unlikely that register from 16-31 would be used
without also using 0-15. So this probably doesn't functionally
matter.

llvm-svn: 372933

5 years ago[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.
Alina Sbirlea [Wed, 25 Sep 2019 23:24:39 +0000 (23:24 +0000)]
[MemorySSA] Avoid adding Phis in the presence of unreachable blocks.

Summary:
If a block has all incoming values with the same MemoryAccess (ignoring
incoming values from unreachable blocks), then use that incoming
MemoryAccess and do not create a Phi in the first place.

Revert IDF work-around added in rL372673; it should not be required unless
the Def inserted is the first in its block.

The patch also cleans up a series of tests, added during the many
iterations on insertDef.

The patch also fixes PR43438.
The same issue that occurs in insertDef with "adding phis, hence the IDF of
Phis is needed", can also occur in fixupDefs: the `getPreviousRecursive`
call only adds Phis walking on the predecessor edges, which means there
may be the case of a Phi added walking the CFG "backwards" which
triggers the needs for an additional Phi in successor blocks.
Such Phis are added during fixupDefs only in the presence of unreachable
blocks.
Hence this highlights the need to avoid adding Phis in blocks with
unreachable predecessors in the first place.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

llvm-svn: 372932

5 years ago[InstCombine] foldUnsignedUnderflowCheck(): one last pattern with 'sub' (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:59 +0000 (22:59 +0000)]
[InstCombine] foldUnsignedUnderflowCheck(): one last pattern with 'sub' (PR43251)

https://rise4fun.com/Alive/0j9

llvm-svn: 372930

5 years ago[NFC][InstCombine] Tests for 'base u<= offset && (base - offset) != 0' pattern (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:48 +0000 (22:59 +0000)]
[NFC][InstCombine] Tests for 'base u<= offset && (base - offset) != 0' pattern (PR43251)

llvm-svn: 372929

5 years ago[InstSimplify] Handle more 'A </>/>=/<= B &&/|| (A - B) !=/== 0' patterns (PR43251)
Roman Lebedev [Wed, 25 Sep 2019 22:59:41 +0000 (22:59 +0000)]
[InstSimplify] Handle more 'A </>/>=/<= B &&/|| (A - B) !=/== 0' patterns (PR43251)

https://rise4fun.com/Alive/sl9s
https://rise4fun.com/Alive/2plN

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

llvm-svn: 372928

5 years ago[NFC][InstSimplify] More exaustive test coverage for 'A </>/>=/<= B &&/|| (A - B...
Roman Lebedev [Wed, 25 Sep 2019 22:59:24 +0000 (22:59 +0000)]
[NFC][InstSimplify] More exaustive test coverage for 'A </>/>=/<= B &&/|| (A - B) !=/== 0' pattern (PR43251)

llvm-svn: 372927

5 years agoSimplify -fms-compatibility include lookup logic, NFC
Reid Kleckner [Wed, 25 Sep 2019 22:50:50 +0000 (22:50 +0000)]
Simplify -fms-compatibility include lookup logic, NFC

This include search logic has an extra parameter to deal with Windows
includes with backslashes, which get normalized to forward slashes on
non-Windows under -fms-compatibility.

Hoist the conditional operator out of LookupHeaderIncludeOrImport and
pass the result in instead of repeating the ?: expression everywhere.

llvm-svn: 372926

5 years agoFix memory leak in DeclTest.
Evgeniy Stepanov [Wed, 25 Sep 2019 22:38:20 +0000 (22:38 +0000)]
Fix memory leak in DeclTest.

Fixes a leak introduced in r372903, detected on the ASan bot.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/35430/steps/check-clang%20asan/logs/stdio

Direct leak of 192 byte(s) in 1 object(s) allocated from:
    #0 0x561d88 in operator new(unsigned long) /b/sanitizer-x86_64-linux-fast/build/llvm-project/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x1a48779 in clang::ItaniumMangleContext::create(clang::ASTContext&, clang::DiagnosticsEngine&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:5134:10
    #2 0xdff000 in Decl_AsmLabelAttr_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/unittests/AST/DeclTest.cpp:97:23

llvm-svn: 372925

5 years ago[LICM] Don't verify domtree/loopinfo unless EXPENSIVE_CHECKS is enabled.
Eli Friedman [Wed, 25 Sep 2019 22:35:47 +0000 (22:35 +0000)]
[LICM] Don't verify domtree/loopinfo unless EXPENSIVE_CHECKS is enabled.

For large functions, verifying the whole function after each loop takes
non-linear time.

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

llvm-svn: 372924

5 years ago[Verifier] add invariant check for callbr
Nick Desaulniers [Wed, 25 Sep 2019 22:28:27 +0000 (22:28 +0000)]
[Verifier] add invariant check for callbr

Summary:
The list of indirect labels should ALWAYS have their blockaddresses as
argument operands to the callbr (but not necessarily the other way
around).  Add an invariant that checks this.

The verifier catches a bad test case that was added recently in r368478.
I think that was a simple mistake, and the test was made less strict in
regards to the precise addresses (as those weren't specifically the
point of the test).

This invariant will be used to find a reported bug.

Link: https://www.spinics.net/lists/arm-kernel/msg753473.html
Link: https://github.com/ClangBuiltLinux/linux/issues/649
Reviewers: craig.topper, void, chandlerc

Reviewed By: void

Subscribers: ychen, lebedev.ri, javed.absar, kristof.beyls, hiraditya, llvm-commits, srhines

Tags: #llvm

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

llvm-svn: 372923

5 years ago[libcxxabi] Fix arm build failer with libgcc
Adhemerval Zanella [Wed, 25 Sep 2019 21:46:24 +0000 (21:46 +0000)]
[libcxxabi] Fix arm build failer with libgcc

Both arm32 armv7/armv8 bots which do not use compiler-rt are failing
to a linking issue:

[100%] Built target cxxabi_static
CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o: In function `(anonymous namespace)::itanium_demangle::OutputStream::writeUnsigned(unsigned long long, bool)':
/home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:55: undefined reference to `__aeabi_uldivmod'
/home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:56: undefined reference to `__aeabi_uldivmod'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

It seems after r371273 OutputStream is used more extensively and
is pulling OutputStream::writeUnsigned (which thus requires unsigned
integer module).

The straightfoward fix is to explicit link against libgcc if
compiler-rt is not used.

llvm-svn: 372921

5 years ago[Dwarf] Fix switch cases that take an dw_tag_t.
Jonas Devlieghere [Wed, 25 Sep 2019 20:59:56 +0000 (20:59 +0000)]
[Dwarf] Fix switch cases that take an dw_tag_t.

Now that dw_tag_t is an enum, a default case is required.

llvm-svn: 372920

5 years ago[clang-format] Modified SortIncludes and IncludeCategories to priority for sorting...
Paul Hoad [Wed, 25 Sep 2019 20:33:01 +0000 (20:33 +0000)]
[clang-format] Modified SortIncludes and IncludeCategories to priority for sorting #includes within the Group Category.

Summary:
This new Style rule is made as a part of adding support for NetBSD KNF in clang-format. NetBSD have it's own priority of includes which should be followed while formatting NetBSD code. This style sorts the Cpp Includes according to the priorities of NetBSD, as mentioned in the [Style Guide](http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=HEAD&content-type=text/x-cvsweb-markup)
 The working of this Style rule shown below:

**Configuration:**
This revision introduces a new field under IncludeCategories named `SortPriority` which defines the priority of ordering the `#includes` and the `Priority` will define the categories for grouping the `#include blocks`.

Reviewers: cfe-commits, mgorny, christos, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: lebedev.ri, rdwampler, christos, mgorny, krytarowski

Patch By: Manikishan

Tags: #clang, #clang-format

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

llvm-svn: 372919

5 years ago[libTooling][NFC] Switch StencilTest.cpp to use EXPECT_THAT_EXPECTED
Yitzhak Mandelbaum [Wed, 25 Sep 2019 20:04:25 +0000 (20:04 +0000)]
[libTooling][NFC] Switch StencilTest.cpp to use EXPECT_THAT_EXPECTED

Summary:
Currently, some tests use homegrown matchers to handle `llvm::Expected`
values. This revision standardizes on EXPECT_THAT_EXPECTED and `HasValue`.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 372918

5 years ago[OPENMP50]Parsing/sema support for 'implementation/vendor' context
Alexey Bataev [Wed, 25 Sep 2019 19:43:37 +0000 (19:43 +0000)]
[OPENMP50]Parsing/sema support for 'implementation/vendor' context
selector.

Added basic parsing/semantic support for
'implementation={vendor(<vendor>)}' context selector.

llvm-svn: 372917

5 years ago[libc++] Purge mentions of GCC 4 from the test suite
Louis Dionne [Wed, 25 Sep 2019 19:40:48 +0000 (19:40 +0000)]
[libc++] Purge mentions of GCC 4 from the test suite

We don't support GCC 4 and older according to the documentation, so
we should pretend it doesn't exist.

This is a re-application of r372787.

llvm-svn: 372916

5 years ago[InstSimplify] Match 1.0 and 0.0 for both operands in SimplifyFMAMul
Florian Hahn [Wed, 25 Sep 2019 19:33:26 +0000 (19:33 +0000)]
[InstSimplify] Match 1.0 and 0.0 for both operands in SimplifyFMAMul

Because we do not constant fold multiplications in SimplifyFMAMul,
we match 1.0 and 0.0 for both operands, as multiplying by them
is guaranteed to produce an exact result (if it is allowed to do so).

Note that it is not enough to just swap the operands to ensure a
constant is on the RHS, as we want to also cover the case with
2 constants.

Reviewers: lebedev.ri, spatel, reames, scanon

Reviewed By: lebedev.ri, reames

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

llvm-svn: 372915

5 years ago[lit] Do a better job at parsing unsupported tests.
Jonas Devlieghere [Wed, 25 Sep 2019 19:31:54 +0000 (19:31 +0000)]
[lit] Do a better job at parsing unsupported tests.

When all the tests run by dotest are unsupported, it still reports
RESULT: PASSED which we translate to success for lit. We can better
report the status as unsupported when we see that there are unsupported
tests but no passing tests. This will not affect the situation where
there are failures or unexpected passes, because those report a non-zero
exit code.

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

llvm-svn: 372914

5 years ago[InstCombine] Fold (A - B) u>=/u< A --> B u>/u<= A iff B != 0
Roman Lebedev [Wed, 25 Sep 2019 19:06:40 +0000 (19:06 +0000)]
[InstCombine] Fold  (A - B) u>=/u< A  --> B  u>/u<= A  iff B != 0

https://rise4fun.com/Alive/KtL

This also shows that the fold added in D67412 / r372257
was too specific, and the new fold allows those test cases
to be handled more generically, therefore i delete now-dead code.

This is yet again motivated by
D67122 "[UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour"

llvm-svn: 372912

5 years ago[NFC][InstCombine] Add tests for (X - Y) < X --> Y <= X iff Y != 0
Roman Lebedev [Wed, 25 Sep 2019 19:06:26 +0000 (19:06 +0000)]
[NFC][InstCombine] Add tests for (X - Y) < X  -->  Y <= X  iff  Y != 0

https://rise4fun.com/Alive/KtL
This should go to InstCombiner::foldICmpBinO(), next to
"Convert sub-with-unsigned-overflow comparisons into a comparison of args."

llvm-svn: 372911

5 years ago[MSP430] Allow msp430_intrcc functions to not have interrupt attribute.
Vadzim Dambrouski [Wed, 25 Sep 2019 18:58:07 +0000 (18:58 +0000)]
[MSP430] Allow msp430_intrcc functions to not have interrupt attribute.

Summary:
Useful in case you want to have control over interrupt vector generation.
For example in Rust language we have an arrangement where all unhandled
ISR vectors gets mapped to a single default handler function. Which is
hard to implement when LLVM tries to generate vectors on its own.

Reviewers: asl, krisb

Subscribers: hiraditya, JDevlieghere, awygle, llvm-commits

Tags: #llvm

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

llvm-svn: 372910

5 years agoAdd forward declaration of operator<< in <string_view> as required.
Eric Fiselier [Wed, 25 Sep 2019 18:56:54 +0000 (18:56 +0000)]
Add forward declaration of operator<< in <string_view> as required.

This declaration was previously missing despite appearing in the
synopsis. Users are still required to include <ostream> to get the
definition of the streaming operator.

llvm-svn: 372909

5 years ago[AMDGPU] Improve fma.f64 test. NFC.
Stanislav Mekhanoshin [Wed, 25 Sep 2019 18:50:34 +0000 (18:50 +0000)]
[AMDGPU] Improve fma.f64 test. NFC.

llvm-svn: 372908

5 years agoadd tests that debug mode catches nullptr->string_view conversions in comparison...
Eric Fiselier [Wed, 25 Sep 2019 18:43:40 +0000 (18:43 +0000)]
add tests that debug mode catches nullptr->string_view conversions in comparison operators

llvm-svn: 372907

5 years ago[AMDGPU] gfx10 v_fmac_f16 operand folding
Stanislav Mekhanoshin [Wed, 25 Sep 2019 18:40:20 +0000 (18:40 +0000)]
[AMDGPU] gfx10 v_fmac_f16 operand folding

Fold immediates into v_fmac_f16.

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

llvm-svn: 372906

5 years ago[lldb] Excludes private headers from SWIG dependency.
Haibo Huang [Wed, 25 Sep 2019 18:17:45 +0000 (18:17 +0000)]
[lldb] Excludes private headers from SWIG dependency.

Reviewers: xiaobai

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 372905

5 years ago[emacs] simplify and improve keyword highlighting in tablegen-mode.el
Bob Haarman [Wed, 25 Sep 2019 18:16:02 +0000 (18:16 +0000)]
[emacs] simplify and improve keyword highlighting in tablegen-mode.el

Summary:
The keyword and type keyword matchers in tablegen-mode.el checked
for space, newline, tab, or open paren after the regular expression
that matches keywords (or type keywords, respectively). This is
unnecessary, because those regular expressions already include word
boundaries. This change removes the extra check. This also causes
"def" in "def:" to be highlighted as a keyword, which was missed
before.

Reviewers: lattner, MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 372904

5 years ago[Mangle] Add flag to asm labels to disable '\01' prefixing
Vedant Kumar [Wed, 25 Sep 2019 18:00:31 +0000 (18:00 +0000)]
[Mangle] Add flag to asm labels to disable '\01' prefixing

LLDB synthesizes decls using asm labels. These decls cannot have a mangle
different than the one specified in the label name. I.e., the '\01' prefix
should not be added.

Fixes an expression evaluation failure in lldb's TestVirtual.py on iOS.

rdar://45827323

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

llvm-svn: 372903

5 years ago[NFC] Add { } to silence compiler warning [-Wmissing-braces].
Huihui Zhang [Wed, 25 Sep 2019 17:32:20 +0000 (17:32 +0000)]
[NFC] Add { } to silence compiler warning [-Wmissing-braces].

llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp:254:25: warning: suggest braces around initialization of subobject [-Wmissing-braces]
  std::array<int, 5> A1{42, -5, 0, 1000000, -1000000};
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        {                           }

llvm-svn: 372902

5 years ago[CMake] Add the system debugserver to lldb-test-deps.
Jonas Devlieghere [Wed, 25 Sep 2019 17:13:02 +0000 (17:13 +0000)]
[CMake] Add the system debugserver to lldb-test-deps.

When using the system debugserver we create a target to copy it over.
This target has to be added to lldb-test-deps.

llvm-svn: 372901

5 years ago[CMake] Run the lldb-server tests with system debugserver.
Jonas Devlieghere [Wed, 25 Sep 2019 17:12:59 +0000 (17:12 +0000)]
[CMake] Run the lldb-server tests with system debugserver.

Now that we no longer build debugserver when LLDB_USE_SYSTEM_DEBUGSERVER
is set, we have to change the logic for testing lldb-server.

llvm-svn: 372900

5 years ago[InstCombine] Limit FMul constant folding for fma simplifications.
Florian Hahn [Wed, 25 Sep 2019 17:03:20 +0000 (17:03 +0000)]
[InstCombine] Limit FMul constant folding for fma simplifications.

As @reames pointed out post-commit, rL371518 adds additional rounding
in some cases, when doing constant folding of the multiplication.
This breaks a guarantee llvm.fma makes and must be avoided.

This patch reapplies rL371518, but splits off the simplifications not
requiring rounding from SimplifFMulInst as SimplifyFMAFMul.

Reviewers: spatel, lebedev.ri, reames, scanon

Reviewed By: reames

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

llvm-svn: 372899

5 years ago[CUDA][HIP] Enable kernel function return type deduction.
Michael Liao [Wed, 25 Sep 2019 16:51:45 +0000 (16:51 +0000)]
[CUDA][HIP] Enable kernel function return type deduction.

Summary:
- Even though only `void` is still accepted as the deduced return type,
  enabling deduction/instantiation on the return type allows more
  consistent coding.

Reviewers: tra, jlebar

Subscribers: cfe-commits, yaxunl

Tags: #clang

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

llvm-svn: 372898

5 years ago[AArch64][GlobalISel] Choose CCAssignFns per-argument for tail call lowering
Jessica Paquette [Wed, 25 Sep 2019 16:45:35 +0000 (16:45 +0000)]
[AArch64][GlobalISel] Choose CCAssignFns per-argument for tail call lowering

When checking for tail call eligibility, we should use the correct CCAssignFn
for each argument, rather than just checking if the caller/callee is varargs or
not.

This is important for tail call lowering with varargs. If we don't check it,
then basically any varargs callee with parameters cannot be tail called on
Darwin, for one thing. If the parameters are all guaranteed to be in registers,
this should be entirely safe.

On top of that, not checking for this could potentially make it so that we have
the wrong stack offsets when checking for tail call eligibility.

Also refactor some of the stuff for CCAssignFnForCall and pull it out into a
helper function.

Update call-translator-tail-call.ll to show that we can now correctly tail call
on Darwin. Also add two extra tail call checks. The first verifies that we still
respect the caller's stack size, and the second verifies that we still don't
tail call when a varargs function has a memory argument.

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

llvm-svn: 372897

5 years agoAdd a missing default parameter to regex::assign. This is LWG3296; reviewed as https...
Marshall Clow [Wed, 25 Sep 2019 16:40:30 +0000 (16:40 +0000)]
Add a missing default parameter to regex::assign. This is LWG3296; reviewed as https://reviews.llvm.org/D67944

llvm-svn: 372896

5 years ago[lldb] Move swig call from python code to cmake
Haibo Huang [Wed, 25 Sep 2019 16:37:11 +0000 (16:37 +0000)]
[lldb] Move swig call from python code to cmake

Summary: Elimiates lots of unused code.

Reviewers: labath, mgorny

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 372895

5 years ago[Docs] Document forwarding arguments with lit
Jonas Devlieghere [Wed, 25 Sep 2019 16:14:26 +0000 (16:14 +0000)]
[Docs] Document forwarding arguments with lit

Explain how to forward arguments to dotest.py from lit.

llvm-svn: 372894

5 years ago[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets
Evandro Menezes [Wed, 25 Sep 2019 16:10:20 +0000 (16:10 +0000)]
[CodeGen] Replace -max-jump-table-size with -max-jump-table-targets

Modern processors predict the targets of an indirect branch regardless of
the size of any jump table used to glean its target address.  Moreover,
branch predictors typically use resources limited by the number of actual
targets that occur at run time.

This patch changes the semantics of the option `-max-jump-table-size` to limit
the number of different targets instead of the number of entries in a jump
table.  Thus, it is now renamed to `-max-jump-table-targets`.

Before, when `-max-jump-table-size` was specified, it could happen that
cluster jump tables could have targets used repeatedly, but each one was
counted and typically resulted in tables with the same number of entries.
With this patch, when specifying `-max-jump-table-targets`, tables may have
different lengths, since the number of unique targets is counted towards the
limit, but the number of unique targets in tables is the same, but for the
last one containing the balance of targets.

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

llvm-svn: 372893

5 years ago[LangRef] Clarify absence of rounding guarantees for fmuladd.
Florian Hahn [Wed, 25 Sep 2019 16:09:24 +0000 (16:09 +0000)]
[LangRef] Clarify absence of rounding guarantees for fmuladd.

During the review of D67434, it was recommended to make fmuladd's
behavior more explicit. D67434 depends on this interpretation.

Reviewers: efriedma, jfb, reames, scanon, lebedev.ri, spatel

Reviewed By: spatel

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

llvm-svn: 372892

5 years ago[Dwarf] Make dw_tag_t a typedef for llvm::dwarf::Tag instead of uint16_t.
Jonas Devlieghere [Wed, 25 Sep 2019 16:04:38 +0000 (16:04 +0000)]
[Dwarf] Make dw_tag_t a typedef for llvm::dwarf::Tag instead of uint16_t.

Currently dw_tag_t is a typedef for uint16_t. This patch changes makes
dw_tag_t a typedef for llvm::dwarf::Tag. This enables us to use the full
power of the DWARF utilities in LLVM without having to do the cast every
time. With this approach, we only have to do the cast when reading the
ULEB value.

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

llvm-svn: 372891

5 years agoModernize Makefile.
Adrian Prantl [Wed, 25 Sep 2019 15:48:30 +0000 (15:48 +0000)]
Modernize Makefile.

llvm-svn: 372890

5 years agoRe-land r372863: [AST] Extract Decl::printNestedNameSpecifier helper from Decl::print...
Ilya Biryukov [Wed, 25 Sep 2019 15:46:04 +0000 (15:46 +0000)]
Re-land r372863: [AST] Extract Decl::printNestedNameSpecifier helper from Decl::printQualifiedName

Reverted in r372880 due to the test failure.
Also contains a fix that adjusts printQualifiedName to return the same results as before in
case of anonymous function locals and parameters.

llvm-svn: 372889

5 years ago[clangd] Change constness of parameters to findExplicitRefs
Kadir Cetinkaya [Wed, 25 Sep 2019 15:44:26 +0000 (15:44 +0000)]
[clangd] Change constness of parameters to findExplicitRefs

Summary:
Recursive AST requires non-const ast nodes, but it doesn't really
mutate them. In addition to that, in clangd we mostly have const ast nodes. So
it makes sense to move the const_cast into callee rather than having it at every
caller in the future.

Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 372888

5 years agofixed test: eliminated race condition which might cause deadlock
Andrey Churbanov [Wed, 25 Sep 2019 15:25:52 +0000 (15:25 +0000)]
fixed test: eliminated race condition which might cause deadlock

llvm-svn: 372887

5 years ago[DAGCombiner] add one-use restriction to vector transform with cheap extract
Sanjay Patel [Wed, 25 Sep 2019 15:08:33 +0000 (15:08 +0000)]
[DAGCombiner] add one-use restriction to vector transform with cheap extract

We might be able to do better on the example in the test,
but in general, we should not scalarize a splatted vector
binop if there are other uses of the binop. Otherwise, we
can end up with code as we had - a scalar op that is
redundant with a vector op.

llvm-svn: 372886

5 years ago[PatternMatch] Make m_Br more flexible, add matchers for BB values.
Florian Hahn [Wed, 25 Sep 2019 15:05:08 +0000 (15:05 +0000)]
[PatternMatch] Make m_Br more flexible, add matchers for BB values.

Currently m_Br only takes references to BasicBlock*, which limits its
flexibility. For example, you have to declare a variable, even if you
ignore the result or you have to have additional checks to make sure the
matched BB matches an expected one.

This patch adds m_BasicBlock and m_SpecificBB matchers, which can be
used like the existing matchers for constants or values.

I also had a look at the existing uses and updated a few. IMO it makes
the code a bit more explicit.

Reviewers: spatel, craig.topper, RKSimon, majnemer, lebedev.ri

Reviewed By: lebedev.ri

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

llvm-svn: 372885

5 years ago[NFC] Fix typo in `getPreviousDecl` comment.
Yitzhak Mandelbaum [Wed, 25 Sep 2019 14:58:39 +0000 (14:58 +0000)]
[NFC] Fix typo in `getPreviousDecl` comment.

llvm-svn: 372884

5 years ago[x86] add test for multi-use scalarization of vector binop; NFC
Sanjay Patel [Wed, 25 Sep 2019 14:57:45 +0000 (14:57 +0000)]
[x86] add test for multi-use scalarization of vector binop; NFC

llvm-svn: 372883

5 years ago[TargetInstrInfo] Let findCommutedOpIndices take const MachineInstr&
Simon Pilgrim [Wed, 25 Sep 2019 14:55:57 +0000 (14:55 +0000)]
[TargetInstrInfo] Let findCommutedOpIndices take const MachineInstr&

Neither the base implementation of findCommutedOpIndices nor any in-tree target modifies the instruction passed in and there is no reason why they would in the future.

Committed on behalf of @hvdijk (Harald van Dijk)

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

llvm-svn: 372882

5 years ago[PatternMatch] Generalize brc_match (NFC).
Florian Hahn [Wed, 25 Sep 2019 14:53:06 +0000 (14:53 +0000)]
[PatternMatch] Generalize brc_match (NFC).

Preparation for D68013.

llvm-svn: 372881

5 years agoRevert r372863: [AST] Extract Decl::printNestedNameSpecifier helper from Decl::printQ...
Ilya Biryukov [Wed, 25 Sep 2019 14:50:12 +0000 (14:50 +0000)]
Revert r372863: [AST] Extract Decl::printNestedNameSpecifier helper from Decl::printQualifiedName

Reason: causes a test failure, will investigate and re-land with a fix.
llvm-svn: 372880

5 years agoEnable tasks dependencies hashmaps resizing.
Andrey Churbanov [Wed, 25 Sep 2019 14:40:19 +0000 (14:40 +0000)]
Enable tasks dependencies hashmaps resizing.

Patch by viroulep (Philippe Virouleau)

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

llvm-svn: 372879

5 years ago[IR] allow fast-math-flags on phi of FP values (2nd try)
Sanjay Patel [Wed, 25 Sep 2019 14:35:02 +0000 (14:35 +0000)]
[IR] allow fast-math-flags on phi of FP values (2nd try)

The changes here are based on the corresponding diffs for allowing FMF on 'select':
D61917 <https://reviews.llvm.org/D61917>

As discussed there, we want to have fast-math-flags be a property of an FP value
because the alternative (having them on things like fcmp) leads to logical
inconsistency such as:
https://bugs.llvm.org/show_bug.cgi?id=38086

The earlier patch for select made almost no practical difference because most
unoptimized conditional code begins life as a phi (based on what I see in clang).
Similarly, I don't expect this patch to do much on its own either because
SimplifyCFG promptly drops the flags when converting to select on a minimal
example like:
https://bugs.llvm.org/show_bug.cgi?id=39535

But once we have this plumbing in place, we should be able to wire up the FMF
propagation and start solving cases like that.

The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a
regression in a LoopVectorize test. We are intersecting the FMF of any
FPMathOperator there, so if a phi is not properly annotated, new math
instructions may not be either. Once we fix the propagation in SimplifyCFG, it
may be safe to remove that hack.

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

llvm-svn: 372878

5 years agoFix analyzer TypeAttributeImpl::anchor() override.
Simon Pilgrim [Wed, 25 Sep 2019 14:23:25 +0000 (14:23 +0000)]
Fix analyzer TypeAttributeImpl::anchor() override.

TypeAttributeImpl inherits from EnumAttributeImpl which already defines anchor() as a virtual, so we should override this instead of redeclaring it.

llvm-svn: 372877

5 years ago[gn build] Fix Python DeprecationWarning
Marco Antognini [Wed, 25 Sep 2019 14:15:34 +0000 (14:15 +0000)]
[gn build] Fix Python DeprecationWarning

Summary:
This fixes two issues:
 - DeprecationWarning: invalid escape sequence \`
 - ResourceWarning: unclosed file

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 372876

5 years ago[clangd] Fix parseNamespaceEvents to parse the last token
Kadir Cetinkaya [Wed, 25 Sep 2019 14:12:05 +0000 (14:12 +0000)]
[clangd] Fix parseNamespaceEvents to parse the last token

Reviewers: hokein, ilya-biryukov

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

Tags: #clang

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

llvm-svn: 372875

5 years ago[Dominators][AMDGPU] Don't use virtual exit node in findNearestCommonDominator. Clean...
Jakub Kuderski [Wed, 25 Sep 2019 14:04:36 +0000 (14:04 +0000)]
[Dominators][AMDGPU] Don't use virtual exit node in findNearestCommonDominator. Cleanup MachinePostDominators.

Summary:
This patch fixes a bug that originated from passing a virtual exit block (nullptr) to `MachinePostDominatorTee::findNearestCommonDominator` and resulted in assertion failures inside its callee. It also applies a small cleanup to the class.

The patch introduces a new function in PDT that given a list of `MachineBasicBlock`s finds their NCD. The new overload of `findNearestCommonDominator` handles virtual root correctly.

Note that similar handling of virtual root nodes is not necessary in (forward) `DominatorTree`s, as right now they don't use virtual roots.

Reviewers: tstellar, tpr, nhaehnle, arsenm, NutshellySima, grosser, hliao

Reviewed By: hliao

Subscribers: hliao, kzhuravl, jvesely, wdng, yaxunl, dstuttard, t-tye, hiraditya, llvm-commits

Tags: #amdgpu, #llvm

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

llvm-svn: 372874

5 years ago[SystemZ] Improve emitSelect()
Jonas Paulsson [Wed, 25 Sep 2019 14:00:33 +0000 (14:00 +0000)]
[SystemZ]  Improve emitSelect()

Merge more Select pseudo instructions in emitSelect() by allowing other
instructions between them as long as they do not clobber CC.

Debug value instructions are now moved down to below the new PHIs instead of
erasing them.

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

llvm-svn: 372873

5 years agoFix cppcheck variable shadow warning. NFCI.
Simon Pilgrim [Wed, 25 Sep 2019 13:45:36 +0000 (13:45 +0000)]
Fix cppcheck variable shadow warning. NFCI.

llvm-svn: 372872

5 years agoAdd missing ExplicitTy default initialization to ConstantExprKeyType constructors.
Simon Pilgrim [Wed, 25 Sep 2019 13:38:54 +0000 (13:38 +0000)]
Add missing ExplicitTy default initialization to ConstantExprKeyType constructors.

Fixes cppcheck uninitialized variable warnings

llvm-svn: 372871

5 years ago[libTooling] Introduce the MatchConsumer abstraction
Yitzhak Mandelbaum [Wed, 25 Sep 2019 13:34:04 +0000 (13:34 +0000)]
[libTooling] Introduce the MatchConsumer abstraction

Summary:
This revision introduces a separate (small) library for the `MatchConsumer`
abstraction: computations over AST match results.  This abstraction is central
to the Transformer framework, and there deserves being defined explicitly.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 372870

5 years ago[lldb][modern-type-lookup] Add two basic tests for modern-type-lookup
Raphael Isemann [Wed, 25 Sep 2019 13:33:50 +0000 (13:33 +0000)]
[lldb][modern-type-lookup] Add two basic tests for modern-type-lookup

The story so far: LLDB's modern type lookup mode has no (as in, 0%) test
coverage. It was supposed to be tested by hardcoding the default to 'true' and then running
the normal LLDB tests, but to my knowledge no one is doing that. As a around 130 tests
seem to fail with this mode enabled, we also can't just enable it globally for now.

As we touch the surrounding code all the time and also want to refactor parts of it, we
should be a bit more ambitious with our testing efforts.

So this patch adds two basic tests that enable this mode and do some
basic expression parsing which should hopefully be basic enough to not
break anywhere but still lets us know if this mode works at all (i.e. setting up the
ExternalASTMerger in LLDB, using its basic import functionality to move declarations
around and do some lookups).

llvm-svn: 372869

5 years agoRevert [IR] allow fast-math-flags on phi of FP values
Sanjay Patel [Wed, 25 Sep 2019 13:29:09 +0000 (13:29 +0000)]
Revert [IR] allow fast-math-flags on phi of FP values

This reverts r372866 (git commit dec03223a97af0e4dfcb23da55c0f7f8c9b62d00)

llvm-svn: 372868

5 years ago[llvm-readobj/llvm-readelf] - .stack_sizes: demangle symbol names in warnings reported.
George Rimar [Wed, 25 Sep 2019 13:16:43 +0000 (13:16 +0000)]
[llvm-readobj/llvm-readelf] - .stack_sizes: demangle symbol names in warnings reported.

I started this patch as a refactoring, tried to make a helper for
getting symbol names, similar to how we get section names
used in warning messages.

So this patch cleanups the code and fixes an issue: symbol names
in warning messages were not demangled.

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

llvm-svn: 372867

5 years ago[IR] allow fast-math-flags on phi of FP values
Sanjay Patel [Wed, 25 Sep 2019 13:14:12 +0000 (13:14 +0000)]
[IR] allow fast-math-flags on phi of FP values

The changes here are based on the corresponding diffs for allowing FMF on 'select':
D61917

As discussed there, we want to have fast-math-flags be a property of an FP value
because the alternative (having them on things like fcmp) leads to logical
inconsistency such as:
https://bugs.llvm.org/show_bug.cgi?id=38086

The earlier patch for select made almost no practical difference because most
unoptimized conditional code begins life as a phi (based on what I see in clang).
Similarly, I don't expect this patch to do much on its own either because
SimplifyCFG promptly drops the flags when converting to select on a minimal
example like:
https://bugs.llvm.org/show_bug.cgi?id=39535

But once we have this plumbing in place, we should be able to wire up the FMF
propagation and start solving cases like that.

The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a
regression in a LoopVectorize test. We are intersecting the FMF of any
FPMathOperator there, so if a phi is not properly annotated, new math
instructions may not be either. Once we fix the propagation in SimplifyCFG, it
may be safe to remove that hack.

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

llvm-svn: 372866

5 years ago[docs][llvm-strings] Clarify "printable character" wording
James Henderson [Wed, 25 Sep 2019 13:09:17 +0000 (13:09 +0000)]
[docs][llvm-strings] Clarify "printable character" wording

The --bytes option uses the phrase "printable ASCII characters", but the
description section used simply "printable characters". To avoid any
confusion about locale impacts etc, this change adopts the former's
phrasing in both places. It also fixes a minor grammar issue in the
description.

Reviewed by: MaskRay

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

llvm-svn: 372865