platform/upstream/llvm.git
4 years agoEHPersonalities.h - reduce Triple.h include to forward declaration. NFC.
Simon Pilgrim [Sat, 6 Jun 2020 14:48:17 +0000 (15:48 +0100)]
EHPersonalities.h - reduce Triple.h include to forward declaration. NFC.

Move implicit include dependencies down to source files.

4 years ago[DAGCombiner] clean-up FMA+FMUL folds; NFC
Sanjay Patel [Fri, 5 Jun 2020 21:16:29 +0000 (17:16 -0400)]
[DAGCombiner] clean-up FMA+FMUL folds; NFC

D80801 suggests some readability improvements before mocing this block.

4 years agoCFG.h - add missing GraphTraits.h include. NFC.
Simon Pilgrim [Sat, 6 Jun 2020 14:18:25 +0000 (15:18 +0100)]
CFG.h - add missing GraphTraits.h include. NFC.

MSVC doesn't care that this isn't declared for default template args but gcc (sometimes) does.

4 years agoCFG.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Sat, 6 Jun 2020 14:06:03 +0000 (15:06 +0100)]
CFG.h - reduce includes to forward declarations. NFC.

Remove unnecessary includes from CFG.cpp.

Fix implicit include dependency in X86WinEHState.cpp.

4 years agoAMDGPU/GlobalISel: Start rewriting load/store legality rules
Matt Arsenault [Sun, 24 May 2020 15:12:11 +0000 (11:12 -0400)]
AMDGPU/GlobalISel: Start rewriting load/store legality rules

The current set is an incomprehensible mess riddled with ordering
hacks for various limitations in the legalizer at the time of writing,
many of which have been fixed. This takes a very small step in
correcting this.

The core first change is to start checking for fully legal cases
first, rather than trying to figure out all of the actions that could
need to be performed. It's recommended to check the legal cases first
for faster legality checks in the common case. This still has a table
listing some common cases, but it needs measuring whether this really
helps or not.

More significantly, stop trying to allow any arbitrary type with a
legal bitwidth as a legal memory type, and start using the bitcast
legalize action for them. Allowing loads of these weird vector types
produced new burdens we don't need for handling all of the
legalization artifacts. Unlike the SelectionDAG handling, this is
still not casting 64 or 16-bit element vectors to 32-bit
vectors. These cases should still be handled by increasing/decreasing
the number of 16-bit elements. This is primarily to fix 8-bit element
vectors.

Another change is to stop trying to handle the load-widening based on
a higher alignment. We should still do this, but the way it was
handled wasn't really correct. We really need to modify the MMO's size
at the same time, and not just increase the result type. The
LegalizerHelper does not do this, and I think this would really
require a separate WidenMemory action (or to add a memory action
payload to the LegalizeMutation). These will now fail to legalize.

The structure of the legalizer rules makes writing concise rules here
difficult. It would be easier if the same function could answer the
query the query, and report the action to perform at the same
time. Instead these two are split into distinct predicate and action
functions. This is mostly tolerable for other cases, but the
load/store rules get pretty complicated so it's difficult to keep two
versions of these functions in sync.

4 years ago[AMDGPU] Increase max iterations count to analyze complete unroll
dfukalov [Thu, 4 Jun 2020 23:18:18 +0000 (02:18 +0300)]
[AMDGPU] Increase max iterations count to analyze complete unroll

Summary: In some cases inner loops may not get boosts so try to analyze them deeper.

Reviewers: rampitec, mzolotukhin

Reviewed By: rampitec

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

Tags: #llvm

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

4 years agoLoopPassManager.h - add missing MemorySSA.h include
Simon Pilgrim [Sat, 6 Jun 2020 13:23:08 +0000 (14:23 +0100)]
LoopPassManager.h - add missing MemorySSA.h include

Fix buildbot failure due to rG5006e551d310 - oddly I can't reproduce this locally on my msvc expensive checks build.

4 years agoLoopAnalysisManager.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Sat, 6 Jun 2020 13:06:25 +0000 (14:06 +0100)]
LoopAnalysisManager.h - reduce includes to forward declarations. NFC.

Move implicit include dependencies down to header/source files.

4 years ago[SVE ACLE] Remove redundant bool_t typedef.
Paul Walker [Fri, 5 Jun 2020 11:49:44 +0000 (11:49 +0000)]
[SVE ACLE] Remove redundant bool_t typedef.

Subscribers: tschuett, cfe-commits

Tags: #clang

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

4 years agoLegacyDivergenceAnalysis.h - reduce DivergenceAnalysis.h include to forward declarati...
Simon Pilgrim [Sat, 6 Jun 2020 12:30:00 +0000 (13:30 +0100)]
LegacyDivergenceAnalysis.h - reduce DivergenceAnalysis.h include to forward declaration. NFC.

Move implicit include dependencies down to source file.

4 years agoLoopInfoImpl.h - remove unused SetVector.h include. NFC.
Simon Pilgrim [Sat, 6 Jun 2020 11:59:22 +0000 (12:59 +0100)]
LoopInfoImpl.h - remove unused SetVector.h include. NFC.

4 years ago[SCEV] ScalarEvolution::createSCEV(): Instruction::Or: drop bogus no-wrap flag detection
Roman Lebedev [Sat, 6 Jun 2020 09:59:58 +0000 (12:59 +0300)]
[SCEV] ScalarEvolution::createSCEV(): Instruction::Or: drop bogus no-wrap flag detection

