platform/upstream/llvm.git
3 years ago[SLP] fix formatting; NFC
Sanjay Patel [Wed, 16 Sep 2020 12:47:35 +0000 (08:47 -0400)]
[SLP] fix formatting; NFC

Also move variable declarations closer to usage and add code comments.

3 years ago[clang-format] [NFC] Fix spelling mistake in the documentation
mydeveloperday [Wed, 16 Sep 2020 12:45:45 +0000 (13:45 +0100)]
[clang-format] [NFC] Fix spelling mistake in the documentation

Ensure ClangFormatStyleOptions.rst can be regenerated from Format.h

Patch By: YangZhihui

Reviewed By: MyDeveloperDay

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

3 years ago[ARM] Reorder some logic
Sam Parker [Wed, 16 Sep 2020 12:38:36 +0000 (13:38 +0100)]
[ARM] Reorder some logic

Re-order some checks in ValidateMVEInst.

3 years ago[SLP] remove uses of 'auto' that obscure functionality; NFC
Sanjay Patel [Wed, 16 Sep 2020 12:26:21 +0000 (08:26 -0400)]
[SLP] remove uses of 'auto' that obscure functionality; NFC

3 years ago[SLP] remove redundant size check; NFC
Sanjay Patel [Wed, 16 Sep 2020 12:11:19 +0000 (08:11 -0400)]
[SLP] remove redundant size check; NFC

We bail out on small array size anyway.

3 years ago[SLP] move loop index variable declaration to its use; NFC
Sanjay Patel [Wed, 16 Sep 2020 11:44:03 +0000 (07:44 -0400)]
[SLP] move loop index variable declaration to its use; NFC

3 years ago[SLP] change poorly named variable; NFC
Sanjay Patel [Wed, 16 Sep 2020 11:40:15 +0000 (07:40 -0400)]
[SLP] change poorly named variable; NFC

'V' shadows a function argument.

3 years ago[RDA] Fix getUniqueReachingDef for self loops
Sam Parker [Wed, 16 Sep 2020 11:42:58 +0000 (12:42 +0100)]
[RDA] Fix getUniqueReachingDef for self loops

We've fixed the case where this could return an instruction after the
given instruction, but also means that we can falsely return a
'unique' def when they could be one coming from the backedge of a
loop.

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

3 years ago[Sema] isOpenMPCapturedDecl - assert we locate CapturedRegionScopeInfo. NFCI.
Simon Pilgrim [Wed, 16 Sep 2020 11:40:15 +0000 (12:40 +0100)]
[Sema] isOpenMPCapturedDecl - assert we locate CapturedRegionScopeInfo. NFCI.

Fixes clang static analayzer null dereference warning.

3 years agoUpdate dead links to Itanium and ARM ABIs. NFC
Sam McCall [Wed, 16 Sep 2020 11:42:01 +0000 (13:42 +0200)]
Update dead links to Itanium and ARM ABIs. NFC

3 years ago[AST] ASTReader::ReadModuleMapFileBlock - assert non-null Module. NFCI.
Simon Pilgrim [Wed, 16 Sep 2020 11:29:50 +0000 (12:29 +0100)]
[AST] ASTReader::ReadModuleMapFileBlock - assert non-null Module. NFCI.

At this stage the Module* shouldn't be null - add an assert to fix a clang static analyzer warning.

3 years agoTokenAnnotator.cpp - remove useless pointer null test. NFCI.
Simon Pilgrim [Wed, 16 Sep 2020 11:17:44 +0000 (12:17 +0100)]
TokenAnnotator.cpp - remove useless pointer null test. NFCI.

We dereference the Left pointer throughout the parseParens() function apart from this single case - just add an non-null assertion and drop the check.

Fixes clang static analayzer null dereference warning.

3 years agoCGBlocks.cpp - assert non-null CGF pointer. NFCI.
Simon Pilgrim [Wed, 16 Sep 2020 11:11:29 +0000 (12:11 +0100)]
CGBlocks.cpp - assert non-null CGF pointer. NFCI.

Fixes static analyzer warning.

