Ron Lieberman [Thu, 2 Sep 2021 23:21:33 +0000 (18:21 -0500)]
[openmp] NFC add bitcode comment
Nico Weber [Thu, 2 Sep 2021 19:09:43 +0000 (12:09 -0700)]
Reland "Try to unbreak Win build differently after
973519826edb76""
Build should be fixed by
https://github.com/llvm/llvm-project/commit/
9d22754389
This reverts commit
df052e1732ab57f5d9c684ceeaed3ab39073cd9f.
Differential Revision: https://reviews.llvm.org/D109181
David Carlier [Thu, 2 Sep 2021 22:53:38 +0000 (23:53 +0100)]
[Sanitizers] remove empty test case.
Lang Hames [Thu, 2 Sep 2021 22:43:02 +0000 (08:43 +1000)]
[ORC] Range check and narrow size value.
This should fix the build issues in
https://lab.llvm.org/buildbot#builders/171/builds/3149.
LLVM GN Syncbot [Thu, 2 Sep 2021 22:29:41 +0000 (22:29 +0000)]
[gn build] Port
dad60f8071d5
Lang Hames [Thu, 2 Sep 2021 10:48:58 +0000 (20:48 +1000)]
[ORC] Add EPCGenericJITLinkMemoryManager: memory management via EPC calls.
All ExecutorProcessControl subclasses must provide a JITLinkMemoryManager object
that can be used to allocate memory in the executor process. The
EPCGenericJITLinkMemoryManager class provides an off-the-shelf
JITLinkMemoryManager implementation for JITs that do not need (or cannot
provide) a specialized JITLinkMemoryManager implementation. This simplifies the
process of creating new ExecutorProcessControl implementations.
Lang Hames [Thu, 2 Sep 2021 10:45:46 +0000 (20:45 +1000)]
[ORC] Add specialized SPSSerializationTraits for ArrayRef<char>.
Deserializing from an SPSSequence<char> to an an ArrayRef<char> will point the
ArrayRef<char> at the input buffer.
Lang Hames [Thu, 2 Sep 2021 08:34:27 +0000 (18:34 +1000)]
[ORC] Move callWrapper and callSPSWrapper functions to ExecutorProcessControl.
The ExecutionSession versions now just forward to the implementations in
ExecutorProcessControl.
This allows callWrapper / callSPSWrapper to be used while bootstrapping an
ExecutorProcessControl instance.
Jessica Paquette [Thu, 2 Sep 2021 04:55:51 +0000 (21:55 -0700)]
[GlobalISel] Combine icmp eq/ne x, 0/1 -> x when x == 0 or 1
This adds the following combines:
```
x = ... 0 or 1
c = icmp eq x, 1
->
c = x
```
and
```
x = ... 0 or 1
c = icmp ne x, 0
->
c = x
```
When the target's true value for the relevant types is 1.
This showed up in the following situation:
https://godbolt.org/z/M5jKexWTW
SDAG currently supports the `ne` case, but not the `eq` case. This can probably
be further generalized, but I don't feel like thinking that hard right now.
This gives some minor code size improvements across the board on CTMark at
-Os for AArch64. (0.1% for 7zip and pairlocalalign in particular.)
Differential Revision: https://reviews.llvm.org/D109130
David Blaikie [Thu, 26 Aug 2021 23:54:47 +0000 (16:54 -0700)]
Fully qualify template template parameters when printing
I discovered this quirk when working on some DWARF - AST printing prints
type template parameters fully qualified, but printed template template
parameters the way they were written syntactically, or wholely
unqualified - instead, we should print them consistently with the way we
print type template parameters: fully qualified.
The one place this got weird was for partial specializations like in
ast-print-temp-class.cpp - hence the need for checking for
TemplateNameDependenceScope::DependentInstantiation template template
parameters. (not 100% sure that's the right solution to that, though -
open to ideas)
Differential Revision: https://reviews.llvm.org/D108794
Kirill Stoimenov [Thu, 2 Sep 2021 19:26:54 +0000 (19:26 +0000)]
[asan] Fixed link error by setting jump symbol to R_X86_64_PLT32.
Fixing this link error:
ld: error: relocation R_X86_64_PC32 cannot be used against symbol __asan_report_load...; recompile with -fPIC
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D109183
Kevin Athey [Thu, 2 Sep 2021 21:09:36 +0000 (14:09 -0700)]
Revert "[CSSPGO] Honor preinliner decision for ThinLTO importing"
This reverts commit
a2768b4732a0216dfd346d34e428685f03f10549.
Breaks sanitizer-x86_64-linux-fast buildbot:
https://lab.llvm.org/buildbot/#/builders/5/builds/11334
Log snippet:
Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: LLVM :: Transforms/SampleProfile/early-inline.ll (65549 of 78729)
******************** TEST 'LLVM :: Transforms/SampleProfile/early-inline.ll' FAILED ********************
Script:
--
: 'RUN: at line 1'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/early-inline.ll -instcombine -sample-profile -sample-profile-file=/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/Inputs/einline.prof -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/early-inline.ll
--
Exit Code: 2
Command Output (stderr):
--
/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1309:53: runtime error: member call on null pointer of type 'llvm::sampleprof::FunctionSamples'
#0 0x5a730f8 in shouldInlineCandidate /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1309:53
#1 0x5a730f8 in (anonymous namespace)::SampleProfileLoader::tryInlineCandidate((anonymous namespace)::InlineCandidate&, llvm::SmallVector<llvm::CallBase*, 8u>*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1178:21
#2 0x5a6cda6 in inlineHotFunctions /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1105:13
#3 0x5a6cda6 in (anonymous namespace)::SampleProfileLoader::emitAnnotations(llvm::Function&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1633:16
#4 0x5a5fcbe in runOnFunction /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:2008:12
#5 0x5a5fcbe in (anonymous namespace)::SampleProfileLoader::runOnModule(llvm::Module&, llvm::AnalysisManager<llvm::Module>*, llvm::ProfileSummaryInfo*, llvm::CallGraph*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1922:15
#6 0x5a5de55 in llvm::SampleProfileLoaderPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:2038:21
#7 0x6552a01 in llvm::detail::PassModel<llvm::Module, llvm::SampleProfileLoaderPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
#8 0x57f807c in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/PassManager.h:526:21
#9 0x37c8522 in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:489:7
#10 0x37e7c11 in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/opt/opt.cpp:830:12
#11 0x7fbf4de4009a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
#12 0x379e519 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt+0x379e519)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1309:53 in
FileCheck error: '<stdin>' is empty.
FileCheck command line: /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/early-inline.ll
--
********************
Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80
FAIL: LLVM :: Transforms/SampleProfile/inline-cold.ll (65643 of 78729)
******************** TEST 'LLVM :: Transforms/SampleProfile/inline-cold.ll' FAILED ********************
Script:
--
: 'RUN: at line 4'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll -sample-profile -sample-profile-file=/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/Inputs/inline-cold.prof -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck -check-prefix=NOTINLINE /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll
: 'RUN: at line 5'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll -passes=sample-profile -sample-profile-file=/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/Inputs/inline-cold.prof -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck -check-prefix=NOTINLINE /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll
: 'RUN: at line 8'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll -sample-profile -sample-profile-file=/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/Inputs/inline-cold.prof -sample-profile-inline-size -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck -check-prefix=INLINE /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll
: 'RUN: at line 11'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll -passes=sample-profile -sample-profile-file=/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/Inputs/inline-cold.prof -sample-profile-inline-size -sample-profile-cold-inline-threshold=9999999 -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck -check-prefix=INLINE /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll
: 'RUN: at line 14'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll -passes=sample-profile -sample-profile-file=/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/Inputs/inline-cold.prof -sample-profile-inline-size -sample-profile-cold-inline-threshold=-500 -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck -check-prefix=NOTINLINE /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll
--
Exit Code: 2
Command Output (stderr):
--
/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1309:53: runtime error: member call on null pointer of type 'llvm::sampleprof::FunctionSamples'
#0 0x5a730f8 in shouldInlineCandidate /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1309:53
#1 0x5a730f8 in (anonymous namespace)::SampleProfileLoader::tryInlineCandidate((anonymous namespace)::InlineCandidate&, llvm::SmallVector<llvm::CallBase*, 8u>*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1178:21
#2 0x5a6cda6 in inlineHotFunctions /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1105:13
#3 0x5a6cda6 in (anonymous namespace)::SampleProfileLoader::emitAnnotations(llvm::Function&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1633:16
#4 0x5a5fcbe in runOnFunction /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:2008:12
#5 0x5a5fcbe in (anonymous namespace)::SampleProfileLoader::runOnModule(llvm::Module&, llvm::AnalysisManager<llvm::Module>*, llvm::ProfileSummaryInfo*, llvm::CallGraph*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1922:15
#6 0x5a5de55 in llvm::SampleProfileLoaderPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:2038:21
#7 0x6552a01 in llvm::detail::PassModel<llvm::Module, llvm::SampleProfileLoaderPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
#8 0x57f807c in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/PassManager.h:526:21
#9 0x37c8522 in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:489:7
#10 0x37e7c11 in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/opt/opt.cpp:830:12
#11 0x7fcd534a209a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
#12 0x379e519 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/opt+0x379e519)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:1309:53 in
FileCheck error: '<stdin>' is empty.
FileCheck command line: /b/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/FileCheck -check-prefix=INLINE /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SampleProfile/inline-cold.ll
--
********************
Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
********************
Failed Tests (2):
LLVM :: Transforms/SampleProfile/early-inline.ll
LLVM :: Transforms/SampleProfile/inline-cold.ll
David Carlier [Thu, 2 Sep 2021 21:34:23 +0000 (22:34 +0100)]
[Sanitizers] intercept clock_getcpuclockid on FreeBSD, and pthread_getcpuclockid.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D108884
Usman Nadeem [Thu, 2 Sep 2021 21:27:11 +0000 (14:27 -0700)]
[NFC] Regenerate SVE ACLE intrinsics tests
Change-Id: Ic4ec50f9a53fcf58e86104bf19ba229c1dd132d0
peter klausler [Wed, 1 Sep 2021 21:03:15 +0000 (14:03 -0700)]
[flang] Fix scope in which undeclared symbols are created
Don't create new symbols in FORALL, implied DO, or other
construct scopes when an undeclared name appears; use the
innermost enclosing program unit's scope. This clears up
a pending TODO in name resolution, and also exposes (& fixes)
an unnoticed name resolution problem in a module file test.
Differential Revision: https://reviews.llvm.org/D109095
peter klausler [Wed, 1 Sep 2021 00:16:01 +0000 (17:16 -0700)]
[flang] NFC: change non-nullable pointer arguments to references
Ticking off a Parser TODO: Preprocessor::Directive()'s Prescanner
argument should be a reference, not a pointer.
Differential Revision: https://reviews.llvm.org/D109094
Stuart Brady [Thu, 12 Aug 2021 15:24:28 +0000 (16:24 +0100)]
[OpenCL] Remove decls for scalar vloada_half and vstorea_half* fns
These functions are not part of the OpenCL C specification.
See https://github.com/KhronosGroup/OpenCL-Docs/issues/648 for a
clarification regarding the vloada_half declarations.
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D108761
Alex Zinenko [Thu, 2 Sep 2021 13:01:19 +0000 (15:01 +0200)]
[mlir] speed up construction of LLVM IR constants when possible
The translation to LLVM IR used to construct sequential constants by recurring
down to individual elements, creating constant values for them, and wrapping
them into aggregate constants in post-order. This is highly inefficient for
large constants with known data such as DenseElementsAttr. Use LLVM's
ConstantData for the innermost dimension instead. LLVM does seem to support
data constants for nested sequential constants so the outer dimensions are
still handled recursively. Nevertheless, this speeds up the translation of
large constants with equal dimensions by up to 30x.
Users are advised to rewrite large constants to use flat types before
translating to LLVM IR if more efficiency in translation is necessary. This is
not done automatically as the translation is not aware of the expectations of
the overall compilation flow about type changes and indexing, in particular for
global constants with external linkage.
Reviewed By: silvas
Differential Revision: https://reviews.llvm.org/D109152
Dávid Bolvanský [Thu, 2 Sep 2021 20:43:41 +0000 (22:43 +0200)]
[NFC] Added testcase for PR40750
Arthur O'Dwyer [Thu, 26 Aug 2021 14:55:18 +0000 (10:55 -0400)]
[libc++] Define insert_iterator::iter with ranges::iterator_t.
The `insert_iterator::iter` member is defined as `Container::iterator` but
the standard requires `iter` to be defined in terms of `ranges::iterator_t` as
of C++20. So, if in C++20 or later, define the `iter` member as
`ranges::iterator_t`.
Original patch by Joe Loser!
Differential Revision: https://reviews.llvm.org/D108575
Arthur Eubanks [Thu, 2 Sep 2021 19:58:41 +0000 (12:58 -0700)]
Fix lldb after D108614
Arthur Eubanks [Thu, 2 Sep 2021 18:21:05 +0000 (11:21 -0700)]
[MemorySSA] Properly handle liveOnEntry in the walker printer
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D109177
Arthur Eubanks [Thu, 2 Sep 2021 19:14:35 +0000 (12:14 -0700)]
[Verifier] Only allow invariant.group metadata on stores and loads
As specified by https://llvm.org/docs/LangRef.html#invariant-group-metadata.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D109182
Arthur Eubanks [Wed, 1 Sep 2021 18:32:23 +0000 (11:32 -0700)]
[NFC] Remove some unclear attribute methods
To any downstream users broken by this change, please examine your uses
of these methods and see if you can use a better method. For example,
getAttribute(AttributeList::FunctionIndex) => getFnAttr(), or
addAttribute(AttributeList::FirstArgIndex + ArgNo) =>
addParamAttribute(ArgNo). 0 corresponds to ReturnIndex, ~0 corresponds
to FunctionIndex. This may make future cleanups less painful.
I've made the mistake of assuming that these indexes are for parameters
multiple times, but actually they're based off of a weird indexing
scheme AttributeList::AttrIndex where 0 is the return value and ~0 is
the function. Hopefully renaming these methods will make this clearer.
Ideally users should use more specific methods like
AttributeList::getFnAttr().
This touches all relevant methods in AttributeList, CallBase, and Function.
This hopefully will make easier a future change to cleanup AttrIndex. A
previous worry about cleaning up AttrIndex was that too many downstream
users would have to look through all uses of AttrIndex and relevant
attribute method calls to see if anything was unintentionally hardcoded
(e.g. using 0 instead of ReturnIndex). With this change hopefully
downstream users will look at existing usages of these methods and clean
them up.
Reviewed By: rnk, MaskRay
Differential Revision: https://reviews.llvm.org/D108614
Wenlei He [Thu, 2 Sep 2021 16:34:10 +0000 (09:34 -0700)]
[llvm-profgen] Turn off cold context trimming by default
We merge cold context by default to save profile size. However trimming cold context after merging doesn't save size much, so default to off to reflect how it's commonly used.
Differential Revision: https://reviews.llvm.org/D109166
Arthur Eubanks [Wed, 1 Sep 2021 16:51:31 +0000 (09:51 -0700)]
[test] Remove legacy PM tests in llvm/test/Other
Differential Revision: https://reviews.llvm.org/D109180
Sam Clegg [Thu, 2 Sep 2021 18:01:55 +0000 (14:01 -0400)]
[WebAssemlby] Remove redundant SDTypeProfile. NFC
I added this back in https://reviews.llvm.org/D54647 but it wasn't
actually needed.
Differential Revision: https://reviews.llvm.org/D109176
Nico Weber [Thu, 2 Sep 2021 19:06:43 +0000 (15:06 -0400)]
Fix lld build after
5881dcff7e76a68
Geoffrey Martin-Noble [Thu, 2 Sep 2021 19:05:33 +0000 (12:05 -0700)]
Revert "Try to unbreak Win build differently after
973519826edb76"
Breaks the build and failed pre-merge checks:
https://buildkite.com/llvm-project/premerge-checks/builds/54930#
07373971-3d37-49cf-9def-
22c0d724ee23
> llvm-project/lld/wasm/Writer.cpp:521:16: error: non-const lvalue reference to
> type 'llvm::StringRef' cannot bind to a temporary of type 'llvm::StringRef'
> for (auto &feature : used.keys()) {
This reverts commit
5881dcff7e76a68323edc8bb3c6e14420ad9cf7c.
Nico Weber [Thu, 2 Sep 2021 16:42:48 +0000 (12:42 -0400)]
Try to unbreak Win build differently after
973519826edb76
Looks like the MS STL wants StringMapKeyIterator::operator*() to be const.
Return the result by copy instead of reference to do that.
Assigning to a hash map key iterator doesn't make sense anyways.
Also reverts
123f811fe5b0b which is now hopefully no longer needed.
Differential Revision: https://reviews.llvm.org/D109167
Arthur Eubanks [Thu, 2 Sep 2021 18:44:45 +0000 (11:44 -0700)]
[test] Remove missed RUN line after D109040
Arthur Eubanks [Wed, 1 Sep 2021 02:26:35 +0000 (19:26 -0700)]
[test][NewPM] Remove RUN lines using -analyze
Only tests in llvm/test/Analysis.
-analyze is legacy PM-specific.
This only touches files with `-passes`.
I looked through everything and made sure that everything had a new PM equivalent.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D109040
Wenlei He [Wed, 1 Sep 2021 22:30:33 +0000 (15:30 -0700)]
[CSSPGO] Allow inlining recursive call for preinliner
When preinliner is used for CSSPGO, we try to honor global preinliner decision as much as we can except for uninlinable callees. We rely on InlineCost::Never to prevent us from illegal inlining.
However, it turns out that we use InlineCost::Never for both illeagle inlining and some of the "not-so-beneficial" inlining.
The most common one is recursive inlining, while it can bloat size a lot during CGSCC bottom-up inlining, it's less of a problem when recursive inlining is guided by profile and done in top-down manner.
Ideally it'd be better to have a clear separation between inline legality check vs cost-benefit check, but that requires a bigger change.
This change enables InlineCost computation to allow inlining recursive calls, controlled by InlineParams. In SampleLoader, we now enable recursive inlining for CSSPGO when global preinliner decision is used.
With this change, we saw a few perf improvements on SPEC2017 with CSSPGO and preinliner on: 2% for povray_r, 6% for xalancbmk_s, 3% omnetpp_s, while size is about the same (no noticeable perf change for all other benchmarks)
Differential Revision: https://reviews.llvm.org/D109104
Nikita Popov [Wed, 1 Sep 2021 21:13:01 +0000 (23:13 +0200)]
[SCEVExpander] Simplify pointer overflow check
This is a followup to D104662 to generate slightly nicer code for
pointer overflow checks. Bypass expandAddToGEP and instead
explicitly generate i8 GEPs. This saves some bitcasts and negates
the value in a more obvious way. In particular, this prevents SCEV
from looking through the umul.with.overflow, same as in the integer
case.
The wrapping-pointer-ni.ll test deserves a comment: Previously,
this generated a typed GEP which used the umulo argument rather
than the multiplication result. This results in more compact IR in
that case, but effectively does the multiplication twice, the
second one is just hidden in the GEP. Reusing the umulo result
seems pretty reasonable to me.
Differential Revision: https://reviews.llvm.org/D109093
Sam Clegg [Thu, 2 Sep 2021 17:27:57 +0000 (13:27 -0400)]
[WebAssembly] Fix names of WebAssemblyWrapper SDNodes. NFC
Other platforms all use CamelCase as normal for these wrapper nodes.
Differential Revision: https://reviews.llvm.org/D109172
Heejin Ahn [Mon, 2 Aug 2021 03:03:45 +0000 (20:03 -0700)]
[WebAssembly] Add Wasm SjLj support
This add support for SjLj using Wasm exception handling instructions:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md
This does not yet support the mixed use of EH and SjLj within a
function. It will be added in a follow-up CL.
This currently passes all SjLj Emscripten tests for wasm0/1/2/3/s,
except for the below:
- `test_longjmp_standalone`: Uses Node
- `test_dlfcn_longjmp`: Uses NodeRAWFS
- `test_longjmp_throw`: Mixes EH and SjLj
- `test_exceptions_longjmp1`: Mixes EH and SjLj
- `test_exceptions_longjmp2`: Mixes EH and SjLj
- `test_exceptions_longjmp3`: Mixes EH and SjLj
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D108960
Nick Desaulniers [Thu, 2 Sep 2021 17:28:41 +0000 (10:28 -0700)]
[MipsISelLowering] avoid emitting libcalls to __multi3
Similar to D108842 and D108844.
__has_builtin(builtin_mul_overflow) returns true for 32b MIPS targets,
but Clang is deferring to compiler RT when encountering long long types.
This breaks MIPS malta_defconfig builds of the Linux kernel that are
using __builtin_mul_overflow with these types for these targets.
If the semantics of __has_builtin mean "the compiler resolves these,
always" then we shouldn't conditionally emit a libcall.
This will still need to be worked around in the Linux kernel in order to
continue to support malta_defconfig builds of the Linux kernel for this
target with older releases of clang.
Link: https://bugs.llvm.org/show_bug.cgi?id=28629
Link: https://github.com/ClangBuiltLinux/linux/issues/1438
Reviewed By: rengolin
Differential Revision: https://reviews.llvm.org/D108926
Daniil Suchkov [Fri, 20 Aug 2021 22:42:29 +0000 (22:42 +0000)]
[InlineCost] Introduce attributes to override InlineCost for inliner testing
This patch introduces four new string attributes: function-inline-cost,
function-inline-threshold, call-inline-cost and call-threshold-bonus.
These attributes allow you to selectively override some aspects of
InlineCost analysis. That would allow us to test inliner separately from
the InlineCost analysis.
That could be useful when you're trying to write tests for inliner and
you need to test some very specific situation, like "the inline cost has
to be this high", or "the threshold has to be this low". Right now every
time someone does that, they have get creative to come up with a way to
make the InlineCost give them the number they need (like adding ~30
load/add pairs for a trivial test). This process can be somewhat tedious
which can discourage some people from writing enough tests for their
changes. Also, that results in tests that are fragile and can be easily
broken without anyone noticing it because the test writer can't
explicitly control what input the inliner will get from the inline cost
analysis.
These new attributes will alleviate those problems to an extent.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D109033
Geoffrey Martin-Noble [Thu, 2 Sep 2021 17:31:06 +0000 (10:31 -0700)]
[Bazel] Add explicit dependency on llvm:Support to reflect layering
Differential Revision: https://reviews.llvm.org/D109173
Jake Egan [Thu, 2 Sep 2021 17:29:26 +0000 (13:29 -0400)]
[AIX][PowerPC] Define __powerpc and __PPC macros
%%%
This patch defines the macros __powerpc and __PPC on AIX to be consistent with XL for AIX. See: https://www.ibm.com/docs/en/xl-c-and-cpp-aix/13.1.0?topic=macros-related-platform
Note: GCC does not currently define __powerpc and __PPC so users should prefer the __powerpc__ and __PPC__ forms.
%%%
Reviewed By: cebowleratibm
Differential Revision: https://reviews.llvm.org/D108917
Mark de Wever [Thu, 2 Sep 2021 17:26:06 +0000 (19:26 +0200)]
[libc++] Remove an unused internal concept.
Removed as suggested by @Quuxplusone during the review of D109075.
Craig Topper [Thu, 2 Sep 2021 17:08:10 +0000 (10:08 -0700)]
[X86] Remove isel predicates for xgetbv/xsetbv instructions so they can work on Windows.
https://reviews.llvm.org/D56686 was supposed to allow these to
work on Windows without needing to enable the xsave feature to
match MSVC. It seems this didn't work because the backend isel
patterns would still block it.
This patch removes the predicates from the isel patterns.
Fixes PR51706.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D109097
Mark de Wever [Wed, 1 Sep 2021 17:46:22 +0000 (19:46 +0200)]
[libc++][NFC] Move concepts to a subheader.
D103357 added some new concepts. Since the header `<concepts>` has moved
all its concepts to a separate header these new concepts feel out of
place. Move them to the appropriate header.
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D109075
Evandro Menezes [Thu, 2 Sep 2021 15:28:51 +0000 (10:28 -0500)]
[RISCV] Improve shrink wrap test (NFC)
Restore test for shrink wrapping disabled.
Jon Chesterfield [Thu, 2 Sep 2021 17:10:40 +0000 (18:10 +0100)]
[libomptarget][amdgpu] Add gfx90a to build list
Geoffrey Martin-Noble [Thu, 2 Sep 2021 17:04:48 +0000 (10:04 -0700)]
[Bazel] Update for Cpp emitter (
2f0750dd2e)
Update the Bazel build for
https://github.com/llvm/llvm-project/commit/
2f0750dd2e.
Differential Revision: https://reviews.llvm.org/D109171
Louis Dionne [Wed, 1 Sep 2021 20:41:42 +0000 (16:41 -0400)]
[libc++][docs] Remove "Last Updated" entries from the docs
Those don't provide a lot of value, and they can easily be wrong anyway.
Differential Revision: https://reviews.llvm.org/D109087
Louis Dionne [Thu, 2 Sep 2021 01:48:24 +0000 (21:48 -0400)]
[libc++][NFC] Replace uses of stdr:: by just std::ranges::
Differential Revision: https://reviews.llvm.org/D109121
Hans Wennborg [Thu, 2 Sep 2021 16:43:26 +0000 (18:43 +0200)]
[Unwind] Cast exception class pointer for strcpy
Follow-up to
f5b997e6b706, see comment on
https://reviews.llvm.org/D109047
Differential revision: https://reviews.llvm.org/D109168
Marius Brehler [Thu, 2 Sep 2021 16:53:53 +0000 (16:53 +0000)]
[mlir] Add missing dep on MLIRTranslation
Stanislav Mekhanoshin [Wed, 1 Sep 2021 20:38:31 +0000 (13:38 -0700)]
[AMDGPU] Use S_BITCMP0_* to replace AND in optimizeCompareInstr
These can be used for reversed conditions if result of the AND
is unused except in the compare:
s_cmp_eq_u32 (s_and_b32 $src, 1), 0 => s_bitcmp0_b32 $src, 0
s_cmp_eq_i32 (s_and_b32 $src, 1), 0 => s_bitcmp0_b32 $src, 0
s_cmp_eq_u64 (s_and_b64 $src, 1), 0 => s_bitcmp0_b64 $src, 0
s_cmp_lg_u32 (s_and_b32 $src, 1), 1 => s_bitcmp0_b32 $src, 0
s_cmp_lg_i32 (s_and_b32 $src, 1), 1 => s_bitcmp0_b32 $src, 0
s_cmp_lg_u64 (s_and_b64 $src, 1), 1 => s_bitcmp0_b64 $src, 0
Differential Revision: https://reviews.llvm.org/D109099
Simon Pilgrim [Thu, 2 Sep 2021 15:46:58 +0000 (16:46 +0100)]
[X86][SSE] combineMulToPMADDWD - improve recognition of sign/zero extended upper bits
PMADDWD(v8i16 x, v8i16 y) == (v4i32) { (int)x[0]*y[0] + (int)x[1]*y[1], ..., (int)x[6]*y[6] + (int)x[7]*y[7] }
Currently combineMulToPMADDWD only folds cases where the upper 17 bits of both vXi32 inputs are known zero (i.e. the first half is positive and the second half of the pair is zero in each 2xi16 pair), this can be relaxed to only require one zero-extended input if the other input has at least 17 sign bits.
That way the sign of the result is still preserved, and the second half is still zero.
Noticed while investigating PR47437.
Differential Revision: https://reviews.llvm.org/D108522
Nico Weber [Wed, 1 Sep 2021 20:17:19 +0000 (16:17 -0400)]
clang/win: Add __readfsdword to intrin.h
When using __readfsdword(), clang used to warn that one has
to include <intrin.h> -- no matter if that was already included
or not.
Now it only warns if it's not yet included.
To verify that this was the only intrin with this problem, I ran:
$ for f in $(grep intrin.h clang/include/clang/Basic/BuiltinsX86* |
egrep -o '\([^,]+,' | egrep -o '[^(,]*'); do
if ! grep -q $f clang/lib/Headers/intrin.h; then echo $f; fi;
done
This printed 9 more functions, but those are all in emmintrin.h,
xsaveintrin.h (which are included by intrin.h based on /arch: flags).
So this is indeed the only built-in that was missing in intrin.h.
Fixes PR51188.
Differential Revision: https://reviews.llvm.org/D109085
Wenlei He [Thu, 2 Sep 2021 00:31:07 +0000 (17:31 -0700)]
[llvm-profgen] Deduplicate and improve warning for truncated context
This change improves the warning for truncated context by: 1) deduplicate them as one call without probe can appear in many different context leading to duplicated warnings , 2) rephrase the message to make it easier to understand. The term "untracked frame" can be confusing.
Differential Revision: https://reviews.llvm.org/D109115
Kazu Hirata [Thu, 2 Sep 2021 16:07:13 +0000 (09:07 -0700)]
[clangd, llvm] Remove redundant calls to c_str() (NFC)
Identified with readability-redundant-string-cstr.
Nico Weber [Thu, 2 Sep 2021 16:03:25 +0000 (12:03 -0400)]
Try to unbreak Win build after
973519826edb76
Apparently some versions of the MS STL don't like constructing a
vector from a StringMapKeyIterator<>: http://45.33.8.238/win/44999/step_4.txt
It builds fine with the MS STL on my Windows box, so just sidestep the issue.
Full error for posterity:
VC\Tools\MSVC\14.14.26428\include\xmemory(218,75):
error: indirection requires pointer operand ('const llvm::StringMapKeyIterator<llvm::StringRef>' invalid)
_Uses_default_construct_t<_Alloc, decltype(_Unfancy(_UDest)), decltype(*_UFirst)>())));
VC\Tools\MSVC\14.14.26428\include\vector(1922,11):
note: in instantiation of function template specialization 'std::_Uninitialized_copy<...>' requested here
return (_Uninitialized_copy(_First, _Last, _Dest, this->_Getal()));
VC\Tools\MSVC\14.14.26428\include\vector(757,22):
note: in instantiation of function template specialization
'std::vector<llvm::StringRef>::_Ucopy<llvm::StringMapKeyIterator<llvm::StringRef>>' requested here
this->_Mylast() = _Ucopy(_First, _Last, this->_Myfirst());
VC\Tools\MSVC\14.14.26428\include\vector(772,3):
note: in instantiation of function template specialization
'std::vector<llvm::StringRef>::_Range_construct_or_tidy<llvm::StringMapKeyIterator<llvm::StringRef>>' requested here
_Range_construct_or_tidy(_Unchecked(_First), _Unchecked(_Last), _Iter_cat_t<_Iter>{});
../../clang/lib/Driver/ToolChains/Arch/X86.cpp(62,30):
note: in instantiation of function template specialization
'std::vector<llvm::StringRef>::vector<llvm::StringMapKeyIterator<llvm::StringRef>, void>' requested here
std::vector<StringRef> ValidArchs{ArchMap.keys().begin(),
Craig Topper [Thu, 2 Sep 2021 15:26:39 +0000 (08:26 -0700)]
[RISCV] Add Zba command line to rv64i-exhaustive-w-insts.ll
Zba adds a zext.w pseudoinstruction using ADDUW. This can simplify
the generated code for many of these tests.
There are at least 2 suboptimal cases in this config that I've marked
with TODOs.
Craig Topper [Thu, 2 Sep 2021 15:01:40 +0000 (08:01 -0700)]
[RISCV] Remove stale TODOs from test. NFC
These were fixed by D106230.
Nico Weber [Thu, 2 Sep 2021 15:32:08 +0000 (11:32 -0400)]
Try to unbreak lldb build after
973519826edb76
Wenlei He [Wed, 1 Sep 2021 20:47:19 +0000 (13:47 -0700)]
[CSSPGO] Honor preinliner decision for ThinLTO importing
When pre-inliner decision is used for CSSPGO, we should take that into account for ThinLTO importing as well, so post-link sample loader inliner can favor that decision. This is handled by a small tweak in this patch. It also includes a change to transfer preinliner decision when merging context.
Differential Revision: https://reviews.llvm.org/D109088
Kristóf Umann [Thu, 2 Sep 2021 15:19:32 +0000 (17:19 +0200)]
Revert "[analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function calls, rather than each ExplodedNode in it"
This reverts commit
7d0e62bfb773c68d2bc8831fddcc8536f4613190.
Ivan Zhechev [Thu, 2 Sep 2021 15:07:05 +0000 (15:07 +0000)]
[flang] Fix non-deterministic line output function
The evaluation order for the `|` operator is undefined
(in contrast to the short-circuiting `||` operator). The arguments are
stored in variables to force a specific evaluation order.
A test in D107575 relies on this change.
Reviewed By: kiranchandramohan, klausler
Differential Revision: https://reviews.llvm.org/D108623
Bradley Smith [Thu, 2 Sep 2021 11:06:29 +0000 (11:06 +0000)]
[AArch64][SVE] Workaround incorrect types when lowering fixed length gather/scatter
When lowering a fixed length gather/scatter the index type is assumed to
be the same as the memory type, this is incorrect in cases where the
extension of the index has been folded into the addressing mode.
For now add a temporary workaround to fix the codegen faults caused by
this by preventing the removal of this extension. At a later date the
lowering for SVE gather/scatters will be redesigned to improve the way
addressing modes are handled.
As a short term side effect of this change, the addressing modes
generated for fixed length gather/scatters will not be optimal.
Differential Revision: https://reviews.llvm.org/D109145
Jinsong Ji [Thu, 2 Sep 2021 14:49:35 +0000 (14:49 +0000)]
[InstrProfiling] Add one missing XCOFF line to profiling.ll
Kristóf Umann [Thu, 19 Aug 2021 13:37:02 +0000 (15:37 +0200)]
[analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function calls, rather than each ExplodedNode in it
D105553 added NoStateChangeFuncVisitor, an abstract class to aid in creating
notes such as "Returning without writing to 'x'", or "Returning without changing
the ownership status of allocated memory". Its clients need to define, among
other things, what a change of state is.
For code like this:
f() {
g();
}
foo() {
f();
h();
}
We'd have a path in the ExplodedGraph that looks like this:
-- <g> -->
/ \
--- <f> --------> --- <h> --->
/ \ / \
-------- <foo> ------ <foo> -->
When we're interested in whether f neglected to change some property,
NoStateChangeFuncVisitor asks these questions:
÷×~
-- <g> -->
ß / \$ @&#*
--- <f> --------> --- <h> --->
/ \ / \
-------- <foo> ------ <foo> -->
Has anything changed in between # and *?
Has anything changed in between & and *?
Has anything changed in between @ and *?
...
Has anything changed in between $ and *?
Has anything changed in between × and ~?
Has anything changed in between ÷ and ~?
...
Has anything changed in between ß and *?
...
This is a rather thorough line of questioning, which is why in D105819, I was
only interested in whether state *right before* and *right after* a function
call changed, and early returned to the CallEnter location:
if (!CurrN->getLocationAs<CallEnter>())
return;
Except that I made a typo, and forgot to negate the condition. So, in this
patch, I'm fixing that, and under the same hood allow all clients to decide to
do this whole-function check instead of the thorough one.
Differential Revision: https://reviews.llvm.org/D108695
Craig Topper [Thu, 2 Sep 2021 14:45:59 +0000 (07:45 -0700)]
[RISCV] Teach instruction selection to elide sext.w in some cases.
If a sext_inreg is up for isel, and all its users are W instructions,
we can skip emitting the sext_inreg. This helpful if the producing
instruction can't become a W instruction.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D108966
Evandro Menezes [Tue, 10 Aug 2021 00:58:31 +0000 (19:58 -0500)]
[RISCV] Enable shrink wrap by default
Differential Revision: https://reviews.llvm.org/D109037
Craig Topper [Wed, 1 Sep 2021 23:20:40 +0000 (16:20 -0700)]
[RISCV] Split PseudoVSETVLI into 2 instructions to allow different register classes for rs1.
X0 has special meaning for vsetvli, we need to make sure we never
create it a vsetvli that uses it by accident. This could happen
if the register coalescer coalesces a copy from X0 into this
instruction.
This patch splits the instruction so that we can have GPRNoX0
register class to use for the cases where we don't want the source
to be X0. The verifier won't let us explicitly use X0 on a GPRNoX0
operand so we need a separate pseudo for those cases.
I don't currently have a failing example for this. There was a
failure in D107957, but the coalescable copy from that example
should have been optimized away much earlier so I've fixed that.
This is not a complete fix. We still need to prevent the same
possible issue on the AVL operand of all of the vector instruction
pseudos. I don't want to make two versions of all of those so we
need to find a different solution for those. I have an idea I'm
going to try.
Differential Revision: https://reviews.llvm.org/D109110
Nico Weber [Wed, 1 Sep 2021 22:40:05 +0000 (18:40 -0400)]
[clang-cl] Emit nicer warning on unknown /arch: arguments
Now prints the list of known archs. This requires plumbing a Driver
arg through a few functions.
Also add two more convenience insert() overlods to StringMap.
Differential Revision: https://reviews.llvm.org/D109105
Kiran Chandramohan [Thu, 2 Sep 2021 14:17:07 +0000 (14:17 +0000)]
[MLIR][OpenMP] Add support for declaring critical construct names
Add an operation omp.critical.declare to declare names/symbols of
critical sections. Named omp.critical operations should use symbols
declared by omp.critical.declare. Having a declare operation ensures
that the names of critical sections are global and unique. In the
lowering flow to LLVM IR, the OpenMP IRBuilder creates unique names
for critical sections.
Reviewed By: ftynse, jeanPerier
Differential Revision: https://reviews.llvm.org/D108713
Piotr Sobczak [Mon, 30 Aug 2021 08:41:19 +0000 (10:41 +0200)]
[AMDGPU] Add merging into S_BUFFER_LOAD_DWORDX8_IMM
Extend SILoadStoreOptimizer to merge into DWORDX8 variant of S_BUFFER_LOAD.
Merging into DWORDX2 and DWORDX4 variants is handled already.
Differential Revision: https://reviews.llvm.org/D108909
Marius Brehler [Mon, 21 Jun 2021 10:44:20 +0000 (10:44 +0000)]
[mlir] Add Cpp emitter
This upstreams the Cpp emitter, initially presented with [1], from [2]
to MLIR core. Together with the previously upstreamed EmitC dialect [3],
the target allows to translate MLIR to C/C++.
[1] https://reviews.llvm.org/D76571
[2] https://github.com/iml130/mlir-emitc
[3] https://reviews.llvm.org/D103969
Co-authored-by: Jacques Pienaar <jpienaar@google.com>
Co-authored-by: Simon Camphausen <simon.camphausen@iml.fraunhofer.de>
Co-authored-by: Oliver Scherf <oliver.scherf@iml.fraunhofer.de>
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D104632
Alex Zinenko [Tue, 24 Aug 2021 15:53:42 +0000 (17:53 +0200)]
[mlir] support translating OpenMP loops with reductions
Use the recently introduced OpenMPIRBuilder facility to transate OpenMP
workshare loops with reductions to LLVM IR calling OpenMP runtime. Most of the
heavy lifting is done at the OpenMPIRBuilder. When other OpenMP dialect
constructs grow support for reductions, the translation can be updated to
operate on, e.g., an operation interface for all reduction containers instead
of workshare loops specifically. Designing such a generic translation for the
single operation that currently supports reductions is premature since we don't
know how the reduction modeling itself will be generalized.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D107343
Raphael Isemann [Thu, 2 Sep 2021 13:27:39 +0000 (15:27 +0200)]
Revert "[lldb server] Tidy up LLDB server return codes and associated tests"
This reverts commit
e387c8c413e2127bc93950fb6d786290237b4a9f. The
TestErrorMessages.test is failing on the Linux bots.
David Green [Thu, 2 Sep 2021 12:42:58 +0000 (13:42 +0100)]
[ARM] Add a tail-predication loop predicate register
The semantics of tail predication loops means that the value of LR as an
instruction is executed determines the predicate. In other words:
mov r3, #3
DLSTP lr, r3 // Start tail predication, lr==3
VADD.s32 q0, q1, q2 // Lanes 0,1 and 2 are updated in q0.
mov lr, #1
VADD.s32 q0, q1, q2 // Only first lane is updated.
This means that the value of lr cannot be spilled and re-used in tail
predication regions without potentially altering the behaviour of the
program. More lanes than required could be stored, for example, and in
the case of a gather those lanes might not have been setup, leading to
alignment exceptions.
This patch adds a new lr predicate operand to MVE instructions in order
to keep a reference to the lr that they use as a tail predicate. It will
usually hold the zeroreg meaning not predicated, being set to the LR phi
value in the MVETPAndVPTOptimisationsPass. This will prevent it from
being spilled anywhere that it needs to be used.
A lot of tests needed updating.
Differential Revision: https://reviews.llvm.org/D107638
Jan Svoboda [Mon, 30 Aug 2021 13:41:53 +0000 (15:41 +0200)]
[clang] NFC: Extract DiagnosticOptions parsing
The way we parse `DiagnosticOptions` is a bit involved.
`DiagnosticOptions` are parsed as part of the cc1-parsing function `CompilerInvocation::CreateFromArgs` which takes `DiagnosticsEngine` as an argument to be able to report errors in command-line arguments. But to create `DiagnosticsEngine`, `DiagnosticOptions` are needed. This is solved by exposing the `ParseDiagnosticArgs` to clients and making its `DiagnosticsEngine` argument optional, essentially breaking the dependency cycle.
The `ParseDiagnosticArgs` function takes `llvm::opt::ArgList &`, which each client needs to create from the command-line (typically represented as `std::vector<const char *>`). Creating this data structure in this context is somewhat particular. This code pattern is copy-pasted in some places across the upstream code base and also in downstream repos. To make things a bit more uniform, this patch extracts the code into a new reusable function: `CreateAndPopulateDiagOpts`.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D108918
Roman Lebedev [Thu, 2 Sep 2021 10:03:31 +0000 (13:03 +0300)]
Revert @llvm.isnan intrinsic patchset.
Please refer to
https://lists.llvm.org/pipermail/llvm-dev/2021-September/152440.html
(and that whole thread.)
TLDR: the original patch had no prior RFC, yet it had some changes that
really need a proper RFC discussion. It won't be productive to discuss
such an RFC, once it's actually posted, while said patch is already
committed, because that introduces bias towards already-committed stuff,
and the tree is potentially in broken state meanwhile.
While the end result of discussion may lead back to the current design,
it may also not lead to the current design.
Therefore i take it upon myself
to revert the tree back to last known good state.
This reverts commit
4c4093e6e39fe6601f9c95a95a6bc242ef648cd5.
This reverts commit
0a2b1ba33ae6dcaedb81417f7c4cc714f72a5968.
This reverts commit
d9873711cb03ac7aedcaadcba42f82c66e962e6e.
This reverts commit
791006fb8c6fff4f33c33cb513a96b1d3f94c767.
This reverts commit
c22b64ef66f7518abb6f022fcdfd86d16c764caf.
This reverts commit
72ebcd3198327da12804305bda13d9b7088772a8.
This reverts commit
5fa6039a5fc1b6392a3c9a3326a76604e0cb1001.
This reverts commit
9efda541bfbd145de90f7db38d935db6246dc45a.
This reverts commit
94d3ff09cfa8d7aecf480e54da9a5334e262e76b.
Cullen Rhodes [Thu, 2 Sep 2021 08:47:42 +0000 (08:47 +0000)]
[clang] NFC: Remove duplicate DependentSizedMatrixType methods
Inherited from MatrixType.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D109137
Michał Górny [Mon, 12 Apr 2021 22:15:51 +0000 (00:15 +0200)]
[lldb] [client] Implement follow-fork-mode
Implement a new target.process.follow-fork-mode setting to control
LLDB's behavior on fork. If set to 'parent', the forked child is
detached and parent continues being traced. If set to 'child',
the parent is detached and child becomes traced instead.
Differential Revision: https://reviews.llvm.org/D100503
Jon Chesterfield [Thu, 2 Sep 2021 10:02:37 +0000 (11:02 +0100)]
[libomptarget][amdgpu] Drop env variables
Use the same debug print as the rest of libomptarget plugins with
the same environment control. Also drop the max queue size debugging hook as
I don't believe it is still in use, can bring it back near the rest of the env
handling in rtl.cpp if someone objects.
That makes most of rt.h and all of utils.cpp unused. Clean that up and simplify
control flow in a couple of places.
Behaviour change is that debug prints that used to use the old environment
variable now use the new one and print in slightly different format, and the
removal of the max queue size variable.
Reviewed By: pdhaliwal
Differential Revision: https://reviews.llvm.org/D108784
Simon Pilgrim [Thu, 2 Sep 2021 09:10:08 +0000 (10:10 +0100)]
[X86] Fold PMADD(x,0) or PMADD(0,x) -> 0
Pulled out of D108522 - handle zero-operand cases for PMADDWD/VPMADDUBSW ops
Simon Pilgrim [Wed, 1 Sep 2021 16:42:21 +0000 (17:42 +0100)]
[X86][SSE] Add combine-pmadd.ll for PMADDWD/VPMADDUBSW combines
Pre-commit for D108522 to show failure to fold multiply by zero operands
Daniel Kiss [Thu, 2 Sep 2021 09:37:09 +0000 (11:37 +0200)]
[libunwind] Compile with -Wunused-but-set-variable
-Wunused-but-set-variable triggers a warning even the block of code is effectively dead.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D107835
Roman Lebedev [Thu, 2 Sep 2021 09:40:22 +0000 (12:40 +0300)]
Revert "[OpenMP][OpenMPIRBuilder] Implement loop unrolling."
Breaks build with -DBUILD_SHARED_LIBS=ON
```
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
"LLVMFrontendOpenMP" of type SHARED_LIBRARY
depends on "LLVMPasses" (weak)
"LLVMipo" of type SHARED_LIBRARY
depends on "LLVMFrontendOpenMP" (weak)
"LLVMCoroutines" of type SHARED_LIBRARY
depends on "LLVMipo" (weak)
"LLVMPasses" of type SHARED_LIBRARY
depends on "LLVMCoroutines" (weak)
depends on "LLVMipo" (weak)
At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.
CMake Generate step failed. Build files cannot be regenerated correctly.
```
This reverts commit
707ce34b06190e275572c3c46843036db1bab6d1.
Daniel Kiss [Thu, 2 Sep 2021 09:30:26 +0000 (11:30 +0200)]
[Unwind] Harmonise exception class for EHABI spec.
EHABI defines the exception class as char[8] instead of uint64_t [1].
For ABI compatibility the ABI the definition needs to be updated.
[1] https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#82language-independent-unwinding-types-and-functions
Reviewed By: manojgupta, MaskRay, #libunwind
Differential Revision: https://reviews.llvm.org/D109047
Ben Shi [Mon, 23 Aug 2021 13:09:12 +0000 (21:09 +0800)]
[RISCV][test] Add more tests for (mul (add x, c1), c2)
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D108606
Ben Shi [Mon, 30 Aug 2021 03:47:22 +0000 (11:47 +0800)]
[RISCV][test] Add tests for optimization with SH*ADD in the zba extension
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D108915
Fraser Cormack [Wed, 11 Aug 2021 15:47:12 +0000 (16:47 +0100)]
[LegalizeTypes][VP] Add splitting support for binary VP ops
This patch extends D107904's introduction of vector-predicated (VP)
operation legalization to include vector splitting.
When the result of a binary VP operation needs splitting, all of its
operands are split in kind. The two operands and the mask are split as
usual, and the vector-length parameter EVL is "split" such that the low
and high halves each execute the correct number of elements.
Tests have been added to the RISC-V target to show splitting several
scenarios for fixed- and scalable-vector types. Without support for
`umax` (e.g. in the `B` extension) the generated code starts to branch.
Ideally a cost model would prevent their insertion in the first place.
Through these tests many opportunities for better codegen can be seen:
combining known-undef VP operations and for constant-folding operations
on `ISD::VSCALE`, to name but a few.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D107957
Simon Moll [Thu, 2 Sep 2021 07:53:53 +0000 (09:53 +0200)]
[VP] Declaration and docs for vp.select intrinsic
llvm.vp.select extends the regular select instruction with an explicit
vector length (%evl).
All lanes with indexes at and above %evl are
undefined. Lanes below %evl are taken from the first input where the
mask is true and from the second input otherwise.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D105351
Sebastian Schwartz [Thu, 2 Sep 2021 09:14:49 +0000 (11:14 +0200)]
[lldb server] Tidy up LLDB server return codes and associated tests
This diff modifies the LLDB server return codes to more accurately reflect usage
error paths. Specifically we always propagate the return codes from the main
entrypoints into GDB remote LLDB server, and platform LLDB server. This way, the
top-level caller of LLDB server will be able to correctly check whether the
executable exited with or without an error.
We additionally modify and extend the associated shell unit tests to expect
nonzero return codes on error conditions.
Test Plan:
LLDB tests pass:
```
ninja check-lldb
```
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D108351
Alexander Belyaev [Thu, 2 Sep 2021 09:06:49 +0000 (11:06 +0200)]
[mlir][linalg] Expose function to create op on buffers during bufferization.
Differential Revision: https://reviews.llvm.org/D109140
David Sherwood [Tue, 31 Aug 2021 13:07:50 +0000 (14:07 +0100)]
[SVE] Fix the FP arithmetic instruction costs for SVE
Several FP instructions (fadd, fsub, etc.) were incorrectly assigned
a higher cost for SVE because they have custom lowering, however we
know they are legal. This patch explicitly assigns a cost of 2 to
these opcodes.
Tests added here:
Analysis/CostModel/AArch64/arith-fp-sve.ll
Differential Revision: https://reviews.llvm.org/D108993
Fangrui Song [Thu, 2 Sep 2021 08:00:51 +0000 (01:00 -0700)]
[MC] Set SHF_INFO_LINK on SHT_REL/SHT_RELA sections
sh_info links to a section, therefore SHF_INFO_LINK should be set as GNU as
does. The issue has been benign because linkers kindly combines relocation
sections w/ and w/o the flag.
Fraser Cormack [Wed, 1 Sep 2021 14:32:58 +0000 (15:32 +0100)]
[SelectionDAG][VP] Fix VP memory ops' EVL/Mask indices
This patch corrects the auto-generated EVL and Mask index positions of
the `VP_LOAD`/`VP_STORE`/`VP_GATHER`/`VP_SCATTER` nodes.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D109063
Michael Kruse [Thu, 2 Sep 2021 06:08:55 +0000 (01:08 -0500)]
[OpenMP][OpenMPIRBuilder] Implement loop unrolling.
Add methods for loop unrolling to the OpenMPIRBuilder class and use them in Clang if `-fopenmp-enable-irbuilder` is enabled. The unrolling methods are:
* `unrollLoopFull`
* `unrollLoopPartial`
* `unrollLoopHeuristic`
`unrollLoopPartial` and `unrollLoopHeuristic` can use compiler heuristics to automatically determine the unroll factor. If possible, that is if no CanonicalLoopInfo is required to pass to another method, metadata for LLVM's LoopUnrollPass is added. Otherwise the unroll factor is determined using the same heurstics as user by LoopUnrollPass. Not requiring a CanonicalLoopInfo, especially with `unrollLoopHeuristic` allows greater flexibility.
With full unrolling and partial unrolling with known unroll factor, instead of duplicating instructions by the OpenMPIRBuilder, the full unroll is still delegated to the LoopUnrollPass. In case of partial unrolling the loop is first tiled using the existing `tileLoops` methods, then the inner loop fully unrolled using the same mechanism.
Reviewed By: jdoerfert, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D107764
Florian Hahn [Wed, 1 Sep 2021 13:32:59 +0000 (15:32 +0200)]
[LoopDistribute] Add tests inspired by PR50296, PR50288.
Wenlei He [Wed, 1 Sep 2021 23:25:59 +0000 (16:25 -0700)]
[CSSPGO] Use preinliner decision by default when available
For CSSPGO, turn on `sample-profile-use-preinliner` by default. This simplifies the use of llvm-profgen preinliner as it's now simply driven by ContextShouldBeInlined flag for each context profile without needing extra compiler switch.
Note that llvm-profgen's preinliner is still off by default, under switch `csspgo-preinliner`.
Differential Revision: https://reviews.llvm.org/D109111
Arthur Eubanks [Wed, 1 Sep 2021 18:53:53 +0000 (11:53 -0700)]
[docs] Mention that the legacy PM is deprecated and will be removed after 14
Per https://lists.llvm.org/pipermail/llvm-dev/2021-August/152305.html.
Reviewed By: MaskRay, fhahn
Differential Revision: https://reviews.llvm.org/D109080
Markus Lavin [Thu, 2 Sep 2021 06:23:33 +0000 (08:23 +0200)]
[NPM] Added opt option -print-pipeline-passes.
Added opt option -print-pipeline-passes to print a -passes compatible
string describing the built pass pipeline.
As an example:
$ opt -enable-new-pm=1 -adce -licm -simplifycfg -o /dev/null /dev/null -print-pipeline-passes
verify,function(adce),function(loop-mssa(licm)),function(simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts>),verify,BitcodeWriterPass
At the moment this is best-effort only and there are some known
limitations:
- Not all passes accepting parameters will print their parameters
(currently only implemented for simplifycfg).
- Some ClassName to pass-name mappings are not unique.
- Some ClassName to pass-name mappings are missing (e.g.
BitcodeWriterPass).
Differential Revision: https://reviews.llvm.org/D108298
Markus Lavin [Thu, 2 Sep 2021 06:22:17 +0000 (08:22 +0200)]
Revert "[NPM] Added opt option -print-pipeline-passes."
This reverts commit
c71869ed4c24b3d4d13e2f83ee2c0104013ca129.