platform/upstream/llvm.git
3 years ago[mlir] Add support for adding attribute+type traits/interfaces to tablegen defs
River Riddle [Thu, 15 Apr 2021 18:29:23 +0000 (11:29 -0700)]
[mlir] Add support for adding attribute+type traits/interfaces to tablegen defs

This matches the current support provided to operations, and allows attaching traits, interfaces, and using the DeclareInterfaceMethods utility. This was missed when attribute/type generation was first added.

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

3 years ago[Hexagon] Avoid infinite loops in type legalization when lowering SETCC
Krzysztof Parzyszek [Thu, 15 Apr 2021 18:28:09 +0000 (13:28 -0500)]
[Hexagon] Avoid infinite loops in type legalization when lowering SETCC

Only widen SETCC if the operands can be widened. Not checking that caused
infinite widen-split loops in legalization.

3 years ago[flang][OpenMP] Remove `OmpEndLoopDirective` handles from code.
Sourabh Singh Tomar [Thu, 15 Apr 2021 16:25:43 +0000 (21:55 +0530)]
[flang][OpenMP] Remove `OmpEndLoopDirective` handles from code.

This directive is currently lowered as NOP.

Patch is an attempt upstream code from:
PR: https://github.com/flang-compiler/f18-llvm-project/pull/573

Reviewed By: kiranchandramohan, schweitz, clementval

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

3 years ago[RISCV] Share RVInstIShift and RVInstIShiftW instruction format classes with the...
Craig Topper [Thu, 15 Apr 2021 18:08:26 +0000 (11:08 -0700)]
[RISCV] Share RVInstIShift and RVInstIShiftW instruction format classes with the B extension.

This generalizes RVInstIShift/RVInstIShiftW to take the upper
5 or 7 bits of the immediate as an input instead of only bit 30. Then
we can share them.

For RVInstIShift I left a hardcoded 0 at bit 26 where RV128 gets
a 7th bit for the shift amount.

Reviewed By: frasercrmck

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

3 years ago[OpenMP] Added codegen for masked directive
cchen [Thu, 15 Apr 2021 17:54:15 +0000 (12:54 -0500)]
[OpenMP] Added codegen for masked directive

Reviewed By: ABataev

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

3 years ago[mlir][sparse] remove restriction on vectorization of index type
Aart Bik [Thu, 15 Apr 2021 01:53:30 +0000 (18:53 -0700)]
[mlir][sparse] remove restriction on vectorization of index type

Rationale:
Now that vector<?xindex> is allowed, the restriction on vectorization
of index types in the sparse compiler can be removed. Also needs
generalization of scatter/gather index types.

Reviewed By: gysit

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

3 years ago[clang][patch] Modify diagnostic level from err to warn: anyx86_interrupt_regsave
Melanie Blower [Wed, 14 Apr 2021 21:07:54 +0000 (17:07 -0400)]
[clang][patch] Modify diagnostic level from err to warn: anyx86_interrupt_regsave

Reviewed By: Aaron Ballman

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

3 years ago[libc++] NFC: Use ASSERT_SAME_TYPE consistently in string.h and wchar.h tests
Louis Dionne [Thu, 15 Apr 2021 17:02:23 +0000 (13:02 -0400)]
[libc++] NFC: Use ASSERT_SAME_TYPE consistently in string.h and wchar.h tests

3 years ago[libc++] Remove test suite workarounds on Apple with old Clangs
Louis Dionne [Wed, 14 Apr 2021 13:31:52 +0000 (09:31 -0400)]
[libc++] Remove test suite workarounds on Apple with old Clangs

In 5fd17ab, we worked around the Apple system headers not providing
const-correct overloads for some <string.h> functions. However, that
required an attribute that was only present in recent Clangs at the
time. We can now assume that all supported Clang versions on Apple
platforms do support that attribute.

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

3 years ago[LoopUnrollAndJam] Avoid repeated instructions for UAJ analysis
Danilo C. Grael [Thu, 15 Apr 2021 16:46:29 +0000 (12:46 -0400)]
[LoopUnrollAndJam] Avoid repeated instructions for UAJ analysis

Avoid visiting repeated instructions for processHeaderPhiOperands as it can cause a scenario of endless loop. Test case is attached and can be ran with `opt -basic-aa -tbaa -loop-unroll-and-jam  -allow-unroll-and-jam -unroll-and-jam-count=4`.

Reviewed By: dmgreen

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

3 years ago[NewPM] Cleanup IR printing instrumentation
Arthur Eubanks [Wed, 14 Apr 2021 21:52:50 +0000 (14:52 -0700)]
[NewPM] Cleanup IR printing instrumentation

Being lazy with printing the banner seems hard to reason with, we should print it
unconditionally first (it could also lead to duplicate banners if we
have multiple functions in -filter-print-funcs).

The printIR() functions were doing too many things. I separated out the
call from PrintPassInstrumentation since we were essentially doing two
completely separate things in printIR() from different callers.

There were multiple ways to generate the name of some IR. That's all
been moved to getIRName(). The printing of the IR name was also
inconsistent, now it's always "IR Dump on $foo" where "$foo" is the
name. For a function, it's the function name. For a loop, it's what's
printed by Loop::print(), which is more detailed. For an SCC, it's the
list of functions in parentheses. For a module it's "[module]", to
differentiate between a possible SCC with a function called "module".

To preserve D74814, we have to check if we're going to print anything at
all first. This is unfortunate, but I would consider this a special
case that shouldn't be handled in the core logic.

Reviewed By: jamieschmeiser

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

3 years ago[asan] Add an offset for the kernel address sanitizer on FreeBSD
Mark Johnston [Thu, 15 Apr 2021 16:24:43 +0000 (17:24 +0100)]
[asan] Add an offset for the kernel address sanitizer on FreeBSD

