platform/upstream/llvm.git
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.

4 years ago[clangd] Disable failing target_info test
Kadir Cetinkaya [Sat, 11 Apr 2020 20:16:54 +0000 (22:16 +0200)]
[clangd] Disable failing target_info test

4 years ago[CallSite removal][SelectionDAGBuilder] Use CallBase instead of ImmutableCallSite...
Craig Topper [Sat, 11 Apr 2020 06:12:07 +0000 (23:12 -0700)]
[CallSite removal][SelectionDAGBuilder] Use CallBase instead of ImmutableCallSite in visitPatchpoint.

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

4 years ago[clangd][test] Provide registered targets to lit tests
Kadir Cetinkaya [Sat, 11 Apr 2020 15:18:25 +0000 (17:18 +0200)]
[clangd][test] Provide registered targets to lit tests

Summary:
We had tests in clangd (target_info.test) that got enabled only on
systems that know about x86. But they were always disabled as clangd lit config
never registered those targets.

This patch adds those targets as `$TARGET$-registered-target`

Reviewers: sammccall

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

Tags: #clang

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

4 years agoGlobalISel: Fix typo in assert message
Matt Arsenault [Sat, 11 Apr 2020 19:32:04 +0000 (15:32 -0400)]
GlobalISel: Fix typo in assert message

4 years agoAMDGPU/GlobalISel: Fix legalizing <3 x s16> vselects
Matt Arsenault [Sat, 11 Apr 2020 19:59:51 +0000 (15:59 -0400)]
AMDGPU/GlobalISel: Fix legalizing <3 x s16> vselects

4 years ago[CodeGen] Allow partial tail duplication in Machine Block Placement.
Hongtao Yu [Sat, 11 Apr 2020 19:20:12 +0000 (12:20 -0700)]
[CodeGen] Allow partial tail duplication in Machine Block Placement.

Summary: A count profile may affect tail duplication's heuristic causing a block to be duplicated in only a part of its predecessors. This is not allowed in the Machine Block Placement pass where an assert will go off. I'm removing the assert and making the optimization bail out when such case happens.

Reviewers: wenlei, davidxl, Carrot

Reviewed By: Carrot

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoUse more LLVM_ENABLE_ABI_BREAKING_CHECKS in Error.h
Aaron Puchert [Sat, 11 Apr 2020 19:14:01 +0000 (21:14 +0200)]
Use more LLVM_ENABLE_ABI_BREAKING_CHECKS in Error.h

Summary:
If we don't read the flag, we don't need to set it. Then we also don't
need to filter it out to get the pointer.

This should have a (small) positive impact on code size and performance.

Reviewed By: lhames

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

4 years ago[mlir][docs] Refactor the layout of the docs folder
River Riddle [Sat, 11 Apr 2020 18:38:05 +0000 (11:38 -0700)]
[mlir][docs] Refactor the layout of the docs folder

Summary:
This revision performs a few refactorings on the main docs folder. Namely it:
* Adds a new Rationale/ folder to contain various rationale documents
* Moves several "getting started" documents to the Tutorials/ folder
* Cleans up the titles of various documents

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

4 years ago[libc++][test] Silence "unused variable" warning
Casey Carter [Sat, 11 Apr 2020 18:38:53 +0000 (11:38 -0700)]
[libc++][test] Silence "unused variable" warning

4 years ago[MC] Default MCAsmInfo::UseIntegratedAssembler to true
Fangrui Song [Sat, 11 Apr 2020 17:06:18 +0000 (10:06 -0700)]
[MC] Default MCAsmInfo::UseIntegratedAssembler to true

4 years ago[MC] Add UseIntegratedAssembler = false. NFC
Fangrui Song [Sat, 11 Apr 2020 17:01:36 +0000 (10:01 -0700)]
[MC] Add UseIntegratedAssembler = false. NFC

4 years agoSimplify string joins. NFCI.
Benjamin Kramer [Sat, 11 Apr 2020 15:18:54 +0000 (17:18 +0200)]
Simplify string joins. NFCI.

4 years ago[clangd] Remove redundant code in test. NFC
Sam McCall [Sat, 11 Apr 2020 15:14:31 +0000 (17:14 +0200)]
[clangd] Remove redundant code in test. NFC

4 years ago[mlir][docs] Explain the EDSC acronym. NFC
Jonathan Roelofs [Fri, 10 Apr 2020 22:40:31 +0000 (16:40 -0600)]
[mlir][docs] Explain the EDSC acronym. NFC

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

