platform/upstream/llvm.git
4 years ago[MC] Fix memory leak when allocating MCInst with bump allocator
hgreving [Wed, 29 Jul 2020 23:48:03 +0000 (16:48 -0700)]
[MC] Fix memory leak when allocating MCInst with bump allocator

Adds the function createMCInst() to MCContext that creates a MCInst using
a typed bump alloctor.

MCInst contains a SmallVector<MCOperand, 8>. The SmallVector is POD only
for <= 8 operands. The default untyped bump pointer allocator of MCContext
does not delete the MCInst, so if the SmallVector grows, it's a leak.

This fixes https://bugs.llvm.org/show_bug.cgi?id=46900.

4 years ago[VE] Extend integer arguments and return values smaller than 64 bits
Kazushi (Jam) Marukawa [Sat, 25 Jul 2020 07:31:07 +0000 (16:31 +0900)]
[VE] Extend integer arguments and return values smaller than 64 bits

In order to follow NEC Aurora SX VE ABI correctly, change to sign/zero
extend integer arguments and return values smaller than 64 bits in clang.
Also update regression test.

Reviewed By: simoll

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

4 years ago[SVE] Remove bad call to VectorType::getNumElements() from AMDGPU
Christopher Tetreault [Mon, 3 Aug 2020 22:42:13 +0000 (15:42 -0700)]
[SVE] Remove bad call to VectorType::getNumElements() from AMDGPU

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

4 years ago[SVE] Remove bad call to VectorType::getNumElements() from ARM
Christopher Tetreault [Mon, 3 Aug 2020 22:16:16 +0000 (15:16 -0700)]
[SVE] Remove bad call to VectorType::getNumElements() from ARM

Reviewed By: dmgreen

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

4 years ago[UBSan] Increase robustness of tests
Julian Lettner [Mon, 3 Aug 2020 20:21:08 +0000 (13:21 -0700)]
[UBSan] Increase robustness of tests

These UBSan tests assert the absence of runtime errors via `count 0`,
which means "expect no output".  This fails the test unnecessarily in
some environments (e.g., iOS simulator in our case).  Alter the test to
be a bit more specific and "expect no error" instead of "expect no
output".

rdar://65503408

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

4 years ago[NFC][ARM] Silence unused variable in release builds
Jordan Rupprecht [Mon, 3 Aug 2020 22:21:44 +0000 (15:21 -0700)]
[NFC][ARM] Silence unused variable in release builds

4 years ago[SVE] Remove bad calls to VectorType::getNumElements() from PowerPC
Christopher Tetreault [Mon, 3 Aug 2020 20:35:49 +0000 (13:35 -0700)]
[SVE] Remove bad calls to VectorType::getNumElements() from PowerPC

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

4 years agoReland D61689 Change -gz and -Wa,--compress-debug-sections to use gABI compression...
Fangrui Song [Mon, 3 Aug 2020 22:11:28 +0000 (15:11 -0700)]
Reland D61689 Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED) with integrated assembler

This fixes an inconsistency: clang -c -gz -fno-integrated-as means SHF_COMPRESSED
while clang -c -gz -fintegrated-as means zlib-gnu.

---

Since July 15, 2015 (binutils-gdb commit
19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas
--compress-debug-sections=zlib (gcc -gz) means zlib-gabi:
SHF_COMPRESSED. Before that GCC/binutils used zlib-gnu (.zdebug).

clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It
is 2020 now and it is not unreasonable to assume users of the new
feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661).

Change clang's default accordingly to improve standard conformance.
zlib-gnu becomes out of fashion and gets poorer toolchain support.
Its mangled names confuse tools and are more likely to cause problems.

Reviewed By: compnerd

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

4 years ago[flang] Make preprocessing behavior tests runnable as regression tests
peter klausler [Mon, 3 Aug 2020 17:50:42 +0000 (10:50 -0700)]
[flang] Make preprocessing behavior tests runnable as regression tests

And fix a minor bug exposed by doing so.

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

4 years ago[MemorySSA] Restrict optimizations after a PhiTranslation.
Alina Sbirlea [Thu, 25 Jun 2020 23:50:15 +0000 (16:50 -0700)]
[MemorySSA] Restrict optimizations after a PhiTranslation.

Merging alias results from different paths, when a path did phi
translation is not necesarily correct. Conservatively terminate such paths.
Aimed to fix PR46156.

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

4 years ago[mlir][OpFormatGen] Add support for eliding UnitAttr when used to anchor an optional...
River Riddle [Mon, 3 Aug 2020 21:20:50 +0000 (14:20 -0700)]
[mlir][OpFormatGen] Add support for eliding UnitAttr when used to anchor an optional group

Unit attributes are given meaning by their existence, and thus have no meaningful value beyond "is it present". As such, in the format of an operation unit attributes are generally used to guard the printing of other elements and aren't generally printed themselves; as the presence of the group when parsing means that the unit attribute should be added. This revision adds support to the declarative format for eliding unit attributes in situations where they anchor an optional group, but aren't the first element.

For example,
```
let assemblyFormat = "(`is_optional` $unit_attr^)? attr-dict";
```

would print `foo.op is_optional` when $unit_attr is present, instead of the current `foo.op is_optional unit`.

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

4 years ago[HWASan] [GlobalISel] Add +tagged-globals backend feature for GlobalISel
Mitch Phillips [Mon, 3 Aug 2020 20:55:27 +0000 (13:55 -0700)]
[HWASan] [GlobalISel] Add +tagged-globals backend feature for GlobalISel

GlobalISel is the default ISel for aarch64 at -O0. Prior to D78465, GlobalISel
didn't have support for dealing with address-of-global lowerings, so it fell
back to SelectionDAGISel.

HWASan Globals require special handling, as they contain the pointer tag in the
top 16-bits, and are thus outside the code model. We need to generate a `movk`
in the instruction sequence with a G3 relocation to ensure the bits are
relocated properly. This is implemented in SelectionDAGISel, this patch does
the same for GlobalISel.

GlobalISel and SelectionDAGISel differ in their lowering sequence, so there are
differences in the final instruction sequence, explained in
`tagged-globals.ll`. Both of these implementations are correct, but GlobalISel
is slightly larger code size / slightly slower (by a couple of arithmetic
instructions). I don't see this as a problem for now as GlobalISel is only on
by default at `-O0`.

Reviewed By: aemerson, arsenm

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

4 years ago[ARM] Convert VPSEL to VMOV in tail predicated loops
David Green [Mon, 3 Aug 2020 21:03:14 +0000 (22:03 +0100)]
[ARM] Convert VPSEL to VMOV in tail predicated loops

VPSEL has slightly different semantics under tail predication (it can
end up selecting from Qn, Qm and Qd). We do not model that at the moment
so they block tail predicated loops from being formed.

