platform/upstream/llvm.git
4 years ago[mlir][spirv] Improve stride support in array types
Lei Zhang [Mon, 13 Apr 2020 16:47:58 +0000 (12:47 -0400)]
[mlir][spirv] Improve stride support in array types

This commit added stride support in runtime array types. It also
adjusted the assembly form for the stride from `[N]` to `stride=N`.
This makes the IR more readable, especially for the cases where
one mix array types and struct types.

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

4 years ago[SanCov] Disable whitelist/blacklist test on Darwin.
Matt Morehouse [Mon, 13 Apr 2020 17:58:26 +0000 (10:58 -0700)]
[SanCov] Disable whitelist/blacklist test on Darwin.

4 years ago[gn build] (manually) merge 6dbf1a1229ba
Nico Weber [Mon, 13 Apr 2020 17:57:00 +0000 (13:57 -0400)]
[gn build] (manually) merge 6dbf1a1229ba

4 years ago[InstCombine] Fix debug variance issue in tryToMoveFreeBeforeNullTest
Vedant Kumar [Fri, 10 Apr 2020 23:47:09 +0000 (16:47 -0700)]
[InstCombine] Fix debug variance issue in tryToMoveFreeBeforeNullTest

Fix an issue where the presence of debug info could disable an
optimization in tryToMoveFreeBeforeNullTest.

4 years ago[Debugify] Strip added metadata in the -debugify-each pipeline
Vedant Kumar [Fri, 10 Apr 2020 21:58:13 +0000 (14:58 -0700)]
[Debugify] Strip added metadata in the -debugify-each pipeline

Summary:
Share logic to strip debugify metadata between the IR and MIR level
debugify passes. This makes it simpler to hunt for bugs by diffing IR
with vs. without -debugify-each turned on.

As a drive-by, fix an issue causing CallGraphNodes to become invalid
when a dead llvm.dbg.value prototype is deleted.

Reviewers: dsanders, aprantl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm-xray][test] Combine two AArch64 tests
Fangrui Song [Fri, 10 Apr 2020 16:41:41 +0000 (09:41 -0700)]
[llvm-xray][test] Combine two AArch64 tests

Rename extract-instrmap-aarch64.test to extract-instrmap.test because
the path component `AArch64` conveys the target name clearly.

Additionally, adopt a convention we start to use in LLVM binary
utilities: prepend `#` to CHECK/RUN lines and `##` to comment lines even
if the file contains no code. The notation makes CHECK/RUN/comments
stand out.

Reviewed By: dberris

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

4 years agoReimplement mlir::Identifier to be a wrapper around 'StringMapEntry*' instead of...
Chris Lattner [Mon, 13 Apr 2020 05:15:26 +0000 (22:15 -0700)]
Reimplement mlir::Identifier to be a wrapper around 'StringMapEntry*' instead of a wrapper around a 'const char*'.  This makes it so strref() can be computed without calling strlen, which is more efficient and less error-prone.  While here...

Summary:
..., reimplement DenseMapInfo<mlir::Identifier>::getHashValue in terms of mlir::hash_value(Identifier).

Both of these improvements were suggested by River, thanks!

Reviewers: rriddle!

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits

Tags: #llvm

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

4 years ago[clangd] Send the correct error code when cancelling requests.
Sam McCall [Sat, 11 Apr 2020 16:19:50 +0000 (18:19 +0200)]
[clangd] Send the correct error code when cancelling requests.

Summary:
I couldn't quite bring myself to make Cancellation depend on LSP ErrorCode.
Magic numbers instead...

Reviewers: kadircet

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[CostModel][X86] Remove comments that begin with a filecheck prefix.
Simon Pilgrim [Mon, 13 Apr 2020 17:39:07 +0000 (18:39 +0100)]
[CostModel][X86] Remove comments that begin with a filecheck prefix.

Stop filecheck from confusing a general comment with a check.

4 years ago[mlir][spirv] Add missing interface storage classes in serializer
Lei Zhang [Mon, 13 Apr 2020 17:14:07 +0000 (13:14 -0400)]
[mlir][spirv] Add missing interface storage classes in serializer

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

4 years ago[ADT] Reduce the requirements for the simple loop in DenseMap::clear
Benjamin Kramer [Mon, 13 Apr 2020 17:28:20 +0000 (19:28 +0200)]
[ADT] Reduce the requirements for the simple loop in DenseMap::clear

We can use it when just the value doesn't require destruction. Empty
keys are safe to overwrite always. This gets the important case of
std::pair values.

4 years ago[OpenMP] Refined CUDA plugin to put all CUDA operations into class
Shilei Tian [Mon, 13 Apr 2020 17:32:21 +0000 (13:32 -0400)]
[OpenMP] Refined CUDA plugin to put all CUDA operations into class

Summary: Current implementation mixed everything up so that there is almost no encapsulation. In this patch, all CUDA related operations are put into a new class DeviceRTLTy and only necessary functions are exposed. In addition, all C++ code now conforms with LLVM code standard, keeping those API functions following C style.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: jfb, yaxunl, guansong, openmp-commits

Tags: #openmp

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

4 years ago[CallSite removal][GlobalISel] Use CallBase instead of CallSite in lowerCall and...
Craig Topper [Mon, 13 Apr 2020 17:17:29 +0000 (10:17 -0700)]
[CallSite removal][GlobalISel] Use CallBase instead of CallSite in lowerCall and translateCallBase.

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

