platform/upstream/llvm.git
3 years ago[libc++] Install missing package in the Dockerfile
Louis Dionne [Thu, 26 Nov 2020 20:14:02 +0000 (15:14 -0500)]
[libc++] Install missing package in the Dockerfile

python3-distutils is required to use `import distutils.spawn`, which is
required by the ABI list targets.

3 years agoRevert "[SimplifyCFG] FoldBranchToCommonDest: lift use-restriction on bonus instructions"
Roman Lebedev [Thu, 26 Nov 2020 20:11:26 +0000 (23:11 +0300)]
Revert "[SimplifyCFG] FoldBranchToCommonDest: lift use-restriction on bonus instructions"

Many bots are unhappy, at the very least missed a few codegen tests,
and possibly this has a logic hole inducing a miscompile
(will be really awesome to have ready reproducer..)

Need to investigate.

This reverts commit 2245fb8aaa1c1f85f53f7b19a1ee3ac69b1a1dfe.

3 years ago[llvmbuildectomy] Also include component groups in llvm-config --components list
Mariusz Ceier [Thu, 26 Nov 2020 20:03:22 +0000 (21:03 +0100)]
[llvmbuildectomy] Also include component groups in llvm-config --components list

Without this change mesa fails while looking for llvm components like amdgpu, engine or native:

    Run-time dependency LLVM (modules: amdgpu(missing), bitreader, bitwriter, core, engine(missing), executionengine, instcombine, ipo, mcdisassembler, mcjit, native(missing), scalaropts, transformutils, coroutines)
    Looking for a fallback subproject for the dependency llvm (modules: bitwriter, engine, mcdisassembler, mcjit, core, executionengine, scalaropts, transformutils, instcombine, amdgpu, native, bitreader, ipo)

This change adds component groups (like all-targets, engine, native, amdgpu) to the "all" component.

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

3 years ago[SimplifyCFG] FoldBranchToCommonDest: lift use-restriction on bonus instructions
Roman Lebedev [Thu, 26 Nov 2020 16:41:31 +0000 (19:41 +0300)]
[SimplifyCFG] FoldBranchToCommonDest: lift use-restriction on bonus instructions

1. It doesn't make sense to enforce that the bonus instruction
   is only used once in it's basic block. What matters is
   whether those user instructions fit within our budget, sure,
   but that is another question.
2. It doesn't make sense to enforce that said bonus instructions
   are only used within their basic block. Perhaps the branch
   condition isn't using the value computed by said bonus instruction,
   and said bonus instruction is simply being calculated
   to be used in successors?

So iff we can clone bonus instructions, to lift these restrictions,
we just need to carefully update their external uses
to use the new cloned instructions.

Notably, this transform (even without this change) appears to be
poison-unsafe as per alive2, but is otherwise (including the patch) legal.

We don't introduce any new PHI nodes, but only "move" the instructions
around, i'm not really seeing much potential for extra cost modelling
for the transform, especially since now we allow at most one such
bonus instruction by default.

This causes the fold to fire +11.4% more (13216 -> 14725)
as of vanilla llvm test-suite + RawSpeed.

The motivational pattern is IEEE-754-2008 Binary16->Binary32
extension code:
https://github.com/darktable-org/rawspeed/blob/ca57d77fb2ba81f21fc712cfac26e54f46406473/src/librawspeed/common/FloatingPoint.h#L115-L120
^ that should be a switch, but it is not now: https://godbolt.org/z/bvja5v
That being said, even thought this seemed like this would fix it: https://godbolt.org/z/xGq3TM
apparently that fold is happening somewhere else afterall,
so something else also has a similar 'artificial' restriction.

3 years ago[NFC][SimplifyCFG] Add test coverage for FoldBranchToCommonDest xform with live-out...
Roman Lebedev [Thu, 26 Nov 2020 12:21:56 +0000 (15:21 +0300)]
[NFC][SimplifyCFG] Add test coverage for FoldBranchToCommonDest xform with live-out bonus instuctions

The uses of the bonus instructions should not be preventing the transformation.

3 years ago[NFC][SimplifyCFG] Add statistic to `FoldBranchToCommonDest()` fold
Roman Lebedev [Thu, 26 Nov 2020 11:58:28 +0000 (14:58 +0300)]
[NFC][SimplifyCFG] Add statistic to `FoldBranchToCommonDest()` fold

3 years ago[libc++] Remove ABI lists for previous releases
Louis Dionne [Thu, 26 Nov 2020 19:45:07 +0000 (14:45 -0500)]
[libc++] Remove ABI lists for previous releases

We don't actually update the ABI lists at every release -- it's too much
work, since we'd technically have to do it even for minor releases.
Furthermore, I don't think anybody uses those (I certainly don't rely
on them for anything).

Instead, it is better to rely on the ABI list changelog and the canonical
ABI list that we always keep up to date. If one wants to know what symbols
were shipped in a specific release, that can be discovered easily using
Git, which is a superior tool than keeping textual copies of old versions.

3 years ago[libc++] Fix the Homebrew tap to install Buildkite on macOS hosts
Louis Dionne [Thu, 26 Nov 2020 19:40:38 +0000 (14:40 -0500)]
[libc++] Fix the Homebrew tap to install Buildkite on macOS hosts

3 years ago[clangd] AddUsing: do not crash on non-namespace using decls.
Adam Czachorowski [Thu, 26 Nov 2020 16:51:04 +0000 (17:51 +0100)]
[clangd] AddUsing: do not crash on non-namespace using decls.

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

3 years ago[X86] Regenerate i64-to-float.ll tests with avx512 coverage
Simon Pilgrim [Thu, 26 Nov 2020 18:29:37 +0000 (18:29 +0000)]
[X86] Regenerate i64-to-float.ll tests with avx512 coverage

Rename prefix from X32 to X86 as we typically use X32 for gnux32 triples