Summary:
That's just really wrong. While sure, if LHS is AddRec, and we could
propagate it's no-wrap flags, that doesn't make, because as long as
the operands of `or` had no common bits set, then the `add`
of these operands will never overflow: http://volta.cs.utah.edu:8080/z/gmt7Sy
IOW we need no propagation/detection, we are free to just set NUW+NSW.

But as rG39e3683534c83573da5c8b70c8adfb43948f601f shows,
even when the old code failed to "deduce" flags,
we'd eventually re-deduce them somewhere, later.

So let's just set them.

Reviewers: mkazantsev, reames, sanjoy, efriedma

Reviewed By: efriedma

Subscribers: efriedma, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[SCEV] ScalarEvolution::createSCEV(): clarify no-wrap flag propagation for shift...
Roman Lebedev [Sat, 6 Jun 2020 09:59:44 +0000 (12:59 +0300)]
[SCEV] ScalarEvolution::createSCEV(): clarify no-wrap flag propagation for shift by bitwidth-1

Summary:
There was this comment here previously:
```
-        // It is currently not resolved how to interpret NSW for left
-        // shift by BitWidth - 1, so we avoid applying flags in that
-        // case. Remove this check (or this comment) once the situation
-        // is resolved. See
-        // http://lists.llvm.org/pipermail/llvm-dev/2015-April/084195.html
-        // and http://reviews.llvm.org/D8890 .
```
But langref was fixed in rL286785, and the behavior is pretty obvious:
http://volta.cs.utah.edu:8080/z/MM4WZP
^ nuw can always be propagated. nsw can be propagated if
either nuw is specified, or the shift is by *less* than bitwidth-1.

This mimics similar D81189 Reassociate change, alive2 is happy about that one.

I'm not sure `NUW` isn't being printed, but that seems unrelated.

Reviewers: mkazantsev, reames, sanjoy, nlopes, craig.topper, efriedma

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NewGVN] Remove alignment from LoadExpression (NFC)
Nikita Popov [Sat, 6 Jun 2020 09:49:20 +0000 (11:49 +0200)]
[NewGVN] Remove alignment from LoadExpression (NFC)

The alignment is not actually used.

4 years ago[InstCombine] Remove unnecessary MaybeAlign use (NFC)
Nikita Popov [Sat, 6 Jun 2020 09:15:45 +0000 (11:15 +0200)]
[InstCombine] Remove unnecessary MaybeAlign use (NFC)

Alloca align is required now.

4 years ago[ASan][Test] Fix globals test on 32-bit architectures
Marco Elver [Sat, 6 Jun 2020 09:18:46 +0000 (11:18 +0200)]
[ASan][Test] Fix globals test on 32-bit architectures

Buildbot reports failures on e.g. armv7 and thumbv7. Fix the test by
expecting either i32 or i64 for the size-argument.

4 years agoRevert "[mlir] Canonicalization and folding of shape.cstr_broadcastable"
Tres Popp [Sat, 6 Jun 2020 09:15:57 +0000 (11:15 +0200)]
Revert "[mlir] Canonicalization and folding of shape.cstr_broadcastable"

This reverts commit 6aab70945915ef1d565f1146734416029549a5a9.

Some users have failing builds with ShapeCanonicalization.td, so revert
for now.

4 years agoRevert "[mlir] Folding and canonicalization of shape.cstr_eq"
Tres Popp [Sat, 6 Jun 2020 09:08:41 +0000 (11:08 +0200)]
Revert "[mlir] Folding and canonicalization of shape.cstr_eq"

This reverts commit 0a554e607ff6247b79d1c4f184999750e5ad53b9.

Some users have build failures when building ShapeCanonicalization.td,
so revert changes that created and rely on it.

4 years ago[mlir] Move attr-dict to end of Shape dialect ops
Tres Popp [Fri, 5 Jun 2020 09:22:10 +0000 (11:22 +0200)]
[mlir] Move attr-dict to end of Shape dialect ops

Summary: This is to be consistent with most other assemblyFormat examles in MLIR.

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

4 years ago[ORC] Always use ObjectLinkingLayer/JITLink for MachO on x86-64 and arm64.
Lang Hames [Fri, 5 Jun 2020 21:08:15 +0000 (14:08 -0700)]
[ORC] Always use ObjectLinkingLayer/JITLink for MachO on x86-64 and arm64.

JITLink supports all code and relocation models, so there's no reason to
conditionalize using JITLink on the code or relocation model settings.

Clients wanting to use RTDyldObjectLinkingLayer/RuntimeDyld will now
need to use a custom object linking layer creator.

4 years ago[mlir][mlir-rocm-runner] Detect HIP version and AMD ISA version.
Wen-Heng (Jack) Chung [Fri, 5 Jun 2020 21:26:57 +0000 (16:26 -0500)]
[mlir][mlir-rocm-runner] Detect HIP version and AMD ISA version.

Summary:
Prior to ROCm / HIP 3.5, HSA code object V2 is the default binary format.
Starting from ROCm 3.5, HSA code object V3 becomes default.

Also invoke `rocm_agent_enumerator` to detect proper AMD ISA version on the
system. Use `gfx900` as the fallback value.

Reviewers: jerryyin yaxunl

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

Tags: #mlir

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

4 years ago[gn build] Port 29203480632
LLVM GN Syncbot [Sat, 6 Jun 2020 01:50:36 +0000 (01:50 +0000)]
[gn build] Port 29203480632

4 years agoRevert "recommit "[HIP] Add default header and include path""
Nico Weber [Sat, 6 Jun 2020 01:50:04 +0000 (21:50 -0400)]
Revert "recommit "[HIP] Add default header and include path""