4 years agoDAG: Fix wrong legality check for ISD::FMAD
Matt Arsenault [Sun, 12 Apr 2020 13:47:03 +0000 (09:47 -0400)]
DAG: Fix wrong legality check for ISD::FMAD

Since 1725f2884175ca618d29b06e35f5c6ebd618053d, this should check
isFMADLegalForFAddFSub rather than the the plain isOperationLegal.

This would assert in a subset of cases due to an oddity in how FMAD is
selected. We will allow FMA formation pre-legalize, but not FMAD even
in cases where it would be valid.

The current hook requires passing in the root fadd/fsub. However, in
this distributed case, this would be far more complicated to pass in
the relevant operand. AMDGPU doesn't get any value from the node, and
only needs the type and is the only implementor, so I'm not sure why
we have this complexity. Just rename and expand the assert to avoid
the more complicated checks spread through the distribution logic.

4 years ago[X86] Move X86ShuffleDecode.cpp/h into MCTargetDesc and remove X86Utils library. NFC
Craig Topper [Mon, 13 Apr 2020 16:33:05 +0000 (09:33 -0700)]
[X86] Move X86ShuffleDecode.cpp/h into MCTargetDesc and remove X86Utils library. NFC

The shuffle decoding is used by X86ISelLowering and
MCTargetDesc/X86InstComments. The latter used to be in a
separate InstPrinter library. The Utils library existed to allow
InstPrinter and CodeGen to share the shuffle decoding. Since
X86InstComments now lives in the MCTargetDesc, which CodeGen
already depends on, we can sink the shuffle decoding there as well.

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

4 years ago[llvm] Fix yet more missing FileCheck colons
Jon Roelofs [Mon, 13 Apr 2020 16:21:01 +0000 (10:21 -0600)]
[llvm] Fix yet more missing FileCheck colons

4 years ago[llvm] Fix another missing FileCheck colon
Jon Roelofs [Mon, 13 Apr 2020 16:19:57 +0000 (10:19 -0600)]
[llvm] Fix another missing FileCheck colon

4 years ago[llvm] Fix more missing FileCheck directive colons
Jonathan Roelofs [Thu, 2 Apr 2020 22:28:32 +0000 (16:28 -0600)]
[llvm] Fix more missing FileCheck directive colons

4 years ago[lit] Print substitutions with --show-suites
Louis Dionne [Thu, 9 Apr 2020 18:34:58 +0000 (14:34 -0400)]
[lit] Print substitutions with --show-suites

We already print available features, and it can be useful to print
substitutions as well since those are a pretty fundamental part of
a test suite. We could also consider printing other things like the
test environment, however the need doesn't appear to be as strong.

As a fly-by fix, we also always print available features, even when
there are none.

Before:

  $ lit -sv libcxx/test --show-suites
  -- Test Suites --
    libc++ - 6350 tests
      Source Root: [...]
      Exec Root  : [...]
      Available Features : -faligned-allocation -fsized-deallocation [...]

After:

  $ lit -sv libcxx/test --show-suites
  -- Test Suites --
    libc++ - 6350 tests
      Source Root: [...]
      Exec Root  : [...]
      Available Features: -faligned-allocation -fsized-deallocation [...]
      Available Substitutions: %{build_module} => [...]
                               %{build} => %{cxx} -o [...]

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

4 years agoFix an indent.
Nico Weber [Mon, 13 Apr 2020 15:53:23 +0000 (11:53 -0400)]
Fix an indent.

4 years ago[llvm-objdump] Fix incomplete relocation output for -D -r mode
jasonliu [Mon, 13 Apr 2020 15:49:36 +0000 (15:49 +0000)]
[llvm-objdump] Fix incomplete relocation output for -D -r mode

This patch intends to fix incomplete relocation printing for
XCOFF (potentially for other targets).

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

4 years ago[X86] Improve combineVectorShiftImm
Jay Foad [Thu, 2 Apr 2020 11:20:35 +0000 (12:20 +0100)]
[X86] Improve combineVectorShiftImm

Summary:
Fold (shift (shift X, C2), C1) -> (shift X, (C1 + C2)) for logical as
well as arithmetic shifts. This is needed to prevent regressions from
an upcoming funnel shift expansion change.

While we're here, fold (VSRAI -1, C) -> -1 too.

Reviewers: RKSimon, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang-format] use spaces for alignment with UT_ForContinuationAndIndentation
mydeveloperday [Mon, 13 Apr 2020 14:14:26 +0000 (15:14 +0100)]
[clang-format] use spaces for alignment with UT_ForContinuationAndIndentation

Summary:
Use spaces instead of tabs for alignment with UT_ForContinuationAndIndentation to make the code aligned for any tab/indent width.

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

Reviewed By: MyDeveloperDay

Patch By: fickert

Tags: #clang-format

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

4 years ago[clang-format] A Minor change to clang-format-diff.py
mydeveloperday [Mon, 13 Apr 2020 14:08:07 +0000 (15:08 +0100)]
[clang-format] A Minor change to clang-format-diff.py

Summary: Testing for None should use the 'is' operator.

Reviewed By: MyDeveloperDay

Patch By:  eagleoflqj

Tags: #clang-format

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