4 years ago[mlir][toy] Fix comment typo. NFC
Jonathan Roelofs [Fri, 10 Apr 2020 14:18:34 +0000 (08:18 -0600)]
[mlir][toy] Fix comment typo. NFC

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

4 years ago[mlir][toy][docs] Fix reference to generated ToyCombine.inc. NFC
Jonathan Roelofs [Wed, 8 Apr 2020 20:55:36 +0000 (14:55 -0600)]
[mlir][toy][docs] Fix reference to generated ToyCombine.inc. NFC

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

4 years ago[mlir][toy][docs] Reword for better sentence flow. NFC
Jonathan Roelofs [Thu, 9 Apr 2020 17:53:56 +0000 (11:53 -0600)]
[mlir][toy][docs] Reword for better sentence flow. NFC

4 years agoAMDGPU/GlobalISel: Work around forming illegal zextload after legalize
Matt Arsenault [Sun, 5 Apr 2020 21:48:55 +0000 (17:48 -0400)]
AMDGPU/GlobalISel: Work around forming illegal zextload after legalize

Selection would fail after the post legalize combiner put an illegal
zextload back together.

The base combiner has parameter to only allow legal operations, but
they appear to not be used. I also don't see a nice way to remove a
single entry from all_combines, so just hack around this.

4 years ago[scudo][standalone] Work with -Werror=class-memaccess
Kostya Kortchinsky [Fri, 10 Apr 2020 20:41:12 +0000 (13:41 -0700)]
[scudo][standalone] Work with -Werror=class-memaccess

Summary:
Fuchsia's gcc uses this, which in turn prevents us to compile successfully
due to a few `memset`'ing some non-trivial classes in some `init`.

Change those `memset` to members initialization.

Reviewers: pcc, hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[MLIR] Handle in-place folding properly in greedy pattern rewrite driver
Uday Bondhugula [Sun, 5 Apr 2020 04:35:52 +0000 (10:05 +0530)]
[MLIR] Handle in-place folding properly in greedy pattern rewrite driver

OperatioFolder::tryToFold performs both true folding and in a few
instances in-place updates through op rewrites. In the latter case, we
should still be applying the supplied pattern rewrites in the same
iteration; however this wasn't the case since tryToFold returned
success() for both true folding and in-place updates, and the patterns
for the in-place updated ops were being applied only in the next
iteration of the driver's outer loop. This fix would make it converge
faster.

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

4 years ago[VectorUtils] rename scaleShuffleMask to narrowShuffleMaskElts; NFC
Sanjay Patel [Sat, 11 Apr 2020 14:05:49 +0000 (10:05 -0400)]
[VectorUtils] rename scaleShuffleMask to narrowShuffleMaskElts; NFC

As proposed in D77881, we'll have the related widening operation,
so this name becomes too vague.

While here, change the function signature to take an 'int' rather
than 'size_t' for the scaling factor, add an assert for overflow of
32-bits, and improve the documentation comments.

4 years agoTargetLoweringObjectFileImpl.h - replace MCExpr.h and Module.h includes with forward...
Simon Pilgrim [Sat, 11 Apr 2020 13:13:18 +0000 (14:13 +0100)]
TargetLoweringObjectFileImpl.h - replace MCExpr.h and Module.h includes with forward declarations. NFC.

Also remove unused llvm::Mangler forward declaration.

4 years ago[FormatVariadic] Put back return type in an attempt to make GCC happy
Benjamin Kramer [Sat, 11 Apr 2020 13:11:44 +0000 (15:11 +0200)]
[FormatVariadic] Put back return type in an attempt to make GCC happy

4 years ago[argpromote] Use formatv to simplify code. NFCI.
Benjamin Kramer [Sat, 11 Apr 2020 12:48:53 +0000 (14:48 +0200)]
[argpromote] Use formatv to simplify code. NFCI.

4 years ago[FormatVariadic] Reduce allocations
Benjamin Kramer [Sat, 11 Apr 2020 12:40:01 +0000 (14:40 +0200)]
[FormatVariadic] Reduce allocations

- Move Adapters array to the stack, we know the size precisely
- Parse format string on demand into a SmallVector. In theory this could
  lead to parsing it multiple times, but I couldn't find a single instance
  of that in LLVM.
- Make more of the implementation details private.

4 years ago[PowerPC] Handle f16 as a storage type only
Nemanja Ivanovic [Sat, 11 Apr 2020 12:34:10 +0000 (07:34 -0500)]
[PowerPC] Handle f16 as a storage type only

The PPC back end currently crashes (fails to select) with f16 input. This patch
expands it on subtargets prior to ISA 3.0 (Power9) and uses the HW conversions
on Power9.

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

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