This just converts them into a predicated VMOV instead (via a VORR),
allowing tail predication to happen whilst still modelling the original
behaviour of the input.

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

4 years ago[WebAssembly] Implement prototype v128.load{32,64}_zero instructions
Thomas Lively [Mon, 3 Aug 2020 20:54:00 +0000 (13:54 -0700)]
[WebAssembly] Implement prototype v128.load{32,64}_zero instructions

Specified in https://github.com/WebAssembly/simd/pull/237, these
instructions load the first vector lane from memory and zero the other
lanes. Since these instructions are not officially part of the SIMD
proposal, they are only available on an opt-in basis via LLVM
intrinsics and clang builtin functions. If these instructions are
merged to the proposal, this implementation will change so that the
instructions will be generated from normal IR. At that point the
intrinsics and builtin functions would be removed.

This PR also changes the opcodes for the experimental f32x4.qfm{a,s}
instructions because their opcodes conflicted with those of the
v128.load{32,64}_zero instructions. The new opcodes were chosen to
match those used in V8.

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

4 years agoRevert "[X86][SSE] Shuffle combine blends to OR(X,Y) if the relevant elements are...
Mitch Phillips [Mon, 3 Aug 2020 20:48:30 +0000 (13:48 -0700)]
Revert "[X86][SSE] Shuffle combine blends to OR(X,Y) if the relevant elements are known zero."

This reverts commit 219f32f4b68679563443cdaae7b8174c9976409a.

Commit contains unsigned compasions that break bots that build with
-Wsign-compare.

4 years ago[ARM] Test for converting VPSEL to VMOVT. NFC
David Green [Mon, 3 Aug 2020 20:46:07 +0000 (21:46 +0100)]
[ARM] Test for converting VPSEL to VMOVT. NFC

4 years ago[MC] Set sh_link to 0 if the associated symbol is undefined
Fangrui Song [Mon, 3 Aug 2020 20:35:59 +0000 (13:35 -0700)]
[MC] Set sh_link to 0 if the associated symbol is undefined

Part of https://bugs.llvm.org/show_bug.cgi?id=41734

LTO can drop externally available definitions. Such AssociatedSymbol is
not associated with a symbol. ELFWriter::writeSection() will assert.

Allow a SHF_LINK_ORDER section to have sh_link=0.

We need to give sh_link a syntax, a literal zero in the linked-to symbol
position, e.g. `.section name,"ao",@progbits,0`

Reviewed By: pcc

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

4 years ago[CodeGen][ObjC] Mark calls to objc_unsafeClaimAutoreleasedReturnValue as
Akira Hatanaka [Mon, 3 Aug 2020 20:25:25 +0000 (13:25 -0700)]
[CodeGen][ObjC] Mark calls to objc_unsafeClaimAutoreleasedReturnValue as
notail on x86-64

This is needed because the epilogue code inserted before tail calls on
x86-64 breaks the handshake between the caller and callee.

Calls to objc_retainAutoreleasedReturnValue used to have the same
problem, which was fixed in https://reviews.llvm.org/D59656.

rdar://problem/66029552

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

4 years agoAllow .dSYM's to be directly placed in an alternate directory
Daniel Sanders [Mon, 3 Aug 2020 19:46:49 +0000 (12:46 -0700)]
Allow .dSYM's to be directly placed in an alternate directory

Once available in the relevant toolchains this will allow us to implement
LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR after D84127 by directly placing the dSYM
in the desired location instead of emitting next to the output file and moving
it.

Reviewed By: JDevlieghere

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

4 years agoFix typo: s/epomymous/eponymous/ NFC
Jon Roelofs [Mon, 3 Aug 2020 20:09:46 +0000 (14:09 -0600)]
Fix typo: s/epomymous/eponymous/ NFC

4 years ago[AArch64] Add missing isel patterns for fcvtzs/u intrinsic on v1f64.
Eli Friedman [Mon, 3 Aug 2020 19:29:40 +0000 (12:29 -0700)]
[AArch64] Add missing isel patterns for fcvtzs/u intrinsic on v1f64.

Fixes test-suite compile failure caused by 8dfb5d7.

While I'm in the area, add some more test coverage to related
operations, to make sure we aren't missing any other patterns.

4 years ago[llvm-jitlink] Add support for static archives and MachO universal archives.
Lang Hames [Mon, 3 Aug 2020 18:55:57 +0000 (11:55 -0700)]
[llvm-jitlink] Add support for static archives and MachO universal archives.

Archives can now be specified as input files the same way that object
files are. Archives will always be linked after all objects (regardless
of the relative order of the inputs) but before any dynamic libraries or
process symbols.

This patch also relaxes matching for slice triples in
StaticLibraryDefinitionGenerator in order to support this feature:
Vendors need not match if the source vendor is unknown.

4 years ago[PGO] Enable the extended value profile buckets for mem op sizes.
Hiroshi Yamauchi [Mon, 3 Aug 2020 18:37:22 +0000 (11:37 -0700)]
[PGO] Enable the extended value profile buckets for mem op sizes.

Following up D81682 and enable the new, extended value profile buckets for mem
op sizes.

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

4 years ago[flang] Fix bug detecting intrinsic function
Tim Keith [Mon, 3 Aug 2020 19:21:57 +0000 (12:21 -0700)]
[flang] Fix bug detecting intrinsic function

Don't set the INTRINSIC attribute on a dummy procedure.

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

4 years ago[InstSimplify] fold variations of max-of-min with common operand
Sanjay Patel [Mon, 3 Aug 2020 18:02:09 +0000 (14:02 -0400)]
[InstSimplify] fold variations of max-of-min with common operand

https://alive2.llvm.org/ce/z/ZtxpZ3

4 years ago[InstSimplify] add tests for min-of-max variants; NFC
Sanjay Patel [Mon, 3 Aug 2020 17:50:54 +0000 (13:50 -0400)]
[InstSimplify] add tests for min-of-max variants; NFC

4 years agoFix layering violation Transforms/Utils -> Scalar
Arthur Eubanks [Mon, 3 Aug 2020 18:50:07 +0000 (11:50 -0700)]
Fix layering violation Transforms/Utils -> Scalar

Introduced in D85063.

4 years ago[X86] support .nops directive
Jian Cai [Fri, 31 Jul 2020 01:33:33 +0000 (18:33 -0700)]
[X86] support .nops directive

Add support of .nops on X86. This addresses llvm.org/PR45788.

Reviewed By: craig.topper

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

4 years ago[ArgPromotion] Replace all md uses of promoted values with undef.
Florian Hahn [Mon, 3 Aug 2020 18:18:13 +0000 (19:18 +0100)]
[ArgPromotion] Replace all md uses of promoted values with undef.

Currently, ArgPromotion may leave metadata uses of promoted values,
which will end up in the wrong function, creating invalid IR.