This is based on a port of the sanitizer runtime to the FreeBSD kernel
that has been commited as https://cgit.freebsd.org/src/commit/?id=38da497a4dfcf1979c8c2b0e9f3fa0564035c147
and the following commits.

Reviewed By: emaste, dim
Differential Revision: https://reviews.llvm.org/D98285

3 years ago[Driver] Enable kernel address and memory sanitizers on FreeBSD
Mark Johnston [Thu, 15 Apr 2021 16:24:13 +0000 (17:24 +0100)]
[Driver] Enable kernel address and memory sanitizers on FreeBSD

Test Plan: using kernel ASAN and MSAN implementations in FreeBSD

Reviewed By: emaste, dim, arichardson

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

3 years ago[PowerPC] Add ROP Protection Instructions for PowerPC
Stefan Pintilie [Thu, 15 Apr 2021 10:30:06 +0000 (05:30 -0500)]
[PowerPC] Add ROP Protection Instructions for PowerPC

There are four new PowerPC instructions that are introduced in
Power 10. They are hashst, hashchk, hashstp, hashchkp.

These instructions will be used for ROP Protection.
This patch adds the four instructions.

Reviewed By: nemanjai, amyk, #powerpc

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

3 years ago[flang] Add list input test to GTest suite
Asher Mancinelli [Tue, 30 Mar 2021 18:16:23 +0000 (11:16 -0700)]
[flang] Add list input test to GTest suite

3 years ago[libc] Add index operator[] to StringView
Guillaume Chatelet [Thu, 15 Apr 2021 15:55:37 +0000 (15:55 +0000)]
[libc] Add index operator[] to StringView

3 years ago[LSR] Fix for pre-indexed generated constant offset
Stelios Ioannou [Thu, 15 Apr 2021 15:44:42 +0000 (16:44 +0100)]
[LSR] Fix for pre-indexed generated constant offset

This patch changed the isLegalUse check to ensure that
LSRInstance::GenerateConstantOffsetsImpl generates an
offset that results in a legal addressing mode and
formula. The check is changed to look similar to the
assert check used for illegal formulas.

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

Change-Id: Iffb9e32d59df96b8f072c00f6c339108159a009a

3 years agoRevert "[DebugInfo] Replace debug uses in replaceUsesOutsideBlock"
OCHyams [Thu, 15 Apr 2021 15:34:19 +0000 (16:34 +0100)]
Revert "[DebugInfo] Replace debug uses in replaceUsesOutsideBlock"

This reverts commit 96a1e6b7cf72d9bd625903ea4b441404200383cf.

Failing build bots e.g. https://lab.llvm.org/buildbot/#/builders/161/builds/163

3 years ago[libcxx][NFC] removes BreakBeforeConceptDeclarations from .clang-format
Christopher Di Bella [Thu, 15 Apr 2021 15:27:08 +0000 (15:27 +0000)]
[libcxx][NFC] removes BreakBeforeConceptDeclarations from .clang-format

BreakBeforeConceptDeclarations is apparently breaking CI.

Partially rolls back 2e3a78b8ca10.

3 years ago[DebugInfo] Replace debug uses in replaceUsesOutsideBlock
OCHyams [Thu, 15 Apr 2021 15:05:30 +0000 (16:05 +0100)]
[DebugInfo] Replace debug uses in replaceUsesOutsideBlock

Value::replaceUsesOutsideBlock doesn't replace debug uses which leads to an
unnecessary reduction in variable location coverage. Fix this, add a unittest for
it, and add a regression test demonstrating the change through instcombine's
replacedSelectWithOperand.

Reviewed By: djtodoro

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

3 years ago[Clang][Docs] Claim the atomic compare
Shilei Tian [Thu, 15 Apr 2021 15:10:07 +0000 (11:10 -0400)]
[Clang][Docs] Claim the atomic compare

I'm working on the implementation of OpenMP 5.1 feature `atomic compare`.

Reviewed By: jdoerfert

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

3 years ago[InstCombine] update RUN lines in assume test; NFC
Sanjay Patel [Thu, 15 Apr 2021 12:34:12 +0000 (08:34 -0400)]
[InstCombine] update RUN lines in assume test; NFC

This was in a draft of from D82703, but it got left out
of the committed version, so we were not actually testing
the new code.

3 years agoFix potential infinite loop with malformed attribute syntax
Aaron Ballman [Thu, 15 Apr 2021 14:45:29 +0000 (10:45 -0400)]
Fix potential infinite loop with malformed attribute syntax

Double square bracket attribute arguments can be arbitrarily complex,
and the attribute argument parsing logic recovers by skipping tokens.
As a fallback recovery mechanism, parse recovery stops before reading a
semicolon. This could lead to an infinite loop in the attribute list
parsing logic.

3 years ago[NFC] Remove the -instcombine flag from strict-fadd.ll
Kerry McLaughlin [Thu, 15 Apr 2021 13:56:16 +0000 (14:56 +0100)]
[NFC] Remove the -instcombine flag from strict-fadd.ll

This also fixes a CHECK line in @fadd_strict_unroll which ensures the
changes made to fixReduction() to support in-order reductions with
unrolling are being tested correctly.

3 years ago[yaml2obj/obj2yaml/llvm-readobj] Support printing and parsing AVR-specific e_flags
LemonBoy [Thu, 15 Apr 2021 13:52:54 +0000 (15:52 +0200)]
[yaml2obj/obj2yaml/llvm-readobj] Support printing and parsing AVR-specific e_flags

The `e_flags` contains a mixture of bitfields and regular ones, ensure all of them can be serialized and deserialized.

Reviewed By: MaskRay

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

