platform/upstream/llvm.git
4 years ago[IR] move/change null-check to assert
Sanjay Patel [Tue, 29 Oct 2019 13:25:36 +0000 (09:25 -0400)]
[IR] move/change null-check to assert

This should trigger a dereference before null-check warning,
but I don't see it when building with clang. In any case, the
current and known future users of this helper require non-null
args, so I'm converting the 'if' to an assert.

4 years ago[BitVector] Cast integer literals to BitWord [NFC]
Simon Pilgrim [Tue, 29 Oct 2019 12:56:13 +0000 (12:56 +0000)]
[BitVector] Cast integer literals to BitWord [NFC]

Associate the integer literals with BitWord, instead of the embedded UL suffix.

Required for https://reviews.llvm.org/D69336.

Committed on behalf of @ekatz (Ehud Katz)

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

4 years ago[IR] move helper function to replace undef constant (elements) with fixed constants
Sanjay Patel [Tue, 29 Oct 2019 11:41:41 +0000 (07:41 -0400)]
[IR] move helper function to replace undef constant (elements) with fixed constants

This is the NFC part of D69519.
We had this functionality locally in instcombine, but it can be used
elsewhere, so hoisting it to Constant class.

4 years ago[LLDB] [PECOFF] Use FindSectionByID to associate symbols to sections
Martin Storsjö [Mon, 21 Oct 2019 06:26:55 +0000 (09:26 +0300)]
[LLDB] [PECOFF] Use FindSectionByID to associate symbols to sections

The virtual container/header section caused the section list to be
offset by one, but by using FindSectionByID, the layout of the
section list shouldn't matter.

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

4 years agoFix some spelling mistakes in comments. NFC
Greg Bedwell [Tue, 29 Oct 2019 12:40:57 +0000 (12:40 +0000)]
Fix some spelling mistakes in comments. NFC

4 years agoFix a spelling mistake in a comment. NFC
Greg Bedwell [Tue, 29 Oct 2019 12:32:01 +0000 (12:32 +0000)]
Fix a spelling mistake in a comment. NFC

(I'm currently trying to debug a strange error message I get when
pushing to github, despite the pushes being successful).

4 years agoFix a spelling mistake in a comment. NFC
Greg Bedwell [Mon, 28 Oct 2019 14:28:00 +0000 (14:28 +0000)]
Fix a spelling mistake in a comment. NFC

4 years agoRevert "[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap"
Andrea Di Biagio [Tue, 29 Oct 2019 12:04:32 +0000 (12:04 +0000)]
Revert "[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap"

This reverts commit 8af5ada09319e5a021d57a1a03715b2fd022e415.

As Bjorn pointed out in D68816, the iteration over `UserVals` may not be safe.

Reverting on behalf of Orlando.

4 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Tue, 29 Oct 2019 12:12:16 +0000 (12:12 +0000)]
Fix unused variable warning. NFCI.

4 years ago[clangd] Add a hidden tweak to dump symbol under the cursor.
Haojian Wu [Mon, 28 Oct 2019 15:27:42 +0000 (16:27 +0100)]
[clangd] Add a hidden tweak to dump symbol under the cursor.

Summary:
This provides a convenient way to see the SymbolID/USR of the symbol, mainly
for debugging purpose.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[LCSSA] Forget values we create LCSSA phis for
Florian Hahn [Tue, 29 Oct 2019 11:54:18 +0000 (11:54 +0000)]
[LCSSA] Forget values we create LCSSA phis for

Summary:
Currently we only forget the loop we added LCSSA phis for. But SCEV
expressions in other loops could also depend on the instruction we added
a PHI for and currently we do not invalidate those expressions. This can
happen when we use ScalarEvolution before converting a function to LCSSA
form. The SCEV expressions will refer to the non-LCSSA value. If this
SCEV expression is then used with the expander, we do not preserve LCSSA
form.

This patch properly forgets the values we created PHIs for. Those need
to be recomputed again. This patch fixes PR43458.

Currently SCEV::verify does not catch this mismatch and any test would
need to run multiple passes to trigger the error (e.g. -loop-reduce
-loop-unroll). I will also look into catching this kind of mismatch in
the verifier. Also, we currently forget the whole loop in LCSSA and I'll
check if we can be more surgical.

Reviewers: efriedma, sanjoy.google, reames

Reviewed By: efriedma

Subscribers: zzheng, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years agoRevert rG70f5aecedef9a6e347e425eb5b843bf797b95319 - "Reland [AArch64][DebugInfo]...
Simon Pilgrim [Tue, 29 Oct 2019 11:54:38 +0000 (11:54 +0000)]
Revert rG70f5aecedef9a6e347e425eb5b843bf797b95319 - "Reland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)"

This fails on EXPENSIVE_CHECKS builds

4 years ago[BranchFolding] skip debug instr to avoid code change
Jeremy Morse [Tue, 29 Oct 2019 11:38:20 +0000 (11:38 +0000)]
[BranchFolding] skip debug instr to avoid code change

Use the existing helper function in BranchFolding, "countsAsInstruction",
to skip over non-instructions. Otherwise debug instructions can be
identified as the last real instruction in a block, leading to different
codegen decisions when debug is enabled as demonstrated by the test case.

Patch by: yechunliang (Chris Ye)!

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

