lldb.git
2 years ago[lld-macho] Add missing search-paths-darwin.test
Greg McGary [Thu, 18 Jun 2020 03:49:46 +0000 (20:49 -0700)]
[lld-macho] Add missing search-paths-darwin.test

Summary: Forgot to `git add` it when patching D80677

2 years ago[lld-macho] Handle framework search path, alongside library search path
Greg McGary [Thu, 18 Jun 2020 02:59:27 +0000 (19:59 -0700)]
[lld-macho] Handle framework search path, alongside library search path

Summary:
Add front-end support for `lld::macho::Configuration::frameworkSearchPath`.

Depends on D80582.

Reviewers: ruiu, pcc, MaskRay, smeenai, int3, Ktwu, alexshap, christylee

Reviewed By: int3

Subscribers: ormris, llvm-commits

Tags: #llvm

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

2 years ago[lld-macho] Handle alignment correctly when merging InputSections
Jez Ng [Sun, 14 Jun 2020 03:06:29 +0000 (20:06 -0700)]
[lld-macho] Handle alignment correctly when merging InputSections

Summary:
Previously, we weren't updating isecAddr when aligning InputSections,
resulting in truncated sections under the right conditions.

Reviewers: #lld-macho, compnerd

Reviewed By: #lld-macho, compnerd

Subscribers: smeenai, compnerd, llvm-commits

Tags: #llvm

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

2 years ago[lld-macho] Ensure __bss sections we output have file offset of zero
Jez Ng [Sun, 14 Jun 2020 03:00:36 +0000 (20:00 -0700)]
[lld-macho] Ensure __bss sections we output have file offset of zero

Summary:
llvm-mc emits `__bss` sections with an offset of zero, but we weren't expecting
that in our input, so we were copying non-zero data from the start of the file and
putting it in `__bss`, with obviously undesirable runtime results. (It appears that
the kernel will copy those nonzero bytes as long as the offset is nonzero, regardless
of whether S_ZERO_FILL is set.)

I debated on whether to make a special ZeroFillSection -- separate from a
regular InputSection -- but it seemed like too much work for now. But I'm happy
to refactor if anyone feels strongly about having it as a separate class.

Depends on D80857.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Reviewed By: smeenai

Subscribers: llvm-commits

Tags: #llvm

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

2 years ago[lld-macho] Handle GOT relocations of non-dylib symbols
Jez Ng [Sun, 14 Jun 2020 03:00:06 +0000 (20:00 -0700)]
[lld-macho] Handle GOT relocations of non-dylib symbols

Summary:
Turns out this case is actually really common -- it happens whenever there's
a reference to an `extern` variable that ends up statically linked.

Depends on D80856.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Reviewed By: smeenai

Subscribers: llvm-commits

Tags: #llvm

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

2 years ago[lld-macho] Support X86_64_RELOC_GOT
Jez Ng [Sun, 14 Jun 2020 02:58:15 +0000 (19:58 -0700)]
[lld-macho] Support X86_64_RELOC_GOT

Summary:
As far as I can tell, it's identical to _GOT_LOAD. llvm-mc has the following
comment explaining why _GOT exists:

```
// x86_64 distinguishes movq foo@GOTPCREL so that the linker can
// rewrite the movq to an leaq at link time if the symbol ends up in
// the same linkage unit.
```

Depends on D80855.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Reviewed By: MaskRay, smeenai

Subscribers: llvm-commits

Tags: #llvm

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

2 years ago[lld-macho] Support non-pcrel section relocs
Jez Ng [Sun, 14 Jun 2020 02:56:04 +0000 (19:56 -0700)]
[lld-macho] Support non-pcrel section relocs

Summary: Depends on D80854.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Subscribers: llvm-commits

Tags: #llvm

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

2 years ago[lld-macho] Avoid explicit -arch in tests by defaulting to x86-64
Jez Ng [Wed, 17 Jun 2020 00:52:45 +0000 (17:52 -0700)]
[lld-macho] Avoid explicit -arch in tests by defaulting to x86-64

Summary:
As mentioned in https://reviews.llvm.org/D81326#2093931, I'm not sure it
makes sense to use the default target triple to determine -arch.
Long-term we should probably detect it from the input object files, but
in the meantime it would be nice not to have to add it to all our tests
by using a convenient default.

Reviewers: #lld-macho

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

2 years agoRemove "unused" member ModuleSlice from `struct OpenMPOpt`
Mehdi Amini [Wed, 17 Jun 2020 17:22:54 +0000 (17:22 +0000)]
Remove "unused" member ModuleSlice from `struct OpenMPOpt`

This is fixing warning from clang:

 warning: private field 'ModuleSlice' is not used [-Wunused-private-field]
  SmallPtrSetImpl<Function *> &ModuleSlice;
                               ^

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

2 years ago[PowerPC] Don't convert Loop to CTR Loop for fp128 BinaryOperator
Kang Zhang [Thu, 18 Jun 2020 02:54:19 +0000 (02:54 +0000)]
[PowerPC] Don't convert Loop to CTR Loop for fp128 BinaryOperator

Summary:
For PPC BinaryOperator of fp128 will become libcall, we shouldn't
convert loop to CTR loop if the loop contain libCall.

But currently, in the PPCTTIImpl::mightUseCTR() function, we only deal
with BinaryOperator for ppc_fp128, don't deal with the fp128.

Reviewed By: shchenz

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

2 years ago[ObjectYAML][ELF] Add support for emitting the .debug_abbrev section.
Xing GUO [Wed, 17 Jun 2020 08:10:58 +0000 (16:10 +0800)]
[ObjectYAML][ELF] Add support for emitting the .debug_abbrev section.

This patch enables yaml2elf emit the .debug_abbrev section.

The generated .debug_abbrev is verified using `llvm-dwarfdump`.

Known issues that will be addressed later:
- Current implementation doesn't support generating multiple abbreviation tables in one .debug_abbrev section.

Reviewed By: jhenderson, grimar

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

2 years ago[PowerPC] Custom lower rotl v1i128 to vector_shuffle.
Esme-Yi [Thu, 18 Jun 2020 01:32:23 +0000 (01:32 +0000)]
[PowerPC] Custom lower rotl v1i128 to vector_shuffle.

Summary: A bug is reported in bugzilla-45628, where the swap_with_shift case can’t be matched to a single HW instruction xxswapd as expected.
In fact the case matches the idiom of rotate. We have MatchRotate to handle an ‘or’ of two operands and generate a rot[lr] if the case matches the idiom of rotate. While PPC doesn’t support ROTL v1i128. We can custom lower ROTL v1i128 to the vector_shuffle. The vector_shuffle will be matched to a single HW instruction during the phase of instruction selection.