This reverts commit 1fa43e0b34d9736f62c6c1b6c371a5e39cd1624d.
Still breaks tests on several bots, see https://reviews.llvm.org/D81176

4 years agoRevert "Migrate the rest of COFFObjectFile to Error"
Nico Weber [Sat, 6 Jun 2020 01:20:11 +0000 (21:20 -0400)]
Revert "Migrate the rest of COFFObjectFile to Error"

This reverts commit b5289656b865d2a73cf90819e20a96fb8414ab0b.
__attribute__((optnone)) doesn't build with msvc, see
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/16326

4 years ago[gn build] Port 1fa43e0b34d
LLVM GN Syncbot [Sat, 6 Jun 2020 00:47:43 +0000 (00:47 +0000)]
[gn build] Port 1fa43e0b34d

4 years ago[AArch64][GlobalISel] Move dup optimization into post-legalizer combiner
Jessica Paquette [Fri, 5 Jun 2020 00:08:36 +0000 (17:08 -0700)]
[AArch64][GlobalISel] Move dup optimization into post-legalizer combiner

Since all of the other G_SHUFFLE_VECTOR transforms are going there, let's do
this with dup as well. This is nice, because it lets us split up the original
code into matching, register bank selection, and instruction selection.

- Create G_DUP, make it equivalent to AArch64dup

- Add a post-legalizer combine which is 90% a copy-and-paste from
  tryOptVectorDup, except with shuffle matching closer to what SelectionDAG
  does in `ShuffleVectorSDNode::isSplatMask`.

- Teach RegBankSelect about G_DUP. Since dup selection relies on the correct
  register bank for FP/GPR dup selection, this is necessary.

- Kill `tryOptVectorDup`, since it's now entirely handled by G_DUP.

- Add testcases for the combine, RegBankSelect, and selection. The selection
  test gives the same selection results as the old test.

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

4 years ago[mlir] Fix representation of BF16 constants
Diego Caballero [Sat, 6 Jun 2020 00:29:56 +0000 (17:29 -0700)]
[mlir] Fix representation of BF16 constants

This patch is a follow-up on https://reviews.llvm.org/D81127

BF16 constants were represented as 64-bit floating point values due to the lack
of support for BF16 in APFloat. APFloat was recently extended to support
BF16 so this patch is fixing the BF16 constant representation to be 16-bit.

Reviewed By: rriddle

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

4 years agorecommit "[HIP] Add default header and include path"
Yaxun (Sam) Liu [Fri, 5 Jun 2020 20:49:38 +0000 (16:49 -0400)]
recommit "[HIP] Add default header and include path"

recommit 11d06b9511bd25aabbfad10dff548b0ce29135a5 with
fix for lit tests.

4 years agoFix convertBFloatAPFloatToAPInt for NaN/Inf values
Diego Caballero [Sat, 6 Jun 2020 00:06:42 +0000 (17:06 -0700)]
Fix convertBFloatAPFloatToAPInt for NaN/Inf values

Bfloat type has an 8-bit exponent so the exponent of NaN/Inf numbers
must be 0xff instead of 0x1f. This is probably a copy-paste mistake
from the half float type.

Reviewed By: lattner

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

4 years agoPR34581: Don't remove an 'if (p)' guarding a call to 'operator delete(p)' under -Oz.
Richard Smith [Mon, 4 May 2020 23:56:47 +0000 (16:56 -0700)]
PR34581: Don't remove an 'if (p)' guarding a call to 'operator delete(p)' under -Oz.

Summary:
This transformation is correct for a builtin call to 'free(p)', but not
for 'operator delete(p)'. There is no guarantee that a user replacement
'operator delete' has no effect when called on a null pointer.

However, the principle behind the transformation *is* correct, and can
be applied more broadly: a 'delete p' expression is permitted to
unconditionally call 'operator delete(p)'. So do that in Clang under
-Oz where possible. We do this whether or not 'p' has trivial
destruction, since the destruction might turn out to be trivial after
inlining, and even for a class-specific (but non-virtual,
non-destroying, non-array) 'operator delete'.

Reviewers: davide, dnsampaio, rjmccall

Reviewed By: dnsampaio

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[PowerPC] Do not special case Darwin on PowerPC in target cpu handling
stevewan [Fri, 5 Jun 2020 23:54:00 +0000 (19:54 -0400)]
[PowerPC] Do not special case Darwin on PowerPC in target cpu handling

Summary: This patch removes the special handling for Darwin on PowerPC in the default target cpu handling, because Darwin is no longer supported on the PowerPC platform.

Reviewers: hubert.reinterpretcast, daltenty

Reviewed By: hubert.reinterpretcast

Subscribers: wuzish, nemanjai, shchenz, steven.zhang, cfe-commits

Tags: #clang

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

4 years ago[Tests] Migrate a number of tests to gc-live bundle representation
Philip Reames [Fri, 5 Jun 2020 21:48:52 +0000 (14:48 -0700)]
[Tests] Migrate a number of tests to gc-live bundle representation

4 years agoMigrate the rest of COFFObjectFile to Error
Reid Kleckner [Fri, 5 Jun 2020 20:56:51 +0000 (13:56 -0700)]
Migrate the rest of COFFObjectFile to Error

4 years agoRe-land "Migrate Binary::checkOffset from error_code to Error, NFC"
Reid Kleckner [Fri, 5 Jun 2020 23:12:38 +0000 (16:12 -0700)]
Re-land "Migrate Binary::checkOffset from error_code to Error, NFC"

