OSDN Git Service
mydeveloperday [Sat, 27 Jun 2020 11:16:05 +0000 (12:16 +0100)]
[clang-format] NFC 1% improvement in the overall clang-formatted status
lh123 [Sat, 27 Jun 2020 10:58:03 +0000 (18:58 +0800)]
Revert "[Docs] Fix typo and test git commit access. NFC."
This reverts commit
c19e82c6b38b74c56d595cb69582b7c3727762b5.
Simon Pilgrim [Sat, 27 Jun 2020 10:27:16 +0000 (11:27 +0100)]
ThreadPool.h - remove unused BitVector.h include. NFC.
mydeveloperday [Sat, 27 Jun 2020 10:35:22 +0000 (11:35 +0100)]
[clang-format] [PR462254] fix indentation of default and break correctly in whitesmiths style
Summary:
https://bugs.llvm.org/show_bug.cgi?id=46254
Reviewed By: curdeius, jbcoe
Differential Revision: https://reviews.llvm.org/D8201
Simon Pilgrim [Sat, 27 Jun 2020 10:16:25 +0000 (11:16 +0100)]
FileCollector.h - reduce Twine.h include to forward declaration. NFC.
Simon Pilgrim [Sat, 27 Jun 2020 10:03:57 +0000 (11:03 +0100)]
[DAG] reduceBuildVecExtToExtBuildVec - don't combine if it would break a splat.
reduceBuildVecExtToExtBuildVec was breaking a splat(zext(x)) pattern into buildvector(x, 0, x, 0, ..) resulting in much more complex insert+shuffle codegen.
We already go to some lengths to avoid this in SimplifyDemandedVectorElts etc. when we encounter splat buildvectors.
It should be OK to fold all splat(aext(x)) patterns - we might need to tighten this if we find a case where we mustn't introduce a buildvector(x, undef, x, undef, ..) but I can't find one.
Fixes PR46461.
Simon Pilgrim [Sat, 27 Jun 2020 09:42:44 +0000 (10:42 +0100)]
[X86] Add PR46461 test case
Simon Pilgrim [Sat, 27 Jun 2020 09:36:37 +0000 (10:36 +0100)]
[X86] Add AVX tests buildvec-insertvec.ll
Simon Pilgrim [Sat, 27 Jun 2020 09:30:05 +0000 (10:30 +0100)]
Fix unused type alias warning. NFC.
The "using InsertPointTy" line is an unnecessary copy + paste from other builder tests.
David Zarzycki [Tue, 23 Jun 2020 09:43:51 +0000 (05:43 -0400)]
Reland: [clang driver] Move default module cache from system temporary directory
This fixes a unit test. Otherwise here is the original commit:
1) Shared writable directories like /tmp are a security problem.
2) Systems provide dedicated cache directories these days anyway.
3) This also refines LLVM's cache_directory() on Darwin platforms to use
the Darwin per-user cache directory.
Reviewers: compnerd, aprantl, jakehehrlich, espindola, respindola, ilya-biryukov, pcc, sammccall
Reviewed By: compnerd, sammccall
Subscribers: hiraditya, llvm-commits, cfe-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D82362
Simon Pilgrim [Sat, 27 Jun 2020 09:12:20 +0000 (10:12 +0100)]
Error.h - GenericBinaryError - pass Twine arg by reference not value.
This allows us to reduce the Twine.h include to a forward declaration.
Simon Pilgrim [Sat, 27 Jun 2020 09:01:48 +0000 (10:01 +0100)]
CompileOnDemandLayer.h - remove unused Twine.h include. NFC.
Simon Pilgrim [Sat, 27 Jun 2020 08:59:05 +0000 (09:59 +0100)]
IndirectionUtils.h - reduce Twine.h include to forward declaration. NFC.
Simon Pilgrim [Sat, 27 Jun 2020 08:57:03 +0000 (09:57 +0100)]
MCSectionWasm.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Sat, 27 Jun 2020 08:47:34 +0000 (09:47 +0100)]
AsmPrinter.h - reduce includes to forward declarations. NFC.
Nikita Popov [Sun, 14 Jun 2020 20:49:57 +0000 (22:49 +0200)]
[IR] Store attributes that are available "somewhere" (NFC)
I noticed that for some benchmarks we spend quite a bit of time
inside AttributeList::hasAttrSomewhere(), mainly when checking
for the "returned" attribute. Most of the time the attribute will
not be present, in which case this function has to walk through
the whole attribute list and check for the attribute at each index.
This patch adds a cache of all "available somewhere" attributes
inside AttributeListImpl. This makes the structure 12 bytes larger,
but I don't think that's problematic, as attribute lists are uniqued.
Compile-time in terms of instructions retired improves by 0.4% on
average, but >1% for sqlite.
Differential Revision: https://reviews.llvm.org/D81867
Simon Pilgrim [Fri, 26 Jun 2020 15:31:38 +0000 (16:31 +0100)]
AsmWriter - printConstVCalls/printNonConstVCalls - avoid std::vector pass by value. NFCI.
Roman Lebedev [Sat, 27 Jun 2020 08:34:58 +0000 (11:34 +0300)]
[SCEV] Make SCEVAddExpr actually always return pointer type if there is pointer operand (PR46457)
Summary:
The added assertion fails on the added test without the fix.
Reduced from test-suite/MultiSource/Benchmarks/MiBench/office-ispell/correct.c
In IR, getelementptr, obviously, takes pointer as it's base,
and returns a pointer.
When creating an SCEV expression, SCEV operands are sorted in hope
that it increases folding potential, and at the same time SCEVAddExpr's
type is the type of the last(!) operand.
Which means, in some exceedingly rare cases, pointer operand may happen to
end up not being the last operand, and as a result SCEV for GEP
will suddenly have a non-pointer return type.
We should ensure that does not happen.
In the end, actually storing the `Type *`, at the cost of increasing
memory footprint of `SCEVAddExpr`, appears to be the solution.
We can't just store a 'is a pointer' bit and create pointer type
on the fly since we don't have data layout in getType().
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=46457 | PR46457 ]]
Reviewers: efriedma, mkazantsev, reames, nikic
Reviewed By: efriedma
Subscribers: hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82633
Roman Lebedev [Sat, 27 Jun 2020 08:34:58 +0000 (11:34 +0300)]
[NFCI][SCEV] getPointerBase(): de-recursify
Summary:
This is boringly straight-forward, each iteration we see if
V is some expression that we can look into, and if it has
a single pointer operand, then set V to that operand
and repeat.
Reviewers: efriedma, mkazantsev, reames, nikic
Reviewed By: nikic
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82632
Melanie Blower [Fri, 26 Jun 2020 16:23:45 +0000 (09:23 -0700)]
Reland D81869 "Modify FPFeatures to use delta not absolute settings"
This reverts commit
defd43a5b393bb63a902042adf578081b03b171d.
with correction to solve msan report
To solve https://bugs.llvm.org/show_bug.cgi?id=46166 where the
floating point settings in PCH files aren't compatible, rewrite
FPFeatures to use a delta in the settings rather than absolute settings.
With this patch, these floating point options can be benign.
Reviewers: rjmccall
Differential Revision: https://reviews.llvm.org/D81869
Fady Ghanim [Sat, 27 Jun 2020 06:43:04 +0000 (02:43 -0400)]
[OpenMP][OMPBuilder] Remove unused variable in Unittest
Relating to buildbot errors to commit
82b8236cf248ef91968b67d18af23890322cde43
Gui Andrade [Sat, 27 Jun 2020 06:46:04 +0000 (06:46 +0000)]
[MSAN] Handle x86 {round,min,max}sd intrinsics
These need special handling over the simple vector intrinsics as they
behave more like a shuffle operation: taking the top half of the vector
from one input, and the bottom half separately. Previously, these were
being handled as though all bits of all operands were combined.
Differential Revision: https://reviews.llvm.org/D82398
Gui Andrade [Sat, 27 Jun 2020 06:24:32 +0000 (06:24 +0000)]
[Docs] BitCodeFormat.rst: List missing attribute codes
Craig Topper [Sat, 27 Jun 2020 06:32:17 +0000 (23:32 -0700)]
[X86] Add MOVBE and RDRND features to BDVER4.
Only 6 years behind gcc. https://gcc.gnu.org/legacy-ml/gcc-patches/2014-08/msg00231.html
Found while working on improving how we define CPU features for
clang and auditing for correctness.
Fady Ghanim [Thu, 4 Jun 2020 16:24:29 +0000 (12:24 -0400)]
[OpenMP][OMPBuilder] Adding privatization related `createXXXX` to OMPBuilder
lh123 [Sat, 27 Jun 2020 05:35:59 +0000 (13:35 +0800)]
[Docs] Fix typo and test git commit access. NFC.
Fangrui Song [Sat, 27 Jun 2020 03:55:44 +0000 (20:55 -0700)]
[BasicAA] Rename -disable-basicaa to -disable-basic-aa to be consistent with the canonical name "basic-aa"
Fangrui Song [Sat, 27 Jun 2020 03:41:37 +0000 (20:41 -0700)]
[BasicAA] Rename deprecated -basicaa to -basic-aa
Follow-up to D82607
Revert an accidental change (empty.ll) of D82683
Fangrui Song [Sat, 27 Jun 2020 03:31:47 +0000 (20:31 -0700)]
[ELF] --warn-backrefs: check that D79300 fixed an issue due to `mb = {}`
D79300 forgot to change `getBuffer().empty()` in LazyObjFile::parse to
`fetched`. This caused incorrect iterating after the current LazyObjFile was
fetched. This issue is benign and can just cause loss of "undefined symbols"
and "backward reference" diagnostics.
Before D79300 `mb = {}` caused --warn-backrefs-exclude to be useless for
a fetched LazyObjFile.
Add two test cases.
Arthur Eubanks [Fri, 26 Jun 2020 22:10:30 +0000 (15:10 -0700)]
[NewPM][BasicAA] basicaa -> basic-aa in Transforms/{New,}GVN
Summary: Following https://reviews.llvm.org/D82607.
Reviewers: ychen
Subscribers: asbirlea, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82688
Arthur Eubanks [Fri, 26 Jun 2020 22:06:47 +0000 (15:06 -0700)]
[NewPM][BasicAA] basicaa -> basic-aa in Transforms/DeadStoreElimination
Summary: Following https://reviews.llvm.org/D82607.
Reviewers: ychen
Subscribers: george.burgess.iv, asbirlea, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82689
Nico Weber [Sat, 27 Jun 2020 02:30:24 +0000 (22:30 -0400)]
Revert "Disable a JSONTest.Integers test with all MSVCs, PR46470"
This reverts commit
63bcf89125fdfe8a41b0125454b006b49abb0184.
Turns out the more targeted disablement in the previous change
was good enough.
Alexander Shaposhnikov [Sat, 27 Jun 2020 00:22:15 +0000 (17:22 -0700)]
[llvm-install-name-tool] Add support for -rpath option
This diff implements -rpath option for llvm-install-name-tool
which replaces the rpath value in the specified Mach-O binary.
Patch by Sameer Arora!
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D82051
Vedant Kumar [Wed, 24 Jun 2020 18:33:28 +0000 (11:33 -0700)]
[InstCombine] Drop debug loc in TryToSinkInstruction (reland)
Summary:
The advice in HowToUpdateDebugInfo.rst is to "... preserve the debug
location of an instruction if the instruction either remains in its
basic block, or if its basic block is folded into a predecessor that
branches unconditionally".
TryToSinkInstruction doesn't seem to satisfy the criteria as it's
sinking an instruction to some successor block. Preserving the debug loc
can make single-stepping appear to go backwards, or make a breakpoint
hit on that location happen "too late" (since single-stepping from that
breakpoint can cause the function to return unexpectedly).
So, drop the debug location.
This was reverted in
ee3620643dfc because it removed source locations
from inlinable calls, breaking a verifier rule. I've added an exception
for calls because the alternative (setting a line 0 location) is not
better. I tested the updated patch by completing a stage2 RelWithDebInfo
build.
Reviewers: aprantl, davide
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82487
Alex Lorenz [Fri, 26 Jun 2020 22:33:56 +0000 (15:33 -0700)]
[darwin][driver] NFC, split addStartObjectFileArgs into multiple functions
Alex Lorenz [Fri, 26 Jun 2020 21:57:00 +0000 (14:57 -0700)]
[darwin][driver] Do not link with libarclite when building for Apple Silicon macOS
peter klausler [Fri, 26 Jun 2020 19:58:05 +0000 (12:58 -0700)]
[flang] Fix line continuation after bare labels (fm200.f)
Fixed-form line continuation was not working when the
preceding line was a bare label.
Reviewed By: tskeith
Differential Revision: https://reviews.llvm.org/D82687
Nico Weber [Sat, 27 Jun 2020 00:02:04 +0000 (20:02 -0400)]
Disable a JSONTest.Integers test with all MSVCs, PR46470
Nico Weber [Fri, 26 Jun 2020 23:57:52 +0000 (19:57 -0400)]
Disable a JSONTest.Integers test with newer MSVCs, PR46470
Craig Topper [Fri, 26 Jun 2020 23:41:30 +0000 (16:41 -0700)]
[X86] Don't disable xsave when avx is disabled. Implicitly enable xsave with avx is enabled and xsave wasn't explciitly disabled
CPUs with avx always have xsave, but some CPUs without avx also
have xsave. So we shouldn't disable xsave just because avx is
disabled. This would prevent xsave from being enabled with
-march=native on CPUs with xsave and not avx.
But we also don't want -mavx -mno-avx to leave xsave eanabled.
So only enable xsave if avx is enabled after processing all features.
I thought about just not turning xsave on with avx at all, but
there might be someone out there depending on it.
Puyan Lotfi [Fri, 26 Jun 2020 23:30:25 +0000 (16:30 -0700)]
[NFCi] Fixing build failures on Windows due to std::tie used w/o proper include.
From https://reviews.llvm.org/D81236 /
https://github.com/llvm/llvm-project/commit/
55fe7b79bb7fab49af3720840224c0720bdb03c6
std::tie is used without including <tuple>. This patch includes <tuple>
so that some downstream Windows bots succesfully build.
Jonas Devlieghere [Fri, 26 Jun 2020 22:55:13 +0000 (15:55 -0700)]
[lldb/Test] Disable eh-frame-augment-noop.test on macOS
The test fails on Darwin because a different Asynchronous UnwindPlan is
chosen:
Asynchronous (not restricted to call-sites) UnwindPlan is 'assembly
insn profiling'`
instead of what the test expects:
Asynchronous (not restricted to call-sites) UnwindPlan is 'eh_frame
CFI'
Arthur Eubanks [Fri, 26 Jun 2020 22:45:23 +0000 (15:45 -0700)]
Fix full-store-partial-alias.ll
Accidentally renamed -disable-basicaa -> -disable-basic-aa
Matt Arsenault [Fri, 26 Jun 2020 20:02:25 +0000 (16:02 -0400)]
LLParser: Accept align(N) as new syntax for parameter attribute
Every other value parameter attribute uses parentheses, so accept this
as the preferred modern syntax. Updating everything to use the new
syntax is left for a future change.
Matt Arsenault [Wed, 10 Jun 2020 14:40:35 +0000 (10:40 -0400)]
AMDGPU/GlobalISel: Fix some legalization of < dword vector stores
This avoids many instances of failing to legalize a vector truncstore
of <4 x s8> to 2 bytes. We don't perfectly handle every truncstore
yet, largely because the given set of legalization actions can't
actually differentiate between changing the result type and changing
the memory type.
Vedant Kumar [Fri, 26 Jun 2020 21:58:58 +0000 (14:58 -0700)]
Revert "[InstCombine] Drop debug loc in TryToSinkInstruction"
This reverts commit
903cf140d0118cf0d3f0f6f8967c6a20d9c5be6b.
This might be causing verifier failures on the bots, such as: "inlinable
function call in a function with debug info must have a !dbg location"
--
http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/16976/steps/bootstrap%20clang/logs/stdio
Arthur Eubanks [Fri, 26 Jun 2020 21:58:41 +0000 (14:58 -0700)]
[NewPM][BasicAA] basicaa -> basic-aa in Transforms/SLPVectorizer
Following https://reviews.llvm.org/D82607.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D82681
Arthur Eubanks [Fri, 26 Jun 2020 21:58:01 +0000 (14:58 -0700)]
[NewPM][BasicAA] basicaa -> basic-aa in Analysis/BasicAA
Following https://reviews.llvm.org/D82607.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D82683
Yuanfang Chen [Fri, 26 Jun 2020 21:55:00 +0000 (14:55 -0700)]
[MemorySSA] Update comment in PassBuilder
Is teaching the LoopFullUnrollPass to preserve MemorySSA very hard or
just impossible?
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D82618
Vedant Kumar [Thu, 18 Jun 2020 21:17:07 +0000 (14:17 -0700)]
[debugify] Demote an error about empty locations to a warning
In https://reviews.llvm.org/D81198, we outlined a number of scenarios
where dropping debug locations is appropriate. Stop issuing an error
when this happens.
Steven Wu [Fri, 26 Jun 2020 21:53:23 +0000 (14:53 -0700)]
[compiler-rt] Fix mismatched #if/#endif comments
Fix a mismatched #if/#endif comments from my previous commit.
Matt Arsenault [Fri, 12 Jun 2020 12:49:18 +0000 (08:49 -0400)]
GlobalISel: Don't fail translate on weak cmpxchg
The translation of cmpxchg added by
9481399c0fd2c198c81b92636c0dcff7d4c41df2 specifically skipped weak
cmpxchg due to not understanding the meaning. Weak cmpxchg was added
in
420a216817def01816186910a2e35885c9201951. As explained in the
commit message, the weak mode is implicit in how
ATOMIC_CMP_SWAP_WITH_SUCCESS is lowered. If it's expanded to a regular
ATOMIC_CMP_SWAP, it's replaced with a strong cmpxchg.
This handling seems weird to me, but this was already following the
DAG behavior. I would expect the strong IR instruction to not have the
boolean output. Failing that, I might expect the IRTranslator to emit
ATOMIC_CMP_SWAP and a constant for the boolean.
Tony [Wed, 24 Jun 2020 08:11:01 +0000 (04:11 -0400)]
[AMDGPU] Define DWARF encoding for condition code registers
Summary:
- Define DWARF register numbers for vector and scalar condition codes.
- Document intended purpose of reserved DWARF register numbers.
Reviewers: yaxunl, kzhuravl, arsenm, rampitec, b-sumner
Subscribers: jvesely, wdng, nhaehnle, aprantl, dstuttard, tpr, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82519
JF Bastien [Fri, 26 Jun 2020 20:48:51 +0000 (13:48 -0700)]
[NFC] Bump ObjCOrBuiltinIDBits to 15
We're now hitting this because we're at the limit for number of builtins:
clang/lib/Basic/IdentifierTable.cpp:39:1: error: static_assert failed due to requirement '2 * LargestBuiltinID < (2 << (ObjCOrBuiltinIDBits - 1))' "Insufficient ObjCOrBuiltinID Bits"
static_assert(2 * LargestBuiltinID < (2 << (ObjCOrBuiltinIDBits - 1)),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bump it to 15 so whoever adds a builtin next (as I am, or as anyone else might) doesn't merge conflict over each other.
Francesco Petrogalli [Fri, 26 Jun 2020 20:06:06 +0000 (20:06 +0000)]
[sve][acle] Recommit https://reviews.llvm.org/D82501
The original patch was reverted in
https://github.com/llvm/llvm-project/commit/
ff5ccf258e297df29f32d6b5e4fa0a7b95c44f9c
as it was missing the C tests that got accidentally missing.
This patch is a NFC of https://reviews.llvm.org/D82501, together with
the SVE ACLE tests for the C intrinsics of svreinterpret for brain
float types.
Amy Huang [Mon, 11 May 2020 21:13:37 +0000 (14:13 -0700)]
Extend or truncate __ptr32/__ptr64 pointers when dereferenced.
Summary:
A while ago I implemented the functionality to lower Microsoft __ptr32
and __ptr64 pointers, which are stored as 32-bit and 64-bit pointer
and are extended/truncated to the appropriate pointer size when
dereferenced.
This patch adds an addrspacecast to cast from the __ptr32/__ptr64
pointer to a default address space when dereferencing.
Bug: https://bugs.llvm.org/show_bug.cgi?id=42359
Reviewers: hans, arsenm, RKSimon
Subscribers: wdng, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81517
Vedant Kumar [Wed, 24 Jun 2020 18:33:28 +0000 (11:33 -0700)]
[InstCombine] Drop debug loc in TryToSinkInstruction
Summary:
The advice in HowToUpdateDebugInfo.rst is to "... preserve the debug
location of an instruction if the instruction either remains in its
basic block, or if its basic block is folded into a predecessor that
branches unconditionally".
TryToSinkInstruction doesn't seem to satisfy the criteria as it's
sinking an instruction to some successor block. Preserving the debug loc
can make single-stepping appear to go backwards, or make a breakpoint
hit on that location happen "too late" (since single-stepping from that
breakpoint can cause the function to return unexpectedly).
So, drop the debug location.
Reviewers: aprantl, davide
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82487
Francesco Petrogalli [Fri, 26 Jun 2020 20:10:15 +0000 (20:10 +0000)]
Revert "[sve][acle] Add reinterpret intrinsics for brain float."
This reverts commit
a15722c5ce4759c12960fe434ee6bd8aac70bb16.
The commmit has to be reverted because I accidentally submit
https://reviews.llvm.org/D82501 without the C tests that were added in
an early version of the patch.
Melanie Blower [Fri, 26 Jun 2020 20:17:45 +0000 (13:17 -0700)]
More corrections to documented spelling of ffinite-math to ffinite-math-only
Florian Hahn [Fri, 26 Jun 2020 16:51:51 +0000 (17:51 +0100)]
[VPlan] Add & use VPValue for VPWidenGEPRecipe operands (NFC).
This patch adds VPValue version of the GEP's operands to
VPWidenGEPRecipe and uses them during code-generation.
Reviewers: Ayal, gilr, rengolin
Reviewed By: gilr
Differential Revision: https://reviews.llvm.org/D80220
JF Bastien [Fri, 26 Jun 2020 19:58:17 +0000 (12:58 -0700)]
[NFC] Builtins: list 'R' for restrict
It was added to the list of builtin modifiers in r148573 back in 2012-01-20, but the comment wasn't updated.
Paul Walker [Sat, 20 Jun 2020 19:23:31 +0000 (20:23 +0100)]
[SVE] Code generation for fixed length vector adds.
Summary:
Teach LowerToPredicatedOp to lower fixed length vector operations.
Add AArch64ISD nodes and isel patterns for predicated integer
and floating point adds.
Together this enables SVE code generation for fixed length vector adds.
Reviewers: rengolin, efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82483
Nick Desaulniers [Fri, 26 Jun 2020 19:52:43 +0000 (12:52 -0700)]
[clang][SourceManager] cache Macro Expansions
A seemingly innocuous Linux kernel change [0] seemingly blew up our
compile times by over 3x, as reported by @nathanchance in [1].
The code in question uses a doubly nested macro containing GNU C
statement expressions that are then passed to typeof(), which is then
used in a very important macro for atomic variable access throughout
most of the kernel. The inner most macro, is passed a GNU C statement
expression. In this case, we have macro arguments that are GNU C
statement expressions, which can contain a significant number of tokens.
The upstream kernel patch caused significant build time regressions for
both Clang and GCC. Since then, some of the nesting has been removed via
@melver, which helps gain back most of the lost compilation time. [2]
Profiles collected [3] from compilations of the slowest TU for us in the
kernel show:
* 51.4% time spent in clang::TokenLexer::updateLocForMacroArgTokens
* 48.7% time spent in clang::SourceManager::getFileIDLocal
* 35.5% time spent in clang::SourceManager::isOffsetInFileID
(mostly calls from the former through to the latter).
So it seems we have a pathological case for which properly tracking the
SourceLocation of macro arguments is significantly harming build
performance. This stands out in referenced flame graph.
In fact, this case was identified previously as being problematic in
commit
3339c568c4 ("[Lex] Speed up updateConsecutiveMacroArgTokens (NFC)")
Looking at the above call chain, there's 3 things we can do to speed up
this case.
1. TokenLexer::updateConsecutiveMacroArgTokens() calls
SourceManager::isWrittenInSameFile() which calls
SourceManager::getFileID(), which is both very hot and very expensive
to call. SourceManger has a one entry cache, member LastFileIDLookup.
If that isn't the FileID for a give source location offset, we fall
back to a linear probe, and then to a binary search for the FileID.
These fallbacks update the one entry cache, but noticeably they do
not for the case of macro expansions!
For the slowest TU to compile in the Linux kernel, it seems that we
miss about 78.67% of the 68 million queries we make to getFileIDLocal
that we could have had cache hits for, had we saved the macro
expansion source location's FileID in the one entry cache. [4]
I tried adding a separate cache item for macro expansions, and to
check that before the linear then binary search fallbacks, but did
not find it faster than simply allowing macro expansions into the one
item cache. This alone nets us back a lot of the performance loss.
That said, this is a modification of caching logic, which is playing
with a double edged sword. While it significantly improves the
pathological case, its hard to say that there's not an equal but
opposite pathological case that isn't regressed by this change.
Though non-pathological cases of builds of the Linux kernel before
[0] are only slightly improved (<1%) and builds of LLVM itself don't
change due to this patch.
Should future travelers find this change to significantly harm their
build times, I encourage them to feel empowered to revert this
change.
2. SourceManager::getFileIDLocal has a FIXME hinting that the call to
SourceManager::isOffsetInFileID could be made much faster since
isOffsetInFileID is generic in the sense that it tries to handle the
more generic case of "local" (as opposed to "loaded") files, though
the caller has already determined the file to be local. This patch
implements a new method that specialized for use when the caller
already knows the file is local, then use that in
TokenLexer::updateLocForMacroArgTokens. This should be less
controversial than 1, and is likely an across the board win. It's
much less significant for the pathological case, but still a
measurable win once we have fallen to the final case of binary
search. D82497
3. A bunch of methods in SourceManager take a default argument.
SourceManager::getLocalSLocEntry doesn't do anything with this
argument, yet many callers of getLocalSLocEntry setup, pass, then
check this argument. This is wasted work. D82498
With this patch applied, the above profile [5] for the same pathological
input looks like:
* 25.1% time spent in clang::TokenLexer::updateLocForMacroArgTokens
* 17.2% time spent in clang::SourceManager::getFileIDLocal
and clang::SourceManager::isOffsetInFileID is no longer called, and thus
falls out of the profile.
There may be further improvements to the general problem of "what
interval contains one number out of millions" than the current use of a
one item cache, followed by linear probing, followed by binary
searching. We might even be able to do something smarter in
TokenLexer::updateLocForMacroArgTokens.
[0] https://github.com/ClangBuiltLinux/linux/commit/
cdd28ad2d8110099e43527e96d059c5639809680
[1] https://github.com/ClangBuiltLinux/linux/issues/1032
[2] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=locking/kcsan&id=
a5dead405f6be1fb80555bdcb77c406bf133fdc8
[3] https://github.com/ClangBuiltLinux/linux/issues/1032#issuecomment-
633712667
[4] https://github.com/ClangBuiltLinux/linux/issues/1032#issuecomment-
633741923
[5] https://github.com/ClangBuiltLinux/linux/issues/1032#issuecomment-
634932736
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D80681
Melanie Blower [Fri, 26 Jun 2020 19:47:58 +0000 (12:47 -0700)]
Correct documented spelling of ffinite-math to ffinite-math-only
This is to correct bugs.llvm.org/show_bug.cgi?id=46444
ffinite-math-only is a gcc option. That is the correct spelling.
File modified is clang/docs/UsersManual.rst
Roman Lebedev [Fri, 26 Jun 2020 19:40:30 +0000 (22:40 +0300)]
[CostModel] Avoid traditional ConstantExpr crashy pitfails
I'm not sure if this is a regression from D81448 + D81643,
which moved at least the code cast from elsewhere,
or somehow no one triggered that before.
But now we can reach it with a non-instruction..
It is not straight-forward to write cost-model tests for constantexprs,
`-cost-model -analyze -cost-kind=` does not appear to look at them,
or maybe i'm doing it wrong.
I've encountered that via a SimplifyCFG crash,
so reduced (currently-crashing) test is added.
There are likely other instances.
For now, simply restore previous status quo of
not crashing and returning TTI::TCC_Basic.
Louis Dionne [Fri, 26 Jun 2020 19:05:46 +0000 (15:05 -0400)]
[libc++] Remove support for building through llvm-config
We've decided to move away from that by requiring that libc++ is built
as part of the monorepo a while ago. This commit removes code pertaining
to that unsupported use case and produces a clear error when the user
violates that.
In fact, building outside of the monorepo will still work as long as
LLVM_PATH is pointing to the root of the LLVM project, although that
is not officially supported.
Matt Arsenault [Thu, 25 Jun 2020 01:01:55 +0000 (21:01 -0400)]
AMDGPU: Add llvm.amdgcn.sqrt intrinsic
I spread the GlobalISel test into the regular one, which I've been
avoiding so far.
David Tenty [Fri, 26 Jun 2020 18:49:24 +0000 (14:49 -0400)]
[NFCI] Cleanup range checks in Register/MCRegister
Summary:
by removing casts from unsigned to int that which may be implementation
defined according to C++14 (and thus trip up the XL compiler on AIX) by
just using unsigned comparisons/masks and refactor out the range
constants to cleanup things a bit while we are at it.
Reviewers: hubert.reinterpretcast, arsenm
Reviewed By: hubert.reinterpretcast
Subscribers: wdng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82197
Richard Barton [Fri, 26 Jun 2020 18:28:43 +0000 (19:28 +0100)]
[flang] Port remaining test_any.sh tests to FileCheck
Port the remaining tests which only require mechanical changes and delete
test_any.sh.
* Delete old RUN lines
* Replace:
EXEC: ${F18} ... | ${FileCheck} ...
with
RUN: %f18 .. | FileCheck ...
* Prepend RUN line with not when it is expected to fail
Also reinstate a de-activated EXEC line and port it in the same way.
Differential Revision: https://reviews.llvm.org/D82168
Sanjay Patel [Fri, 26 Jun 2020 18:20:40 +0000 (14:20 -0400)]
[DAGCombiner] rename variables for readability; NFC
PR46406 shows a pattern where we can do better, so try to clean this up
before adding more code.
Sanjay Patel [Thu, 25 Jun 2020 20:28:30 +0000 (16:28 -0400)]
[AArch64] add vector test for merged condition branching; NFC
Fangrui Song [Fri, 26 Jun 2020 18:18:18 +0000 (11:18 -0700)]
[CMake] Add check-debuginfo-* targets
* check-debuginfo-dexter runs lit tests under debuginfo-tests/dexter/
* check-debuginfo-llgdb-tests runs lit tests under debuginfo-tests/llgdb-tests/
* ...
Reviewed By: tbosch
Differential Revision: https://reviews.llvm.org/D82605
aartbik [Fri, 26 Jun 2020 18:03:11 +0000 (11:03 -0700)]
[mlir] [VectorOps] Add the ability to mark FP reductions with "reassociate" attribute
Rationale:
In general, passing "fastmath" from MLIR to LLVM backend is not supported, and even just providing such a feature for experimentation is under debate. However, passing fine-grained fastmath related attributes on individual operations is generally accepted. This CL introduces an option to instruct the vector-to-llvm lowering phase to annotate floating-point reductions with the "reassociate" fastmath attribute, which allows the LLVM backend to use SIMD implementations for such constructs. Oher lowering passes can start using this mechanism right away in cases where reassociation is allowed.
Benefit:
For some microbenchmarks on x86-avx2, speedups over 20 were observed for longer vector (due to cleaner, spill-free and SIMD exploiting code).
Usage:
mlir-opt --convert-vector-to-llvm="reassociate-fp-reductions"
Reviewed By: ftynse, mehdi_amini
Differential Revision: https://reviews.llvm.org/D82624
Amy Kwan [Fri, 26 Jun 2020 17:22:38 +0000 (12:22 -0500)]
[PowerPC] Add support for llvm.ppc.dcbt, llvm.ppc.dcbtst, llvm.ppc.isync intrinsics
This patch adds LLVM intrinsics for the dcbt (Data Cache Block Touch),
dcbtst (Data Cache Block Touch for Store) and isync (Instruction
Synchronize) instructions.
The intrinsic for dcbt and dcbst in this patch are named llvm.ppc.dcbt.with.hint
and llvm.ppc.dcbtst.with.hint respectively as there already exists an intrinsic
for llvm.ppc.dcbt and llvm.ppc.dcbtst. However, the original variants of the
intrinsics do not accept the TH immediate field, whereas these variants do.
Differential Revision: https://reviews.llvm.org/D79633
Eric Schweitz [Thu, 25 Jun 2020 22:42:50 +0000 (15:42 -0700)]
[flang] Add CHARACTER type lowering helpers and runtime.
In order for these files to build properly, this patch rolls up a number of changes that have been made to various files that have been upstreamed.
Implementations for the interfaces included in Bridge.h and IntrinsicCall.h will be included in a future diff.
Differential revision: https://reviews.llvm.org/D82608
Richard Barton [Fri, 26 Jun 2020 17:50:46 +0000 (18:50 +0100)]
[flang] Port test_any.sh tests to FileCheck: Hand port canondo{08-18} tests
These tests checked for stdout and stderr in the same pipe, which does not
come out in a guaranteed order. test_any.sh's FileCheck accepts CHECK lines in
any order while FileCheck checks must match in order.
Hand port these to pipe stdout to a temp file which is checked with a separate
FileCheck RUN line to test it.
Differential Revision: https://reviews.llvm.org/D82167
Richard Barton [Fri, 26 Jun 2020 17:49:21 +0000 (18:49 +0100)]
[flang] Port test_any.sh tests to FileCheck: Hand port getsymbols tests
test_any.sh's FileCheck accepts the CHECK line matches in any order while
FileCheck checks in strict order. Re-order the CHECK lines to source code
order - they come from an ordered datastructure.
Some CHECK lines are sensitive to line number which are fixed up manually.
getsymbols02 had multiple test inputs which had their own EXEC lines.
Consolidate these together in one file.
Differential Revision: https://reviews.llvm.org/D82166
Richard Barton [Fri, 26 Jun 2020 17:47:13 +0000 (18:47 +0100)]
[flang] Port test_any.sh tests to FileCheck: Hand port getdefinition* tests
These tests are sensitive to line numbers in the input and check output.
They also successively write to a temporary file then check that.
Fix the line number issues and replace the temporary file use with successive
calls to FileCheck with different check-prefixes.
Differential Revision: https://reviews.llvm.org/D82165
Rong Xu [Fri, 26 Jun 2020 17:20:09 +0000 (10:20 -0700)]
[PGO] Add a functionality to always instrument the func entry BB
Add an option to always instrument function entry BB (default off)
Add an option to do atomically updates on the first counter in each
instrumented function.
Differential Revision: https://reviews.llvm.org/D82123
Richard Barton [Fri, 5 Jun 2020 18:09:12 +0000 (19:09 +0100)]
[flang] Port test_any.sh tests to FileCheck: Hand port tests which use regexes
The regex syntax used by test_any.sh's FileCheck is sometimes incompatible with
real FileCheck.
Hand port these tests to use FileCheck and it's regex format.
Also remove FIXME from label01 that no longer applies.
Also add second run-line that enables all tests.
Add some new FIXMEs for issues in original tests
Differential Revision: https://reviews.llvm.org/D82164
Philip Reames [Thu, 25 Jun 2020 23:40:29 +0000 (16:40 -0700)]
Migrate last batch of tests to gc-live bundle format
For context of anyone following along, we've not completed the migration of statepoint to the operand bundle form. The only remaining piece is to actually version the statepoint intrinsic to remove the old inline operand sets. That will follow when I have some time; delay is useful here to allow downstream migrations.
Nico Weber [Fri, 26 Jun 2020 17:25:45 +0000 (13:25 -0400)]
Revert "[clang driver] Move default module cache from system temporary directory"
This reverts commit
bb26838ceffb5feaa18186f55f7525a08084899e.
Breaks Support.CacheDirectoryNoEnv, Support.CacheDirectoryWithEnv
in SupportTests (part of check-llvm) on macOS.
Nick Desaulniers [Fri, 26 Jun 2020 17:22:26 +0000 (10:22 -0700)]
[SourceManager] don't check invalid param of getLocalSLocEntry()
Forked from D80681.
getLocalSLocEntry() has an unused parameter used to satisfy an interface
of libclang (see getInclusions() in
clang/tools/libclang/CIndexInclusionStack.cpp). It's pointless for
callers to construct/pass/check this inout parameter that can never
signify that a FileID is invalid.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D82498
Arthur Eubanks [Fri, 26 Jun 2020 16:28:32 +0000 (09:28 -0700)]
[NewPM][LoopUnroll] Rename unroll* to loop-unroll*
The legacy pass is called "loop-unroll", but in the new PM it's called "unroll".
Also applied to unroll-and-jam and unroll-full.
Fixes various check-llvm tests when NPM is turned on.
Reviewed By: Whitney, dmgreen
Differential Revision: https://reviews.llvm.org/D82590
Kit Barton [Tue, 9 Jun 2020 21:18:02 +0000 (16:18 -0500)]
[PPC][NFC] Add Subtarget and replace all uses of PPCSubTarget with Subtarget.
Summary:
In preparation for GlobalISel, PPCSubTarget needs to be renamed to Subtarget as there places in GlobalISel that assume the presence of the variable Subtarget.
This patch introduces the variable Subtarget, and replaces all existing uses of PPCSubTarget with Subtarget. A subsequent patch will remove the definiton of
PPCSubTarget, once any downstream users have the opportunity to rename any uses they have.
Reviewers: hfinkel, nemanjai, jhibbits, #powerpc, echristo, lkail
Reviewed By: #powerpc, echristo, lkail
Subscribers: echristo, lkail, wuzish, nemanjai, hiraditya, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81623
Yitzhak Mandelbaum [Fri, 26 Jun 2020 16:17:28 +0000 (16:17 +0000)]
[libTooling] Improve error message from failure in selection Stencil
This patch improves the error message provided by the stencil that handles
source from a range selector.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D82654
Louis Dionne [Fri, 26 Jun 2020 15:49:44 +0000 (11:49 -0400)]
[libc++abi] Fix build failure in abort_message.cpp when vasprintf isn't provided
Melanie Blower [Fri, 26 Jun 2020 15:45:12 +0000 (08:45 -0700)]
Revert "Revert "Revert "Modify FPFeatures to use delta not absolute settings"""
This reverts commit
9518763d710bfbbf9315fa88972c55898be44a0e.
Memory sanitizer fails in CGFPOptionsRAII::CGFPOptionsRAII dtor
sstefan1 [Fri, 26 Jun 2020 15:32:06 +0000 (15:32 +0000)]
[OpenMPOpt][NFC] Change ICV macros for initial value
This fixes build breaks when system headers are difining FALSE.
Francesco Petrogalli [Wed, 24 Jun 2020 15:48:10 +0000 (15:48 +0000)]
[sve][acle] Add reinterpret intrinsics for brain float.
Reviewers: kmclaughlin, efriedma, ctetreau, sdesmalen, david-arm
Subscribers: tschuett, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D82501
Kevin P. Neal [Fri, 26 Jun 2020 15:06:48 +0000 (11:06 -0400)]
[NFC] Eliminate an unneeded -vv used in test development.
Thomas Raoux [Fri, 26 Jun 2020 14:59:17 +0000 (07:59 -0700)]
[mlir][vulkan-runner] Make vulkan runner use GPU device memory
To be able to have more meaningful performance out of workloadsi going through
the vulkan-runner we need to use buffers from GPU device memory as access to
system memory is significantly slower for GPU with dedicated memory. This adds
code to do a copy through staging buffer as GPU memory cannot always be mapped
on the host.
Differential Revision: https://reviews.llvm.org/D82504
Melanie Blower [Fri, 26 Jun 2020 14:54:01 +0000 (07:54 -0700)]
Revert "Revert "Modify FPFeatures to use delta not absolute settings""
This reverts commit
b55d723ed61052b77e720dcffecac43abe873186.
Reapply Modify FPFeatures to use delta not absolute settings
To solve https://bugs.llvm.org/show_bug.cgi?id=46166 where the
floating point settings in PCH files aren't compatible, rewrite
FPFeatures to use a delta in the settings rather than absolute settings.
With this patch, these floating point options can be benign.
Reviewers: rjmccall
Differential Revision: https://reviews.llvm.org/D81869
Vy Nguyen [Thu, 25 Jun 2020 15:15:16 +0000 (11:15 -0400)]
[llvm-exegesis] Let Counter returns up to 16 entries
LBR contains (up to) 16 entries for last x branches and the X86LBRCounter (from D77422) should be able to return all those.
Currently, it just returns the latest entry, which could lead to mis-leading measurements.
This patch aslo changes the LatencyBenchmarkRunner to accommodate multi-value readings.
https://reviews.llvm.org/D81050
Melanie Blower [Fri, 26 Jun 2020 14:48:38 +0000 (07:48 -0700)]
Revert "Modify FPFeatures to use delta not absolute settings"
This reverts commit
3a748cbf86cea3844fada04eeff4cc64b01f67e0.
I'm reverting this commit because I forgot to format the commit message
propertly. Sorry for the thrash.
Dmitri Gribenko [Fri, 26 Jun 2020 10:09:11 +0000 (12:09 +0200)]
Work around a bug in MSVC in the syntax tree test
Summary:
MSVC does not handle raw string literals with embedded double quotes
correctly. I switched the affected test case to use regular string
literals insetad.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82636
Melanie Blower [Mon, 15 Jun 2020 19:43:37 +0000 (12:43 -0700)]
Modify FPFeatures to use delta not absolute settings
George Mitenkov [Fri, 26 Jun 2020 14:29:05 +0000 (10:29 -0400)]
[MLIR][SPIRVToLLVM] Conversion for bitrverse and bitcount ops
Implemented conversion for `spv.BitReverse` and `spv.BitCount`. Since ODS
generates builders in a different way for LLVM dialect intrinsics, I
added attributes to build method in `DirectConversionPattern` class. The
tests for these ops are in `bitwise-ops-to-llvm.mlir`.
Differential Revision: https://reviews.llvm.org/D82286
Yitzhak Mandelbaum [Fri, 26 Jun 2020 14:23:25 +0000 (14:23 +0000)]
[libTooling] Rename overloaded `range` range selector.
Renames the overloaded `RangeSelector` combinator `range` to the more
descriptive `enclose` and `encloseNodes`. The old overloads are left in place
and marked deprected and will be deleted at a future time.
Reviewed By: tdl-g
Differential Revision: https://reviews.llvm.org/D82592
Guillaume Chatelet [Fri, 26 Jun 2020 14:14:27 +0000 (14:14 +0000)]
[Alignment][NFC] Migrate TTI::isLegalToVectorize{Load,Store}Chain to Align
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Differential Revision: https://reviews.llvm.org/D82653