PR33641 fixed this for dead arguments, but it can be also be triggered
arguments with users that are promoted (see the updated test case).

We also have to drop uses to them after promoting them. We need to do
this after dealing with the non-metadata uses, so I also moved the empty
use case to the loop that deals with updating the arguments of the new
function.

Reviewed By: aprantl

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

4 years ago[gn build] Port f78f509c758
LLVM GN Syncbot [Mon, 3 Aug 2020 18:05:15 +0000 (18:05 +0000)]
[gn build] Port f78f509c758

4 years ago[PGO] Extend the value profile buckets for mem op sizes.
Hiroshi Yamauchi [Mon, 3 Aug 2020 17:35:47 +0000 (10:35 -0700)]
[PGO] Extend the value profile buckets for mem op sizes.

Extend the memop value profile buckets to be more flexible (could accommodate a
mix of individual values and ranges) and to cover more value ranges (from 11 to
22 buckets).

Disabled behind a flag (to be enabled separately) and the existing code to be
removed later.

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

4 years ago[compiler-rt][profile] Fix various InstrProf tests on Solaris
Rainer Orth [Mon, 3 Aug 2020 17:56:05 +0000 (19:56 +0200)]
[compiler-rt][profile] Fix various InstrProf tests on Solaris

Currently, several InstrProf tests `FAIL` on Solaris (both sparc and x86):

  Profile-i386 :: Posix/instrprof-visibility.cpp
  Profile-i386 :: instrprof-merging.cpp
  Profile-i386 :: instrprof-set-file-object-merging.c
  Profile-i386 :: instrprof-set-file-object.c

On sparc there's also

  Profile-sparc :: coverage_comments.cpp

The failure mode is always the same:

  error: /var/llvm/local-amd64/projects/compiler-rt/test/profile/Profile-i386/Posix/Output/instrprof-visibility.cpp.tmp: Failed to load coverage: Malformed coverage data

The error is from `llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp`
(`loadBinaryFormat`), l.926:

  InstrProfSymtab ProfileNames;
  std::vector<SectionRef> NamesSectionRefs = *NamesSection;
  if (NamesSectionRefs.size() != 1)
    return make_error<CoverageMapError>(coveragemap_error::malformed);

where .size() is 2 instead.

Looking at the executable, I find (with `elfdump -c -N __llvm_prf_names`):

  Section Header[15]:  sh_name: __llvm_prf_names
      sh_addr:      0x8053ca5       sh_flags:   [ SHF_ALLOC ]
      sh_size:      0x86            sh_type:    [ SHT_PROGBITS ]
      sh_offset:    0x3ca5          sh_entsize: 0
      sh_link:      0               sh_info:    0
      sh_addralign: 0x1

  Section Header[31]:  sh_name: __llvm_prf_names
      sh_addr:      0x8069998       sh_flags:   [ SHF_WRITE SHF_ALLOC ]
      sh_size:      0               sh_type:    [ SHT_PROGBITS ]
      sh_offset:    0x9998          sh_entsize: 0
      sh_link:      0               sh_info:    0
      sh_addralign: 0x1

Unlike GNU `ld` (which primarily operates on section names) the Solaris
linker, following the ELF spirit, only merges input sections into an output
section if both section name and section flags match, so two separate
sections are maintained.

The read-write one comes from `lib/clang/12.0.0/lib/sunos/libclang_rt.profile-i386.a(InstrProfilingPlatformLinux.c.o)`
while the read-only one is generated by
`llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp` (`InstrProfiling::emitNameData`)
at l.1004 where `isConstant = true`.

The easiest way to avoid the mismatch is to change the definition in
`compiler-rt/lib/profile/InstrProfilingPlatformLinux.c` to `const`.

This fixes all failures observed.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

4 years ago[X86] Make ENDBR instruction a scheduling boundary
Joao Moreira [Mon, 3 Aug 2020 17:26:31 +0000 (10:26 -0700)]
[X86] Make ENDBR instruction a scheduling boundary

Instructions should not be scheduled across ENDBR instructions, as this would result in the ENDBR being displaced, breaking the parity needed for the Indirect Branch Tracking feature of CET.

Currently, the X86IndirectBranchTracking pass is later than the instruction scheduling in the pipeline, what causes the bug to be unnoticeable and very hard (if not unfeasible) to be triggered while compiling C files with the standard LLVM setup. Yet, for correctness and to prevent issues in future changes, the compiler should prevent the such scheduling.

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

4 years ago[X86][SSE] Shuffle combine blends to OR(X,Y) if the relevant elements are known zero.
Simon Pilgrim [Mon, 3 Aug 2020 16:53:32 +0000 (17:53 +0100)]
[X86][SSE] Shuffle combine blends to OR(X,Y) if the relevant elements are known zero.

This allows us to remove the (depth violating) code in getFauxShuffleMask where we were combining the OR(SHUFFLE,SHUFFLE) shuffle inputs as well, and not just the OR().

This is a minor step toward being able to shuffle combine from/to SELECT/BLENDV as a faux shuffle.

4 years ago[NewPM][LoopVersioning] Port LoopVersioning to NPM
Arthur Eubanks [Sat, 1 Aug 2020 00:30:30 +0000 (17:30 -0700)]
[NewPM][LoopVersioning] Port LoopVersioning to NPM

Reviewed By: ychen, fhahn

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

4 years ago[FPEnv] IRBuilder fails to add strictfp attribute
Kevin P. Neal [Wed, 29 Jul 2020 14:33:01 +0000 (10:33 -0400)]
[FPEnv] IRBuilder fails to add strictfp attribute

The strictfp attribute is required on all function calls in a function
that is itself marked with the strictfp attribute. The IRBuilder knows
this and has a method for adding the attribute to function call instructions.

If a function being called has the strictfp attribute itself then the
IRBuilder will refuse to add the attribute to the calling instruction
despite being asked to add it. Eliminate this error.

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

4 years ago[PGO] Change a `NumVSites == 0` workaround to assert
Fangrui Song [Mon, 3 Aug 2020 17:09:51 +0000 (10:09 -0700)]
[PGO] Change a `NumVSites == 0` workaround to assert

The root cause was fixed by 3d6f53018f845e893ad34f64ff2851a2e5c3ba1d.
The workaround added in 99ad956fdaee5398fdcf46fa49cb433cf52dc461 can be changed
to an assert now. (In case the fix regresses, there will be a heap-use-after-free.)

4 years ago[X86] Use h-register for final XOR of __builtin_parity on 64-bit targets.
Craig Topper [Mon, 3 Aug 2020 17:09:57 +0000 (10:09 -0700)]
[X86] Use h-register for final XOR of __builtin_parity on 64-bit targets.