This reverts commit 38f3ba591e3a64fa5bbe684b3171c7bda6c5b527.

Fix the XCOFF error handling. Unlike std::error_code, Error must be
consumed or handled.

4 years agoFix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after ebcbd5ba39c017bb62...
Fangrui Song [Fri, 5 Jun 2020 23:16:49 +0000 (16:16 -0700)]
Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after ebcbd5ba39c017bb621eefa3175a224aae85ddc8

4 years agoPR46209: properly determine whether a copy assignment operator is
Richard Smith [Fri, 5 Jun 2020 02:16:05 +0000 (19:16 -0700)]
PR46209: properly determine whether a copy assignment operator is
trivial.

We previously took a shortcut by assuming that if a subobject had a
trivial copy assignment operator (with a few side-conditions), we would
always invoke it, and could avoid going through overload resolution.
That turns out to not be correct in the presenve of ref-qualifiers (and
also won't be the case for copy-assignments with requires-clauses
either). Use the same logic for lazy declaration of copy-assignments
that we use for all other special member functions.

Previously committed as c57f8a3a20540fcf9fbf98c0a73f381ec32fce2a. This
now also includes an extension of LLDB's workaround for handling special
members without the help of Sema to cover copy assignments.

4 years agoSet the captures on a CXXRecordDecl representing a lambda closure type
Richard Smith [Fri, 5 Jun 2020 02:15:22 +0000 (19:15 -0700)]
Set the captures on a CXXRecordDecl representing a lambda closure type
before marking it complete.

No functionality change intended.

Previously committed as c13dd74e311d2ac70dd3ea663d800307d1aa5b6b.

4 years ago[ELF] Don't cause assertion failure if --dynamic-list or --version-script takes an...
Fangrui Song [Fri, 5 Jun 2020 22:59:34 +0000 (15:59 -0700)]
[ELF] Don't cause assertion failure if --dynamic-list or --version-script takes an empty file

Fixes PR46184
Report line 1 of the last memory buffer.

4 years ago[arm][darwin] Don't generate libcalls for wide shifts on Darwin
Alex Lorenz [Fri, 5 Jun 2020 22:40:00 +0000 (15:40 -0700)]
[arm][darwin] Don't generate libcalls for wide shifts on Darwin

Similar to ceb801612a678bdffe7e7bf163bd0eed9c9b73a2.

Darwin doesn't always use compiler-rt, and so we can't assume that these
functions are available on arm.

4 years ago[IRExecutionUnit] Early returns for clarity. NFCI.
Davide Italiano [Fri, 5 Jun 2020 21:51:58 +0000 (14:51 -0700)]
[IRExecutionUnit] Early returns for clarity. NFCI.

4 years ago[mlir][Linalg] NFC - Make useFullTileBuffersByDefault option take a boolean.
Nicolas Vasilache [Fri, 5 Jun 2020 21:44:02 +0000 (17:44 -0400)]
[mlir][Linalg] NFC - Make useFullTileBuffersByDefault option take a boolean.

4 years ago[WebAssembly] Improve clang diagnostics for wasm attributes
Dan Gohman [Fri, 5 Jun 2020 21:27:52 +0000 (14:27 -0700)]
[WebAssembly] Improve clang diagnostics for wasm attributes

This patch addresses the review comments on r352930:

 - Removes redundant diagnostic checking code
 - Removes errnoneous use of diag::err_alias_is_definition, which
   turned out to be ineffective anyway since functions can be defined later
   in the translation unit and avoid detection.
 - Adds a test for various invalid cases for import_name and import_module.

This reapplies D59520, with the addition of adding
`InGroup<IgnoredAttributes>` to the new warnings, to fix the
Misc/warning-flags.c failure.

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

4 years ago[X86] Add test cases for PR46203. NFC
Craig Topper [Fri, 5 Jun 2020 21:27:04 +0000 (14:27 -0700)]
[X86] Add test cases for PR46203. NFC

4 years ago[mlir] Fix spurious f64 -> f16 change in CPU runner test
Nicolas Vasilache [Fri, 5 Jun 2020 21:23:15 +0000 (17:23 -0400)]
[mlir] Fix spurious f64 -> f16 change in CPU runner test

4 years ago[CGP] Remove unnecessary MaybeAlign use (NFC)
Nikita Popov [Fri, 5 Jun 2020 21:18:26 +0000 (23:18 +0200)]
[CGP] Remove unnecessary MaybeAlign use (NFC)

Stores now always have an alignment.

4 years ago[LoopIdiomRecognize] Remove unnecessary MaybeAlign use (NFC)
Nikita Popov [Fri, 5 Jun 2020 21:11:04 +0000 (23:11 +0200)]
[LoopIdiomRecognize] Remove unnecessary MaybeAlign use (NFC)

Loads and stores always have an alignment now.

4 years ago[ASan][Test] Fix globals test for Mach-O
Marco Elver [Fri, 5 Jun 2020 20:56:24 +0000 (22:56 +0200)]
[ASan][Test] Fix globals test for Mach-O

Summary: Use a portable section name, as for the test's purpose any name will do.

Reviewers: nickdesaulniers, thakis

Reviewed By: thakis

Subscribers: cfe-commits

Tags: #clang

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

4 years agoRevert "Migrate Binary::checkOffset from error_code to Error, NFC"
Nico Weber [Fri, 5 Jun 2020 21:00:20 +0000 (17:00 -0400)]
Revert "Migrate Binary::checkOffset from error_code to Error, NFC"