4 years ago[VPlan] Drop redundant private: at beginning of class defs (NFC).
Florian Hahn [Sat, 11 Apr 2020 11:59:50 +0000 (12:59 +0100)]
[VPlan] Drop redundant private: at beginning of class defs (NFC).

Default visibility for classes is private, so the private: at the top of
various class definitions is redundant.

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: Ayal

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

4 years ago[TSAN] Fix infinite loop on targets where char is unsigned
Nemanja Ivanovic [Sat, 11 Apr 2020 12:08:05 +0000 (07:08 -0500)]
[TSAN] Fix infinite loop on targets where char is unsigned

For targets where char is unsigned (like PowerPC), something like
char c = fgetc(...) will never produce a char that will compare
equal to EOF so this loop does not terminate.
Change the type to int (which appears to be the POSIX return type
for fgetc).
This allows the test case to terminate normally on PPC.

4 years agoCodeGen/EdgeBundles - move Twine.h include down into EdgeBundles.cpp. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:20:20 +0000 (12:20 +0100)]
CodeGen/EdgeBundles - move Twine.h include down into EdgeBundles.cpp. NFC.

EdgeBundles.h has no use for it.

4 years agoLocal.h - remove unnecessary Twine.h include. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:18:18 +0000 (12:18 +0100)]
Local.h - remove unnecessary Twine.h include. NFC.

4 years agoPhiValues.h - remove unused llvm::Use forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:16:19 +0000 (12:16 +0100)]
PhiValues.h - remove unused llvm::Use forward declaration. NFC.

4 years agoObjCARCAnalysisUtils.h - remove unused llvm::raw_ostream forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:15:22 +0000 (12:15 +0100)]
ObjCARCAnalysisUtils.h - remove unused llvm::raw_ostream forward declaration. NFC.

4 years agoSyntheticCountsUtils.h - remove unused llvm::CallGraph/Function forward declarations...
Simon Pilgrim [Sat, 11 Apr 2020 11:14:23 +0000 (12:14 +0100)]
SyntheticCountsUtils.h - remove unused llvm::CallGraph/Function forward declarations. NFC.

4 years agoOptimizationRemarkEmitter.h - remove unused llvm::DebugLoc/Loop/Pass/Twine forward...
Simon Pilgrim [Sat, 11 Apr 2020 11:13:31 +0000 (12:13 +0100)]
OptimizationRemarkEmitter.h - remove unused llvm::DebugLoc/Loop/Pass/Twine forward declarations. NFC.

4 years agoPasses.h - remove unused llvm::LoopPass/Pass/PassInfo forward declarations. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 11:12:36 +0000 (12:12 +0100)]
Passes.h - remove unused llvm::LoopPass/Pass/PassInfo forward declarations. NFC.

4 years ago[OpenMP] Introduce stream pool to make sure the correctness of device synchr...
Shilei Tian [Sat, 11 Apr 2020 11:08:56 +0000 (07:08 -0400)]
[OpenMP] Introduce stream pool to make sure the correctness of device synchr...
...onization

Summary: In previous patch, in order to optimize performance, we only synchronize once
for each target region. The syncrhonization is via stream synchronization.
However, in the extreme situation, the performce might be bad. Consider the
following case: There is a task that requires transferring huge amount of data
(call many times of data transferring function). It is scheduled to the first
stream. And then we have 255 very light tasks scheduled to the remaining 255
streams (by default we have 256 streams). They can be finished before we do
synchronization at the end of the first task. Next, we get another very huge
task. It will be scheduled again to the first stream. Now the first task
finishes its kernel launch and call stream synchronization. Right now, the
stream already contains two kernels, and the synchronization will wait until the
two kernels finish instead of just the first one for the first task.

In this patch, we introduce stream pool. After each synchronization, the stream
will be returned back to the pool to make sure that for each synchronization,
only expected operations are waited.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: gregrodgers, yaxunl, lildmh, guansong, openmp-commits

Tags: #openmp

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

4 years agoPredicateInfo.h - remove unused llvm::Instruction/MemoryAccess/LLVMContext forward...
Simon Pilgrim [Sat, 11 Apr 2020 10:24:18 +0000 (11:24 +0100)]
PredicateInfo.h - remove unused llvm::Instruction/MemoryAccess/LLVMContext forward declarations. NFC.

4 years agoIntrinsicLowering.h - remove unused llvm::Module forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 10:22:24 +0000 (11:22 +0100)]
IntrinsicLowering.h - remove unused llvm::Module forward declaration. NFC.