3 years ago[BPF][NewPM] Port bpf-adjust-opt to NPM and add it to pipeline
Arthur Eubanks [Thu, 19 Nov 2020 17:37:40 +0000 (09:37 -0800)]
[BPF][NewPM] Port bpf-adjust-opt to NPM and add it to pipeline

Reviewed By: yonghong-song

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

3 years ago[AA] Split up LocationSize::unknown()
Nikita Popov [Tue, 17 Nov 2020 19:11:09 +0000 (20:11 +0100)]
[AA] Split up LocationSize::unknown()

Currently, we have some confusion in the codebase regarding the
meaning of LocationSize::unknown(): Some parts (including most of
BasicAA) assume that LocationSize::unknown() only allows accesses
after the base pointer. Some parts (various callers of AA) assume
that LocationSize::unknown() allows accesses both before and after
the base pointer (but within the underlying object).

This patch splits up LocationSize::unknown() into
LocationSize::afterPointer() and LocationSize::beforeOrAfterPointer()
to make this completely unambiguous. I tried my best to determine
which one is appropriate for all the existing uses.

The test changes in cs-cs.ll in particular illustrate a previously
clearly incorrect AA result: We were effectively assuming that
argmemonly functions were only allowed to access their arguments
after the passed pointer, but not before it. I'm pretty sure that
this was not intentional, and it's certainly not specified by
LangRef that way.

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

3 years ago[MC] Set the unique id of .stack_sizes to the associated .text section's
Fangrui Song [Thu, 26 Nov 2020 17:13:08 +0000 (09:13 -0800)]
[MC] Set the unique id of .stack_sizes to the associated .text section's

Similar to D92113. Currently `clang -fstack-size-section -fno-unique-section-names`
sets the linked-to symbol to the first `.text`, which is:

* incorrect for COMDAT sections
* inferior for non-COMDAT sections in -ffunction-sections mode (poor --gc-sections: .stack_sizes cannot be separately discarded)

Note, if the section symbol can be referenced in more places (if the
function begin symbol does not apply), we probably should consider
defining a different BeginSymbol for sections with ",unique" linkage.

Reviewed By: grimar, jhenderson

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

3 years ago[AIX] Add support for non var_arg extended vector ABI calling convention on AIX
Zarko Todorovski [Thu, 26 Nov 2020 16:15:00 +0000 (11:15 -0500)]
[AIX] Add support for non var_arg extended vector ABI calling convention on AIX

This patch enables passing non variadic vector type parameters on the caller and callee side and vector return on AIX that are passed in vector registers only.

So far, support is enabled for only the AIX extended Altivec ABI Calling convention.

Reviewed By: sfertile, DiggerLin

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

3 years ago[ASTImporter] Import the default argument of TemplateTypeParmDecl
Raphael Isemann [Thu, 26 Nov 2020 16:02:31 +0000 (17:02 +0100)]
[ASTImporter] Import the default argument of TemplateTypeParmDecl

The test case isn't using the AST matchers for all checks as there doesn't seem to be support for
matching TemplateTypeParmDecl default arguments. Otherwise this is simply importing the
default arguments.

Also updates several LLDB tests that now as intended omit the default template
arguments of several std templates.

Reviewed By: martong

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

3 years ago[libc++] Remove sysctl-based implementation of thread::hardware_concurrency()
Louis Dionne [Wed, 25 Nov 2020 21:42:42 +0000 (16:42 -0500)]
[libc++] Remove sysctl-based implementation of thread::hardware_concurrency()

Using sysctl requires including headers that are considered internal on
Linux, like <sys/sysctl.h> & friends. Instead, sysconf is defined by POSIX
(and we have a fallback for Windows), so all the systems we support should
be happy with just sysconf.

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

3 years ago[libc++] Attempt to fix spurious modules-related failures in the CI
Louis Dionne [Wed, 25 Nov 2020 21:17:23 +0000 (16:17 -0500)]
[libc++] Attempt to fix spurious modules-related failures in the CI

I'm not 100% sure what the issue actually is since I can't reproduce it
locally, however what I explain in the comment is my best attempt to
explain what's going on.

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

3 years ago[mlir][DialectConversion] Do not prematurely drop unused cast operations
Stephan Herhut [Thu, 26 Nov 2020 16:08:49 +0000 (17:08 +0100)]
[mlir][DialectConversion] Do not prematurely drop unused cast operations

The rewrite logic has an optimization to drop a cast operation after
rewriting block arguments if the cast operation has no users. This is
unsafe as there might be a pending rewrite that replaced the cast operation
itself and hence would trigger a second free.

Instead, do not remove the casts and leave it up to a later canonicalization
to do so.

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

3 years ago[libc++] Fix two fr_FR locale tests on FreeBSD
Alex Richardson [Thu, 26 Nov 2020 14:47:31 +0000 (14:47 +0000)]
[libc++] Fix two fr_FR locale tests on FreeBSD

FreeBSD's locale data uses the same U+2027 separator as Glibc 2.27 and newer.

Reviewed By: #libc, emaste, ldionne

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

3 years ago[AArch64] Regenerate min/max tests and add vXi64 umin/umax test coverage
Simon Pilgrim [Thu, 26 Nov 2020 15:33:27 +0000 (15:33 +0000)]
[AArch64] Regenerate min/max tests and add vXi64 umin/umax test coverage

3 years ago[ARM] Cleanup for the MVETailPrediction pass
David Green [Thu, 26 Nov 2020 15:10:44 +0000 (15:10 +0000)]
[ARM] Cleanup for the MVETailPrediction pass

This strips out a lot of the code that should no longer be needed from
the MVETailPredictionPass, leaving the important part - find active lane
mask instructions and convert them to VCTP operations.

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