This reverts commit 74bd98829d82312676a60c5c2d142e20691b2f13.
Breaks LLVM::section-headers.test everywhere, see e.g.
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/29940/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Asection-headers.test

4 years agoFix an oversight in GetXcodeContentsDirectory()
Adrian Prantl [Fri, 5 Jun 2020 18:58:05 +0000 (11:58 -0700)]
Fix an oversight in GetXcodeContentsDirectory()

Since FindXcodeContentsDirectoryInPath expects the *.app/Contents and
DEVELOPER_DIR is supposed to point to Xcode.app, we need to append the
Contents path first.

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

4 years agoFactor out GetEnvDeveloperDir() (NFC)
Adrian Prantl [Fri, 5 Jun 2020 18:38:59 +0000 (11:38 -0700)]
Factor out GetEnvDeveloperDir() (NFC)

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

4 years ago[X86] Fold undef elts to 0 in getTargetVShiftByConstNode.
Craig Topper [Fri, 5 Jun 2020 18:46:07 +0000 (11:46 -0700)]
[X86] Fold undef elts to 0 in getTargetVShiftByConstNode.

Similar to D81212.

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

4 years agoMigrate Binary::checkOffset from error_code to Error, NFC
Reid Kleckner [Fri, 5 Jun 2020 20:32:33 +0000 (13:32 -0700)]
Migrate Binary::checkOffset from error_code to Error, NFC

In my use case, this saved 100ms of time doing one-time-initialization
for std::error_code().

4 years agoAMDGPU/GlobalISel: cmp/select method for extract element
Stanislav Mekhanoshin [Wed, 27 May 2020 20:09:00 +0000 (13:09 -0700)]
AMDGPU/GlobalISel: cmp/select method for extract element

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

4 years ago[codeview] Put !heapallocsite on calls to operator new
Reid Kleckner [Tue, 2 Jun 2020 00:11:06 +0000 (17:11 -0700)]
[codeview] Put !heapallocsite on calls to operator new

Clang marks calls to operator new as heap allocation sites, but the
operator declared at global scope returns a void pointer. There is no
explicit cast in the code, so the compiler has to write down the
allocated type itself.

Also generalize a cast to use CallBase, so that we mark heap alloc sites
when exceptions are enabled.

Reviewed By: MaskRay

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

4 years ago[gn build] Port 8a8c6913a93
LLVM GN Syncbot [Fri, 5 Jun 2020 19:48:20 +0000 (19:48 +0000)]
[gn build] Port 8a8c6913a93

4 years agoSROA: Remove pointer from visited along with instruction
Stanislav Mekhanoshin [Mon, 1 Jun 2020 21:35:12 +0000 (14:35 -0700)]
SROA: Remove pointer from visited along with instruction

If an instruction is erased we also need to remove it from
Visited set. There is a very small chance that an another
newly created instruction will be created with the same
pointer value in place of an erased one.

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

4 years agoRevert "[HIP] Add default header and include path"
Yaxun (Sam) Liu [Fri, 5 Jun 2020 19:41:00 +0000 (15:41 -0400)]
Revert "[HIP] Add default header and include path"

This reverts commit 11d06b9511bd25aabbfad10dff548b0ce29135a5.

4 years agoAttempt to fix hip-include-path.hip
Yaxun (Sam) Liu [Fri, 5 Jun 2020 19:31:11 +0000 (15:31 -0400)]
Attempt to fix hip-include-path.hip

4 years agolld: use modern library search ordering
Saleem Abdulrasool [Fri, 5 Jun 2020 00:40:41 +0000 (17:40 -0700)]
lld: use modern library search ordering

This merges the static and shared library and behaves as if
`-search_paths_first` was specified which is also the default behaviour
on ld64 (and now lld). Unify the paths, and use `llvm::sys::path` to
deal with the path to be truly agnostic to the host.

4 years ago[llvm-pdbutil] Add missing --id-stats to dump the IPI stream
Alexandre Ganea [Thu, 4 Jun 2020 19:30:45 +0000 (15:30 -0400)]
[llvm-pdbutil] Add missing --id-stats to dump the IPI stream

Before this patch, llvm-pdbutil supported only --type-stats to dump stats about a PDB TPI stream.
Adding --id-stats for completion.

4 years agoGlobalISel: Add helper for constructing load from offset
Matt Arsenault [Sun, 31 May 2020 00:28:36 +0000 (20:28 -0400)]
GlobalISel: Add helper for constructing load from offset

4 years agoTeach GetXcodeSDK to look in the Xcode that contains LLDB
Adrian Prantl [Fri, 5 Jun 2020 02:02:11 +0000 (19:02 -0700)]
Teach GetXcodeSDK to look in the Xcode that contains LLDB

instead of preferring the one chosen with xcode-select.

<rdar://problem/64000666>

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

4 years agoMove GetXcode*Directory into HostInfo (NFC)
Adrian Prantl [Fri, 5 Jun 2020 00:57:11 +0000 (17:57 -0700)]
Move GetXcode*Directory into HostInfo (NFC)

These functions really don't belong into PlatformDarwin, since they
actualy query state of the Host and not of the remote platform.

4 years agoGlobalISel: Make known bits/alignment API more consistent
Matt Arsenault [Thu, 4 Jun 2020 02:06:49 +0000 (22:06 -0400)]
GlobalISel: Make known bits/alignment API more consistent

Just computing the alignment makes sense without caring about the
general known bits, such as for non-integral pointers. Separate the
two and start calling into the TargetLowering hooks for frame indexes.