4 years agoExecutionDomainFix.h - remove unused llvm::MachineBasicBlock forward declaration...
Simon Pilgrim [Sat, 11 Apr 2020 10:21:40 +0000 (11:21 +0100)]
ExecutionDomainFix.h - remove unused llvm::MachineBasicBlock forward declaration. NFC.

4 years agoCallingConvLower.h - remove unused llvm::TargetMachine forward declaration. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 10:20:00 +0000 (11:20 +0100)]
CallingConvLower.h - remove unused llvm::TargetMachine forward declaration. NFC.

4 years agoAnalysis.h - remove unused SDNode/SDValue/SelectionDAG forward declarations. NFC.
Simon Pilgrim [Sat, 11 Apr 2020 10:18:29 +0000 (11:18 +0100)]
Analysis.h - remove unused SDNode/SDValue/SelectionDAG forward declarations. NFC.

4 years agotsan: add newline in test file
Dmitry Vyukov [Sat, 11 Apr 2020 09:13:39 +0000 (11:13 +0200)]
tsan: add newline in test file

Buildbots say:

[126/127] Running lint check for sanitizer sources...
FAILED: projects/compiler-rt/lib/CMakeFiles/SanitizerLintCheck
cd /home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/stage1/projects/compiler-rt/lib && env LLVM_CHECKOUT=/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/llvm SILENT=1 TMPDIR= PYTHON_EXECUTABLE=/usr/bin/python COMPILER_RT=/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/compiler-rt /home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/compiler-rt/test/tsan/fiber_cleanup.cpp:71:  Could not find a newline character at the end of the file.  [whitespace/ending_newline] [5]
ninja: build stopped: subcommand failed.

Somehow this check is not part of 'ninja check-tsan'.

4 years ago[PDB] Remove defunct PDBFileBuilder::commitFpm declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 17:23:29 +0000 (18:23 +0100)]
[PDB] Remove defunct PDBFileBuilder::commitFpm declaration. NFC.

4 years agotsan: fix leak of ThreadSignalContext memory mapping when destroying fibers
Dmitry Vyukov [Sat, 11 Apr 2020 07:52:13 +0000 (09:52 +0200)]
tsan: fix leak of ThreadSignalContext memory mapping when destroying fibers

When creating and destroying fibers in tsan a thread state is created and destroyed. Currently, a memory mapping is leaked with each fiber (in __tsan_destroy_fiber). This causes applications with many short running fibers to crash or hang because of linux vm.max_map_count.

The root of this is that ThreadState holds a pointer to ThreadSignalContext for handling signals. The initialization and destruction of it is tied to platform specific events in tsan_interceptors_posix and missed when destroying a fiber (specifically, SigCtx is used to lazily create the ThreadSignalContext in tsan_interceptors_posix). This patch cleans up the memory by makinh the ThreadState create and destroy the ThreadSignalContext.

The relevant code causing the leak with fibers is the fiber destruction:

void FiberDestroy(ThreadState *thr, uptr pc, ThreadState *fiber) {
  FiberSwitchImpl(thr, fiber);
  ThreadFinish(fiber);
  FiberSwitchImpl(fiber, thr);
  internal_free(fiber);
}

Author: Florian
Reviewed-in: https://reviews.llvm.org/D76073

4 years agotsan: disable ASLR in Go test on NetBSD
Dmitry Vyukov [Sat, 11 Apr 2020 07:46:45 +0000 (09:46 +0200)]
tsan: disable ASLR in Go test on NetBSD

Tsan does not support ASLR on NetBSD.
Disable ASLR in the Go test and extend
the error message to be more actionable.

Reported-by: Keith Randall (khr)
4 years ago[mlir][NFC] Refactor ClassID into a TypeID class.
River Riddle [Sat, 11 Apr 2020 06:46:52 +0000 (23:46 -0700)]
[mlir][NFC] Refactor ClassID into a TypeID class.

Summary: ClassID is a bit janky right now as it involves passing a magic pointer around. This revision hides the internal implementation mechanism within a new class TypeID. This class is a value-typed wrapper around the original ClassID implementation.

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

4 years agoChange FastISel::CallLoweringInfo::CS to be an ImmutableCallSite instead of a pointer...
Craig Topper [Sat, 11 Apr 2020 06:42:09 +0000 (23:42 -0700)]
Change FastISel::CallLoweringInfo::CS to be an ImmutableCallSite instead of a pointer. NFCI.

This is the same as what was done to the CallLoweringInfo in
TargetLowering.h in r309159.

This is just a step on the way to replacing this with CallBase.