Reviewed By: steven.zhang

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

2 years ago[ELF] Improve --export-dynamic-symbol performance by checking whether wildcard is...
Fangrui Song [Thu, 18 Jun 2020 00:11:38 +0000 (17:11 -0700)]
[ELF] Improve --export-dynamic-symbol performance by checking whether wildcard is really used

A hasWildcard pattern iterates over symVector, which can be slow when there
are many --export-dynamic-symbol. In optimistic cases, most patterns don't use
a wildcard character. hasWildcard: false can avoid a symbol table iteration.

While here, add two tests using `[` and `?`, respectively.

2 years ago[WebAssembly] MC: Fix for data aliases with offsets (getelementptr)
Sam Clegg [Wed, 29 Apr 2020 22:38:11 +0000 (15:38 -0700)]
[WebAssembly] MC: Fix for data aliases with offsets (getelementptr)

For some reason we hadn't seen such cases in the wild which makes
me think that clang and rustc don't generate these.  In the bug which
reproduces it only occurs with LTO so my guess is that some LTO pass
is creating this alias + gep.

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

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

2 years ago[Driver] Search computed sysroot for libc++ header paths
Ryan Prichard [Thu, 11 Jun 2020 00:08:04 +0000 (17:08 -0700)]
[Driver] Search computed sysroot for libc++ header paths

Summary:
The Android NDK's clang driver is used with an Android -target setting,
and the driver automatically finds the Android sysroot at a path
relative to the driver. The sysroot has the libc++ headers in it.

Remove Hurd::computeSysRoot as it is equivalent to the new
ToolChain::computeSysRoot method.

Fixes PR46213.

Reviewers: srhines, danalbert, #libc, kristina

Reviewed By: srhines, danalbert

Subscribers: ldionne, sthibaul, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits

Tags: #clang

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

2 years agoAMDGPU: Don't use 16-bit FP inline constants in integer operands
Matt Arsenault [Sun, 14 Jun 2020 17:09:02 +0000 (13:09 -0400)]
AMDGPU: Don't use 16-bit FP inline constants in integer operands

It seems to be a hardware defect that the half inline constants do not
work as expected for the 16-bit integer operations (the inverse does
work correctly). Experimentation seems to show these are really
reading the 32-bit inline constants, which can be observed by writing
inline asm using op_sel to see what's in the high half of the
constant. Theoretically we could fold the high halves of the 32-bit
constants using op_sel.

The *_asm_all.s MC tests are broken, and I don't know where the script
to autogenerate these are. I started manually fixing it, but there's
just too many cases to fix. This also does break the
assembler/disassembler support for these values, and I'm not sure what
to do about it. These are still valid encodings, so it seems like you
should be able to use them in some way. If you wrote assembly using
them, you could have really meant it (perhaps to read the high bits
with op_sel?). The disassembler will print the invalid literal
constant which will fail to re-assemble. The behavior is also
different depending on the use context. Consider this example, which
was previously accepted and encoded using the inline constant:

  v_mad_i16 v5, v1, -4.0, v3
  ; encoding: [0x05,0x00,0xec,0xd1,0x01,0xef,0x0d,0x04]

In contexts where an inline immediate is required (such as on gfx8/9),
this will now be rejected. For gfx10, this will produce the literal
encoding and change the printed format:
  v_mad_i16 v5, v1, 0xc400, v3
  ; encoding: [0x05,0x00,0x5e,0xd7,0x01,0xff,0x0d,0x04,0x00,0xc4,0x00,0x00]

This is just another variation of the issue that we don't perfectly
handle round trip assembly/disassembly due to not tracking how
immediates were encoded. This doesn't matter much in practice, since
compilers don't emit the suboptimal encoding. I doubt any users are
relying on this behavior (although I did make use of the old behavior
to figure out what was wrong).

Fixes bug 46302.

2 years agoRevert "When performing a substitution into a dependent alias template, mark the"
Richard Smith [Wed, 17 Jun 2020 23:07:58 +0000 (16:07 -0700)]
Revert "When performing a substitution into a dependent alias template, mark the"

This change depends on reverted change c7fbe2191b8b9cd64570ed3906d1bed1dd5fff8e.

This reverts commit c851d6cf4a4ab803d01d0059f4659f4f9f4435ea.

2 years agoRevert "Fix rejects-valid when referencing an implicit operator== from within a"
Richard Smith [Wed, 17 Jun 2020 23:05:04 +0000 (16:05 -0700)]
Revert "Fix rejects-valid when referencing an implicit operator== from within a"

This change may have caused some self-host failures. Reverting while
investigating.

This reverts commit c7fbe2191b8b9cd64570ed3906d1bed1dd5fff8e.

2 years ago[flang] More Fortran runtime support for CHARACTER operations
peter klausler [Wed, 17 Jun 2020 20:17:24 +0000 (13:17 -0700)]
[flang] More Fortran runtime support for CHARACTER operations

Summary:
- Remove C++ library dependence from lock.h
- Implement LEN_TRIM, REPEAT, ADJUSTL, ADJUSTR, MAX/MIN
  intrinsic functions for CHARACTER

Reviewers: tskeith, PeteSteinfeld, sscalpone, schweitz, DavidTruby

Reviewed By: PeteSteinfeld

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

2 years ago[mlir][Inliner] Properly handle callgraph node deletion
River Riddle [Wed, 17 Jun 2020 20:13:48 +0000 (13:13 -0700)]
[mlir][Inliner] Properly handle callgraph node deletion

We previously weren't properly updating the SCC iterator when nodes were removed, leading to asan failures in certain situations. This commit adds a CallGraphSCC class and defers operation deletion until inlining has finished.

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

2 years ago[mlir][spirv] Add MatrixTimesScalar operation
HazemAbdelhafez [Tue, 16 Jun 2020 01:50:18 +0000 (21:50 -0400)]
[mlir][spirv] Add MatrixTimesScalar operation

Summary:
- Define the MatrixTimesScalar operation and add roundtrip tests.
- Added a new base class for matrix-specific operations to avoid invalid operands type mismatch check.
- Created a separate Matrix arithmetic operations td file to add more operations in the future.
- Augmented the automatically generated verify method to print more fine-grained error messages.
- Made minor Updates to the matrix type tests.

Reviewers: antiagainst, rriddle, mravishankar

Reviewed By: antiagainst

Subscribers: mehdi_amini, jpienaar, shauheen, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, bader, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

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