Start calling the TargetLowering implementation for FrameIndexes,
which improves the AMDGPU matching for stack addressing modes. Also
introduce a new hook for returning known alignment of target
instructions. For AMDGPU, it would be useful to report the known
alignment implied by certain intrinsic calls.

Also stop using MaybeAlign.

4 years agoGlobalISel: Add G_EXTRACT/G_INSERT offset to legalize info
Matt Arsenault [Sat, 16 May 2020 14:41:35 +0000 (10:41 -0400)]
GlobalISel: Add G_EXTRACT/G_INSERT offset to legalize info

Immediate legalize fields were added for G_SEXT_INREG. Simiarly, these
are likely not legal except for certain offsets.

4 years agoRevert "[WebAssembly] Improve clang diagnostics for wasm attributes"
Dan Gohman [Fri, 5 Jun 2020 18:52:11 +0000 (11:52 -0700)]
Revert "[WebAssembly] Improve clang diagnostics for wasm attributes"

It broke clang-check.

This reverts commit 931fcd3ba011c27626a95e5e35b657763284882a.

4 years agoCorrectly report modified status for AMDGPUUnifyDivergentExitNodes
Jay Foad [Fri, 5 Jun 2020 16:12:32 +0000 (17:12 +0100)]
Correctly report modified status for AMDGPUUnifyDivergentExitNodes

Related to https://reviews.llvm.org/D80916

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

4 years agoFix -Wunused-variable after D80515
Fangrui Song [Fri, 5 Jun 2020 18:46:50 +0000 (11:46 -0700)]
Fix -Wunused-variable after D80515

4 years ago[gn build] (manually) merge 5eedf07ab999d
Nico Weber [Fri, 5 Jun 2020 18:39:04 +0000 (14:39 -0400)]
[gn build] (manually) merge 5eedf07ab999d

4 years agoAttempt to fix hip-include-path.hip
Yaxun (Sam) Liu [Fri, 5 Jun 2020 18:36:17 +0000 (14:36 -0400)]
Attempt to fix hip-include-path.hip

4 years agoAMDGPU: Fix incorrect selection of buffer atomic fadd
Matt Arsenault [Fri, 5 Jun 2020 17:57:29 +0000 (13:57 -0400)]
AMDGPU: Fix incorrect selection of buffer atomic fadd

There were additional standalone patterns for these nodes which were
missing the subtarget predicate.

4 years agoAMDGPU: Fix missing immarg on buffer.atomic.fadd intrinsic
Matt Arsenault [Fri, 5 Jun 2020 17:48:59 +0000 (13:48 -0400)]
AMDGPU: Fix missing immarg on buffer.atomic.fadd intrinsic

4 years ago[X86] Teach combineVectorShiftImm to constant fold undef elements to 0 not undef.
Craig Topper [Fri, 5 Jun 2020 17:49:21 +0000 (10:49 -0700)]
[X86] Teach combineVectorShiftImm to constant fold undef elements to 0 not undef.

Shifts are supposed to always shift in zeros or sign bits regardless of their inputs. It's possible the input value may have been replaced with undef by SimplifyDemandedBits, but the shift in zeros are still demanded.

This issue was reported to me by ispc from 10.0. Unfortunately their failing test does not fail on trunk. Seems to be because the shl is optimized out earlier now and doesn't become VSHLI.

ispc bug https://github.com/ispc/ispc/issues/1771

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

4 years ago[WebAssembly] Improve clang diagnostics for wasm attributes
Dan Gohman [Sat, 21 Dec 2019 06:11:03 +0000 (22:11 -0800)]
[WebAssembly] Improve clang diagnostics for wasm attributes

This patch addresses the review comments on r352930:

 - Removes redundant diagnostic checking code
 - Removes errnoneous use of diag::err_alias_is_definition, which
   turned out to be ineffective anyway since functions can be defined later
   in the translation unit and avoid detection.
 - Adds a test for various invalid cases for import_name and import_module.

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

4 years ago[hwasan] Disable malloc-fill by default.
Evgenii Stepanov [Fri, 5 Jun 2020 17:57:44 +0000 (10:57 -0700)]
[hwasan] Disable malloc-fill by default.

Summary: Non-zero malloc fill is causing way too many hard to debug issues.

Reviewers: kcc, pcc, hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[KernelAddressSanitizer] Make globals constructors compatible with kernel
Marco Elver [Fri, 29 May 2020 10:52:27 +0000 (12:52 +0200)]
[KernelAddressSanitizer] Make globals constructors compatible with kernel

Summary:
This makes -fsanitize=kernel-address emit the correct globals
constructors for the kernel. We had to do the following:

- Disable generation of constructors that rely on linker features such
  as dead-global elimination.

- Only emit constructors for globals *not* in explicit sections. The
  kernel uses sections for special globals, which we should not touch.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203493

Tested:
1. With 'clang/test/CodeGen/asan-globals.cpp'.
2. With test_kasan.ko, we can see:

   BUG: KASAN: global-out-of-bounds in kasan_global_oob+0xb3/0xba [test_kasan]

Reviewers: glider, andreyknvl

Reviewed By: glider

Subscribers: cfe-commits, nickdesaulniers, hiraditya, llvm-commits

Tags: #llvm, #clang

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

4 years ago[LiveDebugValues] Fix output stream (NFC)
Nikita Popov [Sat, 30 May 2020 14:07:44 +0000 (16:07 +0200)]
[LiveDebugValues] Fix output stream (NFC)