3 years agoRevert rG12d59b696b330 "[DAG] Legalize umin(x,y) -> sub(x,usubsat(x,y)) and umax...
Simon Pilgrim [Thu, 26 Nov 2020 15:07:45 +0000 (15:07 +0000)]
Revert rG12d59b696b330 "[DAG] Legalize umin(x,y) -> sub(x,usubsat(x,y)) and umax(x,y) -> add(x,usubsat(y,x)) iff usubsat is legal"

This reverts commit 12d59b696b33065e070d6ee7a55d2e8c019d138b.

Prematurely pushed this to trunk

3 years ago[DAG] Legalize umin(x,y) -> sub(x,usubsat(x,y)) and umax(x,y) -> add(x,usubsat(y...
Simon Pilgrim [Thu, 26 Nov 2020 14:47:06 +0000 (14:47 +0000)]
[DAG] Legalize umin(x,y) -> sub(x,usubsat(x,y)) and umax(x,y) -> add(x,usubsat(y,x)) iff usubsat is legal

If usubsat() is legal, this is likely to result in smaller codegen expansion than the default cmp+select codegen expansion.

Allows us to move the x86-specific lowering to the generic expansion code.

3 years agoRemove stray debug-only from test
Benjamin Kramer [Thu, 26 Nov 2020 14:37:18 +0000 (15:37 +0100)]
Remove stray debug-only from test

3 years ago[clang][cli] Port Target option flags to new option parsing system
Jan Svoboda [Tue, 24 Nov 2020 11:48:11 +0000 (12:48 +0100)]
[clang][cli] Port Target option flags to new option parsing system

Depends on D83697

Original patch by Daniel Grumberg.

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

3 years ago[LiveDebugVariables] Strip all debug instructions from nodebug functions
Robert Lougher [Wed, 25 Nov 2020 19:52:20 +0000 (19:52 +0000)]
[LiveDebugVariables] Strip all debug instructions from nodebug functions

A crash/assertion failure in the greedy register allocator was tracked
down to a debug instr being passed to LiveIntervals::getInstructionIndex.
Normally this should not occur as debug instructions are collected and
removed by LiveDebugVariables before RA, and reinserted afterwards.
However, when a function has no debug info, LiveDebugVariables simply
strips any debug values that are present as they're not needed (this
situation will occur when a function with debug info is inlined into a
nodebug function). The problem is, it only removes DBG_VALUE instructions,
leaving DBG_LABELs (the cause of the crash).

This patch updates the LiveDebugVariables nodebug path to remove all debug
instructions. The test case verifies that DBG_VALUE/DBG_LABEL instructions
are present, and that they are stripped.

When -experimental-debug-variable-locations is enabled, certain variable
locations are represented by DBG_INSTR_REF instead of DBG_VALUE. The test
case verifies that a DBG_INSTR_REF is emitted by the option, and that it
is also stripped.

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

3 years ago[ASTImporter] Import the default argument of TemplateTemplateParmDecl
Raphael Isemann [Thu, 26 Nov 2020 12:38:49 +0000 (13:38 +0100)]
[ASTImporter] Import the default argument of TemplateTemplateParmDecl

Same idea as in D92103 and D92106, but I realised after creating those reviews that there are
also TemplateTemplateParmDecls that can have default arguments, so here's hopefully the
last patch for default template arguments.

Reviewed By: martong

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

3 years ago[VPlan] Turn VPReplicateRecipe into a VPValue.
Florian Hahn [Thu, 26 Nov 2020 13:50:24 +0000 (13:50 +0000)]
[VPlan] Turn VPReplicateRecipe into a VPValue.

Update VPReplicateRecipe to inherit from VPValue. This still does not
update scalarizeInstruction to set the result for the VPValue of
VPReplicateRecipe, because this first requires tracking scalar values in
VPTransformState.

Reviewed By: reames

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

3 years ago[mlir][linalg] Mark linalg.yield as ReturnLike
Stephan Herhut [Thu, 26 Nov 2020 13:40:21 +0000 (14:40 +0100)]
[mlir][linalg] Mark linalg.yield as ReturnLike

This change is required so that bufferization can properly identify
the linalg.yield as a terminator with an associated parent op.

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

3 years ago[IndVarSimplify] Fix Modified status when handling dead PHI nodes
David Stenberg [Thu, 26 Nov 2020 09:15:59 +0000 (10:15 +0100)]
[IndVarSimplify] Fix Modified status when handling dead PHI nodes

When bailing out in rewriteLoopExitValues() you could be left with PHI
nodes in the DeadInsts vector. Those would be not handled by the use of
RecursivelyDeleteTriviallyDeadInstructions() in IndVarSimplify. This
resulted in the IndVarSimplify pass returning an incorrect modified
status. This was caught by the expensive check introduced in D86589.

This patches changes IndVarSimplify so that it deletes those PHI nodes,
using RecursivelyDeleteDeadPHINode().

This fixes PR47486.

Reviewed By: mkazantsev

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

3 years ago[AArch64][CostModel] Precommit some vector mul tests. NFC.
Sjoerd Meijer [Thu, 26 Nov 2020 13:03:37 +0000 (13:03 +0000)]
[AArch64][CostModel] Precommit some vector mul tests. NFC.

The cost-model is not getting the cost right for a mul with <2 x i64>
operands, i.e. we don't have a MUL.2d, and this is precommitting some
tests before adjusting this.

3 years ago[VE] Add comprehensive stackframe tests
Kazushi (Jam) Marukawa [Mon, 23 Nov 2020 06:37:46 +0000 (15:37 +0900)]
[VE] Add comprehensive stackframe tests

Add comprehensive stackframe regression tests as a preparation of
VEFrameLowering.cpp optimizations.

Reviewed By: simoll

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

3 years ago[mlir][bufferize] Add argument materialization for bufferization
Stephan Herhut [Thu, 26 Nov 2020 12:26:08 +0000 (13:26 +0100)]
[mlir][bufferize] Add argument materialization for bufferization

This enables partial bufferization that includes function signatures. To test this, this
change also makes the func-bufferize partial and adds a dedicated finalizing-bufferize pass.

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

3 years ago[clangd][query-driver] Extract target
Aleksandr Platonov [Thu, 26 Nov 2020 11:58:22 +0000 (14:58 +0300)]
[clangd][query-driver] Extract target

In some cases system includes extractions is not enough, we also need target specific defines.
The problems appears when clang default target is not the same as toolchain's one (GCC cross-compiler, MinGW on Windows).
After this patch `query-driver` also extracts target and adds `--target=<extracted target>` compile option.

Reviewed By: sammccall

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

3 years ago[X86] Extend neg-abs test coverage
Simon Pilgrim [Thu, 26 Nov 2020 12:01:26 +0000 (12:01 +0000)]
[X86] Extend neg-abs test coverage

Add 32-bit tests and test i8/i16/i32/i64/i128 like we do for abs.ll

3 years ago[CostModel] Add basic implementation of getGatherScatterOpCost.
Florian Hahn [Wed, 25 Nov 2020 17:27:11 +0000 (17:27 +0000)]
[CostModel] Add basic implementation of getGatherScatterOpCost.

Add a basic implementation of getGatherScatterOpCost to BasicTTIImpl.

The implementation estimates the cost of scalarizing the loads/stores,
the cost of packing/extracting the individual lanes and the cost of
only selecting enabled lanes.

This more accurately reflects the current cost on targets like AArch64.

Reviewed By: dmgreen

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

3 years ago[clang][Driver] Handle risvc in Baremetal.cpp.
Hafiz Abid Qadeer [Thu, 26 Nov 2020 11:31:45 +0000 (11:31 +0000)]
[clang][Driver] Handle risvc in Baremetal.cpp.

I am working on a baremetal riscv toolchain using LLVM runtime and
LLD linker. Baremetal.cpp provides most of the things needed for such
toolchain. So I have modified it to also handle riscv64/32-unknown-elf
 targets alongside arm-none-eabi.

Currently, targets like riscv64-unknown-elf are handled by RISCVToolChain
which mostly expects a gcc toolchain to be present. If you dont
want the dependency on gcc-toolchain/libgloss or want to use LLD, then
RISCVToolChain is not a good fit.

So in the toolchain selection code, I have made this dependency of
RISCVToolChain on gcc toolchain explicit. It is created if gcc-toolchain
option is present. Otherwise Baremetal toolchain is created. I will be
happy to hear if there is a better way to choose between these two
toolchains.

Reviewed By: jroelofs

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

3 years ago[libc++] Mark a few more tests as unsupported on gcc-8/9.
Marek Kurdej [Thu, 26 Nov 2020 11:40:50 +0000 (12:40 +0100)]
[libc++] Mark a few more tests as unsupported on gcc-8/9.

This will fix remaining failures on gcc-9 buildbot: http://lab.llvm.org:8011/#/builders/101.
gcc-8 and gcc-9 do not support constexpr destructors nor constexpr allocation.

Fix gcc warnings: -Wconversion, -Wpragmas.

3 years ago[SVE][CodeGen] Extend isConstantSplatValue to support ISD::SPLAT_VECTOR
Kerry McLaughlin [Thu, 26 Nov 2020 10:54:56 +0000 (10:54 +0000)]
[SVE][CodeGen] Extend isConstantSplatValue to support ISD::SPLAT_VECTOR

Updated the affected scalable_of_scalable tests in sve-gep.ll, as isConstantSplatValue now returns true in DAGCombiner::visitMUL and folds `(mul x, 1) -> x`

Reviewed By: sdesmalen

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

3 years agoRevert "Return "[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByC...
Max Kazantsev [Thu, 26 Nov 2020 11:12:04 +0000 (18:12 +0700)]
Revert "Return "[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByCond", 2nd try"

This reverts commit f690986f314fbf3f4b3ca9ec0b87b95166008dc1.

Compile time then and again...

3 years ago[X86] Fix -DAG checks on gnux32 pic tests
Simon Pilgrim [Thu, 26 Nov 2020 11:01:03 +0000 (11:01 +0000)]
[X86] Fix -DAG checks on gnux32 pic tests

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

3 years agoReturn "[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByCond...
Max Kazantsev [Thu, 26 Nov 2020 10:30:44 +0000 (17:30 +0700)]
Return "[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByCond", 2nd try

Reverted because the compile time impact is still too high.

isKnownViaNonRecursiveReasoning is used twice, we can do it just once.

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

3 years agoRevert "[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByCond"
Max Kazantsev [Thu, 26 Nov 2020 10:27:42 +0000 (17:27 +0700)]
Revert "[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByCond"

This reverts commit 3d4c0460ec6040fc071e56dc113afd181294591e.

Compile time impact is still high. Need to understand why.

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

3 years ago[llvm-readelf/obj] - Report a warning when the value of the DT_PLTREL dynamic tag...
Georgii Rymar [Wed, 25 Nov 2020 10:58:40 +0000 (13:58 +0300)]
[llvm-readelf/obj] - Report a warning when the value of the DT_PLTREL dynamic tag is invalid.

We report an error for unknown `DT_PLTREL` values.
This switches the error to warning.

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

3 years ago[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByCond
Max Kazantsev [Thu, 26 Nov 2020 09:59:39 +0000 (16:59 +0700)]
[SCEV] Use isBasicBlockEntryGuardedByCond in isLoopBackedgeGuardedByCond

Previously we tried to using isKnownPredicateAt, but it makes an
extra query to isKnownPredicate, which has negative impact on compile
time. Let's try to use more lightweight isBasicBlockEntryGuardedByCond.

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

3 years ago[RISCV] Add isel patterns for sbsetw/sbclrw/sbinvw with sext_inreg as the root.
Craig Topper [Thu, 26 Nov 2020 10:02:38 +0000 (02:02 -0800)]
[RISCV] Add isel patterns for sbsetw/sbclrw/sbinvw with sext_inreg as the root.

This handles cases were the input isn't known to be sign extended.

3 years ago[RISCV] Add test cases for missed opportunities to use sbsetw/sbclrw/sbinvw when...
Craig Topper [Thu, 26 Nov 2020 09:54:07 +0000 (01:54 -0800)]
[RISCV] Add test cases for missed opportunities to use sbsetw/sbclrw/sbinvw when the result isn't known to be sign extended.

If the input isn't sign extended, but the output of the or/xor/and
is used by a sign_inreg we can still use sbsetw/sbclrw/sbinvw.

3 years ago[llvm-profgen] [docs] Fix invalid header. Add to ToC. NFC.
Marek Kurdej [Thu, 26 Nov 2020 09:40:52 +0000 (10:40 +0100)]
[llvm-profgen] [docs] Fix invalid header. Add to ToC. NFC.

3 years agoRevert "[SCEV] Use isKnownPredicateAt in isLoopBackedgeGuardedByCond"
Max Kazantsev [Thu, 26 Nov 2020 09:42:43 +0000 (16:42 +0700)]
Revert "[SCEV] Use isKnownPredicateAt in isLoopBackedgeGuardedByCond"

This reverts commit 14f2ad0e3cc54d5eb254b545a469e8ffdb62b119.

Reverting to investigate compile time drop.

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

3 years ago[NFC][libc++] Mark LWG3296 as complete.
Mark de Wever [Thu, 26 Nov 2020 09:37:04 +0000 (10:37 +0100)]
[NFC][libc++] Mark LWG3296 as complete.

I recalled Marshall had already made this change. The change is
committed in e3f89a989a23b9bfcb9f9d01172cebb63db627e1.

3 years ago[libc++] Fix gcc warning -Wsign-compare.
Marek Kurdej [Thu, 26 Nov 2020 09:20:09 +0000 (10:20 +0100)]
[libc++] Fix gcc warning -Wsign-compare.

3 years ago[libc++] [P0966] [C++20] Fix bug PR45368 by correctly implementing P0966: string...
Marek Kurdej [Thu, 26 Nov 2020 09:07:16 +0000 (10:07 +0100)]
[libc++] [P0966] [C++20] Fix bug PR45368 by correctly implementing P0966: string::reserve should not shrink.

This patch fixes the implementation as well as the tests that didn't actually test the wanted behaviour.
You'll find all the details in the bug report.
It adds as well deprecation warning for reserve() (without argument) and adds a test.

http://wg21.link/P0966R1
https://bugs.llvm.org/show_bug.cgi?id=45368
https://reviews.llvm.org/D54992

Reviewed By: ldionne, #libc

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

3 years ago[AMDGPU] Introduce and use isGFX10Plus. NFC.
Jay Foad [Wed, 25 Nov 2020 11:51:23 +0000 (11:51 +0000)]
[AMDGPU] Introduce and use isGFX10Plus. NFC.

It's more future-proof to use isGFX10Plus from the start, on the
assumption that future architectures will be based on current
architectures.

Also make use of the existing isGFX9Plus in a few places.

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

3 years ago[libc++] [docs] Migrate C++ status pages to RestructuredText (RST).
Marek Kurdej [Thu, 26 Nov 2020 08:03:50 +0000 (09:03 +0100)]
[libc++] [docs] Migrate C++ status pages to RestructuredText (RST).

Currently, papers and issues are in separate .csv files (that is easier to update), but I can put them inline.Transforming current html tables into rst are done by the script (attached to the patch FYI but I'll remove it before committing).
I'll of course update RST files before committing to match any modifications that may happen in master branch.

This patch moves the status pages in www/ to RST format in docs/.

It also does some other minor changes: fix copyright year and broken comment end, adds substitutions for coherence (and add colors, but that can be removed easily).
It adds as well redirects from old to new status pages.

Reviewed By: ldionne, #libc

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

3 years ago[lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction"
Raphael Isemann [Thu, 26 Nov 2020 08:40:02 +0000 (09:40 +0100)]
[lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction"

After cf1c774d6ace59c5adc9ab71b31e762c1be695b1, Clang seems to generate code
that is more similar to icc/Clang, so we can use the same line numbers for
all compilers in this test.

3 years ago[clangd] Do not treat line as inactive if skipped range ends at character position 0
Nathan Ridge [Thu, 26 Nov 2020 02:31:09 +0000 (21:31 -0500)]
[clangd] Do not treat line as inactive if skipped range ends at character position 0

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

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

3 years agoFix use-of-uninitialized-value in rG75f50e15bf8f
Zhengyang Liu [Thu, 26 Nov 2020 07:10:36 +0000 (00:10 -0700)]
Fix use-of-uninitialized-value in rG75f50e15bf8f

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

3 years ago[libc++] [www] Fix HTML. NFC.
Marek Kurdej [Thu, 26 Nov 2020 08:31:20 +0000 (09:31 +0100)]
[libc++] [www] Fix HTML. NFC.

Needed for a future automatic update to RST.

3 years ago[OpenMP][OMPT] Fix building with OMPT disabled after 6d3b81664a4b79
Martin Storsjö [Thu, 26 Nov 2020 08:09:32 +0000 (10:09 +0200)]
[OpenMP][OMPT] Fix building with OMPT disabled after 6d3b81664a4b79

3 years ago[libc++] [libc++abi] Mark a few tests as unsupported/xfail on gcc-7/8/9.
Marek Kurdej [Thu, 26 Nov 2020 07:58:44 +0000 (08:58 +0100)]
[libc++] [libc++abi] Mark a few tests as unsupported/xfail on gcc-7/8/9.

This should make the builder http://lab.llvm.org:8011/#/builders/101/ happy.
It uses gcc-9 and not Tip-Of-Trunk as its name indicates BTW.
GCC-10 passes all these tests.

Fix gcc warnings: -Wsign-compare, -Wparentheses, -Wpragmas.

Reviewed By: ldionne, #libc, #libc_abi

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

3 years ago[Support] Use llvm::is_contained (NFC)
Kazu Hirata [Thu, 26 Nov 2020 07:52:52 +0000 (23:52 -0800)]
[Support] Use llvm::is_contained (NFC)

3 years ago[llvm-readobj] - Fix a warning.
Georgii Rymar [Thu, 26 Nov 2020 07:22:29 +0000 (10:22 +0300)]
[llvm-readobj] - Fix a warning.

This addresses post review comment for D92018.

The warning was:

```
error: loop variable 'Note' is always a copy because the range of type 'iterator_range<llvm::object::ELFFile<llvm::object::ELFType<llvm::support::big, true> >::Elf_Note_Iterator>' (aka 'iterator_range<Elf_Note_Iterator_Impl<ELFType<(llvm::support::endianness)0U, true> > >') does not return a reference [-Werror,-Wrange-loop-analysis]
      for (const typename ELFT::Note &Note : Obj.notes(S, Err))
```

3 years ago[SCEV] Use isKnownPredicateAt in isLoopBackedgeGuardedByCond
Max Kazantsev [Thu, 26 Nov 2020 06:20:02 +0000 (13:20 +0700)]
[SCEV] Use isKnownPredicateAt in isLoopBackedgeGuardedByCond

A piece of code in `isLoopBackedgeGuardedByCond` basically duplicates
the dominators traversal from `isBlockEntryGuardedByCond` called from
`isKnownPredicateAt`, but it's less powerful because it does not give context
to `isImpliedCond`. This patch reuses the `isKnownPredicateAt `function there,
reducing the amount of code duplication and making it more powerful.

Differential Revision: https://reviews.llvm.org/D92152
Reviewed By: skatkov

3 years ago[RISCV] Add isel pattern to match (i64 (sra (shl X, 32), C)) to SRAIW if C > 32.
Craig Topper [Thu, 26 Nov 2020 05:31:41 +0000 (21:31 -0800)]
[RISCV] Add isel pattern to match (i64 (sra (shl X, 32), C)) to SRAIW if C > 32.

3 years ago[IndVars] Use isLoopBackedgeGuardedByCond for last iteration check
Max Kazantsev [Thu, 26 Nov 2020 05:34:55 +0000 (12:34 +0700)]
[IndVars] Use isLoopBackedgeGuardedByCond for last iteration check

Use more context to prove contextual facts about the last iteration. It is
only executed when the backedge is taken, so we can use `isLoopBackedgeGuardedByCond`
to make this check.

Differential Revision: https://reviews.llvm.org/D91535
Reviewed By: skatkov

3 years ago[RISCV] Remove unused PatFrag argument from the tablegen class used for c.beqz/c...
Craig Topper [Thu, 26 Nov 2020 04:35:23 +0000 (20:35 -0800)]
[RISCV] Remove unused PatFrag argument from the tablegen class used for c.beqz/c.bnez. NFC

3 years ago[LegalizerTypes] Add support for scalarizing the operand of an FP_EXTEND when the...
Craig Topper [Thu, 26 Nov 2020 03:12:46 +0000 (19:12 -0800)]
[LegalizerTypes] Add support for scalarizing the operand of an FP_EXTEND when the result type is legal.

3 years ago[LoopLoadElim] Make sure all loops are in simplify form. PR48150
Max Kazantsev [Thu, 26 Nov 2020 03:49:44 +0000 (10:49 +0700)]
[LoopLoadElim] Make sure all loops are in simplify form. PR48150

LoopLoadElim may end up expanding an AddRec from a loop
which is not the current loop. This loop may not be in simplify
form. We figure it out after the no-return point, so cannot bail
in this case.

AddRec requires simplify form to expand. The only way to ensure
this does not crash is to simplify all loops beforehand.

The issue only exists in new PM. Old PM requests LoopSimplify
required pass and it simplifies all loops before the opt begins.

Differential Revision: https://reviews.llvm.org/D91525
Reviewed By: asbirlea, aeubanks

3 years ago[mlir][Python] Add additional capsule interop types.
Stella Laurenzo [Thu, 26 Nov 2020 01:45:58 +0000 (17:45 -0800)]
[mlir][Python] Add additional capsule interop types.

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

3 years ago[lld][WebAssembly] Ensure stub symbols always get address 0
Sam Clegg [Mon, 23 Nov 2020 23:41:07 +0000 (15:41 -0800)]
[lld][WebAssembly] Ensure stub symbols always get address 0

Without this extra flag we can't distingish between stub functions and
functions that happen to have address 0 (relative to __table_base).

Adding this flag bit the base symbol class actually avoids growing the
SymbolUnion struct which would not be true if we added it to the
FunctionSymbol subclass (due to bitbacking).

The previous approach of setting it's table index to zero worked for
normal static relocations but not for `-fPIC` code.

See https://github.com/emscripten-core/emscripten/issues/12819

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

3 years ago[gn build] sync script: try to make a loop clearer
Nico Weber [Thu, 26 Nov 2020 02:11:50 +0000 (21:11 -0500)]
[gn build] sync script: try to make a loop clearer

We want to find 'sources = [', but only if it's not the prefix
of 'sources = []' -- we're looking for a non-empty list.

No behavior change.

3 years ago[gn build] sync script: only compute tokloc when adding files
Nico Weber [Thu, 26 Nov 2020 02:05:11 +0000 (21:05 -0500)]
[gn build] sync script: only compute tokloc when adding files

No behavior change, but maybe a bit clearer.

3 years ago[gn build] sync script: handle multiple source lists if only deleting
Nico Weber [Thu, 26 Nov 2020 01:56:03 +0000 (20:56 -0500)]
[gn build] sync script: handle multiple source lists if only deleting

With this, changes like b534beabeed3ba can be merged automatically.

3 years ago[clangd] Collect main file refs by default
Nathan Ridge [Tue, 24 Nov 2020 01:59:36 +0000 (20:59 -0500)]
[clangd] Collect main file refs by default

This is needed for call hierarchy to be able to find callers of
main-file-only functions.

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

3 years ago[mlir][sparse] add ability to select pointer/index storage type
Aart Bik [Wed, 25 Nov 2020 20:29:05 +0000 (12:29 -0800)]
[mlir][sparse] add ability to select pointer/index storage type

This change gives sparse compiler clients more control over selecting
individual types for the pointers and indices in the sparse storage schemes.
Narrower width obviously results in smaller memory footprints, but the
range should always suffice for the maximum number of entries or index value.

Reviewed By: penpornk

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

3 years ago[gn build] (manually) port b534beabeed3ba
Nico Weber [Thu, 26 Nov 2020 01:19:46 +0000 (20:19 -0500)]
[gn build] (manually) port b534beabeed3ba

3 years agoPart of C++ DR 39: a class member lookup is not ambiguous if it finds the
Richard Smith [Thu, 26 Nov 2020 01:00:23 +0000 (17:00 -0800)]
Part of C++ DR 39: a class member lookup is not ambiguous if it finds the
same type in multiple base classes.

Not even if the type is introduced by distinct declarations (for
example, two typedef declarations, or a typedef and a class definition).

3 years agoAdding PoisonValue for representing poison value explicitly in IR
Zhengyang Liu [Tue, 24 Nov 2020 21:55:24 +0000 (14:55 -0700)]
Adding PoisonValue for representing poison value explicitly in IR

Define ConstantData::PoisonValue.
Add support for poison value to LLLexer/LLParser/BitcodeReader/BitcodeWriter.
Add support for poison value to llvm-c interface.
Add support for poison value to OCaml binding.
Add m_Poison in PatternMatch.

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

3 years agoRefactor and simplify class scope name lookup.
Richard Smith [Wed, 25 Nov 2020 23:22:51 +0000 (15:22 -0800)]
Refactor and simplify class scope name lookup.

This is partly in preparation for an upcoming change that can change the
order in which DeclContext lookup results are presented.

In passing, fix some obvious errors where name lookup's notion of a
"static member function" missed static member function templates, and
where its notion of "same set of declarations" was confused by the same
declarations appearing in a different order.

3 years ago[CodeView] Avoid emitting empty debug globals subsection.
Amy Huang [Tue, 24 Nov 2020 19:26:14 +0000 (11:26 -0800)]
[CodeView] Avoid emitting empty debug globals subsection.

In https://reviews.llvm.org/D89072 I added static const data members
to the debug subsection for globals. It skipped emitting an S_CONSTANT if it
didn't have a value, which meant the subsection could be empty.

This patch fixes the empty subsection issue.

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

3 years agoRevert builtins fp16 support: tests do not pass on Mac
Reid Kleckner [Thu, 26 Nov 2020 00:08:01 +0000 (16:08 -0800)]
Revert builtins fp16 support: tests do not pass on Mac

Revert "[compiler-rt] [builtins] Support conversion between fp16 and fp128" & dependency

Revert "[compiler-rt] [builtins] Use _Float16 on extendhfsf2, truncdfhf2 __truncsfhf2 if available"

This reverts commit 7a948298813c913841a36ed0b460db0856fe7082.

This reverts commit 1fb91fcf9cfe849c7e9996597c491306e34e7abc.

3 years ago[NFC] Fix pattern name.
Sean Silva [Thu, 26 Nov 2020 00:10:34 +0000 (16:10 -0800)]
[NFC] Fix pattern name.

It still had the old name from before ElementwiseMappable was added.

3 years ago[RISCV] Add an implementation of isFMAFasterThanFMulAndFAdd
Craig Topper [Wed, 25 Nov 2020 23:07:34 +0000 (15:07 -0800)]
[RISCV] Add an implementation of isFMAFasterThanFMulAndFAdd

Start with an assumption that FMA is faster than Fmul+FAdd. If thats not true
on some particular implementation we can add a tuning parameter in the future.

I've update the fmuladd test cases and added new test cases for fast math flag
based contraction.

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

3 years ago[SelectionDAGBuilder] Add SPF_NABS support to visitSelect
Craig Topper [Wed, 25 Nov 2020 22:54:26 +0000 (14:54 -0800)]
[SelectionDAGBuilder] Add SPF_NABS support to visitSelect

We currently don't match this which limits the effectiveness of D91120 until
InstCombine starts canonicalizing to llvm.abs. This should be easy to remove
if/when we remove the SPF_ABS handling.

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

3 years agogithub actions: Use llvmbot token for main branch sync
Tom Stellard [Wed, 25 Nov 2020 22:43:18 +0000 (14:43 -0800)]
github actions: Use llvmbot token for main branch sync

The default github actions token cannot push to restricted branches, so we need to use a token from the llvmbot user.

3 years agoDebugInfo: remove unnecessary mtriple from test/DebugInfo/X86/abstract_origin.ll
David Blaikie [Wed, 25 Nov 2020 21:34:15 +0000 (13:34 -0800)]
DebugInfo: remove unnecessary mtriple from test/DebugInfo/X86/abstract_origin.ll

The test already specifies a triple in the IR itself.

Based on post-commit feedback from Luís Marques.

3 years ago[libc++] NFC: Reindent non-lockfree-atomics feature
Louis Dionne [Wed, 25 Nov 2020 21:14:28 +0000 (16:14 -0500)]
[libc++] NFC: Reindent non-lockfree-atomics feature

3 years ago[ms] [llvm-ml] Implement the expression expansion operator
Eric Astor [Wed, 25 Nov 2020 20:37:00 +0000 (15:37 -0500)]
[ms] [llvm-ml] Implement the expression expansion operator

In text-item contexts, %expr expands to a string containing the results of evaluating `expr`.

Reviewed By: thakis

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

3 years ago[mlir] Add build configuration for Quant unittest
Marius Brehler [Thu, 19 Nov 2020 22:21:00 +0000 (22:21 +0000)]
[mlir] Add build configuration for Quant unittest

3 years ago[RISCV] Add test cases to check that we use (smax X, (neg X)) for abs with Zbb extension.
Craig Topper [Wed, 25 Nov 2020 20:40:25 +0000 (12:40 -0800)]
[RISCV] Add test cases to check that we use (smax X, (neg X)) for abs with Zbb extension.

3 years ago[RISCV] Make SMIN/SMAX/UMIN/UMAX legal with Zbb extension.
Craig Topper [Wed, 25 Nov 2020 20:10:40 +0000 (12:10 -0800)]
[RISCV] Make SMIN/SMAX/UMIN/UMAX legal with Zbb extension.

This is the logically correct thing to do. But it generates worse
code for i32 umin/umax on the rv64 due to type legalize requesting
zext even though the arguments are sext. Maybe we can teach type
legalizer to use sext for umin/umax for RISCV.

It's also producing possibly worse code on i64 on RV32 since we
still end up with selects that become branches. But this seems
like something we could improve in type legalization or DAG combine.

Hopefully this makes D92095 work for RISCV with Zbb.

3 years ago[libc++] Factor out common logic for calling aligned allocation
Louis Dionne [Thu, 12 Nov 2020 20:14:33 +0000 (15:14 -0500)]
[libc++] Factor out common logic for calling aligned allocation

There were a couple of places where we needed to call the underlying
platform's aligned allocation/deallocation function. Instead of having
the same logic all over the place, extract the logic into a pair of
helper functions __libcpp_aligned_alloc and __libcpp_aligned_free.

The code in libcxxabi/src/fallback_malloc.cpp looks like it could be
simplified after this change -- I purposefully did not simplify it
further to keep this change as straightforward as possible, since it
is touching very important parts of the library.

Also, the changes in libcxx/src/new.cpp and libcxxabi/src/stdlib_new_delete.cpp
are basically the same -- I just kept both source files in sync.

The underlying reason for this refactoring is to make it easier to support
platforms that provide aligned allocation through C11's aligned_alloc
function instead of posix_memalign. After this change, we'll only have
to add support for that in a single place.

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

3 years ago[clangd] Track deprecation of 'member' semantic token type in LSP.
Sam McCall [Wed, 25 Nov 2020 20:31:18 +0000 (21:31 +0100)]
[clangd] Track deprecation of 'member' semantic token type in LSP.

3 years ago[MLIR][Affine] Add custom builders for AffineVectorLoadOp/AffineVectorStoreOp
Frank Laub [Wed, 25 Nov 2020 20:22:01 +0000 (20:22 +0000)]
[MLIR][Affine] Add custom builders for AffineVectorLoadOp/AffineVectorStoreOp

Adding missing custom builders for AffineVectorLoadOp & AffineVectorStoreOp. In practice, it is difficult to correctly construct these ops without these builders (because the AffineMap is not included at construction time).

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

3 years ago[MS] Add more 128bit cmpxchg intrinsics for AArch64
Reid Kleckner [Tue, 24 Nov 2020 19:50:33 +0000 (11:50 -0800)]
[MS] Add more 128bit cmpxchg intrinsics for AArch64

The MSVC STL for requires this on ARM64.
Requested in https://llvm.org/pr47099

Depends on D92061

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

3 years ago[MS] Fix double evaluation of MSVC builtin arguments
Reid Kleckner [Tue, 24 Nov 2020 22:48:05 +0000 (14:48 -0800)]
[MS] Fix double evaluation of MSVC builtin arguments

This code got quite twisted because we consider some MSVC builtins to be
target agnostic, and some to be target specific. Target specific
intrinsics have a pattern of doing up-front argument evaluation, while
general intrinsics do not evaluate their arguments up front. As we tried
to share codepaths between the target-specific and target-agnostic
handling, we ended up doing double evaluation.

Instead, have each target handle MSVC intrinsics consistently before up
front argument evaluation. This requires passing less data around and is
more consistent with target independent intrinsic handling.

See D50979 for past examples of this bug. I noticed this while looking
into adding some more intrinsics.

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

3 years ago[Hexagon] Add support for ISD::SMAX/SMIN/UMAX/UMIN instead of custom dag patterns
Simon Pilgrim [Wed, 25 Nov 2020 19:00:33 +0000 (19:00 +0000)]
[Hexagon] Add support for ISD::SMAX/SMIN/UMAX/UMIN instead of custom dag patterns

This should handle the basic integer min/max handling - the HVX ops are still TODO.

This is some necessary cleanup work for min/max ops to eventually help us move the add/sub sat patterns into DAGCombine - D91876.

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

3 years ago[RISCV] Add test cases showing that we don't recognize the select form of NABS in...
Craig Topper [Wed, 25 Nov 2020 18:42:08 +0000 (10:42 -0800)]
[RISCV] Add test cases showing that we don't recognize the select form of NABS in SelectionDAGBuilder so we end up with branches. NFC

There's a FIXME that it should produce (sub 0, (abs)).

3 years agoRemove static function unused after cf1c774.
Paul Robinson [Wed, 25 Nov 2020 18:39:09 +0000 (13:39 -0500)]
Remove static function unused after cf1c774.

Caused some -Werror bot failures.

3 years ago[CostModel][X86] Refresh ISD::ABS costs
Simon Pilgrim [Wed, 25 Nov 2020 18:39:56 +0000 (18:39 +0000)]
[CostModel][X86] Refresh ISD::ABS costs

Update costs now that D92095 and D92102 have tweaked the SSE2 implementation

The SSE42 BLENDVPD cost can actually be used on SSE41 as we don't attempt to generate PCMPGT anymore

Add scalar i16/i32/i64 costs as we can do this cheaply with CMOV