platform/upstream/llvm.git
4 years ago[NFC] Make assertion more informative.
Sean Silva [Thu, 21 May 2020 20:10:38 +0000 (13:10 -0700)]
[NFC] Make assertion more informative.

This assert just caught me, and this improved message would have saved
me some time.

4 years ago[AArch64][SVE] Fill out missing unpredicated load/store patterns.
Eli Friedman [Thu, 21 May 2020 00:52:36 +0000 (17:52 -0700)]
[AArch64][SVE] Fill out missing unpredicated load/store patterns.

The set of patterns for unpredicated load/store was incomplete: it only
included non-extending stores.  Fill out the remaining patterns for
extending stores, and add the corresponding support to frame offset
lowering.

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

4 years ago[MsgPack] MsgPackDocument::readFromBlob now merges
Tim Renouf [Thu, 21 May 2020 19:31:24 +0000 (20:31 +0100)]
[MsgPack] MsgPackDocument::readFromBlob now merges

The readFromBlob method can now be used to read MsgPack into a Document
that already contains something, merging the two. There is a new Merger
argument to readFromBlob, a callback function to resolve conflicts.

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

Change-Id: Icf3e959217fe33cd907a41516c0386aef2847c0c

4 years ago[ModuloSchedule] Add missing comma.
Hendrik Greving [Thu, 21 May 2020 20:17:18 +0000 (13:17 -0700)]
[ModuloSchedule] Add missing comma.

This is a test commit as per Chris to verify commit access.

Thanks!

4 years ago[libTooling][NFC]Fix typo in comment in RangeSelectors
Yitzhak Mandelbaum [Thu, 21 May 2020 19:49:23 +0000 (15:49 -0400)]
[libTooling][NFC]Fix typo in comment in RangeSelectors
Fixes transposed names in comment.

4 years ago[SelectionDAG] Add the option of disabling generic combines.
Marcello Maggioni [Wed, 29 Apr 2020 01:25:58 +0000 (01:25 +0000)]
[SelectionDAG] Add the option of disabling generic combines.

Summary:
For some targets generic combines don't really do much and they
consume a disproportionate amount of time.
There's not really a mechanism in SDISel to tactically disable
combines, but we can have a switch to disable all of them and
let the targets just implement what they specifically need.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoReland [libc++] [LWG3321] Mark "year_month_day_last::day() specification does not...
Marek Kurdej [Thu, 21 May 2020 19:48:51 +0000 (21:48 +0200)]
Reland [libc++] [LWG3321] Mark "year_month_day_last::day() specification does not cover !ok() values" issue as "Nothing to do", but add assertion.

Summary:
This LWG issue states that the result of `year_month_day_last::day()` is implementation defined if `ok()` is `false`.
However, from user perspective, calling `day()` in this situation will lead to a (possibly difficult to find) crash.
Hence, I have added an assertion to warn user at least when assertions are enabled.

Reviewed By: ldionne, #libc

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

4 years agoRevert "[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker"
Nico Weber [Thu, 21 May 2020 19:49:46 +0000 (15:49 -0400)]
Revert "[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker"

This reverts commit f7c7e8a523f56b0ed1b14c0756ba4e5d1ccb48d2.
Breaks build everywhere.

4 years ago[dsymutil] Add llvm_unreachable to silence warning
Jonas Devlieghere [Thu, 21 May 2020 19:27:39 +0000 (12:27 -0700)]
[dsymutil] Add llvm_unreachable to silence warning

Fixes warning: control reaches end of non-void function [-Wreturn-type]

4 years ago[mlir][spirv] Enable composite instructions for cooperative matrix type.
Thomas Raoux [Thu, 21 May 2020 18:59:31 +0000 (11:59 -0700)]
[mlir][spirv] Enable composite instructions for cooperative matrix type.

Enable inset/extract/construct composite ops as well as access chain for
cooperative matrix. ConstantComposite requires more change and will be done in
a separate patch. Also fix the getNumElements function for coopMatrix per
feedback from Jeff Bolz. The number of element is implementation dependent so
it cannot be known at compile time.

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

4 years ago[AMDGPU] Added opt pipeline test. NFC.
Stanislav Mekhanoshin [Thu, 21 May 2020 18:58:35 +0000 (11:58 -0700)]
[AMDGPU] Added opt pipeline test. NFC.

4 years ago[mlir][spirv] Add remaining cooperative matrix instructions
Thomas Raoux [Thu, 21 May 2020 18:35:32 +0000 (11:35 -0700)]
[mlir][spirv] Add remaining cooperative matrix instructions

Adds support for cooperative matrix support for arithmetic and cast
instructions. It also adds cooperative matrix store, muladd and matrixlength
instructions which are part of the extension.

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