3 years ago[TableGen] [docs] Correct a reference in the TableGen Overview document
Paul C. Anagnostopoulos [Tue, 13 Apr 2021 13:36:46 +0000 (09:36 -0400)]
[TableGen] [docs] Correct a reference in the TableGen Overview document

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

3 years ago[AMDGPU] Fix large return values with amdgpu_gfx
Sebastian Neubauer [Thu, 1 Apr 2021 08:20:05 +0000 (10:20 +0200)]
[AMDGPU] Fix large return values with amdgpu_gfx

Returning in memory is not supported, so fall back to sret.
Also, extend i1 and i16 to i32. Otherwise, they would be passed through
memory.

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

3 years ago[X86] combineCMP - fold cmpEQ/NE(TRUNC(X),0) -> cmpEQ/NE(X,0)
Simon Pilgrim [Thu, 15 Apr 2021 12:55:32 +0000 (13:55 +0100)]
[X86] combineCMP - fold cmpEQ/NE(TRUNC(X),0) -> cmpEQ/NE(X,0)

If we are truncating from a i32 source before comparing the result against zero, then see if we can directly compare the source value against zero.

If the upper (truncated) bits are known to be zero then we can compare against that, hopefully increasing the chances of us folding the compare into a EFLAG result of the source's operation.

Fixes PR49028.

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

3 years ago[AArch64][NEON] Match (or (and -a b) (and (a+1) b)) => bit select
Bradley Smith [Mon, 12 Apr 2021 12:06:25 +0000 (13:06 +0100)]
[AArch64][NEON] Match (or (and -a b) (and (a+1) b)) => bit select

With this patch vbslq_f32(vnegq_s32(a), b, c) lowers to a BIT instruction.

Co-authored-by: Paul Walker <paul.walker@arm.com>
Differential Revision: https://reviews.llvm.org/D100304

3 years ago[clangd] Only allow remote index to be enabled from user config.
Sam McCall [Thu, 15 Apr 2021 10:52:58 +0000 (12:52 +0200)]
[clangd] Only allow remote index to be enabled from user config.

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

3 years agoFix bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel
Alex Orlov [Thu, 15 Apr 2021 11:06:20 +0000 (15:06 +0400)]
Fix bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel

This fixes the following bugs:
https://bugs.llvm.org/show_bug.cgi?id=27249
https://bugs.llvm.org/show_bug.cgi?id=46414

Reviewed By: MaskRay

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

3 years ago[VPlan] Add VPRecipeBase::mayHaveSideEffects.
Florian Hahn [Thu, 15 Apr 2021 09:42:40 +0000 (10:42 +0100)]
[VPlan] Add VPRecipeBase::mayHaveSideEffects.

Add an initial version of a helper to determine whether a recipe may
have side-effects.

Reviewed By: a.elovikov

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

3 years ago[lldb] Fix incorrect test data in FileSpecTest.IsRelative
Raphael Isemann [Thu, 15 Apr 2021 08:02:51 +0000 (10:02 +0200)]
[lldb] Fix incorrect test data in FileSpecTest.IsRelative

Found by clang-tidy's bugprone-suspicious-missing-comma.

3 years agoadd test case for ignoring -flto=auto and -flto=jobserver
Matthias Klose [Thu, 15 Apr 2021 10:18:25 +0000 (12:18 +0200)]
add test case for ignoring -flto=auto and -flto=jobserver

as requested in https://reviews.llvm.org/D99501, test that the two new options are ignored.

Reviewed By: tejohnson, fhahn

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

3 years ago[DAGCombiner] Fold step_vector with add/mul/shl
Jun Ma [Thu, 8 Apr 2021 05:09:24 +0000 (13:09 +0800)]
[DAGCombiner] Fold step_vector with add/mul/shl

This patch implements some DAG combines for STEP_VECTOR:
add step_vector(C1), step_vector(C2) -> step_vector(C1+C2)
add (add X step_vector(C1)), step_vector(C2) -> add X step_vector(C1+C2)
mul step_vector(C1), C2 -> step_vector(C1*C2)
shl step_vector(C1), C2 -> step_vector(C1<<C2)

TestPlan: check-llvm

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

3 years ago[SVE][LoopVectorize] Fix crash in InnerLoopVectorizer::widenPHIInstruction
David Sherwood [Tue, 23 Mar 2021 16:28:09 +0000 (16:28 +0000)]
[SVE][LoopVectorize] Fix crash in InnerLoopVectorizer::widenPHIInstruction

There were a few places in widenPHIInstruction where calculations of
offsets were failing to take the runtime calculation of VF into
account for scalable vectors. I've fixed those cases in this patch
as well as adding an assert that we should not be scalarising for
scalable vectors.

Tests are added here:

  Transforms/LoopVectorize/AArch64/sve-widen-phi.ll

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

3 years ago[RISCV] Pre-commit vector shuffle test cases
Fraser Cormack [Wed, 14 Apr 2021 08:18:36 +0000 (09:18 +0100)]
[RISCV] Pre-commit vector shuffle test cases

This codegen will be improved by future patches.

3 years ago[AA] Updates for D95543.
dfukalov [Tue, 13 Apr 2021 17:00:12 +0000 (20:00 +0300)]
[AA] Updates for D95543.

Addressing latter comments in D95543:
- `AliasResult::Result` renamed to `AliasResult::Kind`
- Offset printing added for `PartialAlias` case in `-aa-eval`
- Removed VisitedPhiBBs check from BasicAA'

Reviewed By: nikic

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

3 years ago[AArch64] Use type-legalization cost for code size memop cost.
Florian Hahn [Thu, 15 Apr 2021 08:22:32 +0000 (09:22 +0100)]
[AArch64] Use type-legalization cost for code size memop cost.