4 years ago[clang-format] Always break line after enum opening brace
mydeveloperday [Mon, 13 Apr 2020 14:03:36 +0000 (15:03 +0100)]
[clang-format] Always break line after enum opening brace

Summary:
clang-format currently puts the first enumerator on the same line as the
enum keyword and opening brace if it fits (for example, for anonymous
enums if IndentWidth is 8):

  $ echo "enum { RED, GREEN, BLUE };" | clang-format -style="{BasedOnStyle: llvm, ColumnLimit: 15, IndentWidth: 8}"
  enum { RED,
         GREEN,
         BLUE };

This doesn't seem to be intentional, as I can't find any style guide that
suggests wrapping enums this way. Always force the enumerator to be on a new
line, which gets us the desired result:

  $ echo "enum { RED, GREEN, BLUE };" | ./bin/clang-format -style="{BasedOnStyle: llvm, ColumnLimit: 15, IndentWidth: 8}"
  enum {
          RED,
          GREEN,
          BLUE
  };

Test Plan:

New test added. Confirmed test failed without change and passed with change by
running:

  $ ninja FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewed By: MyDeveloperDay

Patch By: osandov

Tags: #clang-format, #clang

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

4 years ago[X86][AVX] Attempt to scale masked shuffles to match the root type
Simon Pilgrim [Mon, 13 Apr 2020 13:57:25 +0000 (14:57 +0100)]
[X86][AVX] Attempt to scale masked shuffles to match the root type

Improve the chances of folding the writemask into the combined shuffle by scaling a wider shuffle mask to match the root's original type.

This creates a few minor issues with variable shuffles, preventing combines of shuffles because of the more limited support binary shuffle types. In most cases we're probably better off combining the shuffles and losing the writemask fold, but this isn't always going to be true.

4 years ago[X86][AVX] Add some masked variable shuffle tests
Simon Pilgrim [Mon, 13 Apr 2020 13:29:57 +0000 (14:29 +0100)]
[X86][AVX] Add some masked variable shuffle tests

Now that's D77928 landed we need to try harder to match shuffle and mask widths. This is a couple of tests showing where variable shuffle masks have been widened preventing them from folding with the mask.

4 years agoAddress sphinx warnings
Benjamin Kramer [Mon, 13 Apr 2020 12:39:25 +0000 (14:39 +0200)]
Address sphinx warnings

LanguageExtensions.rst:2191: WARNING: Title underline too short.
llvm-symbolizer.rst:157: Error in "code-block" directive: maximum 1 argument(s) allowed, 30 supplied.

4 years agoCodeMetrics.h - include and forward declaration cleanup. NFC.
Simon Pilgrim [Mon, 13 Apr 2020 12:09:08 +0000 (13:09 +0100)]
CodeMetrics.h - include and forward declaration cleanup. NFC.

Remove SmallPtrSet include, replace with forward declaration and include SmallPtrSet.h in CodeMetrics.cpp directly.
Remove unused llvm::DataLayout/Instruction forward declarations.

4 years agoIVDescriptors.h - include and forward declaration cleanup. NFC.
Simon Pilgrim [Mon, 13 Apr 2020 11:01:14 +0000 (12:01 +0100)]
IVDescriptors.h - include and forward declaration cleanup. NFC.

Replace unused AliasAnalysis.h and EHPersonalities.h includes
Remove unused llvm::AliasSet/AliasSetTracker/BasicBlock/DataLayout/LoopInfo/OptimizationRemarkEmitter/PredIteratorCache/TargetLibraryInfo/TargetTransformInfo forward declarations.

4 years ago[X86][AVX] Create splitVectorIntBinary helper.
Simon Pilgrim [Sun, 12 Apr 2020 15:15:26 +0000 (16:15 +0100)]
[X86][AVX] Create splitVectorIntBinary helper.

Removes duplicate code from split256IntArith/split512IntArith.

4 years agoTypos correction.
SCOTT-HAMILTON [Mon, 13 Apr 2020 06:39:58 +0000 (08:39 +0200)]
Typos correction.

4 years agoNormalize working directory when running llvm-mc in test
serge-sans-paille [Mon, 13 Apr 2020 11:44:15 +0000 (13:44 +0200)]
Normalize working directory when running llvm-mc in test

Otherwise, depending on the lit location used to run the test, llvm-mc adds an
include_directories entry in the dwarf output, which breaks tests in some setup.

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

4 years agofix some doc typos to cycle bots
Nico Weber [Mon, 13 Apr 2020 10:28:33 +0000 (06:28 -0400)]
fix some doc typos to cycle bots

4 years ago[clangd] Update TUStatus test to handle async PreambleThread
Kadir Cetinkaya [Tue, 7 Apr 2020 18:53:56 +0000 (20:53 +0200)]
[clangd] Update TUStatus test to handle async PreambleThread

Summary:
Currently it doesn't matter because we run PreambleThread in sync mode.
Once we start running it in async, test order will become non-deterministic.

Reviewers: sammccall

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, mgrang, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[LV] Clean up vectorizeInterleaveGroup (NFCI)
Gil Rapaport [Mon, 13 Apr 2020 05:53:42 +0000 (08:53 +0300)]
[LV] Clean up vectorizeInterleaveGroup (NFCI)