3 years ago[ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`
Adam Balogh [Fri, 11 Sep 2020 17:04:38 +0000 (19:04 +0200)]
[ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

//AST Matcher// `hasBody` is a polymorphic matcher that behaves
differently for loop statements and function declarations. The main
difference is the for functions declarations it does not only call
`FunctionDecl::getBody()` but first checks whether the declaration in
question is that specific declaration which has the body by calling
`FunctionDecl::doesThisDeclarationHaveABody()`. This is achieved by
specialization of the template `GetBodyMatcher`. Unfortunately template
specializations do not catch the descendants of the class for which the
template is specialized. Therefore it does not work correcly for the
descendants of `FunctionDecl`, such as `CXXMethodDecl`,
`CXXConstructorDecl`, `CXXDestructorDecl` etc. This patch fixes this
issue by using a template metaprogram.

The patch also introduces a new matcher `hasAnyBody` which matches
declarations which have a body present in the AST but not necessarily
belonging to that particular declaration.

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

3 years ago[clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc
Adam Balogh [Tue, 15 Sep 2020 10:53:13 +0000 (12:53 +0200)]
[clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc

Placement new operators on non-object types cause crash in
`bugprone-misplaced-pointer-arithmetic-in-alloc`. This patch fixes this
issue.

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

3 years ago[clangd] Actually parse Index section of the YAML file.
Adam Czachorowski [Tue, 15 Sep 2020 18:13:00 +0000 (20:13 +0200)]
[clangd] Actually parse Index section of the YAML file.

This fixes a bug in dbf486c0de92c76df77c1a1f815cf16533ecbb3a, which
introduced the Index section of the config, but did not register the
parse method, so it didn't work in a YAML file (but did in a test).

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

3 years ago[ARM] Fix tail predication predicate tracking
Sam Parker [Wed, 16 Sep 2020 10:47:26 +0000 (11:47 +0100)]
[ARM] Fix tail predication predicate tracking

Clear the CurrentPredicate when we find an instruction which would
completely overwrite the VPR. This fix essentially means we're back
to not really being able to handle VPT instructions when tail
predicating.

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

3 years ago[ARM] Add more validForTailPredication
Sam Parker [Wed, 16 Sep 2020 10:17:13 +0000 (11:17 +0100)]
[ARM] Add more validForTailPredication

Modify the unit test to inspect all MVE instructions and mark the
load/store/move of vpr/p0 as valid, as well as the remaining scalar
shifts.

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

3 years agoFix table formatting after D87686
Kirill Bobyrev [Wed, 16 Sep 2020 10:27:20 +0000 (12:27 +0200)]
Fix table formatting after D87686

3 years ago[DAG] Remover getOperand() call. NFCI.
Simon Pilgrim [Wed, 16 Sep 2020 10:02:09 +0000 (11:02 +0100)]
[DAG] Remover getOperand() call. NFCI.

3 years ago[clang-tidy] Improve documentation on Clangd integration
Kirill Bobyrev [Wed, 16 Sep 2020 10:09:29 +0000 (12:09 +0200)]
[clang-tidy] Improve documentation on Clangd integration

The integration is already complete; this patch updates information as well as
suggests using Clang-Tidy via Clangd integration that is vastly available
in most editors through LSP client plugins.

Reviewed By: hokein

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

3 years ago[ARM][LowOverheadLoops] Fix tests after ef0b9f3
Sam Tebbs [Wed, 16 Sep 2020 09:59:19 +0000 (10:59 +0100)]
[ARM][LowOverheadLoops] Fix tests after ef0b9f3

ef0b9f3 didn't update the tests that it affected.

3 years ago[llvm-readobj][test] - Improve section-symbols.test
Georgii Rymar [Mon, 14 Sep 2020 13:38:29 +0000 (16:38 +0300)]
[llvm-readobj][test] - Improve section-symbols.test

`section-symbols.test` tests how we print section symbols in
different situations.

We might have 2 different cases:
1) A named STT_SECTION symbol.
2) An unnamed STT_SECTION symbol.

Usually section symbols have no name and then `--symbols` uses their
section names when prints them. If symbol has a name, then it is used.

For `--relocations` we also want to have this logic probably,
but currently we always ignore symbol names and always use section names.
It is not consistent with GNU readelf and with our logic for `--symbols`.

This patch refines testing to document the existent behavior and improve
coverage.

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

3 years ago[LLD][ELF] Optimize linker script filename glob pattern matching NFC
Andrew Ng [Wed, 9 Sep 2020 09:48:21 +0000 (10:48 +0100)]
[LLD][ELF] Optimize linker script filename glob pattern matching NFC

Optimize the filename glob pattern matching in
LinkerScript::computeInputSections() and LinkerScript::shouldKeep().

Add InputFile::getNameForScript() which gets and if required caches the
Inputfile's name used for linker script matching. This avoids the
overhead of name creation that was in getFilename() in LinkerScript.cpp.

Add InputSectionDescription::matchesFile() and
SectionPattern::excludesFile() which perform the glob pattern matching
for an InputFile and make use of a cache of the previous result. As both
computeInputSections() and shouldKeep() process sections in order and
the sections of the same InputFile are contiguous, these single entry
caches can significantly speed up performance for more complex glob
patterns.

These changes have been seen to reduce link time with --gc-sections by
up to ~40% with linker scripts that contain KEEP filename glob patterns
such as "*crtbegin*.o".

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

3 years ago[Support] Add GlobPattern::isTrivialMatchAll()
Andrew Ng [Mon, 7 Sep 2020 12:22:12 +0000 (13:22 +0100)]
[Support] Add GlobPattern::isTrivialMatchAll()

GlobPattern::isTrivialMatchAll() returns true for the GlobPattern "*"
which will match all inputs.

This can be used to avoid performing expensive preparation of the input
for match() when the result of the match will always be true.

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

3 years ago[clangd] Implement hot index reloading for clangd-index-server
Kirill Bobyrev [Wed, 16 Sep 2020 09:11:31 +0000 (11:11 +0200)]
[clangd] Implement hot index reloading for clangd-index-server

This patch adds a mechanism to load new versions of index into
clangd-index-server using SwapIndex and FileStatus information about last
modification time without downtime.

Reviewed By: kadircet

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

3 years ago[llvm-readobj][test] - Address a forgotten review comment for D86923.
Georgii Rymar [Wed, 16 Sep 2020 08:50:14 +0000 (11:50 +0300)]
[llvm-readobj][test] - Address a forgotten review comment for D86923.

Seems I've forgot to address this bit and this looks like a reason
of a failture on mac (http://45.33.8.238/mac/20491/step_11.txt).

3 years ago[DebugInfo][flang] DISubrange support for fortran assumed size array
Alok Kumar Sharma [Thu, 10 Sep 2020 06:23:43 +0000 (11:53 +0530)]
[DebugInfo][flang] DISubrange support for fortran assumed size array

This is needed to support assumed size array of fortran which can have missing upperBound/count
, contrary to current DISubrange support.
Example:
subroutine sub (array1, array2)
  integer :: array1 (*)
  integer :: array2 (4:9, 10:*)

  array1(7:8) = 9
  array2(5, 10) = 10
end subroutine
Now the validation check is relaxed for fortran.

Reviewed By: aprantl

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

3 years agoFollow up rG635b87511ec3: forgot to add/commit the new test file. NFC.
Sjoerd Meijer [Wed, 16 Sep 2020 08:34:31 +0000 (09:34 +0100)]
Follow up rG635b87511ec3: forgot to add/commit the new test file. NFC.

3 years ago[ARM][LowOverheadLoops] Combine a VCMP and VPST into a VPT
Sam Tebbs [Mon, 14 Sep 2020 14:44:54 +0000 (15:44 +0100)]
[ARM][LowOverheadLoops] Combine a VCMP and VPST into a VPT

This patch combines a VCMP followed by a VPST into a VPT, which has the
same semantics as the combination of the former two.

3 years ago[clangd] Don't use zlib when it's unavailable.
Aleksandr Platonov [Wed, 16 Sep 2020 08:04:53 +0000 (11:04 +0300)]
[clangd] Don't use zlib when it's unavailable.

Without this patch `clangd` crashes at try to load compressed string table when `zlib` is not available.
Example:
- Build `clangd` with MinGW (`zlib` found)
- Build index
- Build `clangd` with Visual Studio compiler (`zlib` not found)
- Try to load index

Reviewed By: sammccall, adamcz

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

3 years ago[ARM][MachineOutliner] Add calls handling.
Yvan Roux [Wed, 16 Sep 2020 07:54:26 +0000 (09:54 +0200)]
[ARM][MachineOutliner] Add calls handling.

Handles calls inside outlined regions, by saving and restoring the link
register.

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

3 years agoRevert "[Asan] Accept __lsan_ignore_object for redzone pointer"
Vitaly Buka [Wed, 16 Sep 2020 07:27:13 +0000 (00:27 -0700)]
Revert "[Asan] Accept __lsan_ignore_object for redzone pointer"

We still keep AddrIsInside.

This reverts commit 1d70984fa220f966ddcecd7906c5f10368fe1b93.

3 years agoRevert "[Asan] Fix false leak report"
Vitaly Buka [Wed, 16 Sep 2020 07:03:07 +0000 (00:03 -0700)]
Revert "[Asan] Fix false leak report"

Additional investigated confirmed that issue is not about
AddrIsInside, but missing registers.

This reverts commit 9d01612db48fa27d18c6320974b8d711572e5c67.

3 years ago[Test] Add positive range checks tests in addition to negative
Max Kazantsev [Wed, 16 Sep 2020 07:24:00 +0000 (14:24 +0700)]
[Test] Add positive range checks tests in addition to negative

3 years ago[flang] Fix docs build
Richard Barton [Wed, 16 Sep 2020 07:18:08 +0000 (08:18 +0100)]
[flang] Fix docs build

Apply a local fix to an issue with recommonmark's AutoStructify extension
when used with certain versions of sphinx.

See https://github.com/readthedocs/recommonmark/issues/93

Reviewed By: hans

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

3 years ago[Test] Some more potential range check elimination opportunities
Max Kazantsev [Wed, 16 Sep 2020 06:59:41 +0000 (13:59 +0700)]
[Test] Some more potential range check elimination opportunities

3 years ago[MemorySSA] Report unoptimized as None, not MayAlias.
Alina Sbirlea [Wed, 16 Sep 2020 05:52:42 +0000 (22:52 -0700)]
[MemorySSA] Report unoptimized as None, not MayAlias.

3 years ago[obj2yaml] Add support for dumping the .debug_addr(v5) section.
Xing GUO [Wed, 16 Sep 2020 06:46:12 +0000 (14:46 +0800)]
[obj2yaml] Add support for dumping the .debug_addr(v5) section.

This patch adds support for dumping the .debug_addr(v5) section to
obj2yaml.

Reviewed By: jhenderson

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

3 years ago[llvm-rc] Lowercase the option definitions. NFC.
Martin Storsjö [Wed, 5 Aug 2020 08:00:21 +0000 (11:00 +0300)]
[llvm-rc] Lowercase the option definitions. NFC.

This matches how such options are most commonly defined in other tools.

This was pointed out in an earlier review a few months ago, that
the llvm-rc td entries felt shouty.

The INCLUDE option is renamed to includepath, to avoid clashing with
the tablegen include directive.

3 years ago[llvm-rc] Update a comment. NFC.
Martin Storsjö [Fri, 31 Jul 2020 14:41:20 +0000 (17:41 +0300)]
[llvm-rc] Update a comment. NFC.

Fix a typo and mention one missing step.

3 years ago[llvm-rc] Allow omitting components from VERSIONINFO versions
Martin Storsjö [Sat, 12 Sep 2020 21:24:26 +0000 (00:24 +0300)]
[llvm-rc] Allow omitting components from VERSIONINFO versions

MS rc.exe doesn't require specifying all 4 components.

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

3 years ago[MemorySSA] Set MustDominate to true for PhiTranslation.
Alina Sbirlea [Wed, 16 Sep 2020 00:42:03 +0000 (17:42 -0700)]
[MemorySSA] Set MustDominate to true for PhiTranslation.

3 years ago[X86] Don't scalarize gather/scatters with non-power of 2 element counts. Widen instead.
Craig Topper [Wed, 16 Sep 2020 06:22:53 +0000 (23:22 -0700)]
[X86] Don't scalarize gather/scatters with non-power of 2 element counts. Widen instead.

We can pad the mask with zeros in order to widen. We already do
this for power 2 types that are smaller than a legal type.

3 years ago[X86] Add test case for non-power of 2 scatter. NFC
Craig Topper [Wed, 16 Sep 2020 05:45:50 +0000 (22:45 -0700)]
[X86] Add test case for non-power of 2 scatter. NFC

3 years ago[ThinLTO] Relax thinlto_embed_bitcode.ll check
Mircea Trofin [Wed, 16 Sep 2020 05:40:13 +0000 (22:40 -0700)]
[ThinLTO] Relax thinlto_embed_bitcode.ll check

Fixes fuscia test [1] - the thinlto annotations may not always be there.

[1] http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/11312

3 years agolibclc: Add a __builtin to let SPIRV targets select between SW and HW FMA
Daniel Stone [Tue, 15 Sep 2020 17:01:04 +0000 (13:01 -0400)]
libclc: Add a __builtin to let SPIRV targets select between SW and HW FMA

Reviewer: jenatali jvesely
Differential Revision: https://reviews.llvm.org/D85910

3 years ago[MLIR][NFC] Value print update for block arguments
Uday Bondhugula [Tue, 15 Sep 2020 05:28:45 +0000 (10:58 +0530)]
[MLIR][NFC] Value print update for block arguments

Emit some more information when printing/dumping `Value`s of
`BlockArgument` kind. This is purely to help for debugging purposes.

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

3 years ago[lldb] Reword CompilerType docstring to not say "generic type"
Dave Lee [Mon, 14 Sep 2020 20:53:50 +0000 (13:53 -0700)]
[lldb] Reword CompilerType docstring to not say "generic type"

Since "generic type" has a precise meaning in some languages, reword the docstring of `CompilerType` to avoid ambiguity.

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

3 years ago[clang-tidy] Fix crash in modernize-use-noexcept on uninstantiated throw class
Zinovy Nis [Mon, 14 Sep 2020 19:08:00 +0000 (22:08 +0300)]
[clang-tidy] Fix crash in modernize-use-noexcept on uninstantiated throw class

Bug: https://bugs.llvm.org/show_bug.cgi?id=47446

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

3 years ago[Test] Add signed version of a test
Max Kazantsev [Wed, 16 Sep 2020 04:30:21 +0000 (11:30 +0700)]
[Test] Add signed version of a test

3 years ago[InstCombine] Add tests for statepoint simplification
Serguei Katkov [Mon, 7 Sep 2020 05:56:34 +0000 (12:56 +0700)]
[InstCombine] Add tests for statepoint simplification

This tests increase coverage for change introduced in D85959

Reviewers: reames, reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D87224

3 years agoFully qualify some more namespace in MLIR ODS to be more friendly to dialects not...
Mehdi Amini [Wed, 16 Sep 2020 03:40:36 +0000 (03:40 +0000)]
Fully qualify some more namespace in MLIR ODS to be more friendly to dialects not defined under the mlir namespace (NFC)

3 years ago[NewPM] Fix opt-hot-cold-split.ll under NPM
Arthur Eubanks [Wed, 16 Sep 2020 03:29:20 +0000 (20:29 -0700)]
[NewPM] Fix opt-hot-cold-split.ll under NPM

Pin to legacy PM, there are already NPM RUN lines.

3 years ago[NewPM][SCEV] Fix constant-fold-gep.ll under NPM
Arthur Eubanks [Wed, 16 Sep 2020 03:25:35 +0000 (20:25 -0700)]
[NewPM][SCEV] Fix constant-fold-gep.ll under NPM

3 years ago[NewPM] Fix 2003-02-19-LoopInfoNestingBug.ll under NPM
Arthur Eubanks [Wed, 16 Sep 2020 03:21:45 +0000 (20:21 -0700)]
[NewPM] Fix 2003-02-19-LoopInfoNestingBug.ll under NPM

Also move it to a more appropriate directory.

3 years ago[X86] Always use 16-bit displacement in 16-bit mode when there is no base or index...
Craig Topper [Wed, 16 Sep 2020 02:31:48 +0000 (19:31 -0700)]
[X86] Always use 16-bit displacement in 16-bit mode when there is no base or index register.

Previously we only did this if the immediate fit in 16 bits, but
the GNU assembler seems to just truncate.

Fixes PR46952

3 years agoFix test after D86156.
Alina Sbirlea [Wed, 16 Sep 2020 02:12:10 +0000 (19:12 -0700)]
Fix test after D86156.

3 years ago[PDB] Drop LF_PRECOMP from debugTypes earlier
Reid Kleckner [Wed, 16 Sep 2020 01:50:34 +0000 (18:50 -0700)]
[PDB] Drop LF_PRECOMP from debugTypes earlier

This is a minor simplification to avoid firing up a BinaryStreamReader
and CVType parser.

3 years ago[Hexagon] Replace incorrect pattern for vpackl HWI32 -> HVi8
Krzysztof Parzyszek [Wed, 16 Sep 2020 01:32:09 +0000 (20:32 -0500)]
[Hexagon] Replace incorrect pattern for vpackl HWI32 -> HVi8

V6_vdealb4w is not correct for pairs, use V6_vpackeh/V6_vpackeb instead.

3 years ago[NewPM] Port strip* passes to NPM
Arthur Eubanks [Mon, 14 Sep 2020 21:37:46 +0000 (14:37 -0700)]
[NewPM] Port strip* passes to NPM

strip-nondebug and strip-debug-declare have no existing associated tests

Reviewed By: ychen

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

3 years ago[LowerSwitch][NewPM] Port lowerswitch to NPM
Arthur Eubanks [Tue, 15 Sep 2020 22:02:23 +0000 (15:02 -0700)]
[LowerSwitch][NewPM] Port lowerswitch to NPM

Reviewed By: ychen

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

3 years agoTest commit
Michael Kitzan [Wed, 16 Sep 2020 00:50:48 +0000 (17:50 -0700)]
Test commit

3 years agoSVML support for log10, sqrt
Wenlei He [Wed, 16 Sep 2020 00:29:32 +0000 (17:29 -0700)]
SVML support for log10, sqrt

Although LLVM supports vectorization of loops containing log10/sqrt, it did not support using SVML implementation of it. Added support so that when clang is invoked with -fveclib=SVML now an appropriate SVML library log2 implementation will be invoked.

Follow up on: https://reviews.llvm.org/D77114

Tests:
Added unit tests to svml-calls.ll, svml-calls-finite.ll. Can be run with llvm-lint.
Created a simple c++ file that tests log10/sqrt, and used clang+ to build it, and output final assembly.

Reviewed By: craig.topper

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

3 years ago[LICM] Make Loop ICM profile aware again
Wenlei He [Wed, 16 Sep 2020 00:21:32 +0000 (17:21 -0700)]
[LICM] Make Loop ICM profile aware again

D65060 was reverted because it introduced non-determinism by using BFI counts from already freed blocks. The parent of this revision fixes that by using a VH callback on blocks to prevent this from happening and makes sure BFI data is passed correctly in LoopStandardAnalysisResults.

This re-introduces the previous optimization of using BFI data to prevent LICM from hoisting/sinking if the instruction will end up moving to a colder block.

Internally at Facebook this change results in a ~7% win in a CPU related metric in one of our big services by preventing hoisting cold code into a hot pre-header like the added test case demonstrates.

Testing:
ninja check

Reviewed By: asbirlea

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

3 years ago[AArch64][GlobalISel] Refactor + improve CMN, ADDS, and ADD emit functions
Jessica Paquette [Thu, 10 Sep 2020 20:34:15 +0000 (13:34 -0700)]
[AArch64][GlobalISel] Refactor + improve CMN, ADDS, and ADD emit functions

These functions were extremely similar:

- `emitADD`
- `emitADDS`
- `emitCMN`

Refactor them a little, introducing a more generic `emitInstr` function to
do most of the work.

Also add support for the immediate + shifted register addressing modes in each
of them.

Update select-uaddo.mir to show that selecing ADDS now supports folding
immediates + shifts. (I don't think this can impact CMN, because the CMN checks
require a G_SUB with a non-constant on the RHS.)

This is around a 0.02% code size improvement on CTMark at -O3.

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

3 years ago[CGSCC][NewPM] Fix adding mutually recursive new functions
Arthur Eubanks [Mon, 14 Sep 2020 18:06:36 +0000 (11:06 -0700)]
[CGSCC][NewPM] Fix adding mutually recursive new functions

When adding a new function via addNewFunctionIntoRefSCC(), it creates a
new node and immediately populates the edges. Since populateSlow() calls
G->get() on all referenced functions, it will create a node (but not
populate it) for functions that haven't yet been added. If we add two
mutually recursive functions, the assert that the node should never have
been created will fire when the second function is added. So here we
remove that assert since the node may have already been created (but not
yet populated).

createNode() is only called from addNewFunctionInto{,Ref}SCC().

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

Reviewed By: jdoerfert

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

3 years agoGlobalISel: Fix a failing combiner test
Volkan Keles [Tue, 15 Sep 2020 23:40:38 +0000 (16:40 -0700)]
GlobalISel: Fix a failing combiner test

test/CodeGen/AArch64/GlobalISel/combine-trunc.mir was failing
due to the different order for evaluating function arguments.
This patch updates the related code to fix the issue.

3 years ago[llvm][cmake] Change LLVM_INTEGRATED_CRT_ALLOC to a path instead of a boolean
Alexandre Ganea [Tue, 15 Sep 2020 23:18:24 +0000 (19:18 -0400)]
[llvm][cmake] Change LLVM_INTEGRATED_CRT_ALLOC to a path instead of a boolean

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

3 years ago[BFI] Make BFI information available through loop passes inside LoopStandardAnalysisR...
Wenlei He [Tue, 15 Sep 2020 23:09:30 +0000 (16:09 -0700)]
[BFI] Make BFI information available through loop passes inside LoopStandardAnalysisResults

~~D65060 uncovered that trying to use BFI in loop passes can lead to non-deterministic behavior when blocks are re-used while retaining old BFI data.~~

~~To make sure BFI is preserved through loop passes a Value Handle (VH) callback is registered on blocks themselves. When a block is freed it now also wipes out the accompanying BFI entry such that stale BFI data can no longer persist resolving the determinism issue. ~~

~~An optimistic approach would be to incrementally update BFI information throughout the loop passes rather than only invalidating them on removed blocks. The issues with that are:~~
~~1. It is not clear how BFI information should be incrementally updated: If a block is duplicated does its BFI information come with? How about if it's split/modified/moved around? ~~
~~2. Assuming we can address these problems the implementation here will be a massive undertaking. ~~

~~There's a known need of BFI in LICM analysis which requires correct but not incrementally updated BFI data. A follow-up change can register BFI in all loop passes so this preserved but potentially lossy data is available to any loop pass that wants it.~~

See: D75341 for an identical implementation of preserving BFI via VH callbacks. The previous statements do still apply but this change no longer has to be in this diff because it's already upstream 😄 .

This diff also moves BFI to be a part of LoopStandardAnalysisResults since the previous method using getCachedResults now (correctly!) statically asserts (D72893) that this data isn't static through the loop passes.

Testing
Ninja check

Reviewed By: asbirlea, nikic

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

3 years ago[GISel] Add new GISel combiners for G_MUL
Aditya Nandakumar [Tue, 15 Sep 2020 23:06:55 +0000 (16:06 -0700)]
[GISel] Add new GISel combiners for G_MUL

https://reviews.llvm.org/D87668

Patch adds two new GICombinerRules, one for G_MUL(X, 1) and another for G_MUL(X, -1).
G_MUL(X, 1) is an identity combine, and G_MUL(X, -1) gets replaced with G_SUB(0, X).
Patch additionally adds new combiner tests for the AArch64 target to test these
new combiner rules, as well as updates AMDGPU GISel tests.

Patch by mkitzan

3 years ago[ThinLTO] add post-thinlto-merge option to -lto-embed-bitcode
Mircea Trofin [Mon, 14 Sep 2020 17:45:00 +0000 (10:45 -0700)]
[ThinLTO] add post-thinlto-merge option to -lto-embed-bitcode

This will embed bitcode after (Thin)LTO merge, but before optimizations.
In the case the thinlto backend is called from clang, the .llvmcmd
section is also produced. Doing so in the case where the caller is the
linker doesn't yet have a motivation, and would require plumbing through
command line args.

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

3 years ago[SourceManager] Explicitly check for potential iterator underflow
Jan Korous [Wed, 19 Aug 2020 05:36:16 +0000 (22:36 -0700)]
[SourceManager] Explicitly check for potential iterator underflow

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

3 years agoGlobalISel: Add combines for G_TRUNC
Volkan Keles [Tue, 15 Sep 2020 22:50:34 +0000 (15:50 -0700)]
GlobalISel: Add combines for G_TRUNC

https://reviews.llvm.org/D87050

3 years ago[AMDGPU] Unify intrinsic ret/nortn interface
Stanislav Mekhanoshin [Thu, 10 Sep 2020 22:10:52 +0000 (15:10 -0700)]
[AMDGPU] Unify intrinsic ret/nortn interface

We have a single noret intrinsic an a lot of special handling
around it. Declare it just as any other but do not define rtn
instructions itself instead.

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

3 years ago[TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN)
Xun Li [Tue, 15 Sep 2020 22:19:57 +0000 (15:19 -0700)]
[TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN)

Call instructions with musttail tag must be optimized as a tailcall, otherwise could lead to incorrect program behavior.
When TSAN is instrumenting functions, it broke the contract by adding a call to the tsan exit function inbetween the musttail call and return instruction, and also inserted exception handling code.
This happend throguh EscapeEnumerator, which adds exception handling code and returns ret instructions as the place to insert instrumentation calls.
This becomes especially problematic for coroutines, because coroutines rely on tail calls to do symmetric transfers properly.
To fix this, this patch moves the location to insert instrumentation calls prior to the musttail call for ret instructions that are following musttail calls, and also does not handle exception for musttail calls.

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

3 years ago[OpenMP] Additional Information for Libomptarget Mappings
Joseph Huber [Tue, 15 Sep 2020 19:04:37 +0000 (15:04 -0400)]
[OpenMP] Additional Information for Libomptarget Mappings

Summary:
This patch adds additonal support for priting infromation from Libomptarget for
already existing maps and printing the final data mapped on the device at
device destruction.

Reviewers: jdoerfort gkistanova

Subscribers: guansong openmp-commits sstefan1 yaxunl

Tags: #OpenMP

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

3 years ago[OPENMP]Fix codegen for is_device_ptr component, captured by reference.
Alexey Bataev [Tue, 15 Sep 2020 19:57:11 +0000 (15:57 -0400)]
[OPENMP]Fix codegen for is_device_ptr component, captured by reference.

Need to map the component as TO instead of the literal, because need to
pass a reference to a component if the pointer is overaligned.

Reviewed By: jdoerfert

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

3 years ago[mlir] Rename 'setInsertionPointAfter' to avoid ambiguity
Diego Caballero [Fri, 4 Sep 2020 18:44:32 +0000 (11:44 -0700)]
[mlir] Rename 'setInsertionPointAfter' to avoid ambiguity

Rename 'setInsertionPointAfter(Value)' API to avoid ambiguity with
'setInsertionPointAfter(Operation *)' for SingleResult operations which
implicitly convert to Value (see D86756).

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

3 years ago[libc] Remove special case for 8 and 16 bytes
Guillaume Chatelet [Tue, 15 Sep 2020 20:48:08 +0000 (20:48 +0000)]
[libc] Remove special case for 8 and 16 bytes

They don't seem to gain much in real apps and its better to favor less branches and smaller code.

3 years agoSema: add support for `__attribute__((__swift_bridged_typedef__))`
Saleem Abdulrasool [Tue, 8 Sep 2020 22:49:41 +0000 (22:49 +0000)]
Sema: add support for `__attribute__((__swift_bridged_typedef__))`

Extend the semantic attributes that clang processes for Swift to include
`swift_bridged_typedef`.  This attribute enables typedefs to be bridged
into Swift with a bridged name.

This is based on the work of the original changes in
https://github.com/llvm/llvm-project-staging/commit/8afaf3aad2af43cfedca7a24cd817848c4e95c0c

Differential Revision: https://reviews.llvm.org/D87396
Reviewed By: Aaron Ballman

3 years ago[libc] use stddef instead of string header
Guillaume Chatelet [Tue, 15 Sep 2020 20:09:50 +0000 (20:09 +0000)]
[libc] use stddef instead of string header

3 years ago[SLPVectorizer][SVE] Skip scalable-vector instructions before vectorizeSimpleInstruct...
Huihui Zhang [Tue, 15 Sep 2020 20:09:56 +0000 (13:09 -0700)]
[SLPVectorizer][SVE] Skip scalable-vector instructions before vectorizeSimpleInstructions.

For scalable type, the aggregated size is unknown at compile-time.
Skip instructions with scalable type to ensure the list of instructions
for vectorizeSimpleInstructions does not contains any scalable-vector instructions.

Reviewed By: RKSimon

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

3 years ago[libc] remove useless headers
Guillaume Chatelet [Tue, 15 Sep 2020 20:03:59 +0000 (20:03 +0000)]
[libc] remove useless headers

3 years agoImplement __isOSVersionAtLeast for Android
Stephen Hines [Tue, 15 Sep 2020 19:50:42 +0000 (12:50 -0700)]
Implement __isOSVersionAtLeast for Android

Add the implementation of __isOSVersionAtLeast for Android. Currently,
only the major version is checked against the API level of the platform
which is an integer. The API level is retrieved by reading the system
property ro.build.version.sdk (and optionally ro.build.version.codename
to see if the platform is released or not).

Patch by jiyong@google.com

Bug: 150860940
Bug: 134795810
Test: m

Reviewed By: srhines

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

3 years ago[TableGen] Fix invalid comparison function `SizeOrder` in `getMatchingSubClassWithSub...
Ta-Wei Tu [Tue, 15 Sep 2020 19:38:06 +0000 (15:38 -0400)]
[TableGen] Fix invalid comparison function `SizeOrder` in `getMatchingSubClassWithSubRegs`

Building LLVM with -DEXPENSIVE_CHECKS fails with the following error
message with libstdc++ in debug mode:

Error: comparison doesn't meet irreflexive requirements,
assert(!(a < a)).

The patch fixes the comparison function SizeOrder by returning false
when comparing two equal items.

3 years agoInferAddressSpaces: Fix assert with unreachable code
Matt Arsenault [Tue, 15 Sep 2020 17:46:23 +0000 (13:46 -0400)]
InferAddressSpaces: Fix assert with unreachable code

Invalid IR in unreachable code is technically valid IR. In this case,
the address space of the value was never inferred, and we tried to
rewrite it with an invalid address space value which would assert.

3 years ago[clang] Add a command line flag for the Machine Function Splitter.
Snehasish Kumar [Wed, 2 Sep 2020 18:00:46 +0000 (11:00 -0700)]
[clang] Add a command line flag for the Machine Function Splitter.

This patch adds a command line flag for the machine function splitter
(added in rG94faadaca4e1).

-fsplit-machine-functions
Split machine functions using profile information (x86 ELF). On
other targets an error is emitted. If profile information is not
provided a warning is emitted notifying the user that profile
information is required.

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

3 years ago[AArch64][SVE] Add lowering for llvm fsqrt
Muhammad Asif Manzoor [Tue, 15 Sep 2020 19:20:55 +0000 (15:20 -0400)]
[AArch64][SVE] Add lowering for llvm fsqrt

Add the functionality to lower fsqrt for passthru variant

Reviewed By: paulwalker-arm

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

3 years ago[PowerPC] Implement __int128 vector divide operations
Albion Fung [Tue, 15 Sep 2020 19:18:54 +0000 (15:18 -0400)]
[PowerPC] Implement __int128 vector divide operations

This patch implements __int128 vector divide operations for ISA3.1.

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

3 years ago[CodeGen][typeid] Emit typeinfo directly if type is known at compile-time
Zequan Wu [Mon, 14 Sep 2020 17:57:23 +0000 (10:57 -0700)]
[CodeGen][typeid] Emit typeinfo directly if type is known at compile-time

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

3 years ago[ASTMatchers] extract public matchers from const-analysis into own patch
Jonas Toth [Sun, 13 Sep 2020 17:30:56 +0000 (19:30 +0200)]
[ASTMatchers] extract public matchers from const-analysis into own patch

The analysis for const-ness of local variables required a view generally useful
matchers that are extracted into its own patch.

They are decompositionDecl and forEachArgumentWithParamType, that works
for calls through function pointers as well.

This is a reupload of https://reviews.llvm.org/D72505, that already landed,
but had to be reverted due to a GCC crash on powerpc
(https://reviews.llvm.org/rG4c48ea68e491cb42f1b5d43ffba89f6a7f0dadc4)

Because this took a long time to adress, i decided to redo this patch and
have a clean workflow.
I try to coordinate with someone that has a PPC to apply this patch and
test for the crash. If everything is fine, I intend to just commit.
If the crash is still happening, i hope to at least find the cause.

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

3 years ago[libc++] Fix broken test for std::any and allocators
Louis Dionne [Tue, 15 Sep 2020 18:59:27 +0000 (14:59 -0400)]
[libc++] Fix broken test for std::any and allocators

The test was not allocating the right number of bytes. This is my fault,
not Marshall's, as I was the one to write the tests for 39c879514170.

3 years ago[Dominators][NewPM] Pin tests with -analyze to legacy PM
Arthur Eubanks [Tue, 15 Sep 2020 18:59:00 +0000 (11:59 -0700)]
[Dominators][NewPM] Pin tests with -analyze to legacy PM

-analyze isn't supported in NPM. All affected tests have corresponding
NPM RUN line.

3 years ago[DemandedBits][NewPM] Pin some tests to legacy PM
Arthur Eubanks [Tue, 15 Sep 2020 18:55:10 +0000 (11:55 -0700)]
[DemandedBits][NewPM] Pin some tests to legacy PM

All tests have corresponding NPM RUN lines.
-analyze doesn't work under NPM.

3 years agoFix .debug_aranges parsing.
Greg Clayton [Mon, 14 Sep 2020 19:20:45 +0000 (12:20 -0700)]
Fix .debug_aranges parsing.

Code was added that used llvm error checking to parse .debug_aranges, but the error check after parsing the DWARFDebugArangesSet was reversed and was causing no error to be returned with no valid address ranges being actually used. This meant we always would fall back onto creating out own address ranges by parsing the compile unit's ranges. This was causing problems for cases where the DW_TAG_compile_unit had a single address range by using a DW_AT_low_pc and DW_AT_high_pc attribute pair (not using a DW_AT_ranges attribute), but the .debug_aranges had correct split ranges. In this case we would end up using the single range for the compile unit that encompassed all of the ranges from the .debug_aranges section and would cause address resolving issues in LLDB where address lookups would fail for certain addresses.

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

3 years ago[gn build] Port 3d42d549554
LLVM GN Syncbot [Tue, 15 Sep 2020 18:32:17 +0000 (18:32 +0000)]
[gn build] Port 3d42d549554

3 years ago[ConstraintElimination] Add constraint elimination pass.
Florian Hahn [Tue, 15 Sep 2020 13:47:23 +0000 (14:47 +0100)]
[ConstraintElimination] Add constraint elimination pass.

This patch is a first draft of a new pass that adds a more flexible way
to eliminate compares based on more complex constraints collected from
dominating conditions.

In particular, it aims at simplifying conditions of the forms below
using a forward propagation approach, rather than instcomine-style
ad-hoc backwards walking of def-use chains.

    if (x < y)
      if (y < z)
        if (x < z) <- simplify

or

    if (x + 2 < y)
        if (x + 1 < y) <- simplify assuming no wraps

The general approach is to collect conditions and blocks, sort them by
dominance and then iterate over the sorted list. Conditions are turned
into a linear inequality and add it to a system containing the linear
inequalities that hold on entry to the block. For blocks, we check each
compare against the system and see if it is implied by the constraints
in the system.

We also keep a stack of processed conditions and remove conditions from
the stack and the constraint system once they go out-of-scope (= do not
dominate the current block any longer).

Currently there still are the least the following areas for improvements

* Currently large unsigned constants cannot be added to the system
  (coefficients must be represented as integers)
* The way constraints are managed currently is not very optimized.

Reviewed By: spatel

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

3 years ago[Bugpoint][NewPM] Pin bugpoint to legacy PM
Arthur Eubanks [Tue, 15 Sep 2020 00:17:32 +0000 (17:17 -0700)]
[Bugpoint][NewPM] Pin bugpoint to legacy PM

Bugpoint has lots of assumptions and hacks around the legacy PM, put off migrating it to NPM until later.
Fixes tests under BugPoint under NPM.

Reviewed By: arsenm

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

3 years ago[X86] Use Align in reduceMaskedLoadToScalarLoad/reduceMaskedStoreToScalarStore. Corre...
Craig Topper [Tue, 15 Sep 2020 18:07:52 +0000 (11:07 -0700)]
[X86] Use Align in reduceMaskedLoadToScalarLoad/reduceMaskedStoreToScalarStore. Correct pointer info.

If we offset the pointer, we also need to offset the pointer info

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