At the moment, getMemoryOpCost returns 1 for all inputs if CostKind is
CodeSize or SizeAndLatency. This fools LoopUnroll into thinking memory
operations on large vectors have a cost of one, even if they will get
expanded to a large number of memory operations in the backend.

This patch updates getMemoryOpCost to return the cost for the type
legalization for both CodeSize and SizeAndLatency. This should more
accurately reflect the number of memory operations required.

I am not sure how latency should properly be included in SizeAndLatency
from the description, but returning the size cost should be clearly more
accurate.

This does not cause any binary changes when building
MultiSource/SPEC2000/SPEC2006 with -O3 -flto for AArch64, likely because
large vector memops are not really formed by code emitted from Clang.
But using the C/C++ matrix extension can easily result in code with very
large vector operations directly from Clang, e.g.
https://clang.godbolt.org/z/6xzxcTGvb

Reviewed By: samparker

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

3 years agoNFC put the armv6m entry with the other Cortex-M entries
Jason Molenda [Thu, 15 Apr 2021 09:00:36 +0000 (02:00 -0700)]
NFC put the armv6m entry with the other Cortex-M entries

The armv6m entry in cores_match() got separated from its
friends armv7m and armv7em.  Reuniting them to make it
easier to keep them updated in all at the same time.

3 years ago[flang] Update the regression tests to use the new driver when enabled
Andrzej Warzynski [Mon, 12 Apr 2021 12:27:49 +0000 (12:27 +0000)]
[flang] Update the regression tests to use the new driver when enabled

This patch updates most of the remaining regression tests (~400) to use
`flang-new` rather then `f18` when `FLANG_BUILD_NEW_DRIVER` is set.
This allows us to share more Flang regression tests between `f18` and
`flang-new`. A handful of tests have not been ported yet - these are
currently either failing or not supported by the new driver.

Summary of changes:
  * RUN lines in tests are updated to use `%flang_fc1` instead of `%f18`
  * option spellings in tests are updated to forms accepted by both `f18` and
    `flang-new`
  * variables in Bash scripts are renamed (e.g. F18 --> FLANG_FC1)
The updated tests will now be run with the new driver, `flang-new`,
whenever it is enabled (i.e when `FLANG_BUILD_NEW_DRIVER` is set).

Although this patch touches many files, vast majority of the changes are
automatic:
```
grep -IEZlr "%f18" flang/test/ | xargs -0 -l sed -i 's/%f18/%flang_fc1/g
```

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

3 years ago[NFC][LoopVectorize] Remove unnecessary VF.isScalable asserts
David Sherwood [Fri, 26 Mar 2021 10:43:00 +0000 (10:43 +0000)]
[NFC][LoopVectorize] Remove unnecessary VF.isScalable asserts

There are a few places in LoopVectorize.cpp where we have been too
cautious in adding VF.isScalable() asserts and it can be confusing.
It also makes it more difficult to see the genuine places where
work needs doing to improve scalable vectorization support.

This patch changes getMemInstScalarizationCost to return an
invalid cost instead of firing an assert for scalable vectors. Also,
vectorizeInterleaveGroup had multiple asserts all for the same
thing. I have removed all but one assert near the start of the
function, and added a new assert that we aren't dealing with masks
for scalable vectors.

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

3 years ago[clang][deps] NFC: Improve documentation
Jan Svoboda [Wed, 14 Apr 2021 12:56:20 +0000 (14:56 +0200)]
[clang][deps] NFC: Improve documentation

Fix typos and simplify wording

3 years agoMark armv6m compat with armv7em; match armv7em being compat with armv6m
Jason Molenda [Thu, 15 Apr 2021 08:28:58 +0000 (01:28 -0700)]
Mark armv6m compat with armv7em; match armv7em being compat with armv6m

armv7em and armv6m in ArchSpec cores_match() will return true.
There was a small bug where the reverse order would not return true.

rdar://76387176

3 years agoAdd convenient composed tsan constants
Martijn Vels [Thu, 15 Apr 2021 07:03:05 +0000 (09:03 +0200)]
Add convenient composed tsan constants

This change adds convenient composed constants to be used for tsan_read_try_lock annotations, reducing the boilerplate at the instrumentation site.

Reviewed By: dvyukov

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

3 years ago[AArch64] Fix windows vararg functions with floats in the fixed args
Martin Storsjö [Sat, 10 Apr 2021 04:40:33 +0000 (07:40 +0300)]
[AArch64] Fix windows vararg functions with floats in the fixed args

On Windows, float arguments are normally passed in float registers
in the calling convention for regular functions. For variable
argument functions, floats are passed in integer registers. This
already was done correctly since many years.

However, the surprising bit was that floats among the fixed arguments
also are supposed to be passed in integer registers, contrary to regular
functions. (This also seems to be the behaviour on ARM though, both
on Windows, but also on e.g. hardfloat linux.)

In the calling convention, don't promote shorter floats to f64, but
convert them to integers of the same length. (Floats passed as part of
the actual variable arguments are promoted to double already on the
C/Clang level; the LLVM vararg calling convention doesn't do any
extra promotion of f32 to f64 - this matches how it works on X86 too.)

Technically, this is an ABI break compared to older LLVM versions,
but it fixes compatibility with the official platform ABI. (In practice,
floats among the fixed arguments in variable argument functions is
a pretty rare construct.)

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

3 years ago[clang] [test] Share patterns in CodeGen/ms_abi_aarch64.c between cases. NFC.
Martin Storsjö [Wed, 14 Apr 2021 11:54:42 +0000 (14:54 +0300)]
[clang] [test] Share patterns in CodeGen/ms_abi_aarch64.c between cases. NFC.

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