4 years ago[ConstantFold] Push extractelement into getelementptr's operands
Jay Foad [Tue, 29 Oct 2019 10:31:52 +0000 (10:31 +0000)]
[ConstantFold] Push extractelement into getelementptr's operands

This fixes a minor oversight mentioned in the review of D69379:
we should push extractelement into the operands of getelementptr
regardless of whether that enables further folding.

4 years ago[clangd] NFC, use URI::resolve to simplify the code.
Haojian Wu [Tue, 29 Oct 2019 09:49:27 +0000 (10:49 +0100)]
[clangd] NFC, use URI::resolve to simplify the code.

4 years ago[obj2yaml] - Update a comment in a test case. NFC.
Georgii Rymar [Tue, 29 Oct 2019 08:58:19 +0000 (11:58 +0300)]
[obj2yaml] - Update a comment in a test case. NFC.

Addresses post-commit comments for D69160.

4 years ago[llvm-readobj] - Fix a comment in stack-sizes.test. NFC.
Georgii Rymar [Tue, 29 Oct 2019 08:49:19 +0000 (11:49 +0300)]
[llvm-readobj] - Fix a comment in stack-sizes.test. NFC.

To address post commit review comment for D69167.

4 years ago[clangd] Add missing highlights for using decls.
Haojian Wu [Mon, 28 Oct 2019 12:42:20 +0000 (13:42 +0100)]
[clangd] Add missing highlights for using decls.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[yaml2obj] - Make .symtab to be not mandatory section for SHT_REL[A] section.
Georgii Rymar [Mon, 28 Oct 2019 10:47:44 +0000 (13:47 +0300)]
[yaml2obj] - Make .symtab to be not mandatory section for SHT_REL[A] section.

Before this change .symtab section was required for SHT_REL[A] section
declarations. yaml2obj automatically defined it in case when YAML document
did not have it.

With this change it is now possible to produce an object that
has a relocation section, but has no symbol table.

It simplifies the code and also it is inline with how we handle Link fields
for another special sections.

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

4 years ago[yaml2obj] - Improve handling of the SHT_GROUP section.
Georgii Rymar [Mon, 28 Oct 2019 10:30:05 +0000 (13:30 +0300)]
[yaml2obj] - Improve handling of the SHT_GROUP section.

Currently, when we do not specify "Info" field in a YAML description
for SHT_GROUP section, yaml2obj reports an error:
"error: unknown symbol referenced: '' by YAML section '.group1'"

Also, we do not link it with a symbol table by default,
though it is what we do for AddrsigSection, HashSection, RelocationSection.
(http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_link)

The patch fixes missings mentioned.

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

4 years ago[JITLink] Tighten section sorting criteria to fix a flaky test case.
Lang Hames [Tue, 29 Oct 2019 05:56:13 +0000 (22:56 -0700)]
[JITLink] Tighten section sorting criteria to fix a flaky test case.

Sections may have zero size and zero-sized sections may share a start address
with other zero-sized sections. For the section overlap test to function
correctly zero-sized sections must be ordered before any non-zero sized ones.

This should fix the intermittent failures in the
test/ExecutionEngine/JITLink/X86/MachO_zero_fill_alignment.s test case that
have been observed on some builders.

4 years agoAMDGPU: Make VReg_1 only include 1 artificial register
Matt Arsenault [Mon, 28 Oct 2019 19:26:27 +0000 (12:26 -0700)]
AMDGPU: Make VReg_1 only include 1 artificial register

When TableGen is inferring register classes from contexts, it uses a
sorting function based on the number of registers in the class. Since
this was being treated as an alias of VGPR_32, they had exactly the
same size. The sort used wasn't a stable sort, and even if it were, I
believe the tie breaker would effectively end up being the
alphabetical ordering of the class name. There appear to be issues
trying to use an empty set of registers, so add only one so this will
always sort to the end.

Also add a comment explaining how VReg_1 is a dirty hack for
SelectionDAG.

This does end up changing the behavior of i1 with inline asm and VGPR
constraints, but the existing behavior was was already nonsensical and
inconsistent. It should probably be disallowed anyway.

Fixes bug 43699

4 years ago[RISCV] Remove RA from reserved register to use as callee saved register
Shiva Chen [Tue, 15 Oct 2019 02:38:11 +0000 (10:38 +0800)]
[RISCV] Remove RA from reserved register to use as callee saved register

Remove RA from reserved register list, so we could use it as callee saved register

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

4 years ago[lit] Remove callback indirection
Julian Lettner [Thu, 21 Feb 2019 07:05:11 +0000 (23:05 -0800)]
[lit] Remove callback indirection

The callback provides no benefits since `run.execute()` does not take
any arguments anymore.

4 years agoFix a few typos in lld/ELF to cycle bots
Nico Weber [Tue, 29 Oct 2019 01:41:38 +0000 (21:41 -0400)]
Fix a few typos in lld/ELF to cycle bots

4 years ago[Attributor] Make IntegerState more flexible
Johannes Doerfert [Mon, 21 Oct 2019 03:28:49 +0000 (22:28 -0500)]
[Attributor] Make IntegerState more flexible

To make IntegerState more flexible but also less error prone we split it
up into (1) incrementing, (2) decrementing, and (3) bit-tracking states.
This adds functionality compared to before and disallows misuse, e.g.,
"incrementing" updates on a bit-tracking state.