4 years ago[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker
Jan Korous [Thu, 21 May 2020 18:52:12 +0000 (11:52 -0700)]
[Analyzer][WebKit] RefCntblBaseVirtualDtorChecker

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

4 years ago[libc++] Link back-deployment tests against the latest libc++ and libc++abi
Louis Dionne [Thu, 21 May 2020 18:33:32 +0000 (14:33 -0400)]
[libc++] Link back-deployment tests against the latest libc++ and libc++abi

Instead of linking the tests against a library in some version of the
SDK, always link against the latest library, but still run against the
specified back-deployment target dylib.

This makes more sense since what we're really trying to test is that
the current library can be used to produce binaries that run on some
deployment target -- not that linking against the library in some
previous SDK makes that possible.

This solves an additional issue that when linking against a system dylib,
the -rpath argument given to the tests is ignored because the install_name
of the system library we link against is absolute.

rdar://63241847

4 years ago[dsymutil] Fix conversion between unique_ptr and Expected
Jonas Devlieghere [Thu, 21 May 2020 18:41:20 +0000 (11:41 -0700)]
[dsymutil] Fix conversion between unique_ptr and Expected

Reproducer.cpp:70:12: error: could not convert ‘Repro’ from
‘std::unique_ptr<llvm::dsymutil::ReproducerGenerate,
std::default_delete<llvm::dsymutil::ReproducerGenerate> >’ to
‘llvm::Expected<std::unique_ptr<llvm::dsymutil::Reproducer> >’

4 years ago[IR] Make Module::setProfileSummary to replace an existing ProfileSummary flag.
Hiroshi Yamauchi [Wed, 13 May 2020 19:14:33 +0000 (12:14 -0700)]
[IR] Make Module::setProfileSummary to replace an existing ProfileSummary flag.

Summary:
Module::setProfileSummary currently calls addModuelFlag. This prevents from
updating the ProfileSummary metadata in the module and results in a second
ProfileSummary added instead of replacing an existing one. I don't think this is
the expected behavior. It prevents updating the ProfileSummary and it does not
make sense to have more than one. To address this, add Module::setModuleFlag and
use it from setProfileSummary.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lld][WebAssembly] Do not emit initialization for .bss segments
Thomas Lively [Thu, 21 May 2020 18:33:25 +0000 (11:33 -0700)]
[lld][WebAssembly] Do not emit initialization for .bss segments

Summary:
This patch fixes a bug where initialization code for .bss segments was
emitted in the memory initialization function even though the .bss
segments were discounted in the datacount section and omitted in the
data section. This was producing invalid binaries due to out-of-bounds
segment indices on the memory.init and data.drop instructions that
were trying to operate on the nonexistent .bss segments.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[gn build] Port 92fd3971e0d
LLVM GN Syncbot [Thu, 21 May 2020 18:20:26 +0000 (18:20 +0000)]
[gn build] Port 92fd3971e0d

4 years ago[dsymutil] Fix include-style
Jonas Devlieghere [Thu, 21 May 2020 18:19:57 +0000 (11:19 -0700)]
[dsymutil] Fix include-style

4 years ago[dsymutil] Add reproducers to dsymutil
Jonas Devlieghere [Thu, 21 May 2020 17:57:53 +0000 (10:57 -0700)]
[dsymutil] Add reproducers to dsymutil

Add support for generating a dsymutil reproducer. The result is a folder
containing all the object files for linking.

When --gen-reproducer is passed, dsymutil uses a FileCollectorFileSystem
which keeps track of all the files used by dsymutil. These files are
copied into a temporary directory when dsymutil exists.

When this path is passed to --use-reproducer, dsymutil uses a
RedirectingFileSystem that will use the files from the reproducer
directory instead of the actual paths. This means you don't need to mess
with the OSO path prefix.

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

4 years ago[mips] Reorganize check directives in the test. NFC
Simon Atanasyan [Thu, 21 May 2020 13:14:24 +0000 (16:14 +0300)]
[mips] Reorganize check directives in the test. NFC

4 years agoMove decorator to the correct function.
Adrian Prantl [Thu, 21 May 2020 17:42:26 +0000 (10:42 -0700)]
Move decorator to the correct function.

4 years agoDisable malloc stepping test under ASAN. The output is different and I'm not sure...
Adrian Prantl [Thu, 21 May 2020 17:41:27 +0000 (10:41 -0700)]
Disable malloc stepping test under ASAN. The output is different and I'm not sure how stable it is.

4 years agoDisable ptr_ref tests under ASAN
Adrian Prantl [Thu, 21 May 2020 17:38:04 +0000 (10:38 -0700)]
Disable ptr_ref tests under ASAN

4 years agoRevert "Revert "[YAMLTraits] Add trait for char""
Jonas Devlieghere [Thu, 21 May 2020 17:32:23 +0000 (10:32 -0700)]
Revert "Revert "[YAMLTraits] Add trait for char""

Reverting this to unblock all the LLDB bots while we try to figure out a
solution for Solaris in https://reviews.llvm.org/D79745.

4 years ago[ImmutableSet] Use IntrusiveRefCntPtr to eliminate some manual refcounting
Benjamin Kramer [Thu, 21 May 2020 17:10:22 +0000 (19:10 +0200)]
[ImmutableSet] Use IntrusiveRefCntPtr to eliminate some manual refcounting

Still not ideal as the refcounting leaks to users, but better than
before. NFCI.

4 years ago[ADT][Analysis] NFC: Fix some more typos
Jean-Michel Gorius [Thu, 21 May 2020 16:53:08 +0000 (18:53 +0200)]
[ADT][Analysis] NFC: Fix some more typos

4 years ago[ProfileSummary] Add the PartialProfileRatio field in ProfileSummary metadata.
Hiroshi Yamauchi [Thu, 14 May 2020 17:21:53 +0000 (10:21 -0700)]
[ProfileSummary] Add the PartialProfileRatio field in ProfileSummary metadata.

Summary:
PartialProfileRatio approximately represents the ratio of the number of profile
counters of the program being built to the number of profile counters in the
partial sample profile. It is used to scale the working set size under the
partial sample profile to reflect the size of the program being built and to
improve the working set size heuristics.

This is a split from D79831.

Reviewers: davidxl

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libFuzzer] Fix leak in unit test.
Matt Morehouse [Thu, 21 May 2020 16:01:39 +0000 (09:01 -0700)]
[libFuzzer] Fix leak in unit test.