3 years agoReland "[lit] Handle plain negations directly in the internal shell"
Martin Storsjö [Thu, 18 Mar 2021 07:44:01 +0000 (09:44 +0200)]
Reland "[lit] Handle plain negations directly in the internal shell"

Keep running "not --crash" via the external "not" executable, but
for plain negations, and for cases that use the shell "!" operator,
just skip that argument and invert the return code.

The libcxx tests only use the shell operator "!" for negations,
never the "not" executable, because libcxx tests can be run without
having a fully built llvm tree available providing the "not"
executable.

This allows using the internal shell for libcxx tests.

It should be possible to reland this now that D99938 fixed the
one test failure in clang-tidy that broke when "not" was handled
internally, letting lit/python execute grep.exe directly instead
of via not.exe. (See D99330 and D99406 for more commentery on the
exact issue that broke and other potential ways of fixing it.)

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

3 years agoRevert "[SCEV] Don't walk uses of phis without SCEV expression when forgetting"
Nikita Popov [Thu, 15 Apr 2021 07:43:52 +0000 (09:43 +0200)]
Revert "[SCEV] Don't walk uses of phis without SCEV expression when forgetting"

This reverts commit faf9f11589ce892b31d271917cf840f8ca903221.

Issues with this patch have been reported in
https://reviews.llvm.org/D100264#2689917 and
https://bugs.llvm.org/show_bug.cgi?id=49967.

3 years ago[NewGVN] Add phi-of-ops operands if no real PHI is created.
Florian Hahn [Thu, 15 Apr 2021 07:25:10 +0000 (08:25 +0100)]
[NewGVN] Add phi-of-ops operands if no real PHI is created.

If the PHI-of-ops simplifies to an existing value, no real PHI is
created, which means the dependencies between the
PHI-of-ops and its operands is not materialized in IR. At the
moment, we fail to create a real PHI node for the PHI-of-ops,
because the PHI-of-ops root instruction is not re-visited if
one of the PHI-of-ops operands changes. We need to add the
operands as additional users in this case.

Even with this patch, there are still some dependencies
missing. I will continue tackling the outstanding
reporeted crashes in this area.

Fixes PR36501, PR42422, PR42557.

Reviewed By: asbirlea

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

3 years ago[RISCV] Add a PatFrag to shorten repeated (XLenVT (VLOp GPR:$vl)) in V extension...
Craig Topper [Thu, 15 Apr 2021 05:31:35 +0000 (22:31 -0700)]
[RISCV] Add a PatFrag to shorten repeated (XLenVT (VLOp GPR:$vl)) in V extension patterns.

Reduces the amount of changes needed in D100288.

3 years ago[RISCV][Clang] Add vmv and vfmv series intrinsic functions.
Zakk Chen [Sun, 11 Apr 2021 13:50:57 +0000 (06:50 -0700)]
[RISCV][Clang] Add vmv and vfmv series intrinsic functions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper, Jim

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

3 years ago[scudo] Restore zxtest compatibility
Vitaly Buka [Tue, 13 Apr 2021 23:44:06 +0000 (16:44 -0700)]
[scudo] Restore zxtest compatibility

Reviewed By: cryptoad

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

3 years agoFix the build of `mlir-doc` (again)
Mehdi Amini [Thu, 15 Apr 2021 05:17:04 +0000 (05:17 +0000)]
Fix the build of `mlir-doc` (again)

This is more fallout from add_mlir_doc() API change

3 years ago[Test] Propagate nofree attribute from function to calls
Max Kazantsev [Thu, 15 Apr 2021 04:49:48 +0000 (11:49 +0700)]
[Test] Propagate nofree attribute from function to calls

3 years agoFix Interface doc generation after recent change to add_mlir_doc() API
Mehdi Amini [Thu, 15 Apr 2021 04:14:33 +0000 (04:14 +0000)]
Fix Interface doc generation after recent change to add_mlir_doc() API

This is basically fixing the build of `mlir-doc`

3 years ago[AMDGPU] Disable forceful inline of non-kernel functions which use LDS.
hsmahesha [Thu, 15 Apr 2021 03:42:46 +0000 (09:12 +0530)]
[AMDGPU] Disable forceful inline of non-kernel functions which use LDS.

Now since LDS uses within non-kernel functions are being handled in the
pass - LowerModuleLDS, we *NO* need to *forcefully* inline non-kernel
functions just because they use LDS. Do forceful inlining only when the
pass - LowerModuleLDS is not enabled. It is enabled by default.

Reviewed By: JonChesterfield

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

3 years agoChange add_mlir_doc CMake macro to take the tablegen command as last argument to...
Mehdi Amini [Thu, 15 Apr 2021 01:04:59 +0000 (01:04 +0000)]
Change add_mlir_doc CMake macro to take the tablegen command as last argument to allow extra flags

This is useful for expressing specific table-gen options, like selecting
a particular dialect to print.
Use it to fix the documentation for the `pdl_interp` dialect which is now
generating the first dialect it finds in its input which is `pdl`.

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

3 years ago[libcxx][NFC] adjusts formatting rules
Christopher Di Bella [Wed, 31 Mar 2021 22:46:28 +0000 (22:46 +0000)]
[libcxx][NFC] adjusts formatting rules

This will reduce the amount of noisy feedback during reviews.

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

3 years agofix comment typos to cycle bots
Nico Weber [Thu, 15 Apr 2021 02:12:56 +0000 (22:12 -0400)]
fix comment typos to cycle bots

3 years ago[gn build] Port b7459a10dad1
LLVM GN Syncbot [Thu, 15 Apr 2021 01:52:03 +0000 (01:52 +0000)]
[gn build] Port b7459a10dad1