Part of the change is a single operator in the base class which
simplifies helper functions that deal with states.

There are certain functional changes but all of which should actually be
corrections.

4 years agogn build: Merge 38839d08b8e
LLVM GN Syncbot [Tue, 29 Oct 2019 01:06:42 +0000 (01:06 +0000)]
gn build: Merge 38839d08b8e

4 years agoPR43764: Qualify a couple of calls to forward_as_tuple to be ADL-resilient.
David Blaikie [Tue, 29 Oct 2019 01:03:59 +0000 (18:03 -0700)]
PR43764: Qualify a couple of calls to forward_as_tuple to be ADL-resilient.

4 years agogn build: fix bad merge of 75f72f6b done in 3431f1ba
Nico Weber [Tue, 29 Oct 2019 00:58:53 +0000 (20:58 -0400)]
gn build: fix bad merge of 75f72f6b done in 3431f1ba

4 years ago[msan] Remove more attributes from sanitized functions.
Evgenii Stepanov [Tue, 29 Oct 2019 00:49:57 +0000 (17:49 -0700)]
[msan] Remove more attributes from sanitized functions.

Summary:
MSan instrumentation adds stores and loads even to pure
readonly/writeonly functions. It is removing some of those attributes
from instrumented functions and call targets, but apparently not enough.

Remove writeonly, argmemonly and speculatable in addition to readonly /
readnone.

Reviewers: pcc, vitalybuka

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agogn build: (manually) merge 75f72f6b
Nico Weber [Tue, 29 Oct 2019 00:56:21 +0000 (20:56 -0400)]
gn build: (manually) merge 75f72f6b

4 years ago[clang][clang-scan-deps] Add -fcxx-modules to test for Darwin.
Michael Spencer [Tue, 29 Oct 2019 00:37:25 +0000 (17:37 -0700)]
[clang][clang-scan-deps] Add -fcxx-modules to test for Darwin.

4 years ago[PowerPC] Emit scalar fp min/max instructions
Nemanja Ivanovic [Mon, 28 Oct 2019 23:33:31 +0000 (18:33 -0500)]
[PowerPC] Emit scalar fp min/max instructions

VSX provides floating point minimum and maximum instructions that conform
to IEEE semantics. This legalizes the respective nodes and emits VSX code
for them. Furthermore, on Power9 cores we have xsmaxcdp and xsmincdp
instructions that conform to language semantics for the conditional operator
even in the presence of NaNs.

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

4 years ago[NFC] Fix some indentation disturbed in D67368
Reid Kleckner [Tue, 29 Oct 2019 00:07:58 +0000 (17:07 -0700)]
[NFC] Fix some indentation disturbed in D67368

4 years agoReplace abort with llvm_unreachable.
Joerg Sonnenberger [Tue, 29 Oct 2019 00:08:11 +0000 (01:08 +0100)]
Replace abort with llvm_unreachable.

The former depended on header pollution to be found and doesn't fit the
LLVM style of error handling.

4 years agoRecommit "Add a heap alloc site marker field to the ExtraInfo in MachineInstrs"
Amy Huang [Mon, 28 Oct 2019 21:53:32 +0000 (14:53 -0700)]
Recommit "Add a heap alloc site marker field to the ExtraInfo in MachineInstrs"

Summary:
Fixes some things from original commit at https://reviews.llvm.org/D69136. The main
change is that the heap alloc marker is always stored as ExtraInfo in the machine
instruction instead of in the PointerSumType because it cannot hold more than
4 pointer types.

Add instruction marker to MachineInstr ExtraInfo. This does almost the
same thing as Pre/PostInstrSymbols, except that it doesn't create a label until
printing instructions. This allows for labels to be put around instructions that
are deleted/duplicated somewhere.
Use this marker to track heap alloc site call instructions.

Reviewers: rnk

Subscribers: MatzeB, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb] move package generation from python to cmake
Haibo Huang [Wed, 16 Oct 2019 05:22:53 +0000 (22:22 -0700)]
[lldb] move package generation from python to cmake

Summary: This is the last part. And we can remove the python script.

Subscribers: lldb-commits, mgorny

Tags: #lldb

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

4 years agoModernize TestThreadStepOut.py
Jim Ingham [Mon, 28 Oct 2019 23:15:09 +0000 (16:15 -0700)]
Modernize TestThreadStepOut.py

This test was timing out on the swift CI bots.  I didn't see any obvious reason
for that, and the test hasn't had problems on greendragon.  OTOH, it was a bit
oddly written, and needed modernizing, so I did that.

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

4 years ago[AArch64][GlobalISel] Fix assertion fail in C++ selection for vector zext of <4 x s8>
Amara Emerson [Mon, 28 Oct 2019 00:04:47 +0000 (17:04 -0700)]
[AArch64][GlobalISel] Fix assertion fail in C++ selection for vector zext of <4 x s8>

We bailed out of dealing with vectors only after the assertion, move it before.

Fixes PR43794

4 years ago[debugserver] Detect arch from LLVM_DEFAULT_TARGET_TRIPLE
Vedant Kumar [Mon, 28 Oct 2019 18:35:36 +0000 (11:35 -0700)]
[debugserver] Detect arch from LLVM_DEFAULT_TARGET_TRIPLE

The debugserver build needs to conditionally include files depending on the
target architecture.