This adds an isel pattern and special XOR8rr_NOREX instruction
to enable the use of h-registers for __builtin_parity. This avoids
a copy and a shift instruction. The NOREX instruction is in case
register allocation doesn't use the matching l-register for some
reason. If a R8-R15 register gets picked instead, we won't be
able to encode the instruction since an h-register can't be used
with a REX prefix.

Fixes PR46954

4 years ago[mlir][DialectConversion] Remove usage of std::distance to track position.
MaheshRavishankar [Mon, 3 Aug 2020 17:04:48 +0000 (10:04 -0700)]
[mlir][DialectConversion] Remove usage of std::distance to track position.

Remove use of iterator::difference_type to know where to insert a
moved or erased block during undo actions.

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

4 years ago[mlir][DialectConversion] Add support for mergeBlocks in ConversionPatternRewriter.
MaheshRavishankar [Mon, 3 Aug 2020 17:04:16 +0000 (10:04 -0700)]
[mlir][DialectConversion] Add support for mergeBlocks in ConversionPatternRewriter.

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

4 years ago[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full...
Nicolas Vasilache [Mon, 3 Aug 2020 16:24:53 +0000 (12:24 -0400)]
[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full and partial copies.

This revision adds a transformation and a pattern that rewrites a "maybe masked" `vector.transfer_read %view[...], %pad `into a pattern resembling:

```
   %1:3 = scf.if (%inBounds) {
      scf.yield %view : memref<A...>, index, index
    } else {
      %2 = vector.transfer_read %view[...], %pad : memref<A...>, vector<...>
      %3 = vector.type_cast %extra_alloc : memref<...> to
      memref<vector<...>> store %2, %3[] : memref<vector<...>> %4 =
      memref_cast %extra_alloc: memref<B...> to memref<A...> scf.yield %4 :
      memref<A...>, index, index
   }
   %res= vector.transfer_read %1#0[%1#1, %1#2] {masked = [false ... false]}
```
where `extra_alloc` is a top of the function alloca'ed buffer of one vector.

This rewrite makes it possible to realize the "always full tile" abstraction where vector.transfer_read operations are guaranteed to read from a padded full buffer.
The extra work only occurs on the boundary tiles.

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

4 years ago[llvm] Add a parser from JSON to TensorSpec
Mircea Trofin [Thu, 30 Jul 2020 19:44:07 +0000 (12:44 -0700)]
[llvm] Add a parser from JSON to TensorSpec

A JSON->TensorSpec utility we will use subsequently to specify
additional outputs needed for certain training scenarios.

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

4 years ago[Utils] Add noundef attribute to vim/emacs/vscode syntax scripts
Gui Andrade [Mon, 3 Aug 2020 16:45:35 +0000 (16:45 +0000)]
[Utils] Add noundef attribute to vim/emacs/vscode syntax scripts

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

4 years ago[MSAN] Instrument freeze instruction by clearing shadow
Gui Andrade [Fri, 31 Jul 2020 18:53:15 +0000 (18:53 +0000)]
[MSAN] Instrument freeze instruction by clearing shadow

Freeze always returns a defined value. This also prevents msan from
checking the input shadow, which happened because freeze wasn't
explicitly visited.

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

4 years ago[SCEV] If Start>=RHS, simplify (Start smin RHS) = RHS for trip counts.
Florian Hahn [Mon, 3 Aug 2020 15:19:06 +0000 (16:19 +0100)]
[SCEV] If Start>=RHS, simplify (Start smin RHS) = RHS for trip counts.

In some cases, it seems like we can get rid of unnecessary s/umins by
using information from the loop guards (unless I am missing something).

One place where this seems to be helpful in practice is when computing
loop trip counts. This patch just changes howManyGreaterThans for now.
Note that this requires a loop for which we can check 'is guarded'.

On SPEC2000/SPEC2006/MultiSource, there are some notable changes for
some programs in the number of loops unrolled and trip counts computed.

```
Same hash: 179 (filtered out)
Remaining: 58
Metric: scalar-evolution.NumTripCountsComputed

Program                                        base    patch   diff
 test-suite...langs-C/compiler/compiler.test    25.00   31.00  24.0%
 test-suite.../Applications/SPASS/SPASS.test   2020.00 2323.00 15.0%
 test-suite...langs-C/allroots/allroots.test    29.00   32.00  10.3%
 test-suite.../Prolangs-C/loader/loader.test    17.00   18.00   5.9%
 test-suite...fice-ispell/office-ispell.test   253.00  265.00   4.7%
 test-suite...006/450.soplex/450.soplex.test   3552.00 3692.00  3.9%
 test-suite...chmarks/MallocBench/gs/gs.test   453.00  470.00   3.8%
 test-suite...ngs-C/assembler/assembler.test    29.00   30.00   3.4%
 test-suite.../Benchmarks/Ptrdist/bc/bc.test   263.00  270.00   2.7%
 test-suite...rks/FreeBench/pifft/pifft.test   722.00  741.00   2.6%
 test-suite...count/automotive-bitcount.test    41.00   42.00   2.4%
 test-suite...0/253.perlbmk/253.perlbmk.test   1417.00 1451.00  2.4%
 test-suite...000/197.parser/197.parser.test   387.00  396.00   2.3%
 test-suite...lications/sqlite3/sqlite3.test   1168.00 1189.00  1.8%
 test-suite...000/255.vortex/255.vortex.test   173.00  176.00   1.7%

Metric: loop-unroll.NumUnrolled

Program                                        base   patch  diff
 test-suite...langs-C/compiler/compiler.test     1.00   3.00 200.0%
 test-suite.../Applications/SPASS/SPASS.test   134.00 234.00 74.6%
 test-suite...count/automotive-bitcount.test     3.00   4.00 33.3%
 test-suite.../Prolangs-C/loader/loader.test     3.00   4.00 33.3%
 test-suite...langs-C/allroots/allroots.test     3.00   4.00 33.3%
 test-suite...Source/Benchmarks/sim/sim.test    10.00  12.00 20.0%
 test-suite...fice-ispell/office-ispell.test    21.00  25.00 19.0%
 test-suite.../Benchmarks/Ptrdist/bc/bc.test    32.00  38.00 18.8%
 test-suite...006/450.soplex/450.soplex.test   300.00 352.00 17.3%
 test-suite...rks/FreeBench/pifft/pifft.test    60.00  69.00 15.0%
 test-suite...chmarks/MallocBench/gs/gs.test    57.00  63.00 10.5%
 test-suite...ngs-C/assembler/assembler.test    10.00  11.00 10.0%
 test-suite...0/253.perlbmk/253.perlbmk.test   145.00 157.00  8.3%
 test-suite...000/197.parser/197.parser.test    43.00  46.00  7.0%
 test-suite...TimberWolfMC/timberwolfmc.test   205.00 214.00  4.4%
 Geomean difference                                           7.6%
```

Fixes https://bugs.llvm.org/show_bug.cgi?id=46939
Fixes https://bugs.llvm.org/show_bug.cgi?id=46924 on X86.

Reviewed By: mkazantsev

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

4 years agoRevert "[mlir][Vector] Add transformation + pattern to split vector.transfer_read...
Mehdi Amini [Mon, 3 Aug 2020 16:16:47 +0000 (16:16 +0000)]
Revert "[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full and partial copies."

This reverts commit 35b65be041127db9fe23d3128a004c888893cbae.

Build is broken with -DBUILD_SHARED_LIBS=ON with some undefined
references like:

VectorTransforms.cpp:(.text._ZN4llvm12function_refIFvllEE11callback_fnIZL24createScopedInBoundsCondN4mlir25VectorTransferOpInterfaceEE3$_8EEvlll+0xa5): undefined reference to `mlir::edsc::op::operator+(mlir::Value, mlir::Value)'

4 years ago[FPEnv] Don't transform FSUB(-0,X)->FNEG(X) in SelectionDAGBuilder.
Cameron McInally [Mon, 3 Aug 2020 15:19:33 +0000 (10:19 -0500)]
[FPEnv] Don't transform FSUB(-0,X)->FNEG(X) in SelectionDAGBuilder.

This patch stops unconditionally transforming FSUB(-0,X) into an FNEG(X) while building the DAG. There is also one small change to handle the new FSUB(-0,X) similarly to FNEG(X) in the AMDGPU backend.

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

4 years ago[analyzer][tests] Fix SATest update functionality
Valeriy Savchenko [Wed, 22 Jul 2020 10:36:13 +0000 (13:36 +0300)]
[analyzer][tests] Fix SATest update functionality

Summary:
Not all projects in the project map file might have newer results
for updating, we should handle this situation gracefully.

Additionally, not every user of the test system would want storing
reference results in git.  For this reason, git functionality is now
optional.

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

4 years ago[DWARFYAML] Implement the .debug_loclists section.
Xing GUO [Mon, 3 Aug 2020 15:19:42 +0000 (23:19 +0800)]
[DWARFYAML] Implement the .debug_loclists section.

This patch implements the .debug_loclists section. There are only two
DWARF expressions are implemented in this patch (DW_OP_consts,
DW_OP_stack_value). We will implement more in the future.

The YAML description of the .debug_loclists section is:

```
debug_loclists:
  - Format:              DWARF32 ## Optional
    Length:              0x1234  ## Optional
    Version:             5       ## Optional (5 by default)
    AddressSize:         8       ## Optional
    SegmentSelectorSize: 0       ## Optional (0 by default)
    OffsetEntryCount:    1       ## Optional
    Offsets:             [ 1 ]   ## Optional
    Lists:
      - Entries:
          - Operator:          DW_LLE_startx_endx
            Values:            [ 0x1234, 0x4321 ]
            DescriptorsLength: 0x1234             ## Optional
            Descriptors:
              - Operator: DW_OP_consts
                Values:   [ 0x1234 ]
```

Reviewed By: jhenderson

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

4 years ago[NFC][APInt][DenseMapInfo] Move DenseMapAPIntKeyInfo into DenseMap.h as DenseMapInfo...
Shinji Okumura [Mon, 3 Aug 2020 14:31:13 +0000 (23:31 +0900)]
[NFC][APInt][DenseMapInfo] Move DenseMapAPIntKeyInfo into DenseMap.h as DenseMapInfo<APInt>

`DenseMapAPIntKeyInfo` is now located in `lib/IR/LLVMContextImpl.h`.
Moved it into `include/ADT/DenseMapInfo.h` to use it.

Reviewed By: jdoerfert

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

4 years ago[InstCombine] reduce xor-of-or's bitwise logic (PR46955); 2nd try
Sanjay Patel [Mon, 3 Aug 2020 13:19:11 +0000 (09:19 -0400)]
[InstCombine] reduce xor-of-or's bitwise logic (PR46955); 2nd try

The 1st try at this (rG2265d01f2a5b) exposed what looks like
unspecified behavior in C/C++ resulting in test variations.

The arguments to BinaryOperator::CreateAnd() were both IRBuilder
function calls, and the order in which they execute determines
the order of the new instructions in the IR. But the order of
function arg evaluation is not fixed by the rules of C/C++, so
depending on compiler config, the test would fail because the
test expected a single fixed ordering of instructions.

Original commit message:
I tried to use m_Deferred() on this, but didn't find
a clean way to do that.

http://bugs.llvm.org/PR46955

https://alive2.llvm.org/ce/z/2h6QTq

4 years ago[DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0.
Xing GUO [Mon, 3 Aug 2020 14:04:33 +0000 (22:04 +0800)]
[DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0.

The offsets field should be omitted when the 'OffsetEntryCount' entry is
specified to be 0.

Reviewed By: jhenderson

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

4 years ago[mlir] First-party modeling of LLVM types
Alex Zinenko [Wed, 29 Jul 2020 12:58:09 +0000 (14:58 +0200)]
[mlir] First-party modeling of LLVM types

The current modeling of LLVM IR types in MLIR is based on the LLVMType class
that wraps a raw `llvm::Type *` and delegates uniquing, printing and parsing to
LLVM itself. This model makes thread-safe type manipulation hard and is being
progressively replaced with a cleaner MLIR model that replicates the type
system.  Introduce a set of classes reflecting the LLVM IR type system in MLIR
instead of wrapping the existing types. These are currently introduced as
separate classes without affecting the dialect flow, and are exercised through
a test dialect. Once feature parity is reached, the old implementation will be
gradually substituted with the new one.

Depends On D84171

Reviewed By: rriddle

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

4 years agoGlobalISel: Handle arbitrary FewerElementsVector for G_IMPLICIT_DEF
Matt Arsenault [Tue, 28 Jul 2020 14:15:30 +0000 (10:15 -0400)]
GlobalISel: Handle arbitrary FewerElementsVector for G_IMPLICIT_DEF

4 years agoAMDGPU/GlobalISel: Remove old hacks for boolean selection
Matt Arsenault [Sun, 26 Jul 2020 14:47:08 +0000 (10:47 -0400)]
AMDGPU/GlobalISel: Remove old hacks for boolean selection

There were various hacks used to try to avoid making s1 SGPR vs. s1
VCC ambiguous after constraining the register before we had a strategy
to deal with this. This also attempted to handle undef operands, which
are now illegal gMIR.

4 years agoGlobalISel: Reimplement moreElementsVectorDst
Matt Arsenault [Sun, 2 Feb 2020 22:42:02 +0000 (17:42 -0500)]
GlobalISel: Reimplement moreElementsVectorDst

Use pad with undef and unmerge with unused results. This is annoyingly
similar to several other places in LegalizerHelper, but they're all
slightly different.

4 years agoRevert "[InstCombine] reduce xor-of-or's bitwise logic (PR46955)"
Sanjay Patel [Mon, 3 Aug 2020 12:58:41 +0000 (08:58 -0400)]
Revert "[InstCombine] reduce xor-of-or's bitwise logic (PR46955)"

This reverts commit 2265d01f2a5bd153959701e22f5be2a40e1674a3.
Seeing bot failures after this change like:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/42586

4 years agoAMDGPU/GlobalISel: Apply load bitcast to s.buffer.load intrinsic
Matt Arsenault [Tue, 16 Jun 2020 18:52:14 +0000 (14:52 -0400)]
AMDGPU/GlobalISel: Apply load bitcast to s.buffer.load intrinsic

Should also apply this to the non-scalar buffer loads.

4 years ago[X86][SSE] Start shuffle combining from ANY_EXTEND_VECTOR_INREG on SSE targets
Simon Pilgrim [Mon, 3 Aug 2020 11:18:21 +0000 (12:18 +0100)]
[X86][SSE] Start shuffle combining from ANY_EXTEND_VECTOR_INREG on SSE targets

We already do this on AVX (+ for ZERO_EXTEND_VECTOR_INREG), but this enables it for all SSE targets - we attempted something similar back at rL357057 but hit issues with the ZERO_EXTEND_VECTOR_INREG handling (PR41249).

I'm still looking at the vector-mul.ll regression - which is due to 32-bit targets performing the load as a f64, resulting in the shuffle combiner thinking it has to create a shuffle in the float domain.

4 years agoAMDGPU/GlobalISel: Fix selecting broken copies for s32->s64 anyext
Matt Arsenault [Thu, 23 Jul 2020 01:07:03 +0000 (21:07 -0400)]
AMDGPU/GlobalISel: Fix selecting broken copies for s32->s64 anyext

These should probably not be legal in the first place, but that might
also be a pain.

4 years ago[InstCombine] reduce xor-of-or's bitwise logic (PR46955)
Sanjay Patel [Mon, 3 Aug 2020 12:11:06 +0000 (08:11 -0400)]
[InstCombine] reduce xor-of-or's bitwise logic (PR46955)

I tried to use m_Deferred() on this, but didn't find
a clean way to do that.

http://bugs.llvm.org/PR46955

https://alive2.llvm.org/ce/z/2h6QTq

4 years ago[InstCombine] add tests for xor-of-ors; NFC
Sanjay Patel [Sun, 2 Aug 2020 17:40:23 +0000 (13:40 -0400)]
[InstCombine] add tests for xor-of-ors; NFC

4 years ago[clang][ARM] Add name-mangling test for direct __fp16 arguments.
Simon Tatham [Mon, 3 Aug 2020 12:30:48 +0000 (13:30 +0100)]
[clang][ARM] Add name-mangling test for direct __fp16 arguments.

`clang/test/CodeGenCXX/fp16-mangle.cpp` tests pointers to __fp16, but
if you give the `-fallow-half-arguments-and-returns` option, then
clang can also leave an __fp16 unmodified as a function argument or
return type. This regression test checks the name-mangling of that.

Reviewed By: miyuki

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

4 years ago[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz
Nicholas Guy [Wed, 1 Jul 2020 10:35:58 +0000 (11:35 +0100)]
[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz

Fixes a regression caused by D82439, in which IT blocks were no longer being
generated when -Oz is present. This was due to the CPSR register being marked as
dead, while this case was not accounted for.

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

4 years ago[clangd] Support new/deleta operator in TargetFinder.
Haojian Wu [Sat, 25 Jul 2020 19:52:33 +0000 (21:52 +0200)]
[clangd] Support new/deleta operator in TargetFinder.

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

4 years ago[analyzer] Introduce minor refactoring of SVal::getSubKind function
Denys Petrov [Fri, 31 Jul 2020 12:54:46 +0000 (15:54 +0300)]
[analyzer] Introduce minor refactoring of SVal::getSubKind function

Summary: `BaseMask` occupies the lowest bits. Effect of applying the mask is neutralized by right shift operation, thus making it useless.

Fix: Remove a redundant bitwise operation.

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

4 years ago[analyzer] Simplify function SVal::getAsSymbolicExpression and similar ones
Denys Petrov [Fri, 31 Jul 2020 15:57:04 +0000 (18:57 +0300)]
[analyzer] Simplify function SVal::getAsSymbolicExpression and similar ones

Summary: Simplify functions SVal::getAsSymbolicExpression SVal::getAsSymExpr and SVal::getAsSymbol. After revision I concluded that `getAsSymbolicExpression` and `getAsSymExpr` repeat functionality of `getAsSymbol`, thus them can be removed.

Fix: Remove functions SVal::getAsSymbolicExpression and SVal::getAsSymExpr.

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

4 years ago[clang][Tooling] Optimize addTargetAndMode in case of invalid modes
Kadir Cetinkaya [Sat, 1 Aug 2020 17:03:40 +0000 (19:03 +0200)]
[clang][Tooling] Optimize addTargetAndMode in case of invalid modes

This skips searching for `target` related flags in the existing args if
we don't have a valid target to insert.

Depends on D85076

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

4 years ago[llvm-readobj] - Don't stop dumping when the name of a relocation section can't be...
Georgii Rymar [Thu, 23 Jul 2020 14:10:31 +0000 (17:10 +0300)]
[llvm-readobj] - Don't stop dumping when the name of a relocation section can't be read.

This removes undesired `unwrapOrError` calls from printRelocations() methods.

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

4 years ago[llvm-readobj] - Massive test cases cleanup.
Georgii Rymar [Thu, 30 Jul 2020 14:55:47 +0000 (17:55 +0300)]
[llvm-readobj] - Massive test cases cleanup.

This patch does the following:
1) Starts using YAML macro to reduce the number of YAML documents in tests.
2) Adds `#` before 'RUN'/`CHECK` lines in a few tests where it is missing.
3) Removes unused YAML keys.
4) Starts using `ENTSIZE=<none>` to simplify tests (see D84526).
5) Removes trailing white spaces in a few places.

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