4 years ago[mlir][Pass] Add a new `Pass::getArgument` hook
River Riddle [Sat, 11 Apr 2020 05:48:58 +0000 (22:48 -0700)]
[mlir][Pass] Add a new `Pass::getArgument` hook

Summary: This hook allows for passes to specify the command line argument without the need for registration. More concretely this will allow for generating pass crash reproducers without needing to have the passes registered. This should remove the need for production tools to register passes, leaving that solely to development tools like mlir-opt.

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

4 years ago[NFC][test] Refine tests for branch align
Shengchen Kan [Sat, 11 Apr 2020 04:32:35 +0000 (12:32 +0800)]
[NFC][test] Refine tests for branch align

Remove some redundant blank and triple description. And rename some
files.

4 years ago[X86][MC] Make -x86-pad-max-prefix-size compatible with --mc-relax-all
Shengchen Kan [Fri, 10 Apr 2020 10:37:24 +0000 (18:37 +0800)]
[X86][MC] Make -x86-pad-max-prefix-size compatible with --mc-relax-all

Summary: We allow non-relaxable instructions emitted into relaxable Fragment when we prefix padding branch. So we need to check if the instruction need relaxation before relaxing it.  Without this patch, it currently triggers a `report_fatal_error` in `llvm::MCAsmBackend::relaxInstruction` when we prefix padding branch along with `--mc-relax-all`.

Reviewers: LuoYuanke, reames, MaskRay

Reviewed By: MaskRay

Subscribers: MaskRay, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lit] Temporarily disable failing tests on Windows
Julian Lettner [Sat, 11 Apr 2020 03:03:44 +0000 (20:03 -0700)]
[lit] Temporarily disable failing tests on Windows

4 years ago[CallSite removal][SelectionDAGBuilder] Remove most CallSite usage from visitInlineAsm.
Craig Topper [Sat, 11 Apr 2020 01:29:02 +0000 (18:29 -0700)]
[CallSite removal][SelectionDAGBuilder] Remove most CallSite usage from visitInlineAsm.

I only left it at the interface to ParseConstraints since that
needs updates to other callers in different files. I'll do that
as a follow up.

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

4 years ago[PowerPC] Another folow-up fix for 6c4b40def776
Nemanja Ivanovic [Sat, 11 Apr 2020 02:05:41 +0000 (21:05 -0500)]
[PowerPC] Another folow-up fix for 6c4b40def776

There was another issue introduced by this commit that the OP
initially missed. Namely, for functions that are free to use
R2 as a callee-saved register, we emit a TOC expression based
on the address of the GEP label without emitting the GEP label.
Since we only emit such expressions for the large code model, this
issue only surfaced there.

I have confirmed that with this fix, the kernel build is successful
with target "all".

4 years ago[X86] Fix to X86LoadValueInjectionRetHardeningPass for possible segfault
Scott Constable [Sat, 11 Apr 2020 00:32:39 +0000 (17:32 -0700)]
[X86] Fix to X86LoadValueInjectionRetHardeningPass for possible segfault

`MBB.back()` could segfault if `MBB.empty()`. Fixed by checking for `MBB.empty()` in the loop.

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

4 years agoConvert the ThreadPlanCommands test to use a scripted plan
Jim Ingham [Sat, 11 Apr 2020 01:11:10 +0000 (18:11 -0700)]
Convert the ThreadPlanCommands test to use a scripted plan
that pushes a step over plan.  Relax the listing checker
so it will look past any entries after the ones listed in
the input patterns.  Then for the internal plans just check
for the StepOver plan that our scripted plan pushes, and look past
any others.

This should make the test more robust on systems that don't use the
step-in then push a step-out plan to step over a function.

4 years agoThread Plans pushed by a scripted plan should be private plans.
Jim Ingham [Fri, 10 Apr 2020 22:37:05 +0000 (15:37 -0700)]
Thread Plans pushed by a scripted plan should be private plans.

If a plan is not private, "thread plan discard" can discard it.  It would
not be hard to write reliable scripted plan if its subplans could get
removed out from under it.

4 years agoRevert "[TLI] Per-function fveclib for math library used for vectorization"
Mehdi Amini [Sat, 11 Apr 2020 01:00:58 +0000 (01:00 +0000)]
Revert "[TLI] Per-function fveclib for math library used for vectorization"

This reverts commit 60c642e74be6af86906d9f3d982728be7bd4329f.

This patch is making the TLI "closed" for a predefined set of VecLib
while at the moment it is extensible for anyone to customize when using
LLVM as a library.
Reverting while we figure out a way to re-land it without losing the
generality of the current API.

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