Switch on the architecture specified by LLVM_DEFAULT_TARGET_TRIPLE, as
the llvm and swift build systems use this variable to identify the
target (the latter, indirectly, through LLVM_HOST_TRIPLE).

It would be possible to switch on CMAKE_OSX_ARCHITECTURES, but the swift
build does not provide it, preferring instead to pass arch-specific
CFLAGS etc explicitly. Switching on LLVM_HOST_TRIPLE is also an option,
but it breaks down when cross-compiling.

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

4 years ago[Builtins] Teach Clang about memccpy
Dávid Bolvanský [Sun, 27 Oct 2019 14:57:54 +0000 (15:57 +0100)]
[Builtins] Teach Clang about memccpy

Summary: Hopefully, -fno-builtin-memccpy will work now. Required for https://reviews.llvm.org/D67986.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: RKSimon, kristina, cfe-commits

Tags: #clang

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

4 years ago[PowerPC] Do not emit HW loop if the body contains calls to lrint/lround
Nemanja Ivanovic [Mon, 28 Oct 2019 21:08:30 +0000 (16:08 -0500)]
[PowerPC] Do not emit HW loop if the body contains calls to lrint/lround

These two intrinsics are lowered to calls so should prevent the formation of
CTR loops. In a subsequent patch, we will handle all currently known intrinsics
and prevent the formation of HW loops if any unknown intrinsics are encountered.

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

4 years agoRevert "[clang] Add no_builtin attribute"
Vlad Tsyrklevich [Mon, 28 Oct 2019 22:21:38 +0000 (15:21 -0700)]
Revert "[clang] Add no_builtin attribute"

This reverts commit bd87916109483d33455cbf20da2309197b983cdd. It was
causing ASan/MSan failures on the sanitizer buildbots.

4 years ago[scudo][standalone] Lists fix
Kostya Kortchinsky [Mon, 28 Oct 2019 22:06:10 +0000 (15:06 -0700)]
[scudo][standalone] Lists fix

Summary:
Apparently during the review of D69265, and my flailing around with
git, a somewhat important line disappeared.

On top of that, there was no test exercising that code path, and
while writing the follow up patch I intended to write, some `CHECK`s
were failing.

Re-add the missing line, and add a test that fails without said line.

Reviewers: hctim, morehouse, pcc, cferris

Reviewed By: hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[NFCI][XCOFF][AIX] Skip empty Section during object file generation
jasonliu [Mon, 28 Oct 2019 21:46:22 +0000 (21:46 +0000)]
[NFCI][XCOFF][AIX] Skip empty Section during object file generation

This is a fix to D69112 where we common up the logic of writing CsectGroup.
However, we forget to skip the Sections that are empty in that patch.

Reviewed by: daltenty, xingxue

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

4 years ago[Docs] Repurpose 'sources' page as 'contributing'.
Jonas Devlieghere [Mon, 28 Oct 2019 22:01:27 +0000 (15:01 -0700)]
[Docs] Repurpose 'sources' page as 'contributing'.

The page describing how to get the sources was more about contributing
to LLDB than getting the actual source. This patch moves some things
around and repurposes this page as a contributing to LLDB landing page.

4 years agoRevert "[Concepts] Constraint Enforcement & Diagnostics"
Vlad Tsyrklevich [Mon, 28 Oct 2019 21:36:31 +0000 (14:36 -0700)]
Revert "[Concepts] Constraint Enforcement & Diagnostics"

This reverts commit ffa214ef22892d75340dc6720271863901dc2c90, it was
causing ASAN test failures on sanitizer-x86_64-linux-bootstrap.

4 years ago[MachineOutliner][NFC] clang-formating the MachineOutliner.
Puyan Lotfi [Mon, 28 Oct 2019 21:57:51 +0000 (17:57 -0400)]
[MachineOutliner][NFC] clang-formating the MachineOutliner.

4 years agoRevert "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"
Reid Kleckner [Mon, 28 Oct 2019 21:40:17 +0000 (14:40 -0700)]
Revert "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"

This reverts commit 9d4806a387892972fd544c0dcaefb0926126220c.

There seem to be bugs in llvm-cov --path-equivalence that are causing
Chromium problems. Revert this until they are understood or fixed.

4 years agoAdd support for DW_AT_export_symbols for anonymous structs
shafik [Mon, 28 Oct 2019 21:26:54 +0000 (14:26 -0700)]
Add support for DW_AT_export_symbols for anonymous structs

Summary:
We add support for DW_AT_export_symbols to detect anonymous struct on top of the heuristics implemented in D66175
This should allow us to differentiate anonymous structs and unnamed structs.
We also fix TestTypeList.py which was incorrectly detecting an unnamed struct as an anonymous struct.

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

4 years ago[Driver] Enable ShadowCallStack, not SafeStack, by default on AArch64 Fuchsia
Leonard Chan [Mon, 28 Oct 2019 21:19:38 +0000 (14:19 -0700)]
[Driver] Enable ShadowCallStack, not SafeStack, by default on AArch64 Fuchsia

Submitted for mcgrathr.

On AArch64, Fuchsia fully supports both SafeStack and ShadowCallStack ABIs.
The latter is now preferred and will be the default. It's possible to
enable both simultaneously, but ShadowCallStack is believed to have most
of the practical benefit of SafeStack with less cost.

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