4 years agoFix update_cc_test_checks.py --llvm-bin after D78478
Alex Richardson [Mon, 3 Aug 2020 10:18:01 +0000 (11:18 +0100)]
Fix update_cc_test_checks.py --llvm-bin after D78478

Not passing --clang would result in a python exception after this change:
(TypeError: expected str, bytes or os.PathLike object, not NoneType)
because the --clang argument default was only being populated in the
initial argument parsing pass but not later on.
Fix this by adding an argparse callback to set the default values.

Reviewed By: vitalybuka, MaskRay

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

4 years ago[lldb/Process/Windows] Attempting to kill exited/detached process in not an error
Tatyana Krasnukha [Thu, 30 Jul 2020 17:13:23 +0000 (20:13 +0300)]
[lldb/Process/Windows] Attempting to kill exited/detached process in not an error

The lldb test-suite on Windows reports a 'CLEANUP ERROR' when attempting to kill
an exited/detached process. This change makes ProcessWindows consistent with
the other processes which only log the error. After this change a number of
'CLEANUP ERROR' messages are now removed.

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

4 years ago[cmake] Make MSVC generate appropriate __cplusplus macro definition
Tatyana Krasnukha [Fri, 17 Jul 2020 12:58:28 +0000 (15:58 +0300)]
[cmake] Make MSVC generate appropriate __cplusplus macro definition

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