This should dump to the provided Out, rather than dbgs(), though
they coincide in current usage.

4 years ago[LiveDebugValues] Remove PendingInLocs (NFC)
Nikita Popov [Sat, 30 May 2020 14:13:41 +0000 (16:13 +0200)]
[LiveDebugValues] Remove PendingInLocs (NFC)

PendingInLocs ends up having the same value as InLocs, just computed
a bit more indirectly. It is a leftover of a previous implementation
approach.

This patch drops PendingInLocs, as well as the Diff and Removed
calulations, which are no longer needed.

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

4 years agoAMDGPU/GlobalISel: Fix some broken YAML in MIR test
Matt Arsenault [Sun, 31 May 2020 18:59:52 +0000 (14:59 -0400)]
AMDGPU/GlobalISel: Fix some broken YAML in MIR test

Different tools seem to be more or less strict with the markers
between different functions.

4 years agoGlobalISel: Infer nofpexcept flag during selection for non-strict ops
Matt Arsenault [Sun, 31 May 2020 18:19:46 +0000 (14:19 -0400)]
GlobalISel: Infer nofpexcept flag during selection for non-strict ops

Match SelectionDAG's behavior of adding nofpexcept to out instructions
that may raise fp exceptions that are selected from instructions that
do not.

4 years ago[apple clang] disable in-process CC1 to preserve crashlog compatibility
Alex Lorenz [Fri, 5 Jun 2020 17:54:03 +0000 (10:54 -0700)]
[apple clang] disable in-process CC1 to preserve crashlog compatibility

The in-process CC1 currently doesn't interoperate with the macOS crash analytics,
which we would like to keep enabled for Apple clang. This commit restores the
out-of-process CC1 to the Apple clang CMake configuration for now.

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

4 years ago[llvm-objcopy] Reorder --dump-section for MachO
Sameer Arora [Fri, 5 Jun 2020 17:47:05 +0000 (10:47 -0700)]
[llvm-objcopy] Reorder --dump-section for MachO

Reorder `DumpSection` under `handleArgs` in file `MachOObjcopy.cpp`. The
operation to dump a section is now performed before both add and remove
section operations for MachO file format.

Change for the ELF format at D81097. Together fixes
https://bugs.llvm.org/show_bug.cgi?id=44283

Reviewed By: jhenderson

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

4 years ago[mlir][test][CPU] Reduce the size of mlir-cpu-runner-tests
Nicolas Vasilache [Fri, 5 Jun 2020 17:41:05 +0000 (13:41 -0400)]
[mlir][test][CPU] Reduce the size of mlir-cpu-runner-tests

Two tests regularly show up on the long tail when testing MLIR.
This revision reduces their size.

4 years ago[llvm-objcopy] Reorder --dump-section before --remove-section for ELF
Sameer Arora [Fri, 5 Jun 2020 17:42:19 +0000 (10:42 -0700)]
[llvm-objcopy] Reorder --dump-section before --remove-section for ELF

Reorder `DumpSection` under `handleArgs` in file `ELFObjcopy.cpp`.
`DumpSection` is placed before `replaceAndRemoveSections` and is
therefore now the first operation under `handleArgs`. Thus, it is now
performed before both `add` and `remove` section operations.

Change for the MachO format at D81123. Together fixes https://bugs.llvm.org/show_bug.cgi?id=44283.

Reviewed By: alexshap, jhenderson, MaskRay

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

4 years ago[libc++] Avoid passing -xc++ in Lit feature detection
Louis Dionne [Fri, 5 Jun 2020 17:39:49 +0000 (13:39 -0400)]
[libc++] Avoid passing -xc++ in Lit feature detection

Otherwise, if %{flags} contain other files like static libraries, those
files are treated as C++ source files instead of object files, and the
compiler gets all confused.

4 years ago[ARM] VQMOVN demand bits analysis
David Green [Fri, 5 Jun 2020 14:34:15 +0000 (15:34 +0100)]
[ARM] VQMOVN demand bits analysis

Similar to VMOVN, a VQMOVN will only demand the top/bottom lanes of it's
first input. However unlike VMOVN it will need access to the entire
second argument, as that value is saturated not just moved in place.

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

4 years ago[llvm-ar] Update error messages and tests as per latest preferred style
Sameer Arora [Fri, 5 Jun 2020 17:29:24 +0000 (10:29 -0700)]
[llvm-ar] Update error messages and tests as per latest preferred style

It updates two error messages under `performOperation` in the file
llvm-ar.cpp. Furthermore, it also updates tests that print out these
error messages: `llvm/test/Object/ar-create.test` and
`llvm/test/tools/llvm-ar/print.test`.

Reviewed By: jhenderson, MaskRay

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

4 years ago[llvm-ar] Add more tests for errors in opening archives
Sameer Arora [Fri, 5 Jun 2020 17:29:18 +0000 (10:29 -0700)]
[llvm-ar] Add more tests for errors in opening archives

Add 2 more tests for the function performOperation under llvm-ar.cpp. It
tests the scenario when the archive could not be opened for reasons
other than `no_such_file_or_directory` In particular, it tests for the
cases `permission_denied` and `is_a_directory` for the target archive.

Reviewed By: alexshap, jhenderson, smeenai, MaskRay

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

4 years ago[mlir][Vector] Add folding of memref_cast into vector_transfer ops
Nicolas Vasilache [Fri, 5 Jun 2020 17:20:59 +0000 (13:20 -0400)]
[mlir][Vector] Add folding of memref_cast into vector_transfer ops