4 years ago[AMDGPU] Tune threshold for cmp/select vector lowering
Stanislav Mekhanoshin [Wed, 20 May 2020 18:51:07 +0000 (11:51 -0700)]
[AMDGPU] Tune threshold for cmp/select vector lowering

It was set in total vector size while the idea was to limit
a number of instructions. Now it started to work with doubles
and thresholds needs to be updated.

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

4 years ago[ADT] NFC: Fix typos in header comments
Jean-Michel Gorius [Thu, 21 May 2020 15:42:31 +0000 (17:42 +0200)]
[ADT] NFC: Fix typos in header comments

4 years agoRevert "[YAMLTraits] Add trait for char"
Rainer Orth [Thu, 21 May 2020 15:33:42 +0000 (17:33 +0200)]
Revert "[YAMLTraits] Add trait for char"

This reverts commit fab08bf4899e40d02d8bf394a63499ac679ac61c.  It has left
the Solaris buildbots broken for a week and a half as reported
in https://reviews.llvm.org/D79745.

4 years ago[llvm][test] Add missing FileCheck colons. NFC
Jon Roelofs [Wed, 20 May 2020 19:45:35 +0000 (13:45 -0600)]
[llvm][test] Add missing FileCheck colons. NFC

4 years ago[llvm][test] Add COM: directives before colon-less non-CHECKs in comments. NFC
Jon Roelofs [Fri, 15 May 2020 15:02:39 +0000 (09:02 -0600)]
[llvm][test] Add COM: directives before colon-less non-CHECKs in comments. NFC

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

4 years ago[SLP][NFC] PR45269 getVectorElementSize() is slow
Dinar Temirbulatov [Thu, 21 May 2020 15:00:20 +0000 (17:00 +0200)]
[SLP][NFC] PR45269 getVectorElementSize() is slow

The algorithm inside getVectorElementSize() is almost O(x^2) complexity and
when, for example, we compile MultiSource/Applications/ClamAV/shared_sha256.c
with 1k instructions inside sha256_transform() function that resulted in almost
~800k iterations. The following change improves the algorithm with the map to
a liner complexity.

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

4 years ago[ModuloSchedule] Trivial fix for instruction with more than one destination in modulo...
Thomas Raoux [Thu, 21 May 2020 15:14:42 +0000 (08:14 -0700)]
[ModuloSchedule] Trivial fix for instruction with more than one destination in modulo peeler.

When moving an instruction into a block where it was referenced by a phi when peeling,
refer to the phi's register number and assert that the instruction has it in its destinations.
This way, it also covers instructions with more than one destination.

Patch by Hendrik Greving!

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

4 years agoFix DeferredDiagnosticsEmitter for bug#45987
Yaxun (Sam) Liu [Thu, 21 May 2020 14:35:14 +0000 (10:35 -0400)]
Fix DeferredDiagnosticsEmitter for bug#45987

InOMPDeviceContext may be greater than 1. It needs to be clamp to 0 and 1
to be used as index for DoneMap.

4 years ago[x86] NFC: Fix typo in command line option description
Jean-Michel Gorius [Thu, 21 May 2020 14:51:32 +0000 (16:51 +0200)]
[x86] NFC: Fix typo in command line option description

4 years agoGenericDomTree.h - remove unused PointerIntPair.h include. NFC.
Simon Pilgrim [Thu, 21 May 2020 14:48:36 +0000 (15:48 +0100)]
GenericDomTree.h - remove unused PointerIntPair.h include. NFC.

4 years ago[mlir][rocdl] Exposing buffer load/store intrinsic
jerryyin [Tue, 19 May 2020 19:59:58 +0000 (19:59 +0000)]
[mlir][rocdl] Exposing buffer load/store intrinsic

Summary:
* Updated ROCDLOps tablegen
* Added parsing and printing function for new intrinsic
* Added unit tests

Reviewers: ftynse

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

Tags: #llvm

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

4 years ago[BitcodeReader] Simplify code. NFCI.
Benjamin Kramer [Thu, 21 May 2020 13:23:12 +0000 (15:23 +0200)]
[BitcodeReader] Simplify code. NFCI.

4 years ago[StringRef] Use some trickery to avoid initializing the std::string returned by upper...
Benjamin Kramer [Thu, 21 May 2020 13:22:33 +0000 (15:22 +0200)]
[StringRef] Use some trickery to avoid initializing the std::string returned by upper()/lower()