3 years ago[lldb] Simplify output for skipped categories in dotest.py
Jonas Devlieghere [Thu, 15 Apr 2021 01:49:57 +0000 (18:49 -0700)]
[lldb] Simplify output for skipped categories in dotest.py

Print a single line listing all the categories that are being skipped,
rather than relying on the check.*Support() functions specifying why a
particular category will be skipped. If we know why a category got
skipped, still print that in verbose mode.

The motivation for this change is that sometimes engineers misidentify
the output of these messages as the cause for a test failure (e.g. not
being able to build libc++ or libstdc++).

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

3 years ago[DWARF] Fix crash for DWARFDie::dump.
Alexander Yermolovich [Thu, 15 Apr 2021 00:04:19 +0000 (17:04 -0700)]
[DWARF] Fix crash for DWARFDie::dump.

When DIE is extracted manually, the DieArray is empty. When dump is invoked on aforementioned DIE it tries to extract child, even if Dump options say otherwise. Resulting in crash.

Reviewed By: dblaikie

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

3 years agoRevert "Simplify BitVector code"
Sterling Augustine [Thu, 15 Apr 2021 01:03:58 +0000 (18:03 -0700)]
Revert "Simplify BitVector code"

This reverts commit 82f0e3d3ea6bf927e3397b2fb423abbc5821a30f.

The change breaks the asan buildbots.

https://lab.llvm.org/buildbot/#/builders/99/builds/2835

3 years ago[llvm-objdump] try to fix section-filter.test in full builds after 51aa61e74bdb
Nico Weber [Thu, 15 Apr 2021 00:58:51 +0000 (20:58 -0400)]
[llvm-objdump] try to fix section-filter.test in full builds after 51aa61e74bdb

3 years ago[llvm-objdump] try to fix hexagon tests more after 51aa61e74bdb
Nico Weber [Thu, 15 Apr 2021 00:50:03 +0000 (20:50 -0400)]
[llvm-objdump] try to fix hexagon tests more after 51aa61e74bdb

3 years ago[llvm-objdump] try to fix hexagon and riscv tests after 1035123ac50db
Nico Weber [Thu, 15 Apr 2021 00:39:52 +0000 (20:39 -0400)]
[llvm-objdump] try to fix hexagon and riscv tests after 1035123ac50db

3 years ago[hwasan] Fix lock contention on thread creation.
Evgenii Stepanov [Mon, 12 Apr 2021 20:35:32 +0000 (13:35 -0700)]
[hwasan] Fix lock contention on thread creation.

Do not hold the free/live thread list lock longer than necessary.
This change speeds up the following benchmark 10x.

constexpr int kTopThreads = 50;
constexpr int kChildThreads = 20;
constexpr int kChildIterations = 8;

void Thread() {
  for (int i = 0; i < kChildIterations; ++i) {
    std::vector<std::thread> threads;
    for (int i = 0; i < kChildThreads; ++i)
      threads.emplace_back([](){});
    for (auto& t : threads)
      t.join();
  }
}

int main() {
  std::vector<std::thread> threads;
  for (int i = 0; i < kTopThreads; ++i)
    threads.emplace_back(Thread);
  for (auto& t : threads)
    t.join();
}

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

3 years ago[llvm-objdump] Switch command-line parsing from llvm::cl to OptTable
Nico Weber [Tue, 13 Apr 2021 02:31:08 +0000 (22:31 -0400)]
[llvm-objdump] Switch command-line parsing from llvm::cl to OptTable

This is similar to D83530, but for llvm-objdump.

The motivation is the desire to add an `llvm-otool` symlink to
llvm-objdump that behaves like macOS's `otool`, using the same
technique the at llvm-objcopy uses to behave like `strip` (etc).

This change for the most part preserves behavior. In some cases,
it increases compatibility with GNU objdump a bit. For example,
the long options now require two dashes, and the long options
taking arguments for the most part now require a `=` in front
of the value. Exceptions are flags where tests passed the
value separately, for these the separate form is kept as
an alias to the = form.

The one-letter short form args are now joined or separate
and long longer accept a =, which also matches GNU objdump.

cl::opt<>s in libraries now have to be explicitly plumbed
through. This patch does that for --x86-asm-syntax=, but
there's hope that we can remove that again.

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

3 years ago[Sema] Fold VLA types in compound literals to constant arrays.
Eli Friedman [Wed, 10 Mar 2021 18:51:00 +0000 (10:51 -0800)]
[Sema] Fold VLA types in compound literals to constant arrays.

Similar to variables with an initializer, this is never valid in
standard C, so we can safely constant-fold as an extension.  I ran into
this construct in a couple proprietary codebases.

While I'm here, drive-by fix for 090dd647: we should only fold variables
with VLA types, not arbitrary variably modified types.

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

3 years agoReapply "[InferAttributes] Materialize all infered attributes for declaration"" and...
Philip Reames [Wed, 14 Apr 2021 23:06:25 +0000 (16:06 -0700)]
Reapply "[InferAttributes] Materialize all infered attributes for declaration"" and follow on patches.

This reverts commit ab98f2c7129a52e216fd7e088b964cf4af27b0f2 and 98eea392cdbcdb7360e58b46e9329573f092cd96.

It includes a fix for the clang test which triggered the revert.  I failed to notice this one because there was another AMDGPU llvm test with a similiar name and the exact same text in the error message.  Odd.  Since only one build bot reported the clang test, I didn't notice that one.

3 years ago[LLLDB] Adding additional check LibCppStdFunctionCallableInfo based on crash reports
Shafik Yaghmour [Wed, 14 Apr 2021 23:25:23 +0000 (16:25 -0700)]
[LLLDB] Adding additional check LibCppStdFunctionCallableInfo based on crash reports