4 years agoExecute llvm-lit with the python found by CMake by default
Alex Richardson [Mon, 3 Aug 2020 09:51:14 +0000 (10:51 +0100)]
Execute llvm-lit with the python found by CMake by default

The check-* targets run ${Python3_EXECUTABLE} $BUILD/bin/llvm-lit, but
running `./bin/llvm-lit $ARGS` from the build directory currently always
uses "python" to run llvm-lit. On most systems this will be python2.7 even
if we found python3 at CMake time.

Reviewed By: compnerd

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

4 years ago[msan] Compile the libatomic.c test with a C compiler
Alex Richardson [Mon, 3 Aug 2020 09:31:31 +0000 (10:31 +0100)]
[msan] Compile the libatomic.c test with a C compiler

Otherwise we end up compiling in C++ mode and on FreeBSD
/usr/include/stdatomic.h is not compatible with C++ since it uses _Bool.

Reviewed By: guiand, eugenis, vitalybuka, emaste

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

4 years ago[asan][tsan] Mark tests failing with debug checks as XFAIL
Alex Richardson [Mon, 3 Aug 2020 09:04:01 +0000 (10:04 +0100)]
[asan][tsan] Mark tests failing with debug checks as XFAIL

See https://llvm.org/PR46862. This does not fix the underlying issue but at
least it allows me to run check-all again without having to disable
building compiler-rt.

