Commit Graph

40602 Commits

Author SHA1 Message Date
Benjamin Kramer 7a5a1e9460 [IR] AttributeList::getContext has a single user, remove it. 2020-05-01 14:18:29 +02:00
Hubert Tong 5d806e254e [XCOFF] Clean-up enum use in BinaryFormat/XCOFF.h; NFC
Summary:
This patch splits mostly unrelated size constants into separate
constexpr variables, sets explicit underlying types for the enumerations
to match the fields they are used for, and improves various comments.

This patch also replaces `<cname>` headers with `<name.h>` headers to
match the usage of the declared names as global namespace members in the
file.

Reviewers: jasonliu, DiggerLin, daltenty, sfertile

Reviewed By: jasonliu, sfertile

Differential Revision: https://reviews.llvm.org/D79136
2020-04-30 20:48:30 -04:00
Sergey Dmitriev cfea3dc102 [AbstractCallSite] Look though constant cast expression when checking for callee use
Summary: That makes AbstractCallSite::isCallee(const Use *) behavior consistent with AbstractCallSite constructor.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79188
2020-04-30 15:09:57 -07:00
Sam Clegg 65e64f6d65 [WebAssembly] Fix test failure after 0a6c4d8d2e
Reverting part of https://reviews.llvm.org/D79137 which caused an
failure in an ObjectYAML test.
2020-04-30 14:27:08 -07:00
Florian Hahn 19ab53f1e2 [LoopVersioning] Update setAliasChecks to take ArrayRef argument (NFC).
This cleanup was suggested as part of D78458.
2020-04-30 22:17:12 +01:00
Eli Friedman c671345153 [IRBuilder][NFC] Dereference MaybeAlign that's known non-None. 2020-04-30 14:08:37 -07:00
Alexey Bataev b5be1c5419 [OPENMP50]Basic support for uses_allocators clause.
Summary: Added parsing/sema/serialization supoprt for uses_allocators clause.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, arphaman, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78577
2020-04-30 16:24:36 -04:00
Sam Clegg 0a6c4d8d2e [WebAssmebly] Add support for defined wasm globals in MC and lld
This change add support for defined wasm globals in the .s format,
the MC layer, and wasm-ld

Currently there is no support custom initialization and all wasm
globals are initialized to zero.

Fixes: PR45742