2 years ago[CUDA] make the test more hermetic
Artem Belevich [Wed, 17 Jun 2020 22:20:46 +0000 (15:20 -0700)]
[CUDA] make the test more hermetic

Otherwise the -Werror tests fail if the locally installed CUDA version found by
the driver is newer than 10.1 and produces a warning.

2 years ago[clang-format] NFC 3% improvement in the overall clang-formatted status
mydeveloperday [Wed, 17 Jun 2020 22:14:32 +0000 (23:14 +0100)]
[clang-format] NFC 3% improvement in the overall clang-formatted status

Update Clang-Formatted Formatted status

2 years ago[BPF] fix a bug for BTF pointee type pruning
Yonghong Song [Wed, 17 Jun 2020 17:13:00 +0000 (10:13 -0700)]
[BPF] fix a bug for BTF pointee type pruning

In BTF, pointee type pruning is used to reduce cluttering
too many unused types into prog BTF. For example,
   struct task_struct {
      ...
      struct mm_struct *mm;
      ...
   }
If bpf program does not access members of "struct mm_struct",
there is no need to bring types for "struct mm_struct" to BTF.

This patch fixed a bug where an incorrect pruning happened.
The test case like below:
    struct t;
    typedef struct t _t;
    struct s1 { _t *c; };
    int test1(struct s1 *arg) { ... }

    struct t { int a; int b; };
    struct s2 { _t c; }
    int test2(struct s2 *arg) { ... }

After processing test1(), among others, BPF backend generates BTF types for
    "struct s1", "_t" and a placeholder for "struct t".
Note that "struct t" is not really generated. If later a direct access
to "struct t" member happened, "struct t" BTF type will be generated
properly.

During processing test2(), when processing member type "_t c",
BPF backend sees type "_t" already generated, so returned.
This caused the problem that "struct t" BTF type is never generated and
eventually causing incorrect type definition for "struct s2".

To fix the issue, during DebugInfo type traversal, even if a
typedef/const/volatile/restrict derived type has been recorded in BTF,
if it is not a type pruning candidate, type traversal of its base type continues.

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

2 years agoWhen performing a substitution into a dependent alias template, mark the
Richard Smith [Wed, 17 Jun 2020 21:49:03 +0000 (14:49 -0700)]
When performing a substitution into a dependent alias template, mark the
outer levels as retained rather than omitting their arguments.

This better reflects what's going on (we're performing a substitution
while still inside a template). In theory this is also more correct, but
I've not found a testcase where it matters in practice (largely because
we don't allow alias templates to be declared inside a function).

2 years agoFix rejects-valid when referencing an implicit operator== from within a
Richard Smith [Wed, 17 Jun 2020 21:06:11 +0000 (14:06 -0700)]
Fix rejects-valid when referencing an implicit operator== from within a
templated class.

When a defaulted operator<=> results in the injection of a defaulted
operator==, that operator== can be named by unqualified name within the
same class, even if the class is templated. To make this work, perform
the transform from defaulted operator<=> to defaulted operator== in the
template definition context instead of the template instantiation
context.

This results in our substituting into a declaration from a context where
we don't have a full list of template arguments (or indeed any), for
which we are now more careful to not spuriously instantiate declarations
that are not dependent on the arguments we're substituting.

2 years ago[MLIR][SPIRVToLLVM] Support cast ops, some logical ops, UModOp
George Mitenkov [Wed, 17 Jun 2020 21:42:27 +0000 (17:42 -0400)]
[MLIR][SPIRVToLLVM] Support cast ops, some logical ops, UModOp

Added support of simple logical ops: `LogicalAnd`, `LogicalOr`,
`LogicalEqual` and `LogicalNotEqual`. Added a missing conversion
for `UMod` op.

Also, implemented SPIR-V cast ops conversion. There are 4 simple
case where there is a clear equivalent in LLVM (e.g. `ConvertFToS`
is `fptosi`). For `FConvert`, `SConvert` and `UConvert` we
distinguish between truncation and extension based on the bit
width of the operand.

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

2 years agoRevert "Remove unused class variable ModuleSlice." as it was
Eric Christopher [Wed, 17 Jun 2020 21:45:17 +0000 (14:45 -0700)]
Revert "Remove unused class variable ModuleSlice." as it was
used in debug only code.

This reverts commit 07a1749081bac07515d357fd96165662031de527.

2 years ago[flang] Fix fallout from varous changes to the cmake files.
Eric Schweitz [Wed, 17 Jun 2020 20:09:07 +0000 (13:09 -0700)]
[flang] Fix fallout from varous changes to the cmake files.

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

2 years agoRemove unused class variable ModuleSlice.
Eric Christopher [Wed, 17 Jun 2020 19:31:42 +0000 (12:31 -0700)]
Remove unused class variable ModuleSlice.

2 years ago[MLIR] Fix parallel loop tiling.
Stephan Herhut [Wed, 17 Jun 2020 14:22:07 +0000 (16:22 +0200)]
[MLIR] Fix parallel loop tiling.

Summary:
Parallel loop tiling did not properly compute the updated loop
indices when tiling, which lead to wrong results.

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

2 years ago[SVE] Eliminate bad VectorType::getNumElements() calls from ConstantFold
Christopher Tetreault [Wed, 17 Jun 2020 21:12:48 +0000 (14:12 -0700)]
[SVE] Eliminate bad VectorType::getNumElements() calls from ConstantFold

Summary:
Assume all usages of this function are explicitly fixed-width operations
and cast to FixedVectorType

Reviewers: efriedma, sdesmalen, c-rhodes, majnemer, dblaikie

Reviewed By: sdesmalen

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

Tags: #llvm

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

2 years ago[SVE] Fix invalid usages of getNumElements in ShuffleVectorInstruction
Christopher Tetreault [Wed, 17 Jun 2020 19:30:44 +0000 (12:30 -0700)]
[SVE] Fix invalid usages of getNumElements in ShuffleVectorInstruction

Summary:
Fix invalid usages of getNumElements identified by test case
LLVM.Transforms/InstCombine::vscale_extractelement.ll.

changesLength: Since the length of the llvm::SmallVector shufflemask
is related to the minimum number of elements in a scalable vector, it is
fine to just get the Min field of the ElementCount

isIdentityWithExtract: Since it is not possible to express the mask
needed for this pattern for scalable vectors, we can just bail before
calling getNumElements()

Reviewers: efriedma, sdesmalen, fpetrogalli, gchatelet, yrouban, craig.topper

Reviewed By: sdesmalen

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