Reviewed By: #sanitizers, vitalybuka

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

4 years ago[clang][Tooling] Fix addTargetAndModeForProgramName to use correct flag names
Kadir Cetinkaya [Sat, 1 Aug 2020 16:55:30 +0000 (18:55 +0200)]
[clang][Tooling] Fix addTargetAndModeForProgramName to use correct flag names

The logic was using incorrect flag versions. For example:
- `-target=` can't be a prefix, it must be `--target=`.
- `--driver-mode` can't appear on its own, value must be attached to it.

While fixing those, also changes the append logic to make use of new
`--target=X` format instead of the legacy `-target X` version.

In addition to that makes use of the OPTTable instead of hardcoded strings to
make sure helper also gets updated if clang's options are modified.

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

4 years ago[llvm-readobj] - Don't call `unwrapOrErr` in `findSectionByName`.
Georgii Rymar [Mon, 27 Jul 2020 13:03:03 +0000 (16:03 +0300)]
[llvm-readobj] - Don't call `unwrapOrErr` in `findSectionByName`.

We have a `findSectionByName` helper that tries to find a section
by it name. It is used in a few places, but never tested.

I'd like to reuse this helper for a different place.
For this, I've changed it to return Expected<> and now it
doesn't use `unwrapOrErr` anymore. It also now a member of
Dumper class and might report warnings.

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

4 years agoAdd document outline symbols from unnamed contexts, e.g. extern "C".
Ilya Golovenko [Mon, 3 Aug 2020 09:34:14 +0000 (11:34 +0200)]
Add document outline symbols from unnamed contexts, e.g. extern "C".

It is necessary to traverse children of unnamed declaration contexts
to get symbols which are currently missing in document outline, e.g.:

extern "C" {
void foo();
}

Reviewed By: kadircet

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

4 years ago[yaml2obj] - Add a support for "<none>" value for all optional fields.
Georgii Rymar [Thu, 23 Jul 2020 12:26:23 +0000 (15:26 +0300)]
[yaml2obj] - Add a support for "<none>" value for all optional fields.

It implements an approach suggested in the D84398 thread.

With it the following:

```
Sections:
  - Name:   .bar
    Type:   SHT_PROGBITS
    Offset: [[MACRO=<none>]]
```

works just like the `Offset` key was not specified.
It is useful for tests that want to have a default value for a field and to
have a way to override it at the same time.

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

4 years ago[mlir] Extended Buffer Assignment to support AllocaOps.
Julian Gross [Fri, 31 Jul 2020 09:42:31 +0000 (11:42 +0200)]
[mlir] Extended Buffer Assignment to support AllocaOps.

Added support for AllocaOps in Buffer Assignment.

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

4 years agofix lldb test on lib64 systems
Luboš Luňák [Sun, 2 Aug 2020 15:44:24 +0000 (17:44 +0200)]
fix lldb test on lib64 systems

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

4 years ago[LV] Do not check widening decision for instrs outside of loop.
Florian Hahn [Mon, 3 Aug 2020 08:47:16 +0000 (09:47 +0100)]
[LV] Do not check widening decision for instrs outside of loop.

No widening decisions will be computed for instructions outside the
loop. Do not try to get a widening decision. The load/store will be just
a scalar load, so treating at as normal should be fine I think.

Fixes PR46950.

Reviewed By: dmgreen

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