4 years ago[lit] Refactor merging of user parameters
Julian Lettner [Thu, 21 Feb 2019 06:54:38 +0000 (22:54 -0800)]
[lit] Refactor merging of user parameters

4 years ago[NVPTX] Added llvm.nvvm.mma.m8n8k4.* intrinsics
Artem Belevich [Tue, 22 Oct 2019 21:07:15 +0000 (14:07 -0700)]
[NVPTX] Added llvm.nvvm.mma.m8n8k4.* intrinsics

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

4 years ago[hwasan] Fix typo in the error type.
Evgenii Stepanov [Mon, 28 Oct 2019 20:00:40 +0000 (13:00 -0700)]
[hwasan] Fix typo in the error type.

"alocation-tail-overwritten" -> "allocation-tail-overwritten"

4 years ago[LLDB] Remove incorrect dotest.py invocation
Jonas Devlieghere [Mon, 28 Oct 2019 20:14:47 +0000 (13:14 -0700)]
[LLDB] Remove incorrect dotest.py invocation

The invocation shown by dotest.py to re-run a single test is misleading:
it ranges from missing arguments (best case scenario) to being totally
wrong (worst case scenario).

In the past I've tried to get it right, but given the dotest
architecture this is harder than it looks. Furthermore, we have pretty
good documentation on the website [1] for most use cases.

This patch removes the rerun invocation.

[1] https://lldb.llvm.org/resources/test.html

4 years ago[Remarks] Fix Sphinx formatting
Francis Visoiu Mistrih [Mon, 28 Oct 2019 20:13:39 +0000 (13:13 -0700)]
[Remarks] Fix Sphinx formatting

4 years ago[Remarks] Add bitstream to the list of supported formats in clang
Francis Visoiu Mistrih [Mon, 28 Oct 2019 20:07:05 +0000 (13:07 -0700)]
[Remarks] Add bitstream to the list of supported formats in clang

4 years ago[PGO][PGSO] SizeOpts changes.
Hiroshi Yamauchi [Mon, 28 Oct 2019 19:35:34 +0000 (12:35 -0700)]
[PGO][PGSO] SizeOpts changes.

Summary:
(Split of off D67120)

SizeOpts/MachineSizeOpts changes for profile guided size optimization.

(A second try after previously committed as r375254 and reverted as r375375.)

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Remarks] Remove references to ELF support
Francis Visoiu Mistrih [Mon, 28 Oct 2019 18:14:48 +0000 (11:14 -0700)]
[Remarks] Remove references to ELF support

There is no ELF support at the moment.

Remove all the references to the `.remarks` section.

4 years ago[Remarks] Emit the remarks section by default for certain formats
Francis Visoiu Mistrih [Mon, 28 Oct 2019 18:10:07 +0000 (11:10 -0700)]
[Remarks] Emit the remarks section by default for certain formats

Emit a remarks section by default for the following formats:

* bitstream
* yaml-strtab

while still providing -remarks-section=<bool> to override the defaults.

4 years ago[MachineOuliner][NFC] Refactoring code to make outline rerunning a cleaner diff.
Puyan Lotfi [Mon, 28 Oct 2019 19:10:21 +0000 (15:10 -0400)]
[MachineOuliner][NFC] Refactoring code to make outline rerunning a cleaner diff.

I want to add the ability to rerun the outliner in certain cases, and I
thought this could be an NFC change that could make a subsequent change
that allows for rerunning the outliner a cleaner diff.

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

4 years ago[ARM][Thumb2InstrInfo] Fix default `0` opcode when rewriting frame indices
David Tellenbach [Mon, 28 Oct 2019 18:57:53 +0000 (18:57 +0000)]
[ARM][Thumb2InstrInfo] Fix default `0` opcode when rewriting frame indices

The static functions `positiveOffsetOpcode`, `negativeOffsetOpcode` and
`immediateOffsetOpcode` (lib/Target/ARM/Thumb2InstrInfo.cpp) currently can
return `0` as default opcode which is meaningless in this situation.

This patch replaces this default value by llvm_unreachable.

Reviewers: t.p.northover, tellenbach

Reviewed By: tellenbach

Subscribers: tellenbach, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

Patch By: Lorenzo Casalino <lorenzo.casalino93@gmail.com>

4 years agoConvert files added in d157a9bc8ba1 to unix line endings.
Nico Weber [Mon, 28 Oct 2019 18:39:45 +0000 (14:39 -0400)]
Convert files added in d157a9bc8ba1 to unix line endings.

Ran:
    git show  --diff-filter=A --stat d157a9bc8ba1 | grep '|' | \
    awk '{ print $1 }' | xargs dos2unix

4 years ago[ConstantFold] Fold extractelement of getelementptr
Jay Foad [Thu, 24 Oct 2019 12:15:45 +0000 (13:15 +0100)]
[ConstantFold] Fold extractelement of getelementptr

Summary:
Getelementptr has vector type if any of its operands are vectors
(the scalar operands being implicitly broadcast to all vector elements).
Extractelement applied to a vector getelementptr can be folded by
applying the extractelement in turn to all of the vector operands.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoLexer::ReadToEndOfLine - fix Token uninitialised value warnings. NFCI.
Simon Pilgrim [Mon, 28 Oct 2019 18:28:03 +0000 (18:28 +0000)]
Lexer::ReadToEndOfLine - fix Token uninitialised value warnings. NFCI.