Tags: #llvm

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

2 years ago[NFC] Use llvm::hasSingleElement() in place of .size() == 1
Rahul Joshi [Wed, 17 Jun 2020 20:20:36 +0000 (13:20 -0700)]
[NFC] Use llvm::hasSingleElement() in place of .size() == 1

- Also use functions in Region instead of Region::getBlocks() where possible.

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

2 years agoRemove code duplication from RegisterContextPOSIX_*
Muhammad Omair Javaid [Wed, 17 Jun 2020 19:59:27 +0000 (00:59 +0500)]
Remove code duplication from RegisterContextPOSIX_*

Summary:
This patch aims to remove multiple copies of GetByteOrder() and ConvertRegisterKindToRegisterNumber used in various versions of RegisterContextPOSIX_*.

Both register implementations are move to RegisterContext class which is parent of RegisterContextPOSIX_* classes.

Built and tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabihf targets.

Reviewers: labath

Reviewed By: labath

Subscribers: wuzish, nemanjai, kristof.beyls, kbarton, atanasyan, lldb-commits

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

2 years ago[NFC] Silence compiler warning [-Wmissing-braces].
Huihui Zhang [Wed, 17 Jun 2020 19:53:49 +0000 (12:53 -0700)]
[NFC] Silence compiler warning [-Wmissing-braces].