We have seen several crashes in LibCppStdFunctionCallableInfo(...) but we don't have a
reproducer. The last crash pointed to last call to line_entry_helper(...) and symbol
was a nullptr. So adding a check for this case.

3 years ago[AST][Introspection] Fix args not being set.
Nathan James [Wed, 14 Apr 2021 23:19:40 +0000 (00:19 +0100)]
[AST][Introspection] Fix args not being set.

This field isn't set in the constructor.
Tweak its accessor to return an ArrayRef.

3 years ago[AST][NFC] Remove temporary ASTTU file from Introspection generation.
Nathan James [Wed, 14 Apr 2021 23:14:52 +0000 (00:14 +0100)]
[AST][NFC] Remove temporary ASTTU file from Introspection generation.

We can use the Preprocessor to remap this file, cleaning up the cmake code.

Reviewed By: steveire

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

3 years ago[AST] Use IntrusiveRefCntPtr for Introspection LocationCall.
Nathan James [Wed, 14 Apr 2021 23:12:21 +0000 (00:12 +0100)]
[AST] Use IntrusiveRefCntPtr for Introspection LocationCall.

Reviewed By: steveire

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

3 years ago[libcxx][nfc] Assign [ranges.primitives] in "RangesStatus."
zoecarver [Wed, 14 Apr 2021 23:09:45 +0000 (16:09 -0700)]
[libcxx][nfc] Assign [ranges.primitives] in "RangesStatus."

3 years agoRevert "Fix buildbots after 61a85da"
Nico Weber [Wed, 14 Apr 2021 22:47:46 +0000 (18:47 -0400)]
Revert "Fix buildbots after 61a85da"

This reverts commit c609d533634416fc701939d39bf1e43f293e84dc.
61a85da was reverted in ab98f2c7

3 years agoRevert "[InferAttributes] Materialize all infered attributes for declaration"
Nico Weber [Wed, 14 Apr 2021 22:41:02 +0000 (18:41 -0400)]
Revert "[InferAttributes] Materialize all infered attributes for declaration"

Breaks check-clang, see comments on D100400

Also revert follow-up "[NFC] Move a recently added utility into a location to enable reuse"

This reverts commit 3ce61fb6d697d49db471c7077b88b3b9ec9dec66.
This reverts commit 61a85da88235983da565bda0160367461fa0f382.

3 years agoNFC: Remove condition to simplify code
Stephen Kelly [Thu, 25 Mar 2021 14:11:38 +0000 (14:11 +0000)]
NFC: Remove condition to simplify code

The run method is only called if there is a match with a binding.

3 years agoFix buildbots after 61a85da
Philip Reames [Wed, 14 Apr 2021 22:15:54 +0000 (15:15 -0700)]
Fix buildbots after 61a85da

3 years ago[flang] Fix typo caught by clang build
peter klausler [Wed, 14 Apr 2021 21:59:59 +0000 (14:59 -0700)]
[flang] Fix typo caught by clang build

An inadvertent ! operator was (fortunately) flagged as a
warning by clang; remove it.

Differential Review: https://reviews.llvm.org/D100513

3 years ago[NFC] Move a recently added utility into a location to enable reuse
Philip Reames [Wed, 14 Apr 2021 22:05:16 +0000 (15:05 -0700)]
[NFC] Move a recently added utility into a location to enable reuse

About to refresh a patch that uses this in FunctionAtrrs, doing the move seperately to control build times.

3 years ago[InferAttributes] Materialize all infered attributes for declaration
Philip Reames [Wed, 14 Apr 2021 21:43:53 +0000 (14:43 -0700)]
[InferAttributes] Materialize all infered attributes for declaration

We have some cases today where attributes can be inferred from another on access, but the result is not explicitly materialized in IR. This change is a step towards changing that.

Why? Two main reasons:

* Human clarity. It's really confusing trying to figure out why a transform is triggering when the IR doesn't appear to have the required attributes.
* This avoids the need to special case declarations in e.g. functionattrs. Since we can assume the attribute is present, we can work directly from attributes (and only attributes) without also needing to query accessors on Function to avoid missing cases due to unannotated (but infered on use) declarations. (This piece will appear must easier to follow once D100226 also lands.)

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

3 years ago[mlir] Fix passArg of ViewOpGraphPass
Chia-hung Duan [Wed, 14 Apr 2021 21:41:55 +0000 (14:41 -0700)]
[mlir] Fix passArg of ViewOpGraphPass

Reviewed By: jpienaar

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

3 years agoUse PassPipelineCLParser in mlir-reduce
Chia-hung Duan [Wed, 14 Apr 2021 21:34:17 +0000 (14:34 -0700)]
Use PassPipelineCLParser in mlir-reduce

We are able to config the reducer pass pipeline through command-line.

Reviewed By: jpienaar, rriddle

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

3 years ago[lldb] Add addressing_bits to KNOWN_HOST_INFO_KEYS and sort the list
Jonas Devlieghere [Wed, 14 Apr 2021 21:14:54 +0000 (14:14 -0700)]
[lldb] Add addressing_bits to KNOWN_HOST_INFO_KEYS and sort the list

This fixes TestGdbRemoteHostInfo on Apple Silicon.

3 years ago[WebAssembly] Codegen for i64x2.extend_{low,high}_i32x4_{s,u}
Thomas Lively [Wed, 14 Apr 2021 20:43:09 +0000 (13:43 -0700)]
[WebAssembly] Codegen for i64x2.extend_{low,high}_i32x4_{s,u}

Removes the builtins and intrinsics used to opt in to using these instructions
and replaces them with normal ISel patterns now that they are no longer
prototypes.

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

3 years agoRefactor the architecture of mlir-reduce
Chia-hung Duan [Wed, 14 Apr 2021 20:19:36 +0000 (13:19 -0700)]
Refactor the architecture of mlir-reduce