Pass from the calling recipe the interleave group itself instead of passing the
group's insertion position and having the function query CM for its interleave
group and making sure that given instruction is the insertion point of.

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

4 years ago[AssumeBundles] adapt Assumption cache to assume bundles
Tyker [Mon, 13 Apr 2020 09:27:27 +0000 (11:27 +0200)]
[AssumeBundles] adapt Assumption cache to assume bundles

Summary: change assumption cache to store an assume along with an index to the operand bundle containing the knowledge.

Reviewers: jdoerfert, hfinkel

Reviewed By: jdoerfert

Subscribers: hiraditya, mgrang, llvm-commits

Tags: #llvm

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

4 years ago[LLDB] Remove xfail aarch64/linux from TestThreadPlanCommands.py
Muhammad Omair Javaid [Mon, 13 Apr 2020 09:30:23 +0000 (14:30 +0500)]
[LLDB] Remove xfail aarch64/linux from TestThreadPlanCommands.py

4 years agoRevert "[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef."
Benjamin Kramer [Mon, 13 Apr 2020 09:23:26 +0000 (11:23 +0200)]
Revert "[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef."

This reverts commit 1a02aaeaa4f8675490da38ee8cb0d4a6d39815dd. Crashes on
the following test case:

$ cat crash.ll
source_filename = "__compute_module"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"

@0 = private unnamed_addr constant [24 x i8] c"\00\00\C0\7F\00\00\C0\7F\09\85\08?\ED\C94\FE~\EB/\F3\90\CF\BA\C1"
@1 = private unnamed_addr constant [24 x i8] c"\00\00\C0\7F\A3\A0\0FA\00\00\C0\7F\00\00\C0\7F\00\00\00\00\02\9AA\00"

define void @IgammaSpecialValues.448() {
entry:
  br label %fusion.26.loop_header.dim.0

fusion.26.loop_header.dim.0:                      ; preds = %fusion.26.loop_header.dim.0, %entry
  %fusion.26.invar_address.dim.0.0 = phi i64 [ 0, %entry ], [ %invar.inc17, %fusion.26.loop_header.dim.0 ]
  %0 = getelementptr inbounds [6 x float], [6 x float]* bitcast ([24 x i8]* @0 to [6 x float]*), i64 0, i64 %fusion.26.invar_address.dim.0.0
  %1 = load float, float* %0
  %2 = fmul float %1, 0.000000e+00
  %3 = getelementptr inbounds [6 x float], [6 x float]* bitcast ([24 x i8]* @1 to [6 x float]*), i64 0, i64 %fusion.26.invar_address.dim.0.0
  %4 = load float, float* %3
  %5 = fneg float %4
  %6 = fadd float %2, %5
  %invar.inc17 = add nuw nsw i64 %fusion.26.invar_address.dim.0.0, 1
  br label %fusion.26.loop_header.dim.0
}