4 years ago[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.
Wen-Heng (Jack) Chung [Mon, 18 May 2020 18:01:54 +0000 (13:01 -0500)]
[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.

Due to similar APIs between CUDA and ROCm (HIP),
ConvertGpuLaunchFuncToCudaCalls pass could be used on both platforms with some
refactoring.

In this commit:

- Migrate ConvertLaunchFuncToCudaCalls from GPUToCUDA to GPUCommon, and rename.
- Rename runtime wrapper APIs be platform-neutral.
- Let GPU binary annotation attribute be specifiable as a PassOption.
- Naming changes within the implementation and tests.

Subsequent patches would introduce ROCm-specific tests and runtime wrapper
APIs.

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

4 years ago[analyzer][CallAndMessage] Add checker options for each bug type
Kirstóf Umann [Sun, 5 Apr 2020 17:53:22 +0000 (19:53 +0200)]
[analyzer][CallAndMessage] Add checker options for each bug type

iAs listed in the summary D77846, we have 5 different categories of bugs we're
checking for in CallAndMessage. I think the documentation placed in the code
explains my thought process behind my decisions quite well.

A non-obvious change I had here is removing the entry for
CallAndMessageUnInitRefArg. In fact, I removed the CheckerNameRef typed field
back in D77845 (it was dead code), so that checker didn't really exist in any
meaningful way anyways.

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

4 years agoFix debug info for NoDebug attr
Yaxun (Sam) Liu [Fri, 15 May 2020 03:09:30 +0000 (23:09 -0400)]
Fix debug info for NoDebug attr

NoDebug attr does not totally eliminate debug info about a function when
inlining is enabled. This is inconsistent with when inlining is disabled.

This patch fixes that.

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

4 years agoFix compile for -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY
David Nicuesa [Thu, 21 May 2020 12:46:42 +0000 (13:46 +0100)]
Fix compile for -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY

Summary: Compilation with  -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY was failing due to missing declarations of functions used in libcxx/include/atomic. The lines this commit affects are the places where those functions are defined, now moved to be always defined.

Reviewers: #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: miyuki, dexonsmith, ldionne, jfb, libcxx-commits

Tags: #libc

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

4 years agoOn Windows, handle interrupt signals without crash message
James Henderson [Wed, 13 May 2020 09:29:02 +0000 (10:29 +0100)]
On Windows, handle interrupt signals without crash message

For LLVM on *nix systems, the signal handlers are not run on signals
such as SIGINT due to CTRL-C. See sys::CleanupOnSignal. This makes
sense, as such signals are not really crashes. Prior to this change,
this wasn't the case on Windows, however. This patch changes the Windows
behaviour to be consistent with Linux, and adds testing that verifies
this.

The test uses llvm-symbolizer, but any tool with an interactive mode
would do the job.

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

Reviewed by: MaskRay, rnk, aganea

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

4 years ago[CostModel] Sink intrinsic costs to base TTI.
Sam Parker [Thu, 21 May 2020 12:13:25 +0000 (13:13 +0100)]
[CostModel] Sink intrinsic costs to base TTI.

Recommitting part of "[CostModel] Unify Intrinsic Costs."
de71def3f59dc9f12f67141b5040d8e15c84d08a

Move the switch statement from TTImpl::getIntrinsicCost to
TTI::getIntrinsicInstrCost. This enables BasicTTI to understand
more 'free' intrinsics instead of defaulting to a cost of 1.

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

4 years agoRevert "[CostModel] Unify Intrinsic Costs."
Sam Parker [Thu, 21 May 2020 11:50:24 +0000 (12:50 +0100)]
Revert "[CostModel] Unify Intrinsic Costs."

This reverts commit de71def3f59dc9f12f67141b5040d8e15c84d08a.

This is causing some very large changes, so I'm first going to break
this patch down and re-commit in parts.

4 years ago[FlattenCFG] Fix `MergeIfRegion` in case then-path is empty
Ehud Katz [Thu, 21 May 2020 11:06:44 +0000 (14:06 +0300)]
[FlattenCFG] Fix `MergeIfRegion` in case then-path is empty

In case the then-path of an if-region is empty, then merging with the
else-path should be handled with the inverse of the condition (leading
to that path).

Fix PR37662

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

4 years ago[analyzer][CallAndMessage][NFC] Split up checkPreCall
Kirstóf Umann [Sun, 5 Apr 2020 17:53:22 +0000 (19:53 +0200)]
[analyzer][CallAndMessage][NFC] Split up checkPreCall

The patch aims to use CallEvents interface in a more principled manner, and also
to highlight what this checker really does. It in fact checks for 5 different
kinds of errors (from checkPreCall, that is):

 * Invalid function pointer related errors
 * Call of methods from an invalid C++ this object
 * Function calls with incorrect amount of parameters
 * Invalid arguments for operator delete
 * Pass of uninitialized values to pass-by-value parameters

In a previous patch I complained that this checker is responsible for emitting
a lot of different diagnostics all under core.CallAndMessage's name, and this
patch shows where we could start to assign different diagnostics to different
entities.

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

4 years agoMachineMemOperand.h - reduce GlobalValue.h include to just DerivedTypes.h. NFC.
Simon Pilgrim [Thu, 21 May 2020 10:38:09 +0000 (11:38 +0100)]
MachineMemOperand.h - reduce GlobalValue.h include to just DerivedTypes.h. NFC.

We don't need anything specifically from GlobalValue.h

4 years ago[IndVarSimplify][LoopUtils] Avoid TOCTOU/ordering issues (PR45835)
Roman Lebedev [Thu, 21 May 2020 09:54:58 +0000 (12:54 +0300)]
[IndVarSimplify][LoopUtils] Avoid TOCTOU/ordering issues (PR45835)

Summary:
Currently, `rewriteLoopExitValues()`'s logic is roughly as following:
> Loop over each incoming value in each PHI node.
> Query whether the SCEV for that incoming value is high-cost.
> Expand the SCEV.
> Perform sanity check (`isValidRewrite()`, D51582)
> Record the info
> Afterwards, see if we can drop the loop given replacements.
> Maybe perform replacements.

The problem is that we interleave SCEV cost checking and expansion.
This is A Problem, because `isHighCostExpansion()` takes special care
to not bill for the expansions that were already expanded, and we can reuse.

While it makes sense in general - if we know that we will expand some SCEV,
all the other SCEV's costs should account for that, which might cause
some of them to become non-high-cost too, and cause chain reaction.

But that isn't what we are doing here. We expand *all* SCEV's, unconditionally.
So every next SCEV's cost will be affected by the already-performed expansions
for previous SCEV's. Even if we are not planning on keeping
some of the expansions we performed.

Worse yet, this current "bonus" depends on the exact PHI node
incoming value processing order. This is completely wrong.

As an example of an issue, see @dmajor's `pr45835.ll` - if we happen to have
a PHI node with two(!) identical high-cost incoming values for the same basic blocks,
we would decide first time around that it is high-cost, expand it,
and immediately decide that it is not high-cost because we have an expansion
that we could reuse (because we expanded it right before, temporarily),
and replace the second incoming value but not the first one;
thus resulting in a broken PHI.

What we instead should do for now, is not perform any expansions
until after we've queried all the costs.

Later, in particular after `isValidRewrite()` is an assertion (D51582)
we could improve upon that, but in a more coherent fashion.

See [[ https://bugs.llvm.org/show_bug.cgi?id=45835 | PR45835 ]]

Reviewers: dmajor, reames, mkazantsev, fhahn, efriedma

Reviewed By: dmajor, mkazantsev

Subscribers: smeenai, nikic, hiraditya, javed.absar, llvm-commits, dmajor

Tags: #llvm

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

4 years ago[HardwareLoops] llvm.loop.decrement.reg definition
Sjoerd Meijer [Thu, 21 May 2020 09:40:26 +0000 (10:40 +0100)]
[HardwareLoops] llvm.loop.decrement.reg definition

This is split off from D80316, slightly tightening the definition of overloaded
hardwareloop intrinsic llvm.loop.decrement.reg specifying that both operands
its result have the same type.

4 years ago[mlir] NFC - Add a builder to vector.transpose
Nicolas Vasilache [Thu, 21 May 2020 09:12:31 +0000 (05:12 -0400)]
[mlir] NFC - Add a builder to vector.transpose

Summary: Also expose some more vector ops to EDSCs.

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

4 years ago[libc] Fix accidental inclusion of system libc headers.
Paula Toth [Thu, 21 May 2020 08:21:07 +0000 (01:21 -0700)]
[libc] Fix accidental inclusion of system libc headers.

Summary:
I found that because `--system-headers` flag was not included when running clang-tidy, errors produced from compiler provided headers were being suppressed. After passing this flag I realized that by including headers like stdint.h we were indirectly including headers from the system libc. To prevent this we pass `-ffreestanding`.
We don't want to pass `--system-headers` for all checks just the `llvmlibc-restrict-system-libc-headers` therefore we do a separate invocation of clang-tidy for this check.

Reviewers: abrachet, sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, aheejin, tschuett, ecnelises, libc-commits

Tags: #libc-project

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

4 years ago[Statepoint] Constant fold FP deopt args.
Denis Antrushin [Wed, 20 May 2020 19:40:07 +0000 (22:40 +0300)]
[Statepoint] Constant fold FP deopt args.

We do not have any special handling for constant FP deopt arguments.
They are just spilled to stack or generated in register by MOVS
instruction. This is inefficient and, when we have too many such
constant arguments, may result in register allocation failure.
Instead, we can bitcast such constant FP operands to appropriately
sized integer and record as constant into statepoint and later, into
StackMap.

Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D80318

4 years agoFix a layering violation by not depending from Transforms/Utils on Transforms/Scalar.
Benjamin Kramer [Thu, 21 May 2020 07:50:57 +0000 (09:50 +0200)]
Fix a layering violation by not depending from Transforms/Utils on Transforms/Scalar.

NFC.

4 years ago[clang][index] Fix a crash for accessing a null field decl.
Haojian Wu [Wed, 20 May 2020 21:15:08 +0000 (23:15 +0200)]
[clang][index] Fix a crash for accessing a null field decl.

getField() may return a nullptr, we already did that in
BodyIndexer::VisitDesignatedInitExpr, but missed one place.

4 years ago[SVE] Remove IITDescriptor::ScalableVecArgument
David Sherwood [Fri, 15 May 2020 13:31:13 +0000 (14:31 +0100)]
[SVE] Remove IITDescriptor::ScalableVecArgument

I have refactored the code so that we no longer need the
ScalableVecArgument descriptor - the scalable property of vectors is
now encoded using the ElementCount class in IITDescriptor. This means
that when matching intrinsics we know precisely how to match the
arguments and return values.

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

4 years ago[PowerPC] add more high latency opcodes for machine combiner pass
Chen Zheng [Thu, 21 May 2020 06:04:10 +0000 (02:04 -0400)]
[PowerPC] add more high latency opcodes for machine combiner pass

Reviewed By: steven.zhang

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

4 years ago[CostModel] Unify Intrinsic Costs.
Sam Parker [Mon, 18 May 2020 08:02:05 +0000 (09:02 +0100)]
[CostModel] Unify Intrinsic Costs.

With the two getIntrinsicInstrCosts folded into one, now fold in the
scalar/code-size orientated getIntrinsicCost. This involved sinking
cost of the TTIImpl into the base implementation, as it performs no
target checks. The opcodes remaining were memcpy, cttz and ctlz which
now have special handling in the BasicTTI implementation.
getInstructionThroughput can now directly return the result of
getUserCost.

This had required a change in the AMDGPU backend for fabs and its
always 'free'. I've also changed the X86 backend to return '1' for
any intrinsic when the CostKind isn't RecipThroughput.

Though this intended to be a non-functional change, there are many
paths being combined here so I would be very surprised if this didn't
have an effect.

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

4 years ago[lldb/Reproducers] Fix/skip passive replay failures in python_api subdir
Jonas Devlieghere [Thu, 21 May 2020 06:23:50 +0000 (23:23 -0700)]
[lldb/Reproducers] Fix/skip passive replay failures in python_api subdir

Fixes or skips tests in the python_api subdirectory that were failing
with passive replay.

4 years agoRevert "[lit] GoogleTest framework should report failures if test binary crashes"
Jonas Devlieghere [Thu, 21 May 2020 06:16:43 +0000 (23:16 -0700)]
Revert "[lit] GoogleTest framework should report failures if test binary crashes"

This reverts commit ef2103182244c96f5206b02164b62b9c9e0cbce8 because it
breaks the Windows bot:

http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/16447

Failing Tests (2):
  ...
  lldb-unit :: API/./APITests.exe/failed_to_discover_tests_from_gtest

4 years ago[CostModel] Remove getExtCost
Sam Parker [Tue, 12 May 2020 12:17:33 +0000 (13:17 +0100)]
[CostModel] Remove getExtCost

This has not been implemented by any backends which appear to cover
the functionality through getCastInstrCost. Sink what there is in the
default implementation into BasicTTI.

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

4 years ago[MC] Simplify MakeStartMinusEndExpr(). NFC.
Igor Kudrin [Thu, 21 May 2020 06:05:38 +0000 (13:05 +0700)]
[MC] Simplify MakeStartMinusEndExpr(). NFC.

The function does not need an MCStreamer per se; it was used only to get
access to the MCContext.

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

4 years ago[BrachProbablityInfo] Set edge probabilities at once and fix calcMetadataWeights()
Yevgeny Rouban [Thu, 21 May 2020 04:49:11 +0000 (11:49 +0700)]
[BrachProbablityInfo] Set edge probabilities at once and fix calcMetadataWeights()

Hide the method that allows setting probability for particular edge
and introduce a public method that sets probabilities for all
outgoing edges at once.
Setting individual edge probability is error prone. More over it is
difficult to check that the total probability is 1.0 because there is
no easy way to know when the user finished setting all
the probabilities.

Related bug is fixed in BranchProbabilityInfo::calcMetadataWeights().
Changing unreachable branch probabilities to raw(1) and distributing
the rest (oldProbability - raw(1)) over the reachable branches could
introduce total probability inaccuracy bigger than 1/numOfBranches.

Reviewers: yamauchi, ebrevnov
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79396

4 years ago[LegalizeDAG] Modify ExpandLegalINT_TO_FP to swap data for little/big endian instead...
Craig Topper [Thu, 21 May 2020 05:27:53 +0000 (22:27 -0700)]
[LegalizeDAG] Modify ExpandLegalINT_TO_FP to swap data for little/big endian instead of the pointers.

Will make it easier to pass the pointer info and alignment
correctly to the loads/stores.

While there also make the i32 stores independent and use a token
factor to join before the load.

4 years agoRevert "[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass."
Mehdi Amini [Thu, 21 May 2020 03:44:35 +0000 (03:44 +0000)]
Revert "[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass."

This reverts commit cdb6f05e2d5f0132956020e6b4990af0206c066f.

The build is broken with:

  You have called ADD_LIBRARY for library obj.MLIRGPUtoCUDATransforms without any source files. This typically indicates a problem with your CMakeLists.txt file

4 years agoFix typo in CMake error message "LLVM_LIBC_ENABLE_PROJECTS"->"LLVM_ENABLE_PROJECTS...
Mehdi Amini [Thu, 21 May 2020 03:07:52 +0000 (03:07 +0000)]
Fix typo in CMake error message "LLVM_LIBC_ENABLE_PROJECTS"->"LLVM_ENABLE_PROJECTS" (NFC)

4 years ago[Darwin] Remove obsolete OS version checks
Julian Lettner [Thu, 14 May 2020 19:27:41 +0000 (12:27 -0700)]
[Darwin] Remove obsolete OS version checks

The oldest supported deployment target currently is 10.7 [1].  We can
remove a few outdated checks.

[1] https://github.com/llvm/llvm-project/blob/3db893b3712a5cc98ac0dbc88e08df70069be216/compiler-rt/cmake/config-ix.cmake#L397

Reviewed By: delcypher

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

4 years agoadd a test for D77524
Juneyoung Lee [Thu, 21 May 2020 01:03:27 +0000 (10:03 +0900)]
add a test for D77524

4 years ago[gn build] Port d9a4a244138
LLVM GN Syncbot [Thu, 21 May 2020 00:30:02 +0000 (00:30 +0000)]
[gn build] Port d9a4a244138

4 years agoAdd CanonicalizeFreezeInLoops pass
Juneyoung Lee [Thu, 7 May 2020 20:28:42 +0000 (05:28 +0900)]
Add CanonicalizeFreezeInLoops pass

Summary:
If an induction variable is frozen and used, SCEV yields imprecise result
because it doesn't say anything about frozen variables.

Due to this reason, performance degradation happened after
https://reviews.llvm.org/D76483 is merged, causing
SCEV yield imprecise result and preventing LSR to optimize a loop.

The suggested solution here is to add a pass which canonicalizes frozen variables
inside a loop. To be specific, it pushes freezes out of the loop by freezing
the initial value and step values instead & dropping nsw/nuw flags from instructions used by freeze.
This solution was also mentioned at https://reviews.llvm.org/D70623 .

Reviewers: spatel, efriedma, lebedev.ri, fhahn, jdoerfert

Reviewed By: fhahn

Subscribers: nikic, mgorny, hiraditya, javed.absar, llvm-commits, sanwou01, nlopes

Tags: #llvm

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

4 years ago[clang-format][docfix] Update predefined styles in docs
Jake Merdich [Wed, 20 May 2020 16:17:55 +0000 (12:17 -0400)]
[clang-format][docfix] Update predefined styles in docs

Summary:
The predefined styles that clang-format supports are listed in two
places, and neither is up-to-date. GNU style isn't mentioned at all!

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[analyzer] Make buildbots happy
Kirstóf Umann [Wed, 20 May 2020 23:54:11 +0000 (01:54 +0200)]
[analyzer] Make buildbots happy

4 years ago[AArch64] Fix unwind info generated by outliner.
Eli Friedman [Tue, 19 May 2020 20:24:53 +0000 (13:24 -0700)]
[AArch64] Fix unwind info generated by outliner.

The offsets were wrong. The result is now the same as what the compiler
would generate for a function that spills lr normally.

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

4 years agoMake Value::getPointerAlignment() return an Align, not a MaybeAlign.
Eli Friedman [Sun, 17 May 2020 00:55:18 +0000 (17:55 -0700)]
Make Value::getPointerAlignment() return an Align, not a MaybeAlign.

If we don't know anything about the alignment of a pointer, Align(1) is
still correct: all pointers are at least 1-byte aligned.

Included in this patch is a bugfix for an issue discovered during this
cleanup: pointers with "dereferenceable" attributes/metadata were
assumed to be aligned according to the type of the pointer.  This
wasn't intentional, as far as I can tell, so Loads.cpp was fixed to
stop making this assumption. Frontends may need to be updated.  I
updated clang's handling of C++ references, and added a release note for
this.

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

4 years ago[AArch64] Fix GlobalISel tests on non-darwin platforms
Francis Visoiu Mistrih [Wed, 20 May 2020 23:26:37 +0000 (16:26 -0700)]
[AArch64] Fix GlobalISel tests on non-darwin platforms

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/6998

4 years ago[LLD] Make scoped timers thread safe
Reid Kleckner [Wed, 20 May 2020 14:50:19 +0000 (07:50 -0700)]
[LLD] Make scoped timers thread safe

Summary:
This is a pre-requisite to parallelizing PDB symbol and type merging.
Currently this timer usage would not be thread safe.

Reviewers: aganea, MaskRay

Subscribers: jfb, llvm-commits

Tags: #llvm

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

4 years ago[analyzer] Fix a null FunctionDecl dereference bug after D75432
Kirstóf Umann [Wed, 20 May 2020 23:03:31 +0000 (01:03 +0200)]
[analyzer] Fix a null FunctionDecl dereference bug after D75432

4 years ago[AArch64] Provide Darwin variants of most calling conventions
Francis Visoiu Mistrih [Fri, 31 Jan 2020 21:20:57 +0000 (13:20 -0800)]
[AArch64] Provide Darwin variants of most calling conventions

With the new SVE stack layout, we now need to provide a Darwin variant
for all the calling conventions based on the main AAPCS CSR save order.

This also changes APCS_SwiftError to have a Darwin and a non-Darwin
version, assuming it could be used on other platforms these days, and
restricts the AArch64_CXX_TLS calling convention to Darwin.

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

4 years ago[AMDGPU] Always expand ext/insertelement with divergent idx
Stanislav Mekhanoshin [Fri, 15 May 2020 17:43:18 +0000 (10:43 -0700)]
[AMDGPU] Always expand ext/insertelement with divergent idx

Even though series of cmd/cndmask can produce quite a lot of
code that is still better than a loop. In case of doubles we
would even produce two loops.

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

4 years ago[LegalizeVectorTypes] Create correct memoperands in SplitVecRes_INSERT_SUBVECTOR.
Craig Topper [Wed, 20 May 2020 22:06:36 +0000 (15:06 -0700)]
[LegalizeVectorTypes] Create correct memoperands in SplitVecRes_INSERT_SUBVECTOR.

Previously this code just used a default constructed
MachinePointerInfo. But we know the accesses are to a fixed stack
object or at least somewhere on the stack.

While there fix the alignment passed to the full vector load/stores.

I don't think this function is currently exercised in tree so I
don't know how to test it. I just noticed it when I removed
non-constant index support in this function.

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

4 years ago[mlir] NFC - Appease GCC 5 again..
Nicolas Vasilache [Wed, 20 May 2020 21:58:10 +0000 (17:58 -0400)]
[mlir] NFC - Appease GCC 5 again..

4 years ago[mlir][gpu] Refactor functions for workgroup and private buffer attributions.
Wen-Heng (Jack) Chung [Wed, 6 May 2020 17:45:58 +0000 (12:45 -0500)]
[mlir][gpu] Refactor functions for workgroup and private buffer attributions.

Summary:

Consolidate interfaces adding workgroup and private buffer attributions in GPU
dialect.

Note all private buffer attributions must follow workgroup buffer attributions.

Reviewers: herhut

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

Tags: #llvm, #mlir

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

4 years ago[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.
Wen-Heng (Jack) Chung [Mon, 18 May 2020 18:01:54 +0000 (13:01 -0500)]
[mlir][gpu] Refactor ConvertGpuLaunchFuncToCudaCalls pass.

Due to similar APIs between CUDA and ROCm (HIP),
ConvertGpuLaunchFuncToCudaCalls pass could be used on both platforms with some
refactoring.

In this commit:

- Migrate ConvertLaunchFuncToCudaCalls from GPUToCUDA to GPUCommon, and rename.
- Rename runtime wrapper APIs be platform-neutral.
- Let GPU binary annotation attribute be specifiable as a PassOption.
- Naming changes within the implementation and tests.

Subsequent patches would introduce ROCm-specific tests and runtime wrapper
APIs.

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

4 years ago[lldb/Test] Support arbitrary file extensions in TestPositionalArgs.test
Jonas Devlieghere [Wed, 20 May 2020 21:08:55 +0000 (14:08 -0700)]
[lldb/Test] Support arbitrary file extensions in TestPositionalArgs.test

On Windows the line must match:

  Use 'lldb.exe --help' for a complete list of options.

4 years ago[mlir] NFC - Appease GCC 5 again..
Nicolas Vasilache [Wed, 20 May 2020 20:41:41 +0000 (16:41 -0400)]
[mlir] NFC - Appease GCC 5 again..

4 years ago[lit] GoogleTest framework should report failures if test binary crashes
Stephen Neuendorffer [Mon, 18 May 2020 00:41:39 +0000 (17:41 -0700)]
[lit] GoogleTest framework should report failures if test binary crashes

lit runs a gtest executable multiple times. First it runs it to
discover tests, then later it runs the executable again for each test.
However, if the discovery fails (perhaps because of a broken
executable), then no tests were previously run and no failures were
reported.  This patch creates a dummy test if discovery fails, which
will later fail when test are run and be reported as a failure.

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

4 years ago[clang-format] Added new option IndentExternBlock
mydeveloperday [Wed, 20 May 2020 20:25:18 +0000 (21:25 +0100)]
[clang-format] Added new option IndentExternBlock

Reviewers: MyDeveloperDay, krasimir, klimek, mitchell-stellar, Abpostelnicu

Patch By: MarcusJohnson91

Reviewed By: MyDeveloperDay, Abpostelnicu

Subscribers: sylvestre.ledru, Abpostelnicu, cfe-commits

Tags: #clang, #clang-format, #clang-tools-extra

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

4 years agoGive microsoftDemangle() an outparam for how many input bytes were consumed.
Nico Weber [Mon, 18 May 2020 23:57:30 +0000 (19:57 -0400)]
Give microsoftDemangle() an outparam for how many input bytes were consumed.

Demangling Itanium symbols either consumes the whole input or fails,
but Microsoft symbols can be successfully demangled with just some
of the input.

Add an outparam that enables clients to know how much of the input was
consumed, and use this flag to give llvm-undname an opt-in warning
on partially consumed symbols.

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

4 years ago[clang-format] Set of unit test to begin to validate that we don't change defaults
mydeveloperday [Wed, 20 May 2020 20:11:10 +0000 (21:11 +0100)]
[clang-format] Set of unit test to begin to validate that we don't change defaults

Summary:
This revision is to complement {D75791} so we can be sure that we don't change any default behavior.

For now just add rules to cover AfterExternBlock, but in the future we should add cases to cover the other BraceWrapping rules for each style. This will help guard us when we change code inside of the various getXXXStyle() functions to ensure we are not breaking everyone.

Reviewed By: MarcusJohnson91

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https:

4 years ago[lldb/Reproducers] Add instrumentation to SBEnvironment
Jonas Devlieghere [Wed, 20 May 2020 19:59:51 +0000 (12:59 -0700)]
[lldb/Reproducers] Add instrumentation to SBEnvironment

This class should've been instrumented when it landed. Whether the class
is "highly mutable" or not doesn't affect that.

With this patch TestSBEnvironment.py now passes when replayed.

4 years ago[sanitizer_symbolizer] Add __isinf to symbols list.
Matt Morehouse [Wed, 20 May 2020 19:39:40 +0000 (12:39 -0700)]
[sanitizer_symbolizer] Add __isinf to symbols list.

4 years ago[lldb/Driver] Print snippet before exiting with unknown argument.
Jonas Devlieghere [Wed, 20 May 2020 19:32:41 +0000 (12:32 -0700)]
[lldb/Driver] Print snippet before exiting with unknown argument.

Print a little snippet before exiting when passed unrecognized
arguments. The goal is twofold:

 - Point users to lldb --help.
 - Make it clear that we exited the debugger.

4 years ago[lldb] Cleans up system_libs
Haibo Huang [Tue, 19 May 2020 22:23:35 +0000 (15:23 -0700)]
[lldb] Cleans up system_libs

Summary:
Long long ago system_libs was appended to LLDB_SYSTEM_LIBS in
cmake/LLDBDependencies.cmake. After that file was removed, system_libs
is orphaned.

Currently the only user is source/Utility. Move the logic there and
remove system_libs.

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Allows customizing libxml2 for darwin
Haibo Huang [Tue, 19 May 2020 23:00:54 +0000 (16:00 -0700)]
[lldb] Allows customizing libxml2 for darwin

Summary:
This changes allows to disable or use customized libxml2 for lldb.

1. Removes redundant include_directories. The one in LLDBConfig.cmake should be enough.

2. Link to ${LIBXML2_LIBRARIES} if xml2 is enabled.

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years ago[OPENMP]Fix PR45911: Data sharing and lambda capture.
Alexey Bataev [Thu, 14 May 2020 20:37:30 +0000 (16:37 -0400)]
[OPENMP]Fix PR45911: Data sharing and lambda capture.

Summary:
No need to generate inlined OpenMP region for variables captured in
lambdas or block decls, only for implicitly captured variables in the
OpenMP region.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

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

4 years ago[mlir][spirv] Adapt subview legalization to the updated op semantics.
MaheshRavishankar [Wed, 20 May 2020 18:48:22 +0000 (11:48 -0700)]
[mlir][spirv] Adapt subview legalization to the updated op semantics.

The subview semantics changes recently to allow for more natural
representation of constant offsets and strides. The legalization of
subview op for lowering to SPIR-V needs to account for this.
Also change the linearization to use the strides from the affine map
of a memref.

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