Differential Revision: https://reviews.llvm.org/D79137
2020-04-30 12:43:15 -07:00
Arthur Eubanks a90948fd6e [NFC] Rename *ByValOrInalloca* to *PassPointeeByValue*
Summary: In preparation for preallocated.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79152
2020-04-30 09:42:13 -07:00
Jann Horn cfe36e4c6a [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
Summary:
Refactor getInterestingMemoryOperands() so that information about the
pointer operand is returned through an array of structures instead of
passing each piece of information separately by-value.

This is in preparation for returning information about multiple pointer
operands from a single instruction.

A side effect is that, instead of repeatedly generating the same
information through isInterestingMemoryAccess(), it is now simply collected
once and then passed around; that's probably more efficient.

HWAddressSanitizer has a bunch of copypasted code from AddressSanitizer,
so these changes have to be duplicated.

This is patch 3/4 of a patch series:
https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments

[glider: renamed llvm::InterestingMemoryOperand::Type to OpType to fix
GCC compilation]

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77618
2020-04-30 17:09:13 +02:00
Raphael Isemann 5e6f167aa9 Include SmallVector.h in IPO.h to fix modules build [NFC]
This file currently doesn't compile under LLVM_ENABLE_MODULES as SmallVector
is used in this header but is never forward declared or included in any way.
Let's include SmallVector.h instead and get rid of the SmallVectorImpl fwd
declaration which is now no longer necessary.
2020-04-30 16:33:55 +02:00
Alexander Potapenko 7e7754df32 Revert an accidental commit of four AddressSanitizer refactor CLs
I couldn't make arc land the changes properly, for some reason they all got
squashed. Reverting them now to land cleanly.

Summary: This reverts commit cfb5f89b62.

Reviewers: kcc, thejh

Subscribers:
2020-04-30 16:15:43 +02:00
diggerlin a2c8cd1812 [AIX] emit .extern and .weak directive linkage
SUMMARY:

emit .extern and .weak directive linkage

Reviewers: hubert.reinterpretcast, Jason Liu
Subscribers: wuzish, nemanjai, hiraditya

Differential Revision: https://reviews.llvm.org/D76932
2020-04-30 09:54:10 -04:00
Jann Horn cfb5f89b62 [AddressSanitizer] Refactor ClDebug{Min,Max} handling
Summary:
A following commit will split the loop over ToInstrument into two.
To avoid having to duplicate the condition for suppressing instrumentation
sites based on ClDebug{Min,Max}, refactor it out into a new function.

While we're at it, we can also avoid the indirection through
NumInstrumented for setting FunctionModified.

This is patch 1/4 of a patch series:
https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: jfb, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77616
2020-04-30 15:30:46 +02:00
Cullen Rhodes 7e4c26bb88 [AArch64][SVE] Remove unused FP reduction intrinsic definitions
Summary: FP reductions no longer use these intrinsics since D78723.

Reviewers: efriedma, sdesmalen

Reviewed By: efriedma, sdesmalen

Differential Revision: https://reviews.llvm.org/D79010
2020-04-30 10:18:40 +00:00
Evgeniy Brevnov 3e68a66704 [BPI][NFC] Reuse post dominantor tree from analysis manager when available
Summary: Currenlty BPI unconditionally creates post dominator tree each time. While this is not incorrect we can save compile time by reusing existing post dominator tree (when it's valid) provided by analysis manager.

Reviewers: skatkov, taewookoh, yrouban

Reviewed By: skatkov

Subscribers: hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78987
2020-04-30 11:31:03 +07:00
Mircea Trofin 3ab319b295 [llvm][NFC] Use CallBase explicitly instead of Instruction in FunctionComparator
Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79098
2020-04-29 15:37:46 -07:00
Alina Sbirlea 161ccfe5ba [MemorySSA] Pass DT to the upward iterator for proper PhiTranslation.
Summary:
A valid DominatorTree is needed to do PhiTranslation.
Before this patch, a MemoryUse could be optimized to an access outside a loop, while the address it loads from is modified in the loop.
This can lead to a miscompile.

Reviewers: george.burgess.iv

Subscribers: Prazek, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79068
2020-04-29 14:28:31 -07:00
Christopher Tetreault 7ef15c869a [NFC] Make ConstantVector/ConstantDataVector::getType() return a FixedVectorType
Reviewers: efriedma, huihuiz, dexonsmith, spatel

Reviewed By: efriedma

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79122
2020-04-29 14:23:40 -07:00
Jan Korous 4c53f4202a [FileCollector] move Root creation
If we don't handle the errors we can't rely on the directory being created early anyway.

Differential Revision: https://reviews.llvm.org/D78959
2020-04-29 11:47:23 -07:00
Christopher Tetreault 0700cb64b5 [SVE] Upgrade VectorType tests to test new types
Reviewers: efriedma, sdesmalen, c-rhodes, ddunbar

Reviewed By: sdesmalen

Subscribers: huntergr, tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78831
2020-04-29 11:45:46 -07:00
Anh Tuyen Tran c7878ad231 [VFDatabase] Scalar functions are vector functions with VF =1
Summary:
Return scalar function when VF==1. The new trivial mapping scalar --> scalar when VF==1 to prevent false positive for "isVectorizable" query.

Author: masoud.ataei (Masoud Ataei)

Reviewers: Whitney (Whitney Tsang), fhahn (Florian Hahn), pjeeva01 (Jeeva P.), fpetrogalli (Francesco Petrogalli), rengolin (Renato Golin)

Reviewed By: fpetrogalli (Francesco Petrogalli)

Subscribers: hiraditya (Aditya Kumar), llvm-commits, LLVM

Tag: LLVM

Differential Revision: https://reviews.llvm.org/D78054
2020-04-29 17:20:37 +00:00
Hiroshi Yamauchi 1831986826 [PGO][PGSO] Prep for enabling non-cold code size opts under non-partial-profile sample PGO.
Summary:
- Distinguish between partial-profile and non-partial-profile sample PGO.
- Add a flag for partial-profile sample PGO.
- Tune the sample PGO cutoff.
- No default behavior change (yet).

Reviewers: davidxl

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78949
2020-04-29 08:57:47 -07:00
Mircea Trofin e61247c0a8 [llvm][NFC] Change parameter type to more specific CallBase in IndirectCallPromotion
Reviewers: dblaikie, craig.topper, wmi

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79047
2020-04-29 08:42:32 -07:00
Simon Pilgrim 1be7f2de1b Revert rG5c4b4a62256876 "PseudoSourceValue.h - reduce GlobalValue.h include to forward declaration. NFC."
Causes buildbot failures.
2020-04-29 16:12:19 +01:00
Simon Pilgrim 5c4b4a6225 PseudoSourceValue.h - reduce GlobalValue.h include to forward declaration. NFC.
Fix MachineMemOperand.h implicit dependency on Type.h via PseudoSourceValue.h
2020-04-29 15:39:27 +01:00
Simon Pilgrim 090cae8491 [TTI] Add DemandedElts to getScalarizationOverhead
The improvements to the x86 vector insert/extract element costs in D74976 resulted in the estimated costs for vector initialization and scalarization increasing higher than should be expected. This is particularly noticeable on pre-SSE4 targets where the available of legal INSERT_VECTOR_ELT ops is more limited.

This patch does 2 things:
1 - it implements X86TTIImpl::getScalarizationOverhead to more accurately represent the typical costs of a ISD::BUILD_VECTOR pattern.
2 - it adds a DemandedElts mask to getScalarizationOverhead to permit the SLP's BoUpSLP::getGatherCost to be rewritten to use it directly instead of accumulating raw vector insertion costs.

This fixes PR45418 where a v4i8 (zext'd to v4i32) was no longer vectorizing.

A future patch should extend X86TTIImpl::getScalarizationOverhead to tweak the EXTRACT_VECTOR_ELT scalarization costs as well.

Reviewed By: @craig.topper

Differential Revision: https://reviews.llvm.org/D78216
2020-04-29 12:00:38 +01:00
David Blaikie 11af7d32c7 Remove DeleteContainer* functions, now that all uses have been ported to unique_ptr 2020-04-28 22:49:02 -07:00
Sterling Augustine 3421d1ede4 Make getCompileUnitForAddress public.
Summary:
Certain dwarf information (like the compilation directory), are only
accessible from the compile unit. Make it available for use.

Subscribers: aprantl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79048
2020-04-28 16:51:23 -07:00
Sam McCall 4e769e93b9 Reland "Add a facility to get system cache directory and use it in clangd"
This reverts commit faf2dce1dd.
2020-04-29 00:56:36 +02:00
Eric Christopher faf2dce1dd Temporarily revert "Add a facility to get system cache directory and use it in clangd"
This reverts commit ad38f4b371.

As it broke building the unittests:

.../sources/llvm-project/llvm/unittests/Support/Path.cpp:334:5: error: use of undeclared identifier 'set'
    set(Value);
    ^
1 error generated.
2020-04-28 15:49:46 -07:00
Vojtěch Štěpančík ad38f4b371 Add a facility to get system cache directory and use it in clangd
Summary:
This patch adds a function that is similar to `llvm::sys::path::home_directory`, but provides access to the system cache directory.

For Windows, that is %LOCALAPPDATA%, and applications should put their files under %LOCALAPPDATA%\Organization\Product\.

For *nixes, it adheres to the XDG Base Directory Specification, so it first looks at the XDG_CACHE_HOME environment variable and falls back to ~/.cache/.

Subsequently, the Clangd Index storage leverages this new API to put index files somewhere else than the users home directory.

Fixes https://github.com/clangd/clangd/issues/341

Reviewers: sammccall, chandlerc, Bigcheese

Reviewed By: sammccall

Subscribers: hiraditya, ilya-biryukov, MaskRay, jkorous, dexonsmith, arphaman, kadircet, ormris, usaxena95, cfe-commits, llvm-commits

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

Differential Revision: https://reviews.llvm.org/D78501
2020-04-28 23:18:31 +02:00
Davide Italiano 0ed276bb08 [GlobalISel] Assign the correct debug location when combining G_ANYEXT/G_ZEXT
<rdar://problem/62535712>
2020-04-28 14:12:33 -07:00
Florian Hahn 616657b39c [LAA] Move CheckingPtrGroup/PointerCheck outside class (NFC).
This allows forward declarations of PointerCheck, which in turn reduce
the number of times LoopAccessAnalysis needs to be included.

Ultimately this helps with moving runtime check generation to
Transforms/Utils/LoopUtils.h, without having to include it there.

Reviewers: anemet, Ayal

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D78458
2020-04-28 21:47:31 +01:00
Mircea Trofin 8a7cf11f92 [llvm][NFC] Refactor APIs operating on CallBase
Summary:
Refactored the parameter and return type where they are too generally
typed as Instruction.

Reviewers: dblaikie, wmi, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79027
2020-04-28 13:23:47 -07:00
David Blaikie 89e2fe3210 MustBeExecutedContextExplorer::InstructionIteratorMap: use unique_ptr for values in this map to simplify memory management 2020-04-28 12:26:53 -07:00
David Blaikie 3c89256d71 Attributor::ArgumentReplacementMap: Use unique_ptr to simplify memory management 2020-04-28 12:26:52 -07:00
Fangrui Song 6f23049119 [Support] Simplify and optimize ThreadPool
* Merge QueueLock and CompletionLock.
* Avoid spurious CompletionCondition.notify_all() when ActiveThreads is greater than 0.
* Use default member initializers.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D78856
2020-04-28 12:20:42 -07:00
Jan Korous 1e43cab3c6 [FileCollector] Lock Mutex in copyFiles
We should synchronize reading of VFSWriter's data with the rest of the methods.

Differential revision: https://reviews.llvm.org/D78956
2020-04-28 11:08:04 -07:00
Nick Desaulniers 1b9fdec1f6 [TII] remove overrides of isUnpredicatedTerminator
Summary:
They all match the base implementation in
TargetInstrInfo::isUnpredicatedTerminator.

Follow up to D62749.

Reviewers: echristo, MaskRay, hfinkel

Reviewed By: echristo

Subscribers: wuzish, nemanjai, hiraditya, kbarton, llvm-commits, srhines

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78976
2020-04-28 08:47:28 -07:00
Sam Parker e9c9329aa4 [TTI] Add TargetCostKind argument to getUserCost
There are several different types of cost that TTI tries to provide
explicit information for: throughput, latency, code size along with
a vague 'intersection of code-size cost and execution cost'.

The vectorizer is a keen user of RecipThroughput and there's at least
'getInstructionThroughput' and 'getArithmeticInstrCost' designed to
help with this cost. The latency cost has a single use and a single
implementation. The intersection cost appears to cover most of the
rest of the API.

getUserCost is explicitly called from within TTI when the user has
been explicit in wanting the code size (also only one use) as well
as a few passes which are concerned with a mixture of size and/or
a relative cost. In many cases these costs are closely related, such
as when multiple instructions are required, but one evident diverging
cost in this function is for div/rem.

This patch adds an argument so that the cost required is explicit,
so that we can make the important distinction when necessary.

Differential Revision: https://reviews.llvm.org/D78635
2020-04-28 08:57:45 +01:00
Craig Topper a58b62b4a2 [IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().
This method has been commented as deprecated for a while. Remove
it and replace all uses with the equivalent getCalledOperand().

I also made a few cleanups in here. For example, to removes use
of getElementType on a pointer when we could just use getFunctionType
from the call.

Differential Revision: https://reviews.llvm.org/D78882
2020-04-27 22:17:03 -07:00
Mircea Trofin cb56e9b923 [llvm][NFC] Use CallBase instead of Instruction in ProfileSummaryInfo
Summary:
getProfileCount requires the parameter be a valid CallBase, and its uses
reflect that.

Reviewers: dblaikie, craig.topper, wmi

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78940
2020-04-27 20:47:52 -07:00
Arthur Eubanks 3b0450acec Add IR constructs for preallocated (inalloca replacement)
Add llvm.call.preallocated.{setup,arg} instrinsics.
Add "preallocated" operand bundle which takes a token produced by llvm.call.preallocated.setup.
Add "preallocated" parameter attribute, which is like byval but without the copy.

Verifier changes for these IR constructs.

See https://github.com/rnk/llvm-project/blob/call-setup-docs/llvm/docs/CallSetup.md

Subscribers: hiraditya, jdoerfert, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74651
2020-04-27 16:15:50 -07:00
Christopher Tetreault d52ca3d7e6 [SVE] Add specialized overloads of VectorType::get
Summary:
Add overloads of get to FixedVectorType and ScalableVectorType that
mirror VectorType::get(Type *Ty, VectorType *VTy) that take and return
derived vector types

Reviewers: efriedma, c-rhodes, david-arm, fpetrogalli

Reviewed By: david-arm

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78841
2020-04-27 15:45:57 -07:00
Andrew Browne dda3c19a36 ADT: SmallVector size/capacity use word-size integers when elements are small
SmallVector currently uses 32bit integers for size and capacity to reduce
sizeof(SmallVector). This limits the number of elements to UINT32_MAX.

For a SmallVector<char>, this limits the SmallVector size to only 4GB.
Buffering bitcode output uses SmallVector<char>, but needs >4GB output.

This changes SmallVector size and capacity to conditionally use word-size
integers if the element type is small (<4 bytes). For larger elements types,
the vector size can reach ~16GB with 32bit size.

Making this conditional on the element type provides both the smaller
sizeof(SmallVector) for larger types which are unlikely to grow so large,
and supports larger capacities for smaller element types.

This recommit fixes the same template being instantiated twice on platforms
where uintptr_t is the same as uint32_t.
2020-04-27 13:41:01 -07:00
Mircea Trofin 8a4013ed38 [llvm][NFC] Add an explicit 'ComputeFullInlineCost' API
Summary:
Added getInliningCostEstimate, which is essentially what getInlineCost
computes if passed default inlining params, and  non-null ORE or
InlineParams::ComputeFullInlineCost.

Reviewers: davidxl, eraman, jdoerfert

Subscribers: hiraditya, haicheng, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78730
2020-04-27 09:11:45 -07:00
Wei Mi 10b57ca690 [ProfileSummary] Add partial profile annotation on IR.
Profile and profile summary are usually read only once and then annotated
on IR. The profile summary metadata on IR should include the value of the
newly added partial profile flag, so that compilation phase like thinlto
postlink can get the full set of profile information.

Differential Revision: https://reviews.llvm.org/D78310
2020-04-27 08:34:15 -07:00
Simon Pilgrim 6d5a9e8d82 CachedHashString.h - remove unnecessary includes. NFC.
We don't need the full DenseMap.h just DenseMapInfo.h
2020-04-27 13:51:32 +01:00
Raphael Isemann 8d15e222da Fix modules build after introduction of PassSupport.h include check
D78815 added a check that ensures that PassSupport.h and PassAnalysisSupport.h
aren't included directly. However, as compiling this header into a module will
try to parse it with a clean preprocessor state, this check is also triggered
there. The check seems to make sense and it seems that compiling this header
into its own module is a mistake, so this patch makes those two headers
textual in the modulemap.
2020-04-27 13:53:44 +02:00