$ opt -ipsccp -S < crash.ll
opt: llvm/include/llvm/Analysis/ValueLattice.h:251: bool llvm::ValueLatticeElement::markConstant(llvm::Constant *, bool): Assertion `getConstant() == V && "Marking constant with different value"' failed.

4 years ago[mlir][NFC] Mark a debug only variable as (void) to avoid unused warning
River Riddle [Mon, 13 Apr 2020 07:48:17 +0000 (00:48 -0700)]
[mlir][NFC] Mark a debug only variable as (void) to avoid unused warning

4 years ago[VPlan] Introduce VPWidenSelectRecipe (NFC).
Florian Hahn [Mon, 13 Apr 2020 07:28:26 +0000 (08:28 +0100)]
[VPlan] Introduce VPWidenSelectRecipe (NFC).

Widening a selects depends on whether the condition is loop invariant or
not. Rather than checking during codegen-time, the information can be
recorded at the VPlan construction time.

This was suggested as part of D76992, to reduce the reliance on
accessing the original underlying IR values.

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: gilr

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

4 years ago[mlir][SymbolDCE][NFC] Fix the visibility of the symbols within the test and
River Riddle [Mon, 13 Apr 2020 07:19:14 +0000 (00:19 -0700)]
[mlir][SymbolDCE][NFC] Fix the visibility of the symbols within the test and
move it to test/Transforms/

4 years ago[CallSite removal][CodeGen] Use CallBase instead of CallSite in getNoopInput in Analy...
Craig Topper [Mon, 13 Apr 2020 06:47:17 +0000 (23:47 -0700)]
[CallSite removal][CodeGen] Use CallBase instead of CallSite in getNoopInput in Analysis.cpp. NFC

4 years ago[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in TargetFrameL...
Craig Topper [Mon, 13 Apr 2020 06:43:06 +0000 (23:43 -0700)]
[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in TargetFrameLoweringInfo. NFC

4 years ago[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in IntrinsicLow...
Craig Topper [Mon, 13 Apr 2020 06:34:57 +0000 (23:34 -0700)]
[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in IntrinsicLowering. NFC

4 years ago[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in WinEHPrepare...
Craig Topper [Mon, 13 Apr 2020 06:12:41 +0000 (23:12 -0700)]
[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in WinEHPrepare. NFC

4 years ago[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in SwiftErrorVa...
Craig Topper [Mon, 13 Apr 2020 06:09:35 +0000 (23:09 -0700)]
[CallSite removal][CodeGen] Use CallBase instead of ImmutableCallSite in SwiftErrorValueTracking. NFC

4 years ago[MC] Reorganize and improve macro tests
Fangrui Song [Mon, 13 Apr 2020 05:02:55 +0000 (22:02 -0700)]
[MC] Reorganize and improve macro tests

* Reorganize tests and add coverage
* Improve diagnostic testing
* Make assert() tests more relevant
* Rename tests to macro-* or altmacro-*

This is not NFC because a (previously untested) diagnostic message is changed.

4 years agoRemove dependency between test files.
Alexander Kornienko [Mon, 13 Apr 2020 04:16:46 +0000 (06:16 +0200)]
Remove dependency between test files.

There seems to be no good reason for rocm-device-libs.cl to depend on opencl.cl.
Removed this dependency to unbreak the tests in our setup.

4 years ago[AMDGPU] Don't assert on partial exec copy
Austin Kerbow [Mon, 13 Apr 2020 01:44:45 +0000 (18:44 -0700)]
[AMDGPU] Don't assert on partial exec copy

After Machine CSE and coalescing we can end up with copies of exec to
subregister SGPRs.

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

4 years ago[NFC][PowerPC] Add a new test case early-ret-verify.mir
Kang Zhang [Mon, 13 Apr 2020 03:48:35 +0000 (03:48 +0000)]
[NFC][PowerPC] Add a new test case early-ret-verify.mir

4 years ago[mlir][EnumGen] Generate utility symbolizeEnum and stringifyEnum methods during EnumGen
River Riddle [Mon, 13 Apr 2020 02:03:33 +0000 (19:03 -0700)]
[mlir][EnumGen] Generate utility symbolizeEnum and stringifyEnum methods during EnumGen

Summary:
This revision adds generation of two utility methods during EnumGen:
```
llvm::Optional<EnumType> symbolizeEnum<EnumType>(llvm::StringRef)
<stringifyResult> stringifyEnum(EnumType);
```

This provides a generic interface for stringifying/symbolizing any enum that can be used in a template environment.

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

4 years ago[CallSite removal][FastISel] Use CallBase instead of CallSite in fastLowerCall.
Craig Topper [Sun, 12 Apr 2020 23:47:06 +0000 (16:47 -0700)]
[CallSite removal][FastISel] Use CallBase instead of CallSite in fastLowerCall.

4 years agoclang format one more line.
Chris Lattner [Sun, 12 Apr 2020 23:36:56 +0000 (16:36 -0700)]
clang format one more line.

4 years agoNFC: Clean up the implementation of StringPool a bit, and remove dependence on some...
Chris Lattner [Sun, 12 Apr 2020 17:44:03 +0000 (10:44 -0700)]
NFC: Clean up the implementation of StringPool a bit, and remove dependence on some "implicitly MallocAllocator" based methods on StringMapEntry. This allows reducing the #includes in StringMapEntry.h.

Summary:
StringPool has many caveats and isn't used in the monorepo.  I will
propose removing it as a patch separate from this refactoring patch.

Reviewers: rriddle

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[GlobalOpt] Explicitly set alignment of bool load/store operations.
Eli Friedman [Sun, 12 Apr 2020 23:01:28 +0000 (16:01 -0700)]
[GlobalOpt] Explicitly set alignment of bool load/store operations.

4 years ago[NFC] Use VectorType::isScalable to align with ongoing VectorType refactor.
Huihui Zhang [Sun, 12 Apr 2020 22:05:37 +0000 (15:05 -0700)]
[NFC] Use VectorType::isScalable to align with ongoing VectorType refactor.

4 years ago[MC][test] Reorganize macro tests
Fangrui Song [Sun, 12 Apr 2020 15:14:37 +0000 (08:14 -0700)]
[MC][test] Reorganize macro tests

* Add locations
* Use FileCheck --match-full-lines --strict-whitespace
* Use CHECK-NEXT:
* Merge related tests
* Delete redundant tests
* Improve test coverage

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

4 years ago[clang-tidy] Convert config options that are bools to use the bool overload of get...
Nathan James [Thu, 9 Apr 2020 21:47:09 +0000 (22:47 +0100)]
[clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)?

Summary: This was done with a script that looks for calls to Options.get(GlobalOrLocal) that take an integer for the second argument and the result is either compared not equal to 0 or implicitly converted to bool. There may be other occurances

Reviewers: aaron.ballman, alexfh, gribozavr2

Reviewed By: aaron.ballman

Subscribers: wuzish, nemanjai, xazax.hun, kbarton, cfe-commits

Tags: #clang

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

4 years ago[NFC] Silence compiler warning [-Wmissing-braces].
Huihui Zhang [Sun, 12 Apr 2020 21:41:03 +0000 (14:41 -0700)]
[NFC] Silence compiler warning [-Wmissing-braces].

llvm/include/llvm/Support/FormatVariadic.h:146:15: warning: suggest braces around initialization of subobject [-Wmissing-braces]
      return {&Items...};
              ^~~~~~
              {     }

4 years ago[X86] Print k-mask in FMA3 comments.
Craig Topper [Sun, 12 Apr 2020 20:16:53 +0000 (13:16 -0700)]
[X86] Print k-mask in FMA3 comments.

4 years ago[CallSite removal][TargetLowering] Use CallBase instead of CallSite in TargetLowering...
Craig Topper [Sun, 12 Apr 2020 04:45:09 +0000 (21:45 -0700)]
[CallSite removal][TargetLowering] Use CallBase instead of CallSite in TargetLowering::ParseConstraints interface.

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

4 years agoreland: [DAG] Fix PR45049: LegalizeTypes crash
Jonathan Roelofs [Sat, 28 Mar 2020 18:55:51 +0000 (12:55 -0600)]
reland: [DAG] Fix PR45049: LegalizeTypes crash

Sometimes LegalizeTypes knows about common subexpressions before SelectionDAG
does, leading to accidental SDValue removal before its reference count was
truly zero.

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

Reviewed-By: bjope
Fixes: https://bugs.llvm.org/show_bug.cgi?id=45049

Reverted in 3ce77142a6452d76d6f97c9a6c2da193e78841ba because the previous patch
broke the expensive-checks bots. The new patch removes the broken check.

4 years ago[llvm][NFC] Refactor uses of CallSite to CallBase - call promotion
Mircea Trofin [Sun, 12 Apr 2020 01:07:50 +0000 (18:07 -0700)]
[llvm][NFC] Refactor uses of CallSite to CallBase - call promotion

Summary:
Updated CallPromotionUtils and impacted sites. Parameters that are
expected to be non-null, and return values that are guranteed non-null,
were replaced with CallBase references rather than pointers.

Left FIXME in places where more changes are facilitated by CallBase, but
aren't CallSites: Instruction* parameters or return values, for example,
where the contract that they are actually CallBase values.

Reviewers: davidxl, dblaikie, wmi

Reviewed By: dblaikie

Subscribers: arsenm, jvesely, nhaehnle, eraman, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years agoRefactor StringMap.h, splitting StringMapEntry out to its own header.
Chris Lattner [Sun, 12 Apr 2020 05:33:06 +0000 (22:33 -0700)]
Refactor StringMap.h, splitting StringMapEntry out to its own header.

Summary:
StringMapEntry.h can have lower dependencies, than StringMap.h, which
is useful for public headers that want to expose inline methods on
StringMapEntry<> but don't need to expose all of StringMap.h.  One
example of this is mlir's Identifier.h, another example is the existing
LLVM StringPool.h.

StringPool also could use a cleanup, I'll deal with that in a follow-on
patch.

Reviewers: rriddle

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[x86] use vector instructions to lower FP->int->FP casts
Sanjay Patel [Sun, 12 Apr 2020 14:26:43 +0000 (10:26 -0400)]
[x86] use vector instructions to lower FP->int->FP casts

As discussed in PR36617:
https://bugs.llvm.org/show_bug.cgi?id=36617#c13
...we can avoid the likely slow round-trip from XMM to GPR to XMM
by using the vector versions of the convert instructions.

Based on experimental results from recent Intel/AMD chips, we don't
need to worry about triggering denorm stalls while operating on
garbage data in the high lanes with convert instructions, so this is
expected to always be as good or better perf than the scalar
instruction equivalent. FP exceptions are also not a concern because
strict code should not be using the regular SDAG opcodes.

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

4 years ago[VectorUtils] add IR-level analysis for widening of shuffle mask
Sanjay Patel [Sun, 12 Apr 2020 13:17:59 +0000 (09:17 -0400)]
[VectorUtils] add IR-level analysis for widening of shuffle mask

This is similar to the recent move/addition of "scaleShuffleMask" (D76508),
but there are a couple of differences:

1. The existing x86 helper (canWidenShuffleElements) always tries to
   divide-by-2, so it gets called iteratively and wouldn't handle the
   general case of non-pow-2 length.
2. The existing x86 code handles "SM_SentinelZero" - we don't have
   that in IR, but this code should be safe to use with that or other
   special (negative) values.

The motivation is to enable shuffle folds in instcombine/vector-combine
that are similar to D76844 and D76727, but in the reverse-bitcast direction.
Those patterns are visible in the tests for D40633.

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

4 years ago[clangd] Reland target_info_test
Kadir Cetinkaya [Sat, 11 Apr 2020 20:25:25 +0000 (22:25 +0200)]
[clangd] Reland target_info_test

4 years agoTrigramIndex.h - remove unnecessary StringMap.h include. NFC
Simon Pilgrim [Sun, 12 Apr 2020 13:30:52 +0000 (14:30 +0100)]
TrigramIndex.h - remove unnecessary StringMap.h include. NFC

Include StringRef.h inside TrigramIndex.cpp as thats the only part of StringMap.h that is actually required.

4 years agoIPO.h - replace SmallVector.h include with forward declaration. NFC.
Simon Pilgrim [Sun, 12 Apr 2020 12:49:57 +0000 (13:49 +0100)]
IPO.h - replace SmallVector.h include with forward declaration. NFC.

4 years agoPass.h - replace StringRef.h include with forward declaration. NFC.
Simon Pilgrim [Sun, 12 Apr 2020 12:36:20 +0000 (13:36 +0100)]
Pass.h - replace StringRef.h include with forward declaration. NFC.

4 years agoVirtRegMap.h - remove unnecessary MCRegisterInfo.h include. NFC
Simon Pilgrim [Sun, 12 Apr 2020 12:11:13 +0000 (13:11 +0100)]
VirtRegMap.h - remove unnecessary MCRegisterInfo.h include. NFC

4 years agoSelectionDAGISel.h - remove Pass.h include and forward declarations. NFC.
Simon Pilgrim [Sun, 12 Apr 2020 11:49:29 +0000 (12:49 +0100)]
SelectionDAGISel.h - remove Pass.h include and forward declarations. NFC.

Remove Pass.h include - we don't use anything direct from the header and its implicitly included by MachineFunctionPass.h.
Remove unused forward declarations.

4 years agoParallelCG.h - replace TargetMachine.h include with forward declaration. NFC.
Simon Pilgrim [Sun, 12 Apr 2020 11:36:02 +0000 (12:36 +0100)]
ParallelCG.h - replace TargetMachine.h include with forward declaration. NFC.

We need to include memory.h as it was being implicitly included.

Also remove unused llvm::TargetOptions forward declaration.

4 years ago[VPlan] Turn classes with all public members into structs (NFC).
Florian Hahn [Sun, 12 Apr 2020 09:51:17 +0000 (10:51 +0100)]
[VPlan] Turn classes with all public members into structs (NFC).

struct should be used when all members are public:
 https://llvm.org/docs/CodingStandards.html#use-of-class-and-struct-keywords

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: Ayal

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

4 years ago[X86] Use isAnyZero shuffle mask helper where possible. NFC.
Simon Pilgrim [Sun, 12 Apr 2020 09:57:29 +0000 (10:57 +0100)]
[X86] Use isAnyZero shuffle mask helper where possible. NFC.

4 years ago[MLIR] Fix MLIR_MAIN_[SRC|INCLUDE]_DIR variables
Ehud Katz [Sun, 12 Apr 2020 06:29:07 +0000 (09:29 +0300)]
[MLIR] Fix MLIR_MAIN_[SRC|INCLUDE]_DIR variables

Define MLIR_MAIN_INCLUDE_DIR, as it was not set anywhere.

Set MLIR_MAIN_SRC_DIR to the actual "source directory", and not the
"include directory" (as currently set).

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

4 years ago[mlir][IR] Manually register command line options for MLIRContext and AsmPrinter
River Riddle [Sun, 12 Apr 2020 06:11:51 +0000 (23:11 -0700)]
[mlir][IR] Manually register command line options for MLIRContext and AsmPrinter

Summary: This revision makes the registration of command line options for these two files manual with `registerMLIRContextCLOptions` and `registerAsmPrinterCLOptions` methods. This removes the last remaining static constructors within lib/.

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

4 years ago[mlir][StorageUniquer] Replace all usages of std::function with function_ref.
River Riddle [Sun, 12 Apr 2020 06:00:11 +0000 (23:00 -0700)]
[mlir][StorageUniquer] Replace all usages of std::function with function_ref.

Summary: std::function has a notoriously large amount of malloc traffic, whereas function_ref is a cheaper and more efficient alternative.

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

4 years agoA few cosmetic cleanups to StringMap/StringSet.h, including fixing
Chris Lattner [Sun, 12 Apr 2020 05:14:35 +0000 (22:14 -0700)]
A few cosmetic cleanups to StringMap/StringSet.h, including fixing
the indentation of the StringSet.h file and its file comment header,
and significantly reduce redundant #includes that are already pulled
in transitively.  NFC.

This is in preparation for a more interesting patch I'll post to phab.

4 years agoChange the identifier table in MLIRContext to use StringSet instead of
Chris Lattner [Sun, 12 Apr 2020 05:06:45 +0000 (22:06 -0700)]
Change the identifier table in MLIRContext to use StringSet instead of
StringMap<char>, saving a byte due to the StringMapEntry specialization
for a value of NoneType.  NFC.

4 years ago[MLIR] CMake cleanup for mlir-opt
Stephen Neuendorffer [Sat, 11 Apr 2020 01:20:20 +0000 (18:20 -0700)]
[MLIR] CMake cleanup for mlir-opt

A few libraries which are also Dialect libraries where independently
in the link line for mlir-opt.  Remove them.

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

4 years ago[MLIR] add cmake abstraction for translation libraries
Stephen Neuendorffer [Fri, 10 Apr 2020 23:58:39 +0000 (16:58 -0700)]
[MLIR] add cmake abstraction for translation libraries

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

4 years agoChange the implementation of mlir::hash_value(Identifier) to be consistent
Chris Lattner [Sun, 12 Apr 2020 04:59:48 +0000 (21:59 -0700)]
Change the implementation of mlir::hash_value(Identifier) to be consistent
with DenseMapInfo<mlir::Identifier>::getHashValue. NFC.

Adjust a few variable names to follow MLIR convention while here NFC.

4 years agoImplement some micro-optimizations for Identifier. NFC
Chris Lattner [Sun, 12 Apr 2020 01:15:56 +0000 (18:15 -0700)]
Implement some micro-optimizations for Identifier. NFC

Summary:
Identifier doesn't maintain a length, so every time strref() is called,
it does a strlen.  In the case of comparisons, this isn't necessary:
there is no need to scan a string to get its length, then rescan it to
do the comparison.  Just done one comparison.

This also moves some assertions in Identifier::get as another
microoptimization for 'assertions enabled' modes.

Reviewers: rriddle!

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits

Tags: #llvm

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

4 years ago[CallSite removal][FastISel] Remove uses of CallSite.
Craig Topper [Sat, 11 Apr 2020 07:35:32 +0000 (00:35 -0700)]
[CallSite removal][FastISel] Remove uses of CallSite.

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

4 years ago[X86] Enable shuffle combining for AVX512 unless the root is used by a vselect
Craig Topper [Sat, 11 Apr 2020 22:17:13 +0000 (15:17 -0700)]
[X86] Enable shuffle combining for AVX512 unless the root is used by a vselect

A lot of vectorized code doesn't use masks so we shouldn't penalize them by not doing shuffle combining on avx512 targets.

I've added support for VALIGNQ/VALIGND and 512-bit SHUF128 to prevent some regressions. I also prevented recombining 256-bit SHUF128 to PERM2X128. We may not need to add 256-bit SHUF128 support, but I don't think I found any cases requiring that in my testing.

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

4 years ago[LoopTerminology] LCSSA: Fix typo in code sample
Stefanos Baziotis [Sun, 12 Apr 2020 01:40:55 +0000 (04:40 +0300)]
[LoopTerminology] LCSSA: Fix typo in code sample

4 years ago[lld][WebAssembly] Add test for --export of empty string
Sam Clegg [Fri, 27 Mar 2020 23:54:39 +0000 (16:54 -0700)]
[lld][WebAssembly] Add test for --export of empty string

The actual bug was fixed in https://reviews.llvm.org/D74589

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

4 years agoAMDGPU/GlobalISel: Fix RegBankSelect for v2s16 shifts
Matt Arsenault [Sat, 11 Apr 2020 23:26:19 +0000 (19:26 -0400)]
AMDGPU/GlobalISel: Fix RegBankSelect for v2s16 shifts

These need to be promoted and scalarized for the SALU.

4 years agoRevert "llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries"
David Blaikie [Sat, 11 Apr 2020 23:53:26 +0000 (16:53 -0700)]
Revert "llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries"

Broke an LLDB build bot & I can't seem to build LLDB locally to fix
forward...
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/15567/steps/test/logs/stdio

This reverts commit 416fa7720e30750939c53935051c6c750dfad2c2.

4 years agoRevert "This is a test commit."
Rahman Lavaee [Sat, 11 Apr 2020 22:55:07 +0000 (15:55 -0700)]
Revert "This is a test commit."

This reverts commit ab31797e166c118217ecf926a29c4b3a4a414847.

4 years agoThis is a test commit.
Rahman Lavaee [Sat, 11 Apr 2020 21:52:33 +0000 (14:52 -0700)]
This is a test commit.

4 years agoAMDGPU/GlobalISel: Legalize 16-bit shift amounts to s16
Matt Arsenault [Sat, 11 Apr 2020 21:04:48 +0000 (17:04 -0400)]
AMDGPU/GlobalISel: Legalize 16-bit shift amounts to s16

The current selector depends on 16-bit shifts using 16-bit shift
amount types, but really it should accept either for all types.

4 years ago[MLIR][NFC] add doc cross links from/to std.alloca
Uday Bondhugula [Sat, 11 Apr 2020 21:11:45 +0000 (02:41 +0530)]
[MLIR][NFC] add doc cross links from/to std.alloca

 Add doc cross links between std.alloca and AutomaticAllocationScope.

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits

Tags: #llvm

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

4 years ago[X86] Cleanup ISD::BRIND handling code in X86DAGToDAGISel::Select. NFC
Craig Topper [Sat, 11 Apr 2020 21:23:42 +0000 (14:23 -0700)]
[X86] Cleanup ISD::BRIND handling code in X86DAGToDAGISel::Select. NFC

-Drop llvm:: on MVT::i32
-Use getValueType instead of getSimpleValueType for an equality
check just cause its shorter and doesn't matter.
-Don't create a const SDValue & since its cheap to copy.
-Remove explicit case from MVT enum to EVT.
-Add message to assert.

4 years ago[X86] Move code that replaces ISD::VSELECT with X86ISD::BLENDV from X86DAGToDAGISel...
Craig Topper [Sat, 11 Apr 2020 21:05:27 +0000 (14:05 -0700)]
[X86] Move code that replaces ISD::VSELECT with X86ISD::BLENDV from X86DAGToDAGISel::Select to PreprocessISelDAG

4 years ago[DenseMap] Add assertion that end() iterator isn't derefenced.
Eli Friedman [Sat, 11 Apr 2020 21:53:09 +0000 (14:53 -0700)]
[DenseMap] Add assertion that end() iterator isn't derefenced.

This would have saved me some time this morning.

4 years ago[mlir][docs] Remove the MLIR prefix from several titles.
River Riddle [Sat, 11 Apr 2020 21:49:03 +0000 (14:49 -0700)]
[mlir][docs] Remove the MLIR prefix from several titles.

This prefix is already implied by the doc location and functions only as
filler.

4 years agoModuleUtils.h - include and forward declaration cleanup. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 12:18:39 +0000 (13:18 +0100)]
ModuleUtils.h - include and forward declaration cleanup. NFC.

Replace SmallSet.h include with SmallVector.h - only SmallVector.h is used from inside SmallSet.h
Remove llvm::StringRef forward declaration (we include StringRef.h)
Remove unused llvm::GlobalVariable forward declaration.