4 years ago[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full...
Nicolas Vasilache [Mon, 3 Aug 2020 08:39:18 +0000 (04:39 -0400)]
[mlir][Vector] Add transformation + pattern to split vector.transfer_read into full and partial copies.

This revision adds a transformation and a pattern that rewrites a "maybe masked" `vector.transfer_read %view[...], %pad `into a pattern resembling:

```
   %1:3 = scf.if (%inBounds) {
      scf.yield %view : memref<A...>, index, index
    } else {
      %2 = vector.transfer_read %view[...], %pad : memref<A...>, vector<...>
      %3 = vector.type_cast %extra_alloc : memref<...> to
      memref<vector<...>> store %2, %3[] : memref<vector<...>> %4 =
      memref_cast %extra_alloc: memref<B...> to memref<A...> scf.yield %4 :
      memref<A...>, index, index
   }
   %res= vector.transfer_read %1#0[%1#1, %1#2] {masked = [false ... false]}
```
where `extra_alloc` is a top of the function alloca'ed buffer of one vector.

This rewrite makes it possible to realize the "always full tile" abstraction where vector.transfer_read operations are guaranteed to read from a padded full buffer.
The extra work only occurs on the boundary tiles.

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

4 years ago[debugserver] Fix that is_dot_app is producing unused warnings
Raphael Isemann [Mon, 3 Aug 2020 08:23:48 +0000 (10:23 +0200)]
[debugserver] Fix that is_dot_app is producing unused warnings

Some build configurations don't use this static function.

4 years ago[MLIR][Shape] Lower `shape.broadcast` to `scf`
Frederik Gossen [Mon, 3 Aug 2020 08:18:48 +0000 (08:18 +0000)]
[MLIR][Shape] Lower `shape.broadcast` to `scf`

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

4 years ago[MachOYAML] Remove redundant variable initialization. NFC.
Xing GUO [Mon, 3 Aug 2020 08:14:47 +0000 (16:14 +0800)]
[MachOYAML] Remove redundant variable initialization. NFC.

The value of `is64Bit` is initialized in the constructor body.

4 years ago[Attributor] Check nonnull attribute violation in AAUndefinedBehavior
Shinji Okumura [Mon, 3 Aug 2020 08:02:49 +0000 (17:02 +0900)]
[Attributor] Check nonnull attribute violation in AAUndefinedBehavior

This patch makes it possible to handle nonnull attribute violation at callsites in AAUndefinedBehavior.
If null pointer is passed to callee at a callsite and the corresponding argument of callee has nonnull attribute, the behavior of the callee is undefined.
In this patch, violations of argument nonnull attributes is only handled.
But violations of returned nonnull attributes can be handled and I will implement that in a follow-up patch.

Reviewed By: jdoerfert

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

4 years ago[DebugInfo] Make DIEDelta::SizeOf() more explicit. NFCI.
Igor Kudrin [Mon, 3 Aug 2020 08:04:15 +0000 (15:04 +0700)]
[DebugInfo] Make DIEDelta::SizeOf() more explicit. NFCI.

The patch restricts DIEDelta::SizeOf() to accept only DWARF forms that
are actually used in the LLVM codebase. This should make the use of the
class more explicit and help to avoid issues similar to fixed in D83958
and D84094.

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

4 years ago[DebugInfo] Fix misleading using of DWARF forms with DIELabel. NFCI.
Igor Kudrin [Mon, 3 Aug 2020 08:04:08 +0000 (15:04 +0700)]
[DebugInfo] Fix misleading using of DWARF forms with DIELabel. NFCI.

DIELabel can emit only 32- or 64-bit values, while it was created in
some places with DW_FORM_udata, which implies emitting uleb128.
Nevertheless, these places also expected to emit U32 or U64, but just
used a misleading DWARF form. The patch updates those places to use more
appropriate DWARF forms and restricts DIELabel::SizeOf() to accept only
forms that are actually used in the LLVM codebase.

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

4 years ago[DebugInfo] Fix a comment and a variable name. NFC.
Igor Kudrin [Mon, 3 Aug 2020 08:04:00 +0000 (15:04 +0700)]
[DebugInfo] Fix a comment and a variable name. NFC.

DebugLocListIndex keeps the index of an entry list, not the offset.

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

4 years ago[DebugInfo] Make DIELocList::SizeOf() more explicit. NFCI.
Igor Kudrin [Mon, 3 Aug 2020 08:03:37 +0000 (15:03 +0700)]
[DebugInfo] Make DIELocList::SizeOf() more explicit. NFCI.

DIELocList is used with a limited number of DWARF forms, see the only
place where it is instantiated, DwarfCompileUnit::addLocationList().

The patch marks the unexpected execution path in DIELocList::SizeOf()
as unreachable, to reduce ambiguity.

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

4 years ago[libunwind] Make the test depend on the libunwind explicitly.
Daniel Kiss [Mon, 3 Aug 2020 07:40:35 +0000 (09:40 +0200)]
[libunwind] Make the test depend on the libunwind explicitly.

Before this patch the `ninja check-unwind` won't rebuild the unwind library.

Reviewed By: jroelofs

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

4 years ago[NFC] [MIR] Document the reg state flags
Djordje Todorovic [Mon, 3 Aug 2020 07:01:37 +0000 (09:01 +0200)]
[NFC] [MIR] Document the reg state flags

This patch adds documentation for the RegState enumeration.

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

4 years ago[MLIR][SPIRV] Control attributes support for loop and selection
George Mitenkov [Mon, 3 Aug 2020 06:31:08 +0000 (09:31 +0300)]
[MLIR][SPIRV] Control attributes support for loop and selection

This patch handles loopControl and selectionControl in parsing and
printing. In order to reuse the functionality, and avoid handling cases when
`{` of the region is parsed as a dictionary attribute, `control` keyword was
introduced.`None` is a default control attribute. This functionality can be
later extended to `spv.func`.
Also, loopControl and selectionControl can now be (de)serialized.

Reviewed By: antiagainst

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

4 years ago[CMake] Default ENABLE_X86_RELAX_RELOCATIONS to ON
Fangrui Song [Mon, 3 Aug 2020 06:05:50 +0000 (23:05 -0700)]
[CMake] Default ENABLE_X86_RELAX_RELOCATIONS to ON

This makes clang default to -Wa,-mrelax-relocations=yes, which enables
R_386_GOT32X (GNU as enables it regardless of -mrelax-relocations=) and
R_X86_64_[REX_]GOTPCRELX in MC. The produced object files require GNU ld>=2.26
to link. binutils 2.26 is considered a very old release today.

4 years ago[gn build] Port 160ff83765a
LLVM GN Syncbot [Mon, 3 Aug 2020 05:55:14 +0000 (05:55 +0000)]
[gn build] Port 160ff83765a

4 years ago[OpenMP][AMDGCN] Support OpenMP offloading for AMDGCN architecture - Part 3
Saiyedul Islam [Mon, 3 Aug 2020 05:29:48 +0000 (05:29 +0000)]
[OpenMP][AMDGCN] Support OpenMP offloading for AMDGCN architecture - Part 3

Provides AMDGCN and NVPTX specific specialization of getGPUWarpSize,
getGPUThreadID, and getGPUNumThreads methods. Adds tests for AMDGCN
codegen for these methods in generic and simd modes. Also changes the
precondition in InitTempAlloca to be slightly more permissive. Useful for
AMDGCN OpenMP codegen where allocas are created with a cast to an
address space.

Reviewed By: ABataev

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

4 years ago[MC] Default MCAsmBackend::mayNeedRelaxation() to false
Fangrui Song [Mon, 3 Aug 2020 05:13:59 +0000 (22:13 -0700)]
[MC] Default MCAsmBackend::mayNeedRelaxation() to false

4 years ago[FLANG] Fix issues in SELECT TYPE construct when intrinsic type specification is...
compinder [Mon, 3 Aug 2020 03:27:17 +0000 (08:57 +0530)]
[FLANG] Fix issues in SELECT TYPE construct when intrinsic type specification is specified in TYPE GUARD statement.

Fix of PR46789 and PR46830.

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