clang/lib/CodeGen/CGNonTrivialStruct.cpp:330:7: warning: suggest braces around initialization of subobject [-Wmissing-braces]
  Address(CGF->Builder.CreateLoad(CGF->GetAddrOfLocalVar(Args[Ints])),
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  {

2 years ago[Driver] Delete CC1 -fxray-function-index and clean up some tests
Fangrui Song [Wed, 17 Jun 2020 19:59:02 +0000 (12:59 -0700)]
[Driver] Delete CC1 -fxray-function-index and clean up some tests

2 years ago[InstCombine] Negator: while there, add detection for cycles during negation
Roman Lebedev [Wed, 17 Jun 2020 19:33:44 +0000 (22:33 +0300)]
[InstCombine] Negator: while there, add detection for cycles during negation

I don't have any testcases showing it happening,
and i haven't succeeded in creating one,
but i'm also not positive it can't ever happen,
and i recall having something that looked like
that in the very beginning of Negator creation.

But since we now already have a negation cache,
we can now detect such cases practically for free.

Let's do so instead of "relying" on stack overflow :D

2 years ago[InstCombine] Negator: cache negation results (PR46362)
Roman Lebedev [Wed, 17 Jun 2020 18:37:19 +0000 (21:37 +0300)]
[InstCombine] Negator: cache negation results (PR46362)

It is possible that we can try to negate the same value multiple times.
For example, PHI nodes may happen to have multiple incoming values
(all of which must be the same value) for the same incoming basic block.
It may happen that we try to negate such a PHI node, and succeed,
and that might result in having now-different incoming values..

To avoid that, and in general to reduce the amount of duplicated
work we might be doing, let's introduce a cache where
we'll track results of negating each value.

The added test was previously failing -verify after -instcombine.

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

2 years ago[NFC][InstCombine] Negator: add thin negate() wrapped before visit()
Roman Lebedev [Wed, 17 Jun 2020 16:52:48 +0000 (19:52 +0300)]
[NFC][InstCombine] Negator: add thin negate() wrapped before visit()

2 years ago[NFC][InstCombine] Negator: do not include unneeded "llvm/IR/DerivedTypes.h" header
Roman Lebedev [Wed, 17 Jun 2020 18:16:45 +0000 (21:16 +0300)]
[NFC][InstCombine] Negator: do not include unneeded "llvm/IR/DerivedTypes.h" header

2 years ago[WebAssembly] Fix bug in FixBrTables and use branch analysis utils
Thomas Lively [Wed, 17 Jun 2020 19:34:45 +0000 (12:34 -0700)]
[WebAssembly] Fix bug in FixBrTables and use branch analysis utils

Summary:
This commit fixes a bug in the FixBrTables pass in which an
unconditional branch from the switch header block to the jump table
block was not removed before the blocks were combined. The result was
an invalid CFG in the MachineFunction. This commit also switches from
using bespoke branch analysis and deletion code to using the standard
utilities for the same.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

2 years agoRevert 'This is a test commit - ded57e1a06a6ba
Ronak Chauhan [Wed, 17 Jun 2020 19:33:42 +0000 (01:03 +0530)]
Revert 'This is a test commit - ded57e1a06a6ba

2 years agoThis is a test commit
Ronak Chauhan [Wed, 17 Jun 2020 19:31:19 +0000 (01:01 +0530)]
This is a test commit

2 years ago[clang-tidy] Prune dead code. NFC.
Benjamin Kramer [Wed, 17 Jun 2020 19:16:59 +0000 (21:16 +0200)]
[clang-tidy] Prune dead code. NFC.

2 years ago[flang] Fix out-of-tree builds
Tim Keith [Wed, 17 Jun 2020 19:01:59 +0000 (12:01 -0700)]
[flang] Fix out-of-tree builds

Replace two MLIR dependencies with MLIRLinalgOps.

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

2 years agoRevert "[OpenMP][NFC] Added DeviceID and Event pointer to __tgt_async_info"
Shilei Tian [Wed, 17 Jun 2020 19:01:16 +0000 (15:01 -0400)]
Revert "[OpenMP][NFC] Added DeviceID and Event pointer to __tgt_async_info"

This reverts commit ee1bf45e1d42d7f386d8321c3a8799476344ad91.

2 years ago[InlineSpiller] add assert about spills post terminators
Nick Desaulniers [Wed, 17 Jun 2020 18:51:51 +0000 (11:51 -0700)]
[InlineSpiller] add assert about spills post terminators

Summary:
This invariant is being violated in the test case
https://reviews.llvm.org/D77849, related to the use of the relatively
new ability for callbr to have return values, and MachineBasicBlocks
with INLINEASM_BR terminators to emit live out register defs.

As noted in the comment, this triggers invariant violations in
MachineVerifier via `llc -verify-machineinstrs` or
`llc -verify-regalloc`, since only MachineInstrs that are terminators
are allowed to follow the first terminator.

https://reviews.llvm.org/D75098 may rework this very assertion if we're
spilling via a (proposed) TCOPY MachineInstr.

Reviewers: void, efriedma, arsenm

Reviewed By: efriedma

Subscribers: qcolombet, wdng, hiraditya, llvm-commits, srhines

Tags: #llvm

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

2 years ago[clang-tidy][NFC] Remove the double look-up on IncludeInserter
Nathan James [Wed, 17 Jun 2020 18:48:12 +0000 (19:48 +0100)]
[clang-tidy][NFC] Remove the double look-up on IncludeInserter

Refactor out the double lookup in `IncludeInserter` when trying to get the `IncludeSorter` for a specified `FileID`.

Reviewed By: aaron.ballman

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

2 years agoBreakCriticalEdges for callbr indirect dests
Nick Desaulniers [Wed, 17 Jun 2020 18:37:31 +0000 (11:37 -0700)]
BreakCriticalEdges for callbr indirect dests

Summary:
llvm::SplitEdge was failing an assertion that the BasicBlock only had
one successor (for BasicBlocks terminated by CallBrInst, we typically
have multiple successors).  It was surprising that the earlier call to
SplitCriticalEdge did not handle the critical edge (there was an early
return).  Removing that triggered another assertion relating to creating
a BlockAddress for a BasicBlock that did not (yet) have a parent, which
is a simple order of operations issue in llvm::SplitCriticalEdge (a
freshly constructed BasicBlock must be inserted into a Function's basic
block list to have a parent).

Thanks to @nathanchance for the report.
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1018

Reviewers: craig.topper, jyknight, void, fhahn, efriedma

Reviewed By: efriedma

Subscribers: eli.friedman, rnk, efriedma, fhahn, hiraditya, llvm-commits, nathanchance, srhines

Tags: #llvm

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

2 years ago[mlir] [VectorOps] Add create mask integration tests
aartbik [Tue, 16 Jun 2020 19:15:40 +0000 (12:15 -0700)]
[mlir] [VectorOps] Add create mask integration tests

Summary:
Two integration tests focused on i1 vectors, which exposed omissions
in the llvm backend which have since then been fixed. Note that this also
exposed an inaccuracy for print_i1 which has been fixed in this CL:
for a pure C ABI, int should be used rather than bool.

Reviewers: nicolasvasilache, ftynse, reidtatge, andydavis1, bkramer

Reviewed By: bkramer

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

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

2 years ago[libc][benchmarks] Link the memory benchmark exes to functions from LLVM libc.
Siva Chandra Reddy [Mon, 15 Jun 2020 20:54:53 +0000 (13:54 -0700)]
[libc][benchmarks] Link the memory benchmark exes to functions from LLVM libc.

Summary:
To get the target order correct, the benchmarks directory has been moved
one level higher. Previously, it was living in the utils directory. The
utils directory is a collection of utils which are to be used by the
tests and implementations. However, benchmarks *use* the
implementations. So, moving it out of utils helps us setup proper
target level dependencies.

Reviewers: gchatelet

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

2 years ago[lit] Avoid re-iterating result codes in different places
Julian Lettner [Wed, 17 Jun 2020 18:25:25 +0000 (11:25 -0700)]
[lit] Avoid re-iterating result codes in different places

Let's have one canonical place to define ResultCode instances and their
labels.

Also make ResultCode's `__init__` function self-registering to better
support custom ResultCodes.

2 years ago[OpenMP][NFC] Added DeviceID and Event pointer to __tgt_async_info
Shilei Tian [Wed, 17 Jun 2020 18:29:09 +0000 (14:29 -0400)]
[OpenMP][NFC] Added DeviceID and Event pointer to __tgt_async_info

DeviceID is added for some cases that we only have the __tgt_async_info but do
not know its corresponding device id. However, to communicate with target
plugins, we need that information.

Event is added for another way to synchronize.

2 years ago[llvm-readobj] set --elf-cg-profile as alias of --cg-profile
Zequan Wu [Mon, 15 Jun 2020 17:21:47 +0000 (10:21 -0700)]
[llvm-readobj] set --elf-cg-profile as alias of --cg-profile

Summary: Rename --elf-cg-profile to --cg-profile and keep --elf-cg-profile as an alias of --cg-profile.

Reviewers: jhenderson, MaskRay, espindola, hans

Reviewed By: jhenderson, MaskRay

Subscribers: emaste, rupprecht, llvm-commits

Tags: #llvm

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

2 years ago[CGP] Reset the debug location when promoting zext(s).
Davide Italiano [Wed, 17 Jun 2020 17:29:47 +0000 (10:29 -0700)]
[CGP] Reset the debug location when promoting zext(s).

When the zext gets promoted, it used to retain the original location,
which pessimizes the debugging experience causing an unexpected
jump in stepping at -Og.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46120 (which also
contains a full C repro).

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

2 years ago[xray] Option to omit the function index
Ian Levesque [Wed, 17 Jun 2020 00:36:11 +0000 (20:36 -0400)]
[xray] Option to omit the function index

Summary:
Add a flag to omit the xray_fn_idx to cut size overhead and relocations
roughly in half at the cost of reduced performance for single function
patching.  Minor additions to compiler-rt support per-function patching
without the index.

Reviewers: dberris, MaskRay, johnislarry

Subscribers: hiraditya, arphaman, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

2 years ago[X86] For 32-bit targets, emit two-byte NOP when possible
Alexandre Ganea [Wed, 17 Jun 2020 17:26:10 +0000 (13:26 -0400)]
[X86] For 32-bit targets, emit two-byte NOP when possible

In order to support hot-patching, we need to make sure the first emitted instruction in a function is a two-byte+ op. This is already the case on x86_64, which seems to always emit two-byte+ ops. However on 32-bit targets this wasn't the case.

PATCHABLE_OP now lowers to a XCHG AX, AX, (66 90) like MSVC does. However when targetting pentium3 (/arch:SSE) or i386 (/arch:IA32) targets, we generate MOV EDI,EDI (8B FF) like MSVC does. This is for compatiblity reasons with older tools that rely on this two byte pattern.

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

2 years ago[X86] Change signature of EmitNops. NFC.
Alexandre Ganea [Wed, 17 Jun 2020 16:08:12 +0000 (12:08 -0400)]
[X86] Change signature of EmitNops. NFC.

This is to support https://reviews.llvm.org/D81301.

2 years ago[llvm-cov gcov] Support clang<11 fake 4.2 format
Fangrui Song [Wed, 17 Jun 2020 17:17:15 +0000 (10:17 -0700)]
[llvm-cov gcov] Support clang<11 fake 4.2 format

Test cases are restored from a3bed4bd3743b5fee1e66116a63089df742bcae1

2 years ago[lldb/Test] Fix tests that rely on logfiles with reproducers.
Jonas Devlieghere [Wed, 17 Jun 2020 16:32:17 +0000 (09:32 -0700)]
[lldb/Test] Fix tests that rely on logfiles with reproducers.

Now that the log file is included in the reproducers, the path needs to
be remapped for the test to find the new file in the reproducer.

2 years ago[clang-tools-extra] Prevent linking to duplicate .a libs and dylib
Michał Górny [Tue, 16 Jun 2020 18:43:55 +0000 (20:43 +0200)]
[clang-tools-extra] Prevent linking to duplicate .a libs and dylib

Fix various tool libraries not to link to clang's .a libraries and dylib
simultaneously.  This may cause breakage, in particular through
duplicate command-line option declarations.

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

2 years ago[llvm] Disable linking llvm-exegesis to dylib
Michał Górny [Tue, 16 Jun 2020 10:31:36 +0000 (12:31 +0200)]
[llvm] Disable linking llvm-exegesis to dylib

Force linking llvm-exegesis to static LLVM libraries instead of dylib
to prevent duplicate symbols due to linking both.  Ideally, we'd want
to link to the dylib only here but the target sub-libraries use hidden
symbols from LLVM target libraries and therefore linking the dylib
fails.

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

2 years ago[llvm] Avoid linking llvm-cfi-verify to duplicate libs
Michał Górny [Tue, 16 Jun 2020 10:16:52 +0000 (12:16 +0200)]
[llvm] Avoid linking llvm-cfi-verify to duplicate libs

Fix the CMake rules for LLVMCFIVerify library not to pull duplicate
LLVM .a libraries when linking to the dylib.  This prevents problems
due to duplicate symbols and apparently fixes mingw32.

This is an alternative approach to D44650 that just forces .a libraries
instead.  However, there doesn't seem to be any reason to do that.

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

2 years ago[llvm] [CommandLine] Do not suggest really hidden opts in nearest lookup
Michał Górny [Wed, 17 Jun 2020 10:22:48 +0000 (12:22 +0200)]
[llvm] [CommandLine] Do not suggest really hidden opts in nearest lookup

Skip 'really hidden' options when performing lookup of the nearest
option when invalid option was passed.  Since these options aren't even
documented in --help-hidden, it seems inconsistent to suggest them
to users.

This fixes clang-tools-extra test failures due to unexpected suggestions
when linking the tools to LLVM dylib (that provides more options than
the subset of LLVM libraries linked directly).

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

2 years ago[Clang][Driver] Remove gold linker support for PS4 toolchain
Yuanfang Chen [Tue, 16 Jun 2020 20:50:41 +0000 (13:50 -0700)]
[Clang][Driver] Remove gold linker support for PS4 toolchain

Reviewers: probinson

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[AMDGPU] Skip CFIInstructions in SIInsertWaitcnts
Scott Linder [Wed, 17 Jun 2020 16:38:34 +0000 (12:38 -0400)]
[AMDGPU] Skip CFIInstructions in SIInsertWaitcnts

Summary:
CFI emitted during PEI at the beginning of the prologue needs to apply
to any inserted waitcnts on function entry.

Reviewers: arsenm, t-tye, RamNalamothu

Reviewed By: arsenm

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm, #debug-info

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

2 years ago[clangd] Make use of preamble bounds from the patch inside ReplayPreamble
Kadir Cetinkaya [Tue, 16 Jun 2020 19:21:45 +0000 (21:21 +0200)]
[clangd] Make use of preamble bounds from the patch inside ReplayPreamble

Summary:
Clangd was using bounds from the stale preamble, which might result in
crashes. For example:
```
 #include "a.h"
 #include "b.h" // this line is newly inserted
 #include "c.h"
```

PreambleBounds for the baseline only contains first two lines, but
ReplayPreamble logic contains an include from the third line. This would
result in a crash as we only lex preamble part of the current file
during ReplayPreamble.

This patch adds a `preambleBounds` method to PreamblePatch, which can be
used to figure out preamble bounds for the current version of the file.
Then uses it when attaching ReplayPreamble, so that it can lex the
up-to-date preamble region.

Reviewers: sammccall

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

Tags: #clang

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

2 years ago[NFC] Move getAll{S,V}GPR{32,128} methods to SIFrameLowering
vnalamot [Wed, 17 Jun 2020 16:08:09 +0000 (12:08 -0400)]
[NFC] Move getAll{S,V}GPR{32,128} methods to SIFrameLowering

Summary:
Future patch needs some of these in multiple places.

The definitions of these can't be in the header and be eligible for
inlining without making the full declaration of GCNSubtarget visible.
I'm not sure what the right trade-off is, but I opted to not bloat
SIRegisterInfo.h

Reviewers: arsenm, cdevadas

Reviewed By: arsenm

Subscribers: RamNalamothu, qcolombet, jvesely, wdng, nhaehnle, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

2 years ago[OpenMPOPT][NFC] Introducing OMPInformationCache.
sstefan1 [Sat, 13 Jun 2020 21:57:48 +0000 (23:57 +0200)]
[OpenMPOPT][NFC] Introducing OMPInformationCache.

Summary:
Introduction of OpenMP-specific information cache based on Attributor's `InformationCache`. This should make it easier to share information between them.

Reviewers: jdoerfert, JonChesterfield, hamax97, jhuber6, uenoku

Subscribers: yaxunl, hiraditya, guansong, uenoku, llvm-commits

Tags: #llvm

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

2 years ago[AMDGPU] Simplify GCNPassConfig::addOptimizedRegAlloc. NFC.
Jay Foad [Wed, 17 Jun 2020 14:55:58 +0000 (15:55 +0100)]
[AMDGPU] Simplify GCNPassConfig::addOptimizedRegAlloc. NFC.

2 years ago[X86] Regenerate mixed-ptr tests checks
Simon Pilgrim [Wed, 17 Jun 2020 14:48:07 +0000 (15:48 +0100)]
[X86] Regenerate mixed-ptr tests checks

Help reduce the diffs in D81517

2 years agoScalarEvolution.h - reduce LoopInfo.h include to forward declarations. NFC.
Simon Pilgrim [Wed, 17 Jun 2020 14:24:59 +0000 (15:24 +0100)]
ScalarEvolution.h - reduce LoopInfo.h include to forward declarations. NFC.

Move ScalarEvolution::forgetLoopDispositions implementation to ScalarEvolution.cpp to remove the dependency.

Add implicit header dependency to source files where necessary.

2 years ago[ARM] Reimplement MVE Tail-Predication pass using @llvm.get.active.lane.mask
Sjoerd Meijer [Wed, 17 Jun 2020 13:32:55 +0000 (14:32 +0100)]
[ARM] Reimplement MVE Tail-Predication pass using @llvm.get.active.lane.mask

To set up a tail-predicated loop, we need to to calculate the number of
elements processed by the loop. We can now use intrinsic
@llvm.get.active.lane.mask() to do this, which is emitted by the vectoriser in
D79100. This intrinsic generates a predicate for the masked loads/stores, and
consumes the Backedge Taken Count (BTC) as its second argument. We can now use
that to reconstruct the loop tripcount, instead of the IR pattern match
approach we were using before.

Many thanks to Eli Friedman and Sam Parker for all their help with this work.

This also adds overflow checks for the different, new expressions that we
create: the loop tripcount, and the sub expression that calculates the
remaining elements to be processed. For the latter, SCEV is not able to
calculate precise enough bounds, so we work around that at the moment, but is
not entirely correct yet, it's conservative. The overflow checks can be
overruled with a force flag, which is thus potentially unsafe (but not really
because the vectoriser is the only place where this intrinsic is emitted at the
moment). It's also good to mention that the tail-predication pass is not yet
enabled by default.  We will follow up to see if we can implement these
overflow checks better, either by a change in SCEV or we may want revise the
definition of llvm.get.active.lane.mask.

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

2 years agoRevert "[InlineCost] InlineCostAnnotationWriterPass introduced"
Kirill Naumov [Wed, 17 Jun 2020 14:02:34 +0000 (14:02 +0000)]
Revert "[InlineCost] InlineCostAnnotationWriterPass introduced"

This reverts commit 37e06e8f5c6ee39a1d7cbaf7d5f5a3ebfa1b4e15.

2 years agoRevert "[InlineCost] PrinterPass prints constants to which instructions are simplified"
Kirill Naumov [Wed, 17 Jun 2020 14:02:29 +0000 (14:02 +0000)]
Revert "[InlineCost] PrinterPass prints constants to which instructions are simplified"

This reverts commit 52b0db22f8cfb594c32389224570681d2d2c2f21.

2 years agoRevert "[InlineCost] GetElementPtr with constant operands"
Kirill Naumov [Wed, 17 Jun 2020 14:02:18 +0000 (14:02 +0000)]
Revert "[InlineCost] GetElementPtr with constant operands"

This reverts commit 34fba68d80051e3c53e7843157c036f6d511ae03.

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

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

Reviewers: apilipenko, davidxl, mtrofin

Reviewed By: mtrofin

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

2 years ago[InlineCost] PrinterPass prints constants to which instructions are simplified
Kirill Naumov [Tue, 2 Jun 2020 18:57:30 +0000 (18:57 +0000)]
[InlineCost] PrinterPass prints constants to which instructions are simplified

This patch enables printing of constants to see which instructions were
constant-folded. Needed for tests and better visiual analysis of
inliner's work.

Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev

Reviewed By: mtrofin

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

2 years ago[InlineCost] InlineCostAnnotationWriterPass introduced
Kirill Naumov [Thu, 11 Jun 2020 22:24:10 +0000 (22:24 +0000)]
[InlineCost] InlineCostAnnotationWriterPass introduced

This class allows to see the inliner's decisions for better
optimization verifications and tests. To use, use flag
"-passes="print<inline-cost>"".

Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev

Reviewed By: mtrofin

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

2 years ago[clang-tidy] warnings-as-error no longer exits with ErrorCount
Nathan James [Wed, 17 Jun 2020 13:35:32 +0000 (14:35 +0100)]
[clang-tidy] warnings-as-error no longer exits with ErrorCount

When using `-warnings-as-errors`, If there are any warnings promoted to errors, clang-tidy exits with the number of warnings. This really isn't needed and can cause issues when the number of warnings doesn't fit into 8 bits as POSIX terminals aren't designed to handle more than that.
This addresses https://bugs.llvm.org/show_bug.cgi?id=46305.

Bug originally added in D15528

Reviewed By: aaron.ballman

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

2 years agoRevert "GlobalISel: Make LLT constructors constexpr"
Hans Wennborg [Wed, 17 Jun 2020 13:31:12 +0000 (15:31 +0200)]
Revert "GlobalISel: Make LLT constructors constexpr"

This reverts commit 5a95be22d248be654b992dfb25e3850dbb182a14.

It causes GCC 5.3 to segfault:

In file included from /work/llvm.monorepo/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp:357:0:                                               lib/Target/AArch64/AArch64GenGlobalISel.inc:189:17:   in constexpr expansion of ‘llvm::LLT::scalar(16u)’
lib/Target/AArch64/AArch64GenGlobalISel.inc:205:1: internal compiler error: Segmentation fault

2 years ago[OPENMP]Fix overflow during counting the number of iterations.
Alexey Bataev [Thu, 4 Jun 2020 16:07:13 +0000 (12:07 -0400)]
[OPENMP]Fix overflow during counting the number of iterations.

Summary:
The OpenMP loops are normalized and transformed into the loops from 0 to
max number of iterations. In some cases, original scheme may lead to
overflow during calculation of number of iterations. If it is unknown,
if we can end up with overflow or not (the bounds are not constant and
  we cannot define if there is an overflow), cast original type to the
  unsigned.

Reviewers: jdoerfert

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

Tags: #clang, #openmp

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

2 years ago[OPENMP50]Codegen for scan directive in for simd regions.
Alexey Bataev [Tue, 16 Jun 2020 21:06:49 +0000 (17:06 -0400)]
[OPENMP50]Codegen for scan directive in for simd regions.

Summary:
Added codegen for scan directives in parallel for regions.

Emits the code for the directive with inscan reductions.
Original code:
```
 #pragma omp for simd reduction(inscan, op : ...)
for(...) {
  <input phase>;
  #pragma omp scan (in)exclusive(...)
  <scan phase>
}
```
is transformed to something:
```
size num_iters = <num_iters>;
<type> buffer[num_iters];
 #pragma omp for simd
for (i: 0..<num_iters>) {
  <input phase>;
  buffer[i] = red;
}
 #pragma omp barrier
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
  buffer[i] op= buffer[i-pow(2,k)];
 #pragma omp for simd
for (0..<num_iters>) {
  red = InclusiveScan ? buffer[i] : buffer[i-1];
  <scan phase>;
}
```

Reviewers: jdoerfert

Reviewed By: jdoerfert

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

Tags: #clang

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

2 years ago[SCCP] Add a few more additional sext tests (NFC).
Florian Hahn [Wed, 17 Jun 2020 12:39:36 +0000 (13:39 +0100)]
[SCCP] Add a few more additional sext tests (NFC).

2 years agoRemove global std::strings. NFCI.
Benjamin Kramer [Wed, 17 Jun 2020 12:27:36 +0000 (14:27 +0200)]
Remove global std::strings. NFCI.

2 years agoFollow up of rGe345d547a0d5, and attempt to pacify buildbot:
Sjoerd Meijer [Wed, 17 Jun 2020 12:24:09 +0000 (13:24 +0100)]
Follow up of rGe345d547a0d5, and attempt to pacify buildbot:

"error: 'get' is deprecated: The base class version of get with the scalable
argument defaulted to false is deprecated."

Changed VectorType::get() -> FixedVectorType::get().

2 years agoRecommit "[LV] Emit @llvm.get.active.lane.mask for tail-folded loops"
Sjoerd Meijer [Wed, 17 Jun 2020 09:48:20 +0000 (10:48 +0100)]
Recommit "[LV] Emit @llvm.get.active.lane.mask for tail-folded loops"

Fixed ARM regression test.

Please see the original commit message rG47650451738c for details.

2 years ago[SYCL][OpenMP] Implement thread-local storage restriction
Mariya Podchishchaeva [Wed, 17 Jun 2020 11:31:38 +0000 (14:31 +0300)]
[SYCL][OpenMP] Implement thread-local storage restriction

Summary:
SYCL and OpenMP prohibits thread local storage in device code,
so this commit ensures that error is emitted for device code and not
emitted for host code when host target supports it.

Reviewers: jdoerfert, erichkeane, bader

Reviewed By: jdoerfert, erichkeane

Subscribers: guansong, riccibruno, ABataev, yaxunl, ebevhan, Anastasia, sstefan1, cfe-commits

Tags: #clang

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

2 years ago[LSR] Filter for postinc formulae
David Green [Fri, 29 May 2020 09:53:30 +0000 (10:53 +0100)]
[LSR] Filter for postinc formulae

In more complicated loops we can easily hit the complexity limits of
loop strength reduction. If we do and filtering occurs, it's all too
easy to remove the wrong formulae for post-inc preferring accesses due
to it attempting to maximise register re-use. The patch adds an
alternative filtering step when the target is preferring postinc to pick
postinc formulae instead, hopefully lowering the complexity to below the
limit so that aggressive filtering is not needed.

There is also a change in here to stop considering existing addrecs as
free under postinc. We should already be modelling them as a reg so
don't want it to cause us to get the cost wrong. (I'm not sure that code
makes sense in general, but there are X86 tests specifically for it
where it seems to be helping so have left it around for the standard
non-post-inc case).

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

2 years ago[llvm-readobj] - Do not crash when GnuHashTable->symndx is greater than the dynamic...
Georgii Rymar [Tue, 16 Jun 2020 14:05:51 +0000 (17:05 +0300)]
[llvm-readobj] - Do not crash when GnuHashTable->symndx is greater than the dynamic symbols count.

`Elf_GnuHash_Impl` has the following method:

```
ArrayRef<Elf_Word> values(unsigned DynamicSymCount) const {
  return ArrayRef<Elf_Word>(buckets().end(), DynamicSymCount - symndx);
}
```

When DynamicSymCount is less than symndx we return an array with the huge broken size.
This patch fixes the issue and adds an assert. This assert helped to fix an issue
in one of the test cases.

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

2 years ago[llvm-readobj] - Split the printGnuHashTable(). NFCI.
Georgii Rymar [Tue, 16 Jun 2020 11:35:05 +0000 (14:35 +0300)]
[llvm-readobj] - Split the printGnuHashTable(). NFCI.

`printGnuHashTable` contains the code to check the GNU hash table.
This patch splits it to `getGnuHashTableChains` helper
(and reorders slightly to reduce).

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

2 years ago[AMDGPU] Fix failure in VCC spilling
Carl Ritson [Wed, 17 Jun 2020 10:38:25 +0000 (19:38 +0900)]
[AMDGPU] Fix failure in VCC spilling

Spills of VCC (SGPR64) will fail with new SGPR spill code,
because super register is not correctly resolved.

Reviewed By: arsenm

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

2 years ago[CallPrinter] Remove static constructor.
Benjamin Kramer [Wed, 17 Jun 2020 11:00:32 +0000 (13:00 +0200)]
[CallPrinter] Remove static constructor.

No need to have std::string here. NFC.

2 years ago[SCCP] Precommit some sext tests (NFC).
Florian Hahn [Fri, 12 Jun 2020 18:52:32 +0000 (19:52 +0100)]
[SCCP] Precommit some sext tests (NFC).

2 years ago[lldb] Remove xfail aarch64/linux from TestBuiltinTrap.py
Muhammad Omair Javaid [Wed, 17 Jun 2020 10:39:52 +0000 (15:39 +0500)]
[lldb] Remove xfail aarch64/linux from TestBuiltinTrap.py

The underlying clang bug seems to have been fixed in and test is
consistently passing on aarch64-linux buildbot.

2 years agoReturn "[InstCombine] Simplify compare of Phi with constant inputs against a constant"
Sam Parker [Wed, 17 Jun 2020 10:29:45 +0000 (11:29 +0100)]
Return "[InstCombine] Simplify compare of Phi with constant inputs against a constant"

I originally reverted the patch because it was causing performance
issues, but now I think it's just enabling simplify-cfg to do
something that I don't want instead :)

Sorry for the noise.

This reverts commit 3e39760f8eaad4770efa05824768e67237915cf5.

2 years ago[NFC] Run clang-format on clang/test/OpenMP/nvptx_target_codegen.cpp
Alexey Bader [Wed, 17 Jun 2020 10:02:35 +0000 (13:02 +0300)]
[NFC] Run clang-format on clang/test/OpenMP/nvptx_target_codegen.cpp

2 years ago[FileCheck] Implement * and / operators for ExpressionValue.
Paul Walker [Mon, 1 Jun 2020 10:09:58 +0000 (10:09 +0000)]
[FileCheck] Implement * and / operators for ExpressionValue.

Subscribers: arichardson, hiraditya, thopre, llvm-commits

Tags: #llvm

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

2 years ago[IR] Don't copy profile metadata in createCallMatchingInvoke()
Hans Wennborg [Wed, 17 Jun 2020 08:26:30 +0000 (10:26 +0200)]
[IR] Don't copy profile metadata in createCallMatchingInvoke()

The invoke instruction can have profile metadata with branch_weights,
which does not make sense for a call instruction and will be
rejected by the verifier.

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