Add iterator for ReductionNode traversal and use range to indicate the
region we would like to keep. Refactor the interaction between
Pass/Tester/ReductionNode.
Now it'll be easier to add new traversal type and OpReducer

Reviewed By: jpienaar, rriddle

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

3 years ago[AST] Add introspection support for more base nodes
Stephen Kelly [Wed, 17 Mar 2021 22:56:39 +0000 (22:56 +0000)]
[AST] Add introspection support for more base nodes

Fix the logic of detecting pseudo-virtual getBeginLoc etc on Stmt and
Decl subclasses.

Adjust the test infrastructure to filter out invalid source locations.
This makes the tests more clear about which nodes have which locations.

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

3 years agoMake test runnable on read-only file systems.
Sterling Augustine [Wed, 14 Apr 2021 20:28:57 +0000 (13:28 -0700)]
Make test runnable on read-only file systems.

3 years ago[AST] Replace asserts with a condition
Stephen Kelly [Wed, 14 Apr 2021 18:03:33 +0000 (19:03 +0100)]
[AST] Replace asserts with a condition

As was done for other locations in commit 54272e5b (NFC:
Replace asserts with if() in SourceLocation accessors, 2019-01-07).

Extracted from  https://reviews.llvm.org/D99231

3 years ago[lldb-vscode] Reduce chattiness of progress events
Walter Erquinigo [Wed, 14 Apr 2021 04:45:03 +0000 (21:45 -0700)]
[lldb-vscode] Reduce chattiness of progress events

Progress events internally have a completed count and a total count, which can mean that for a job with 20000 total counts, then there will be 20000 events fired. Sending all these events to the IDE can break it. For example, debugging a huge binary resulted in around 50 million messages, which rendered the IDE useless, as it was spending all of its resources simply parsing messages and updating the UI.

A way to fix this is to send unique percentage updates, which are at most 100 per job, which is not much. I was able to debug that big target and confirm that only unique percentage notifications are sent. I can't write a test for this because the current test is flaky. I'll figure out later how to make the test reliable, but fixing this will unblock us from deploy a new version of lldb-vscode.

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

3 years ago[mlir] Use default lli JIT in Integration tests
Emilio Cota [Wed, 14 Apr 2021 19:42:09 +0000 (12:42 -0700)]
[mlir] Use default lli JIT in Integration tests

Now that 9b8e7a9d ("[lli] Honor the --entry-function flag in orc and
orc-lazy modes") fixed https://llvm.org/PR49906.

Reviewed By: mehdi_amini, aartbik

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

3 years agoSimplify BitVector code
serge-sans-paille [Tue, 13 Apr 2021 14:14:32 +0000 (16:14 +0200)]
Simplify BitVector code

Instead of managing memory by hand, delegate it to std::vector. This makes the
code much simpler, and also avoids repeatedly computing the storage size.

According to valgrind --tool=callgrind, this also slightly decreases the
instruction count, but by a small margin.

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

3 years agoRevert "Refactor the architecture of mlir-reduce"
Mehdi Amini [Wed, 14 Apr 2021 19:25:43 +0000 (19:25 +0000)]
Revert "Refactor the architecture of mlir-reduce"

This reverts commit a32846b1d0147f30f6dde4bfec453cd681937005.

The build is broken with -DBUILD_SHARED_LIBS=ON:

tools/mlir/lib/Reducer/CMakeFiles/obj.MLIRReduce.dir/Tester.cpp.o: In function `mlir::Tester::isInteresting(mlir::ModuleOp) const':
Tester.cpp:(.text._ZNK4mlir6Tester13isInterestingENS_8ModuleOpE+0xa8): undefined reference to `mlir::OpPrintingFlags::OpPrintingFlags()'
Tester.cpp:(.text._ZNK4mlir6Tester13isInterestingENS_8ModuleOpE+0xc6): undefined reference to `mlir::Operation::print(llvm::raw_ostream&, mlir::OpPrintingFlags)'

3 years agoUpdate OpBase.td AttrDef class to define default value for returnType and convertFrom...
Mehdi Amini [Tue, 13 Apr 2021 00:46:48 +0000 (00:46 +0000)]
Update OpBase.td AttrDef class to define default value for returnType and convertFromStorage (NFC)

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

3 years ago[lldb] Only override target arch if it is compatible
Fred Riss [Wed, 6 May 2020 00:49:24 +0000 (17:49 -0700)]
[lldb] Only override target arch if it is compatible

It looks like the goal of this code is to provide a more precise
architecture definition for the target when attaching to a process. When
attaching to a foreign debugserver, you might get into a situation where
the active (host) platform will give you bogus information on the target
process.

This change allows the platform to override the target arch only with a
compatible architecture. This fixes TestTargetXMLArch.py on Apple
Silicon. Another alternative would be to just fail in this scenario and
update the test(s).

3 years ago[lldb/test] Remove the "expect_captures" feature of lldb-server tests
Pavel Labath [Tue, 13 Apr 2021 16:02:20 +0000 (18:02 +0200)]
[lldb/test] Remove the "expect_captures" feature of lldb-server tests

This functionality is used exactly once, and it is trivial to implement
it differently (capture into two distinct variables, and compare for
equality afterwards).

3 years ago[lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs
Pavel Labath [Tue, 13 Apr 2021 14:07:28 +0000 (16:07 +0200)]
[lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs

These were in the shared llgs+platform code, but they only make sense
for llgs (as they deal with how the server reports information about
debugged processes).

3 years agofix typo to cycle bots
Nico Weber [Wed, 14 Apr 2021 18:59:18 +0000 (14:59 -0400)]
fix typo to cycle bots