Use Token::startToken to initialize Token.

4 years ago[X86] Add a DAG combine to turn (and (bitcast (vXi1 (concat_vectors (vYi1 setcc)...
Craig Topper [Mon, 28 Oct 2019 18:10:49 +0000 (11:10 -0700)]
[X86] Add a DAG combine to turn (and (bitcast (vXi1 (concat_vectors (vYi1 setcc), undef,))), C) into (bitcast (vXi1 (concat_vectors (vYi1 setcc), zero,)))

The legalization of v2i1->i2 or v4i1->i4 bitcasts followed by a setcc can create an and after the bitcast. If we're lucky enough that the input to the bitcast is a concat_vectors where the first operand is a setcc that can natively 0 all the upper bits of ak-register, then we should replace the other operands of the concat_vectors with zero in order to remove the AND.

With the AND removed we might be able to use a kortest on the result.

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

4 years agogn build: (manually) merge d157a9bc
Nico Weber [Mon, 28 Oct 2019 18:17:07 +0000 (14:17 -0400)]
gn build: (manually) merge d157a9bc

While here, also merge r335850 / r366396.

4 years ago[Docs] Update source code link to Github
Jonas Devlieghere [Mon, 28 Oct 2019 18:14:49 +0000 (11:14 -0700)]
[Docs] Update source code link to Github

4 years ago[lit] Remove redundant comments from main function
Julian Lettner [Thu, 21 Feb 2019 06:19:52 +0000 (22:19 -0800)]
[lit] Remove redundant comments from main function

Hopefully the functionality is now clear due to the use of small,
well-named helper functions.

4 years ago[IR] Use UnaryOperator::CreateFNeg in NoFolder::createFNeg
Craig Topper [Mon, 28 Oct 2019 18:01:16 +0000 (11:01 -0700)]
[IR] Use UnaryOperator::CreateFNeg in NoFolder::createFNeg

If IRBuilder is constructed using the NoFolder constant folder, we should use the Unary FNeg to match the non-constant part of IRBuilder.

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

4 years agoReland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)
Sander de Smalen [Mon, 28 Oct 2019 09:49:48 +0000 (09:49 +0000)]
Reland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)

Fixed up test/DebugInfo/MIR/Mips/live-debug-values-reg-copy.mir that
broke r375425.

4 years ago[LV] Interleaving should not exceed estimated loop trip count.
Craig Topper [Mon, 28 Oct 2019 17:11:20 +0000 (10:11 -0700)]
[LV] Interleaving should not exceed estimated loop trip count.

Currently we may do iterleaving by more than estimated trip count
coming from the profile or computed maximum trip count. The solution is to
use "best known" trip count instead of exact one in interleaving analysis.

Patch by Evgeniy Brevnov.

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

4 years agoAdd missing lld checks in sanitizer tests.
Evgenii Stepanov [Mon, 28 Oct 2019 17:21:01 +0000 (10:21 -0700)]
Add missing lld checks in sanitizer tests.

Do not add an lld dependency when this target does not exist. In this
case the system installation of lld is used (or whatever is detected
with -fuse-ld=lld by default).

4 years ago[OPENMP]Fix PR43771: Do not capture contexprs variables.
Alexey Bataev [Fri, 25 Oct 2019 20:35:32 +0000 (16:35 -0400)]
[OPENMP]Fix PR43771: Do not capture contexprs variables.

If the variable is a constexpr variable, it should not be captured in the OpenMP region.

4 years ago[utils] InlineFunction: fix for debug info affecting optimizations
Bjorn Pettersson [Mon, 28 Oct 2019 16:34:52 +0000 (17:34 +0100)]
[utils] InlineFunction: fix for debug info affecting optimizations

Summary:
Debug info affects output from "opt -inline", InlineFunction could
not handle the llvm.dbg.value when it exist between alloca
instructions.

Problem was that the first alloca in a sequence of allocas was
handled differently from the subsequence alloca instructions. Now
all static alloca instructions are treated the same (being removed
if the have no uses). So it does not matter if there are dbg
instructions (or any other instructions) in between.

Fix the issue: https://bugs.llvm.org/show_bug.cgi?id=43291k

Patch by: yechunliang (Chris Ye)

Reviewers: bjope, jmorse, vsk, probinson, jdoerfert, mtrofin, aprantl, fhahn

Reviewed By: bjope

Subscribers: uabelho, ormris, aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAMDGPU: Avoid overwriting saved PC
Austin Kerbow [Mon, 28 Oct 2019 16:39:20 +0000 (09:39 -0700)]
AMDGPU: Avoid overwriting saved PC

Summary:
An outstanding load with same destination sgpr as call could cause PC to be
updated with junk value on return.

Reviewers: arsenm, rampitec

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lit] Make main.py a pure Python module
Julian Lettner [Sat, 26 Oct 2019 01:51:29 +0000 (18:51 -0700)]
[lit] Make main.py a pure Python module

Running it directly as a tool, that is what lit.py is for.

4 years ago[Docs] Disable Python docs when LLDB_DISABLE_PYTHON is set
Jonas Devlieghere [Mon, 28 Oct 2019 16:49:58 +0000 (09:49 -0700)]
[Docs] Disable Python docs when LLDB_DISABLE_PYTHON is set

This leads to a configuration error because we're trying to get a
property that doesn't exist:

get_target_property() called with non-existent target "swig_wrapper"

4 years ago[AIX] Refactor AIX Call Lowering to use CCState. NFCI.
Sean Fertile [Mon, 28 Oct 2019 15:31:26 +0000 (11:31 -0400)]
[AIX] Refactor AIX Call Lowering to use CCState. NFCI.

This patch reworks the AIX call lowering to use CCState. Some defensive errors
are added in this patch to protect from emitting bad code for calling convention
logic that has not been implemented by design. The use of CCState follows the
precedent of other targets and enables the reuse of calling convention logic in
LowerFormalArguments, which will be rewritten to also use CCState in a late
patch.

Patch by Chris Bowler.

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

4 years ago[scudo][standalone] Consolidate lists
Kostya Kortchinsky [Mon, 28 Oct 2019 16:25:04 +0000 (09:25 -0700)]
[scudo][standalone] Consolidate lists

Summary:
This is a clean patch using the last diff of D69265, but using git
instead of svn, since svn went ro and arc was making my life harded
than it needed to be.

I was going to introduce a couple more lists and realized that our
lists are currently a bit all over the place. While we have a singly
linked list type relatively well defined, we are using doubly linked
lists defined on the fly for the stats and for the secondary blocks.

This CL adds a doubly linked list object, reorganizing the singly list
one to extract as much of the common code as possible. We use this
new type in the stats and the secondary. We also reorganize the list
tests to benefit from this consolidation.

There are a few side effect changes such as using for iterator loops
that are, in my opinion, cleaner in a couple of places.

Reviewers: hctim, morehouse, pcc, cferris

Reviewed By: hctim

Subscribers: jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years agoRemove extra ';'. NFCI.
Simon Pilgrim [Mon, 28 Oct 2019 16:31:01 +0000 (16:31 +0000)]
Remove extra ';'. NFCI.

4 years ago[clang] Add no_builtin attribute
Guillaume Chatelet [Wed, 25 Sep 2019 09:31:28 +0000 (11:31 +0200)]
[clang] Add no_builtin attribute

Summary:
This is a follow up on https://reviews.llvm.org/D61634
This patch is simpler and only adds the no_builtin attribute.

Reviewers: tejohnson, courbet, theraven, t.p.northover, jdoerfert

Subscribers: mgrang, cfe-commits

Tags: #clang

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

4 years ago[NFC] Comment endif to test commit access
--global [Mon, 28 Oct 2019 15:53:44 +0000 (08:53 -0700)]
[NFC] Comment endif to test commit access

4 years ago[LiveIntervalUnion] Expose extraction of last index in map for external users
Marcello Maggioni [Mon, 28 Oct 2019 16:15:52 +0000 (09:15 -0700)]
[LiveIntervalUnion] Expose extraction of last index in map for external users

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

4 years ago[InstCombine] Extra combine for uadd_sat
David Green [Sun, 20 Oct 2019 10:28:33 +0000 (11:28 +0100)]
[InstCombine] Extra combine for uadd_sat

This is an extra fold for a canonical form of uadd_sat, as shown in
D68651. It essentially selects uadd from an add and a select.

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

4 years agoAdd Windows Control Flow Guard checks (/guard:cf).
Andrew Paverd [Mon, 28 Oct 2019 13:22:19 +0000 (13:22 +0000)]
Add Windows Control Flow Guard checks (/guard:cf).

Summary:
A new function pass (Transforms/CFGuard/CFGuard.cpp) inserts CFGuard checks on
indirect function calls, using either the check mechanism (X86, ARM, AArch64) or
or the dispatch mechanism (X86-64). The check mechanism requires a new calling
convention for the supported targets. The dispatch mechanism adds the target as
an operand bundle, which is processed by SelectionDAG. Another pass
(CodeGen/CFGuardLongjmp.cpp) identifies and emits valid longjmp targets, as
required by /guard:cf. This feature is enabled using the `cfguard` CC1 option.

Reviewers: thakis, rnk, theraven, pcc

Subscribers: ychen, hans, metalcanine, dmajor, tomrittervg, alex, mehdi_amini, mgorny, javed.absar, kristof.beyls, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[AArch64] Fix unannotated fall-through between switch labels
Jinsong Ji [Mon, 28 Oct 2019 15:03:07 +0000 (15:03 +0000)]
[AArch64] Fix unannotated fall-through between switch labels

This is breaking buildbot with -Werror,-Wimplicit-fallthrough on.
eg:
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/6881

4 years agoPrecommit AArch64 test for -consider-local-interval-cost
Sanne Wouda [Mon, 28 Oct 2019 11:40:45 +0000 (11:40 +0000)]
Precommit AArch64 test for -consider-local-interval-cost

Summary:
Precommitting this test makes it more obvious what the delta is of enabling
-consider-local-interval-cost in D69437.

Reviewers: dmgreen

Subscribers: kristof.beyls, llvm-commits

Tags: #llvm

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

4 years ago[LIBOMPTARGET]Fix build, NFC.
Alexey Bataev [Mon, 28 Oct 2019 14:39:49 +0000 (10:39 -0400)]
[LIBOMPTARGET]Fix build, NFC.

Need to include nvptx_interface.h in target_impl.h, otherwise the build
is failed because of missing __kmpc_impl_lanemask_t type.

4 years agolld/COFF: Simplify getOutputPath() using sys::path functions.
Nico Weber [Mon, 28 Oct 2019 14:35:56 +0000 (10:35 -0400)]
lld/COFF: Simplify getOutputPath() using sys::path functions.

Also mention "basename" and "dirname" in Path.h since I tried
to find these functions by looking for these strings. It might
help others find them faster if the comments contain these strings.

No behavior change.

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

4 years ago[DebugInfo] MachineSink: find more DBG_VALUEs to sink
Jeremy Morse [Mon, 28 Oct 2019 14:23:50 +0000 (14:23 +0000)]
[DebugInfo] MachineSink: find more DBG_VALUEs to sink

In the Pre-RA machine sinker, previously we were relying on all DBG_VALUEs
being immediately after the instruction that defined their operands. This
isn't a valid assumption, as a variable location change doesn't
necessarily correspond to where the value is computed. In this patch, we
collect DBG_VALUEs that might need sinking as we walk through a block,
and sink all of them if their defining instruction is sunk.

This patch adds some copy propagation too, so that if we sink a copy inst,
the now non-dominated paths can use the copy source for the variable
location.

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

4 years ago[DAGCombiner] widen any_ext of popcount based on target support
Sanjay Patel [Mon, 28 Oct 2019 14:04:30 +0000 (10:04 -0400)]
[DAGCombiner] widen any_ext of popcount based on target support

This enhances D69127 (rGe6c145e0548e3b3de6eab27e44e1504387cf6b53)
to handle the looser "any_extend" cast in addition to zext.

This is a prerequisite step for canonicalizing in the other direction
(narrow the popcount) in IR - PR43688:
https://bugs.llvm.org/show_bug.cgi?id=43688

4 years ago[AArch64][Builtins] Avoid unnecessary cache cleaning
Bryan Chan [Mon, 28 Oct 2019 13:52:28 +0000 (09:52 -0400)]
[AArch64][Builtins] Avoid unnecessary cache cleaning

Use new control bits CTR_EL0.DIC and CTR_EL0.IDC to discover the d-cache
cleaning and i-cache invalidation requirements for instruction-to-data
coherence. This matches the behavior in the latest libgcc.

Author: Shaokun Zhang <zhangshaokun@hisilicon.com>

Reviewed By: peter.smith

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

4 years ago[InstCombine][NFC] Tests for uadd.sat and sadd.sat canonicalisation.
David Green [Mon, 21 Oct 2019 08:11:29 +0000 (09:11 +0100)]
[InstCombine][NFC] Tests for uadd.sat and sadd.sat canonicalisation.

4 years ago[clangd] Do not report anonymous entities in findExplicitReferences
Ilya Biryukov [Mon, 28 Oct 2019 13:41:06 +0000 (14:41 +0100)]
[clangd] Do not report anonymous entities in findExplicitReferences

Summary:
Otherwise every client dealing with name location should handle
anonymous names in a special manner.

This seems too error-prone, clients can probably handle anonymous
entities they care about differently.

Reviewers: hokein

Reviewed By: hokein

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[CVP] prevent propagating poison when substituting edge values into a phi (PR43802)
Sanjay Patel [Mon, 28 Oct 2019 12:56:23 +0000 (08:56 -0400)]
[CVP] prevent propagating poison when substituting edge values into a phi (PR43802)

This phi simplification transform was added with:
D45448

However as shown in PR43802:
https://bugs.llvm.org/show_bug.cgi?id=43802

...we must be careful not to propagate poison when we do the substitution.
There might be some more complicated analysis possible to retain the overflow flag,
but it should always be safe and easy to drop flags (we have similar behavior in
instcombine and other passes).

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

4 years ago[DebugInfo] MachineSink: Insert undef DBG_VALUEs when sinking instructions
Jeremy Morse [Mon, 28 Oct 2019 12:11:03 +0000 (12:11 +0000)]
[DebugInfo] MachineSink: Insert undef DBG_VALUEs when sinking instructions

When we sink DBG_VALUEs between blocks, we simply move the DBG_VALUE
instruction to below the sunk instruction. However, we should also mark
the variable as being undef at the original location, to terminate any
earlier variable location. This patch does that -- plus, if the
instruction being sunk is a copy, it attempts to propagate the copy
through the DBG_VALUE, replacing the destination with the source.

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

4 years ago[AMDGPU][MC][GFX10] Added v_interp_[p1/p2/mov]_f32_e64
Dmitry Preobrazhensky [Mon, 28 Oct 2019 12:03:43 +0000 (15:03 +0300)]
[AMDGPU][MC][GFX10] Added v_interp_[p1/p2/mov]_f32_e64

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

Reviewers: arsenm, rampitec

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

4 years ago[Codegen][ARM] Add float softening for cbrt
David Green [Wed, 23 Oct 2019 16:08:21 +0000 (17:08 +0100)]
[Codegen][ARM] Add float softening for cbrt

We would previously have no soft-float softening for cbrt, so could hit
a crash failing to select. This fills in what appears to be missing.

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

4 years agominor doc typo fix / testing github commit
Rafael Stahl [Mon, 28 Oct 2019 11:07:00 +0000 (12:07 +0100)]
minor doc typo fix / testing github commit