Summary:
This revision adds a common folding pattern that starts appearing on
vector_transfer ops.

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

4 years ago[gn build] Port 11d06b9511b
LLVM GN Syncbot [Fri, 5 Jun 2020 17:22:19 +0000 (17:22 +0000)]
[gn build] Port 11d06b9511b

4 years agoFix lit tests hip-include-path.hip and hip-host-cpu-macros.cu
Yaxun (Sam) Liu [Fri, 5 Jun 2020 17:21:24 +0000 (13:21 -0400)]
Fix lit tests hip-include-path.hip and hip-host-cpu-macros.cu

4 years agoReland D80640: [CodeGen][SVE] Calculate correct type legalization for scalable vectors.
Sander de Smalen [Fri, 5 Jun 2020 15:46:25 +0000 (16:46 +0100)]
Reland D80640: [CodeGen][SVE] Calculate correct type legalization for scalable vectors.

This reverts commit 9bcef270d7a319c6c0fdffc6c80984a8f0a30ecb.

4 years ago[libc++abi] Properly fix XFAILs for exception alignment
Louis Dionne [Fri, 5 Jun 2020 17:06:37 +0000 (13:06 -0400)]
[libc++abi] Properly fix XFAILs for exception alignment

Since <unwind.h> is in the SDK, not in /usr/include, the XFAILs must
be predicated on the compiler version (ideally even on the SDK version)
instead of the target system version.

4 years ago[mlir][Linalg] NFC - Cleanup debug, address post-commit review.
Nicolas Vasilache [Fri, 5 Jun 2020 17:02:13 +0000 (13:02 -0400)]
[mlir][Linalg] NFC - Cleanup debug, address post-commit review.

4 years ago[mlir] Add verify method to adaptor
Jacques Pienaar [Fri, 5 Jun 2020 16:47:37 +0000 (09:47 -0700)]
[mlir] Add verify method to adaptor

This allows verifying op-indepent attributes (e.g., attributes that do not require the op to have been created) before constructing an operation. These include checking whether required attributes are defined or constraints on attributes (such as I32 attribute). This is not perfect (e.g., if one had a disjunctive constraint where one part relied on the op and the other doesn't, then this would not try and extract the op independent from the op dependent).

The next step is to move these out to a trait that could be verified earlier than in the generated method. The first use case is for inferring the return type while constructing the op. At that point you don't have an Operation yet and that ends up in one having to duplicate the same checks, e.g., verify that attribute A is defined before querying A in shape function which requires that duplication. Instead this allows one to invoke a method to verify all the traits and, if this is checked first during verification, then all other traits could use attributes knowing they have been verified.

It is a little bit funny to have these on the adaptor, but I see the adaptor as a place to collect information about the op before the op is constructed (e.g., avoiding stringly typed accessors, verifying what is possible to verify before the op is constructed) while being cheap to use even with constructed op (so layer of indirection between the op constructed/being constructed). And from that point of view it made sense to me.

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

4 years ago[CMake] Do not append -lm to CMAKE_REQUIRED_LIBRARIES on Apple
Louis Dionne [Fri, 5 Jun 2020 15:12:47 +0000 (11:12 -0400)]
[CMake] Do not append -lm to CMAKE_REQUIRED_LIBRARIES on Apple

On Apple platforms, linking against libSystem.dylib is sufficient, and
some Apple platforms don't provide libm.dylib. On those platforms, adding
-lm to CMAKE_REQUIRED_LIBRARIES causes all subsequent compile-flag checks
to fail due to the missing library.

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

4 years ago[HIP] Add default header and include path
Yaxun (Sam) Liu [Wed, 3 Jun 2020 14:05:52 +0000 (10:05 -0400)]
[HIP] Add default header and include path

To support std::complex and some other standard C/C++ functions in HIP device code,
they need to be forced to be __host__ __device__ functions by pragmas. This is done
by some clang standard C++ wrapper headers which are shared between cuda-clang and hip-Clang.

For these standard C++ wapper headers to work properly, specific include path order
has to be enforced:

  clang C++ wrapper include path
  standard C++ include path
  clang include path

Also, these C++ wrapper headers require device version of some standard C/C++ functions
must be declared before including them. This needs to be done by including a default
header which declares or defines these device functions. The default header is always
included before any other headers are included by users.

This patch adds the the default header and include path for HIP.

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

4 years agoScalarEvolutionNormalization.h - reduce ScalarEvolutionExpressions.h include to forwa...
Simon Pilgrim [Fri, 5 Jun 2020 16:40:19 +0000 (17:40 +0100)]
ScalarEvolutionNormalization.h - reduce ScalarEvolutionExpressions.h include to forward declaration. NFC.

4 years agoTypeMetadataUtils.h - reduce Instructions.h include to forward declaration. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 16:27:55 +0000 (17:27 +0100)]
TypeMetadataUtils.h - reduce Instructions.h include to forward declaration. NFC.

Move implicit include dependencies down to source file.

4 years ago[x86] form reduction intrinsics from vectorizers instead of raw IR
Sanjay Patel [Fri, 5 Jun 2020 16:20:13 +0000 (12:20 -0400)]
[x86] form reduction intrinsics from vectorizers instead of raw IR

Motivating examples are seen in the PhaseOrdering tests based on:
https://bugs.llvm.org/show_bug.cgi?id=43953#c2 - if we have
intrinsics there, some pass can fold them.

The intrinsics are still named "experimental" at this point, but
if there is no fallout from this patch, that will be a good
indicator that it is safe to finalize them.

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