platform/upstream/llvm.git
6 years agoImplement LWG3035: std::allocator's constructors should be constexpr.
Marshall Clow [Tue, 20 Mar 2018 23:02:53 +0000 (23:02 +0000)]
Implement LWG3035: std::allocator's constructors should be constexpr.

llvm-svn: 328059

6 years ago[MustExecute] Shwo the effect of using full loop info variant
Philip Reames [Tue, 20 Mar 2018 23:00:54 +0000 (23:00 +0000)]
[MustExecute] Shwo the effect of using full loop info variant

Most basic possible test for the logic used by LICM.

Also contains a speculative build fix for compiles which complain about a definition of a stuct K; followed by a declaration as class K;

llvm-svn: 328058

6 years ago[WebAssembly] Update torture compile test expectations
Derek Schuff [Tue, 20 Mar 2018 23:00:13 +0000 (23:00 +0000)]
[WebAssembly] Update torture compile test expectations

The tests compile after r328049

llvm-svn: 328057

6 years ago[MustExecute] Add simplest possible test for LoopSafetyOnfo
Philip Reames [Tue, 20 Mar 2018 22:55:20 +0000 (22:55 +0000)]
[MustExecute] Add simplest possible test for LoopSafetyOnfo

(Currently showing without, will enable and check in diff to show impact)

llvm-svn: 328056

6 years ago[MustExecute] Move isGuaranteedToExecute and related rourtines to Analysis
Philip Reames [Tue, 20 Mar 2018 22:45:23 +0000 (22:45 +0000)]
[MustExecute] Move isGuaranteedToExecute and related rourtines to Analysis

Next step is to actually merge the implementations and get both implementations tested through the new printer.

llvm-svn: 328055

6 years agoImplement LWG 3039 and 3041 - 'Treating Unnecessary decay'.
Marshall Clow [Tue, 20 Mar 2018 22:37:37 +0000 (22:37 +0000)]
Implement LWG 3039 and 3041 - 'Treating Unnecessary decay'.

llvm-svn: 328054

6 years ago[Modules] Honor -fmodule-name when handling private framework modules
Bruno Cardoso Lopes [Tue, 20 Mar 2018 22:36:39 +0000 (22:36 +0000)]
[Modules] Honor -fmodule-name when handling private framework modules

When skipping building the module for a private framework module,
LangOpts.CurrentModule isn't enough for implict modules builds; for
instance, in case a private module is built while building a public one,
LangOpts.CurrentModule doesn't reflect the -fmodule-name being passed
down, but instead the module name which triggered the build.

Store the actual -fmodule-name in LangOpts.ModuleName and actually
check a name was provided during compiler invocation in order to
skip building the private module.

rdar://problem/38434694

llvm-svn: 328053

6 years ago[SchedModel] Simplify InstRegexOp::apply. NFCI.
Simon Pilgrim [Tue, 20 Mar 2018 22:20:28 +0000 (22:20 +0000)]
[SchedModel] Simplify InstRegexOp::apply. NFCI.

As discussed on D44687, there was no need for 2 separate for loops for collecting the Regex and then matching against instructions.

llvm-svn: 328052

6 years agoChange ImplicitConverionKind comments to refer to C++ stable names[NFC]
Erich Keane [Tue, 20 Mar 2018 22:05:01 +0000 (22:05 +0000)]
Change ImplicitConverionKind comments to refer to C++ stable names[NFC]

llvm-svn: 328051

6 years agoDelete BuiltinCC. NFC.
Rafael Espindola [Tue, 20 Mar 2018 22:02:57 +0000 (22:02 +0000)]
Delete BuiltinCC. NFC.

It is always identical to RuntimeCC.

llvm-svn: 328050

6 years ago[WebAssembly] Strip threadlocal attribute from globals in single thread mode
Derek Schuff [Tue, 20 Mar 2018 22:01:32 +0000 (22:01 +0000)]
[WebAssembly] Strip threadlocal attribute from globals in single thread mode

The default thread model for wasm is single, and in this mode thread-local
global variables can be lowered identically to non-thread-local variables.

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

llvm-svn: 328049

6 years agoAdd CHECKs for a few declarations. NFC.
Rafael Espindola [Tue, 20 Mar 2018 21:54:14 +0000 (21:54 +0000)]
Add CHECKs for a few declarations. NFC.

We were just missing test coverage for this.

llvm-svn: 328048

6 years ago[format] Eliminate global destructors.
Benjamin Kramer [Tue, 20 Mar 2018 21:52:19 +0000 (21:52 +0000)]
[format] Eliminate global destructors.

llvm-svn: 328047

6 years agoRead OMP_TARGET_OFFLOAD and provide API to access ICV
Jonathan Peyton [Tue, 20 Mar 2018 21:18:17 +0000 (21:18 +0000)]
Read OMP_TARGET_OFFLOAD and provide API to access ICV

Added settings code to read OMP_TARGET_OFFLOAD environment variable. Added
target-offload-var ICV as __kmp_target_offload, set via OMP_TARGET_OFFLOAD,
if available, otherwise defaulting to DEFAULT. Valid values for the ICV are
specified as enum values {0,1,2} for disabled, default, and mandatory. An
internal API access function __kmpc_get_target_offload is provided.

Patch by Terry Wilmarth

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

llvm-svn: 328046

6 years ago[X86] Drop unnecessary InstRW overrides for WriteFMA
Simon Pilgrim [Tue, 20 Mar 2018 21:15:23 +0000 (21:15 +0000)]
[X86] Drop unnecessary InstRW overrides for WriteFMA

As noticed on D44687, these already match the WriteFMA def so can be removed.

llvm-svn: 328045

6 years ago[Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 20 Mar 2018 21:08:59 +0000 (21:08 +0000)]
[Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 328044

6 years ago[ReachingDefAnalysis] Fix what I assume to be a typo ReachingDedDefaultVal->ReachingD...
Craig Topper [Tue, 20 Mar 2018 20:53:21 +0000 (20:53 +0000)]
[ReachingDefAnalysis] Fix what I assume to be a typo ReachingDedDefaultVal->ReachingDefDefaultVal.

Unless Ded has some many I don't know about.

llvm-svn: 328043

6 years ago[ObjCARC] Add funclet token to ARC marker
Shoaib Meenai [Tue, 20 Mar 2018 20:45:41 +0000 (20:45 +0000)]
[ObjCARC] Add funclet token to ARC marker

The inline assembly generated for the ARC autorelease elision marker
must have a funclet token if it's emitted inside a funclet, otherwise
the inline assembly (and all subsequent code in the funclet) will be
marked unreachable by WinEHPrepare.

Note that this only applies for the non-O0 case, since at O0, clang
emits the autorelease elision marker itself rather than deferring to the
backend. The fix for clang is handled in a separate change.

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

llvm-svn: 328042

6 years ago[format] Initialize regex lazily
Benjamin Kramer [Tue, 20 Mar 2018 20:43:12 +0000 (20:43 +0000)]
[format] Initialize regex lazily

No need to pay for this on program startup, and also no need to destroy
it on process end.

llvm-svn: 328041

6 years agoSet dso_local on string literals.
Rafael Espindola [Tue, 20 Mar 2018 20:42:55 +0000 (20:42 +0000)]
Set dso_local on string literals.

llvm-svn: 328040

6 years ago[X86] Don't use the MSVC stack protector names on mingw
Martin Storsjo [Tue, 20 Mar 2018 20:37:51 +0000 (20:37 +0000)]
[X86] Don't use the MSVC stack protector names on mingw

Mingw uses the same stack protector functions as GCC provides
on other platforms as well.

Patch by Valentin Churavy!

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

llvm-svn: 328039

6 years ago[AArch64] Add vmulxh_lane fp16 vector intrinsic
Abderrazek Zaafrani [Tue, 20 Mar 2018 20:37:31 +0000 (20:37 +0000)]
[AArch64] Add vmulxh_lane fp16 vector intrinsic

https://reviews.llvm.org/D44591

llvm-svn: 328038

6 years agoFor llvm-objdump and Mach-O files, fix the printing of module init and
Kevin Enderby [Tue, 20 Mar 2018 20:29:52 +0000 (20:29 +0000)]
For llvm-objdump and Mach-O files, fix the printing of module init and
term sections from .o files to look to see if the pointers have a relocation
entry and if so print the symbol name from the relocation entry.  If not fall
back to the existing code and use the pointer value to look up that value
in the symbol table.

rdar://38337506

llvm-svn: 328037

6 years agoSet dso_local for runtime function.
Rafael Espindola [Tue, 20 Mar 2018 20:27:30 +0000 (20:27 +0000)]
Set dso_local for runtime function.

This is another case where there is special logic for adding dllimport
and so we cannot use setGVProperties.

llvm-svn: 328036

6 years ago[AArch64] Add vmulxh_lane fp16 vector intrinsic
Abderrazek Zaafrani [Tue, 20 Mar 2018 20:25:40 +0000 (20:25 +0000)]
[AArch64] Add vmulxh_lane fp16 vector intrinsic

https://reviews.llvm.org/D44591

llvm-svn: 328035

6 years ago[TableGen] Use range based for loop. NFC
Craig Topper [Tue, 20 Mar 2018 20:24:16 +0000 (20:24 +0000)]
[TableGen] Use range based for loop. NFC

llvm-svn: 328034

6 years ago[TableGen] Use vector::append instead of looping and calling push_back. NFC
Craig Topper [Tue, 20 Mar 2018 20:24:14 +0000 (20:24 +0000)]
[TableGen] Use vector::append instead of looping and calling push_back. NFC

Both vectors contain unsigned so we can just use append to do the copying. Not only is this shorter, but it should be able to predict the final size and only grow the vector once if needed.

llvm-svn: 328033

6 years ago[TableGen] Use llvm::transform to simplify some loops. NFCI
Craig Topper [Tue, 20 Mar 2018 20:24:12 +0000 (20:24 +0000)]
[TableGen] Use llvm::transform to simplify some loops. NFCI

llvm-svn: 328032

6 years ago[TableGen] Pass result of std::unique to vector::erase instead of calculating a size...
Craig Topper [Tue, 20 Mar 2018 20:24:10 +0000 (20:24 +0000)]
[TableGen] Pass result of std::unique to vector::erase instead of calculating a size and calling resize.

llvm-svn: 328031

6 years ago[DEBUGINFO] Add -no-dwarf-debug-ranges option.
Alexey Bataev [Tue, 20 Mar 2018 20:21:38 +0000 (20:21 +0000)]
[DEBUGINFO] Add -no-dwarf-debug-ranges option.

Summary:
Added option -no-dwarf-debug-ranges option to disable emission of
.debug_ranges section.

Reviewers: probinson, echristo

Subscribers: aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 328030

6 years ago[llvm-mca] add keyword override to a couple of methods in BackendStatistics.
Andrea Di Biagio [Tue, 20 Mar 2018 20:18:36 +0000 (20:18 +0000)]
[llvm-mca] add keyword override to a couple of methods in BackendStatistics.

This should fix the buildbots after r328011.

llvm-svn: 328029

6 years ago[WebAssembly] Added initial AsmParser implementation.
Derek Schuff [Tue, 20 Mar 2018 20:06:35 +0000 (20:06 +0000)]
[WebAssembly] Added initial AsmParser implementation.

It uses the MC framework and the tablegen matcher to do the
heavy lifting. Can handle both explicit and implicit locals
(-disable-wasm-explicit-locals). Comes with a small regression
test.

This is a first basic implementation that can parse most llvm .s
output and round-trips most instructions succesfully, but in order
to keep the commit small, does not address all issues.

There are a fair number of mismatches between what MC / assembly
matcher think a "CPU" should look like and what WASM provides,
some already have workarounds in this commit (e.g. the way it
deals with register operands) and some that require further work.
Some of that further work may involve changing what the
Disassembler outputs (and what s2wasm parses), so are probably
best left to followups.

Some known things missing:
- Many directives are ignored and not emitted.
- Vararg calls are parsed but extra args not emitted.
- Loop signatures are likely incorrect.
- $drop= is not emitted.
- Disassembler does not output SIMD types correctly, so assembler
  can't test them.

Patch by Wouter van Oortmerssen

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

llvm-svn: 328028

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Tue, 20 Mar 2018 20:00:29 +0000 (20:00 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Fix typo in the number of integer dividers.

llvm-svn: 328027

6 years ago[llvm-objcopy] Revert the tests from r328012
Alexander Shaposhnikov [Tue, 20 Mar 2018 19:50:14 +0000 (19:50 +0000)]
[llvm-objcopy] Revert the tests from r328012

Temporarily revert the tests from r328012 as well.

llvm-svn: 328026

6 years ago[ExpressionParser] Re-implement r327356 in a less disruptive way.
Davide Italiano [Tue, 20 Mar 2018 19:46:32 +0000 (19:46 +0000)]
[ExpressionParser] Re-implement r327356 in a less disruptive way.

Instead of applying the sledgehammer of refusing to insert any
C++ symbol in the ASTContext, try to validate the decl if what
we have is an operator. There was other code in lldb which was
responsible for this, just not really exposed (or used) in this
codepath. Also, add a better/more comprehensive test.

<rdar://problem/35645893>

llvm-svn: 328025

6 years ago[llvm-objcopy] Revert r328012
Alexander Shaposhnikov [Tue, 20 Mar 2018 19:46:00 +0000 (19:46 +0000)]
[llvm-objcopy] Revert r328012

Temporarily revert r328012 (since it broke down the big-endian bots),
will resubmit an updated version later.

llvm-svn: 328024

6 years ago[Hexagon] Add a few more lit tests, NFC
Krzysztof Parzyszek [Tue, 20 Mar 2018 19:35:09 +0000 (19:35 +0000)]
[Hexagon] Add a few more lit tests, NFC

llvm-svn: 328023

6 years ago[Hexagon] Add heuristic to exclude critical path cost for scheduling
Krzysztof Parzyszek [Tue, 20 Mar 2018 19:26:27 +0000 (19:26 +0000)]
[Hexagon] Add heuristic to exclude critical path cost for scheduling

Patch by Brendon Cahoon.

llvm-svn: 328022

6 years ago[Hexagon] Fix fall-through warnings in HexagonMCDuplexInfo.cpp
Krzysztof Parzyszek [Tue, 20 Mar 2018 19:23:18 +0000 (19:23 +0000)]
[Hexagon] Fix fall-through warnings in HexagonMCDuplexInfo.cpp

llvm-svn: 328021

6 years ago[lldb-dotest] Wrap arguments in single quotes
Jonas Devlieghere [Tue, 20 Mar 2018 19:18:11 +0000 (19:18 +0000)]
[lldb-dotest] Wrap arguments in single quotes

If we don't wrap arguments to the wrapper in single quotes, combined
arguments, for example for -E, don't reach dotest.py as a unit but as
separate arguments, causing the latter to fail.

llvm-svn: 328020

6 years ago[MC,X86] Cleanup some X86 parser functions to use MCParser helpers. NFCI.
Nirav Dave [Tue, 20 Mar 2018 19:12:41 +0000 (19:12 +0000)]
[MC,X86] Cleanup some X86 parser functions to use MCParser helpers. NFCI.

llvm-svn: 328019

6 years ago[llvm-mca] Remove const from a bunch of ArrayRef. NFC
Andrea Di Biagio [Tue, 20 Mar 2018 19:06:34 +0000 (19:06 +0000)]
[llvm-mca] Remove const from a bunch of ArrayRef. NFC

llvm-svn: 328018

6 years ago[PowerPC][LegalizeFloatTypes] Move the PPC hacks for (i32 fp_to_sint/fp_to_uint ...
Craig Topper [Tue, 20 Mar 2018 18:49:28 +0000 (18:49 +0000)]
[PowerPC][LegalizeFloatTypes] Move the PPC hacks for (i32 fp_to_sint/fp_to_uint (ppcf128 X)) out of LegalizeFloatTypes and into PPC specific code

I'm not entirely sure these hacks are still needed. If you remove the hacks completely, the name of the library call that gets generated doesn't match the grep the test previously had. So the test wasn't really checking anything.

If the hack is still needed it belongs in PPC specific code. I believe the FP_TO_SINT code here is the only place in the tree where a FP_ROUND_INREG node is created today. And I don't think its even being used correctly because the legalization returned a BUILD_PAIR with the same value twice. That doesn't seem right to me. By moving the code entirely to PPC we can avoid creating the FP_ROUND_INREG at all.

I replaced the grep in the existing test with full checks generated by hacking update_llc_test_check.py to support ppc32 just long enough to generate it.

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

llvm-svn: 328017

6 years ago[X86] Add phony registers for high halves of regs with low halves
Krzysztof Parzyszek [Tue, 20 Mar 2018 18:46:55 +0000 (18:46 +0000)]
[X86] Add phony registers for high halves of regs with low halves

Registers E[A-D]X, E[SD]I, E[BS]P, and EIP have 16-bit subregisters
that cover the low halves of these registers. This change adds artificial
subregisters for the high halves in order to differentiate (in terms of
register units) between the 32- and the low 16-bit registers.

This patch contains parts that aim to preserve the calculated register
pressure. This is in order to preserve the current codegen (minimize the
impact of this patch). The approach of having artificial subregisters
could be used to fix PR23423, but the pressure calculation would need
to be changed.

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

llvm-svn: 328016

6 years ago[MustExecute] Use the annotation style printer
Philip Reames [Tue, 20 Mar 2018 18:43:44 +0000 (18:43 +0000)]
[MustExecute] Use the annotation style printer

As suggested in the original review (https://reviews.llvm.org/D44524), use an annotation style printer instead.

Note: The switch from -analyze to -disable-output in tests was driven by the fact that seems to be the idiomatic style used in annoation passes.  I tried to keep both working, but the old style pass API for printers really doesn't make this easy.  It invokes (runOnFunction, print(Module)) repeatedly.  I decided the extra state wasn't worth it given the old pass manager is going away soonish anyway.
llvm-svn: 328015

6 years agoRevert "Resubmit "Support embedding natvis files in PDBs.""
Zachary Turner [Tue, 20 Mar 2018 18:37:03 +0000 (18:37 +0000)]
Revert "Resubmit "Support embedding natvis files in PDBs.""

This is still failing on a different bot this time due to some
issue related to hashing absolute paths.  Reverting until I can
figure it out.

llvm-svn: 328014

6 years ago[TestExpr] Fix a typo in a test, unbreaking the lldb Mac OS X bot.
Davide Italiano [Tue, 20 Mar 2018 18:32:47 +0000 (18:32 +0000)]
[TestExpr] Fix a typo in a test, unbreaking the lldb Mac OS X bot.

llvm-svn: 328013

6 years ago[llvm-objcopy] Implement support for section groups
Alexander Shaposhnikov [Tue, 20 Mar 2018 18:20:42 +0000 (18:20 +0000)]
[llvm-objcopy] Implement support for section groups

This diff adds support for SHT_GROUP sections to llvm-objcopy.
Some sections are interrelated and comprise a group.
For example, a definition of an inline function might require,
in addition to the section containing its instructions,
a read-only data section containing literals referenced inside the function.
A section of the type SHT_GROUP contains the indices of the group members,
therefore, it needs to be updated whenever the indices change.
Similarly, the fields sh_link, sh_info should be recalculated as well.

Test plan: make check-all

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

llvm-svn: 328012

6 years ago[llvm-mca] Move the logic that computes the scheduler's queue usage to the BackendSta...
Andrea Di Biagio [Tue, 20 Mar 2018 18:20:39 +0000 (18:20 +0000)]
[llvm-mca] Move the logic that computes the scheduler's queue usage to the BackendStatistics view.

This patch introduces two new callbacks in the event listener interface to
handle the "buffered resource reserved" event and the "buffered resource
released" event. Every time a buffered resource is used, an event is generated.

Before this patch, the Scheduler (with the help of the ResourceManager) was
responsible for tracking the scheduler's queue usage. However, that design
forced the Scheduler to 'publish' scheduler's queue pressure information through
the Backend interface.

The goal of this patch is to break the dependency between the BackendStatistics
view, and the Backend. Now the Scheduler knows how to notify "buffer
reserved/released" events.  The scheduler's queue usage analysis has been moved
to the BackendStatistics.

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

llvm-svn: 328011

6 years agoFix consitent -> consistent.
Eric Christopher [Tue, 20 Mar 2018 18:10:30 +0000 (18:10 +0000)]
Fix consitent -> consistent.

llvm-svn: 328010

6 years ago[ELF] Simplify compCtors and writeInt.
Fangrui Song [Tue, 20 Mar 2018 18:07:25 +0000 (18:07 +0000)]
[ELF] Simplify compCtors and writeInt.

Reviewers: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 328009

6 years agoBasic: support PreserveMost and PreserveAll on Windows ARM
Saleem Abdulrasool [Tue, 20 Mar 2018 17:33:26 +0000 (17:33 +0000)]
Basic: support PreserveMost and PreserveAll on Windows ARM

Do not ignore these calling conventions on Windows ARM.  They are used
by the swift runtime for certain calls.

llvm-svn: 328007

6 years ago[NVPTX] Make tensor load/store intrinsics overloaded.
Artem Belevich [Tue, 20 Mar 2018 17:18:59 +0000 (17:18 +0000)]
[NVPTX] Make tensor load/store intrinsics overloaded.

This way we can support address-space specific variants without explicitly
encoding the space in the name of the intrinsic. Less intrinsics to deal with ->
less boilerplate.

Added a bit of tablegen magic to match/replace an intrinsics with a pointer
argument in particular address space with the space-specific instruction
variant.

Updated tests to use non-default address spaces.

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

llvm-svn: 328006

6 years agoAdjust to clang-format changes
Tobias Grosser [Tue, 20 Mar 2018 17:16:32 +0000 (17:16 +0000)]
Adjust to clang-format changes

llvm-svn: 328005

6 years agoAdd an analysis printer for must execute reasoning
Philip Reames [Tue, 20 Mar 2018 17:09:21 +0000 (17:09 +0000)]
Add an analysis printer for must execute reasoning

Many of our loop passes make use of so called "must execute" or "guaranteed to execute" facts to prove the legality of code motion. The basic notion is that we know (by assumption) an instruction didn't fault at it's original location, so if the location we move it to is strictly post dominated by the original, then we can't have introduced a new fault.

At the moment, the testing for this logic is somewhat adhoc and done mostly through LICM. Since I'm working on that code, I want to improve the testing. This patch is the first step in that direction. It doesn't actually test the variant used by the loop passes - I need to move that to the Analysis library first - but instead exercises an alternate implementation used by SCEV. (I plan on merging both implementations.)

Note: I'll be replacing the printing logic within this with an annotation based version in the near future.  Anna suggested this in review, and it seems like a strictly better format.

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

llvm-svn: 328004

6 years agoMC: fix layering violation introduced in r325139.
Rafael Espindola [Tue, 20 Mar 2018 17:07:25 +0000 (17:07 +0000)]
MC: fix layering violation introduced in r325139.

Move AsmToken from MC/MCParser/MCAsmLexer.h into MC/MCAsmMacro.h in
order to avoid MCAsmMacro definition depending on MCParser.

Patch by Roger Pau Monné <royger@freebsd.org>.

llvm-svn: 328003

6 years agoResubmit "Support embedding natvis files in PDBs."
Zachary Turner [Tue, 20 Mar 2018 17:06:39 +0000 (17:06 +0000)]
Resubmit "Support embedding natvis files in PDBs."

The issue causing this to fail in certain configurations
should be fixed.

It was due to the fact that DIA apparently expects there to be
a null string at ID 1 in the string table.  I'm not sure why this
is important but it seems to make a difference, so set it.

llvm-svn: 328002

6 years ago[LangRef] fix link formatting
Sanjay Patel [Tue, 20 Mar 2018 17:05:19 +0000 (17:05 +0000)]
[LangRef] fix link formatting

llvm-svn: 328001

6 years ago[Hexagon] Correct the computation of TopReadyCycle and BotReadyCycle of SU
Krzysztof Parzyszek [Tue, 20 Mar 2018 17:03:27 +0000 (17:03 +0000)]
[Hexagon] Correct the computation of TopReadyCycle and BotReadyCycle of SU

TopReadyCycle and BotReadyCycle were off by one cycle when an SU is either
the first instruction or the last instruction in a packet.

Patch by Ikhlas Ajbar.

llvm-svn: 328000

6 years ago[XRay] Lazily compute MachineLoopInfo instead of requiring it.
Michael Zolotukhin [Tue, 20 Mar 2018 17:02:29 +0000 (17:02 +0000)]
[XRay] Lazily compute MachineLoopInfo instead of requiring it.

Summary:
Currently X-Ray Instrumentation pass has a dependency on MachineLoopInfo
(and thus on MachineDominatorTree as well) and we have to compute them
even if X-Ray is not used. This patch changes it to a lazy computation
to save compile time by avoiding these redundant computations.

Reviewers: dberris, kubamracek

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 327999

6 years ago[LangRef] describe the default FP environment
Sanjay Patel [Tue, 20 Mar 2018 16:38:22 +0000 (16:38 +0000)]
[LangRef] describe the default FP environment

Follow-up for D44216: add a section and examples to describe the FP env.
Also, add pointers from the FP instructions to this new section to reduce
bloat.

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

llvm-svn: 327998

6 years ago[Hexagon] Check weak dependences when only 1 instruction is available
Krzysztof Parzyszek [Tue, 20 Mar 2018 16:22:06 +0000 (16:22 +0000)]
[Hexagon] Check weak dependences when only 1 instruction is available

Patch by Brendon Cahoon.

llvm-svn: 327997

6 years agoMove StringExtractorGDBRemote.h to the include folder
Pavel Labath [Tue, 20 Mar 2018 16:14:00 +0000 (16:14 +0000)]
Move StringExtractorGDBRemote.h to the include folder

While trying to use this header I noticed that it is not in the include
folder. Move it to there and update all #includes to reference that file
correctly.

llvm-svn: 327996

6 years ago[AArch64] add fabs tests for PR36600; NFC
Sanjay Patel [Tue, 20 Mar 2018 16:08:47 +0000 (16:08 +0000)]
[AArch64] add fabs tests for PR36600; NFC

llvm-svn: 327995

6 years ago[DEBUGINFO] Add flag -no-dwarf-pub-sections to disable pub sections.
Alexey Bataev [Tue, 20 Mar 2018 16:04:40 +0000 (16:04 +0000)]
[DEBUGINFO] Add flag -no-dwarf-pub-sections to disable pub sections.

Summary:
Added a flag -no-dwarf-pub-sections, which allows to disable
emission of DWARF public sections.

Reviewers: probinson, echristo

Subscribers: aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 327994

6 years agoSet dso_local for CFConstantStringClassReference.
Rafael Espindola [Tue, 20 Mar 2018 15:48:00 +0000 (15:48 +0000)]
Set dso_local for CFConstantStringClassReference.

This one cannot use setGVProperties since it has special logic for
when it is dllimport or not.

llvm-svn: 327993

6 years ago[X86][Haswell][Znver1] Fix typo in fldl instregexs
Simon Pilgrim [Tue, 20 Mar 2018 15:44:47 +0000 (15:44 +0000)]
[X86][Haswell][Znver1] Fix typo in fldl instregexs

Missing comma was casing 2 instregex entries to be concatenated together by mistake.

Found while investigating PR35548

llvm-svn: 327992

6 years agoSet dso_local for guid decls.
Rafael Espindola [Tue, 20 Mar 2018 15:42:58 +0000 (15:42 +0000)]
Set dso_local for guid decls.

llvm-svn: 327991

6 years ago[OPENMP, NVPTX] Codegen for target distribute parallel combined
Alexey Bataev [Tue, 20 Mar 2018 15:41:05 +0000 (15:41 +0000)]
[OPENMP, NVPTX] Codegen for target distribute parallel combined
constructs in generic mode.

Fixed codegen for distribute parallel combined constructs. We have to
pass and read the shared lower and upper bound from the distribute
region in the inner parallel region. Patch is for generic mode.

llvm-svn: 327990

6 years ago[Kaleidoscope] doc fix
Sjoerd Meijer [Tue, 20 Mar 2018 15:37:15 +0000 (15:37 +0000)]
[Kaleidoscope] doc fix

This fixes the compile command of the example in Chapter 2.

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

llvm-svn: 327989

6 years ago[Hexagon] Improve scheduling heuristic for large basic blocks
Krzysztof Parzyszek [Tue, 20 Mar 2018 14:54:01 +0000 (14:54 +0000)]
[Hexagon] Improve scheduling heuristic for large basic blocks

This patch changes the isLatencyBound heuristic to look at the
path length based upon the number of packets needed to schedule
a basic block. For small basic blocks, the heuristic uses a small
threshold for isLatencyBound. For large basic blocks, the
heuristic uses a large threshold.

The goal is to increase the priority of an instruction in a small
basic block that has a large height or depth relative to the code
size. For large functions, the height and depth are ignored
because it increases the live range of a register and causes more
spills. That is, for large functions, it is more important to
schedule instructions when available, and attempt to keep the defs
and uses closer together.

Patch by Brendon Cahoon.

llvm-svn: 327987

6 years ago[clang-format] Fix ObjC selectors with multiple params passed to macro
Ben Hamilton [Tue, 20 Mar 2018 14:53:25 +0000 (14:53 +0000)]
[clang-format] Fix ObjC selectors with multiple params passed to macro

Summary:
Objective-C selectors with arguments take the form of:

foo:
foo:bar:
foo:bar:baz:

These can be passed to a macro, like NS_SWIFT_NAME():

https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

and must never have spaces inserted around the colons.

Previously, there was logic in TokenAnnotator's tok::colon parser to
handle the single-argument case, but it failed for the
multiple-argument cases.

This diff fixes the bug and adds more tests.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, djasper, Wizard

Reviewed By: jolesiak, Wizard

Subscribers: klimek, cfe-commits

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

llvm-svn: 327986

6 years ago[OPENMP, NVPTX] Globalization of the private redeclarations.
Alexey Bataev [Tue, 20 Mar 2018 14:45:59 +0000 (14:45 +0000)]
[OPENMP, NVPTX] Globalization of the private redeclarations.

If the generic codegen is enabled and private copy of the original
variable escapes the declaration context, this private copy should be
globalized just like it was the original variable.

llvm-svn: 327985

6 years agoBackport changes from llvm/.clang_tidy to clang/.clang_tidy configs
Ilya Biryukov [Tue, 20 Mar 2018 14:39:12 +0000 (14:39 +0000)]
Backport changes from llvm/.clang_tidy to clang/.clang_tidy configs

Summary: LLVM .clang_tidy seems to be more up-to-date.

Reviewers: alexfh, simark

Reviewed By: alexfh

Subscribers: simark, cfe-commits

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

llvm-svn: 327984

6 years ago[ELF] - Make __start_/__stop_<section_name> symbols STV_PROTECTED
George Rimar [Tue, 20 Mar 2018 14:22:10 +0000 (14:22 +0000)]
[ELF] - Make __start_/__stop_<section_name> symbols STV_PROTECTED

There are no reasons for them to be STV_DEFAULT,
recently bfd did the same change.

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

llvm-svn: 327983

6 years ago[AArch64][Falkor] Correct load/store increment scheduling details
Geoff Berry [Tue, 20 Mar 2018 13:46:35 +0000 (13:46 +0000)]
[AArch64][Falkor] Correct load/store increment scheduling details

llvm-svn: 327982

6 years ago[LLDB] Fix TestTargetXMLArch's expected arch
Pavel Labath [Tue, 20 Mar 2018 13:46:05 +0000 (13:46 +0000)]
[LLDB] Fix TestTargetXMLArch's expected arch

Summary:
When running on an architecture other than x86_64, the
target.ConnectRemote() part of the test may add platform information to
the target triple.

It was observed that this happens at Process::CompleteAttach() method,
after the platform_sp->IsCompatibleArchitecture() check fails.
This method then calls platform_sp->GetPlatformForArchitecture(), that
on a Linux machine ends up returning a generic Linux platform, that then
ends up getting added to the original target architecture.

Reviewers: clayborg, labath, jasonmolenda

Reviewed By: labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D44022
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 327981

6 years ago[Hexagon] Fix division by zero in machine scheduler
Krzysztof Parzyszek [Tue, 20 Mar 2018 13:28:46 +0000 (13:28 +0000)]
[Hexagon] Fix division by zero in machine scheduler

llvm-svn: 327980

6 years ago[RISCV] Add codegen for RV32F floating point load/store
Alex Bradbury [Tue, 20 Mar 2018 13:26:12 +0000 (13:26 +0000)]
[RISCV] Add codegen for RV32F floating point load/store

As part of this, add support for load/store from the constant pool. This is
used to materialise f32 constants.

llvm-svn: 327979

6 years ago[llvm-mca] Use llvm::make_unique in a few places. NFC
Andrea Di Biagio [Tue, 20 Mar 2018 12:58:34 +0000 (12:58 +0000)]
[llvm-mca] Use llvm::make_unique in a few places. NFC

Also, clang-format a couple of DEBUG functions.

llvm-svn: 327978

6 years agoFix some tests for PPC64le architecture
Pavel Labath [Tue, 20 Mar 2018 12:46:33 +0000 (12:46 +0000)]
Fix some tests for PPC64le architecture

Summary:
- Fix test jump for powerpc64le
  Jumping directly to the return line on power architecture dos not means
  returning the value that is seen on the code. The last test fails, because
  it needs the execution of some assembly in the beginning of the function.
  Avoiding this test for this architecture.

- Avoid evaluate environ variable name on Linux
  On Linux the Symbol environ conflicts with another variable, then in
  order to avoid it, this test was moved into a specific test, which is not
  supported if the OS is Linux.

- Added PPC64le as MIPS behavior
  Checking the disassembler output, on PPC64le machines behaves as MPIS.
  Added method to identify PPC64le architecture and checking it when
  disassembling instructions in the test case.

Reviewers: labath

Reviewed By: labath

Subscribers: clayborg, labath, luporl, alexandreyy, sdardis, ki.stfu, arichardson

Differential Revision: https://reviews.llvm.org/D44101
Patch by Leonardo Bianconi <leonardo.bianconi@eldorado.org.br>.

llvm-svn: 327977

6 years ago[RISCV] Add codegen for RV32F arithmetic and conversion operations
Alex Bradbury [Tue, 20 Mar 2018 12:45:35 +0000 (12:45 +0000)]
[RISCV] Add codegen for RV32F arithmetic and conversion operations

Currently, only a soft floating point ABI is supported.

llvm-svn: 327976

6 years ago[Hexagon] Improve scheduling based on register pressure
Krzysztof Parzyszek [Tue, 20 Mar 2018 12:28:43 +0000 (12:28 +0000)]
[Hexagon] Improve scheduling based on register pressure

Patch by Brendon Cahoon.

llvm-svn: 327975

6 years ago[X86][SandyBridge] Merge multiple InstrRW entries that map to the same SchedWriteRes...
Simon Pilgrim [Tue, 20 Mar 2018 12:26:55 +0000 (12:26 +0000)]
[X86][SandyBridge] Merge multiple InstrRW entries that map to the same SchedWriteRes group (NFCI) (PR35955)

I've also merged some VEX/non-VEX instregex strings with a (V?) prefix - there are still a lot more of these to do.

llvm-svn: 327974

6 years ago[llvm-mca] Move the routine that computes processor resource masks to its own file.
Andrea Di Biagio [Tue, 20 Mar 2018 12:25:54 +0000 (12:25 +0000)]
[llvm-mca] Move the routine that computes processor resource masks to its own file.

Function computeProcResourceMasks is used by the ResourceManager (owned by the
Scheduler) to compute resource masks for processor resources.  Before this
refactoring, there was an implicit dependency between the Scheduler and the
InstrBuilder. That is because InstrBuilder has to know about resource masks when
computing the set of processor resources consumed by a new instruction.

With this patch, the functionality that computes resource masks has been
extracted from the ResourceManager, and moved to a separate file (Support.h).
This helps removing the dependency between the Scheduler and the InstrBuilder.

No functional change intended.

llvm-svn: 327973

6 years ago[MergeICmps] Break eargerly out of loop
Xin Tong [Tue, 20 Mar 2018 12:03:25 +0000 (12:03 +0000)]
[MergeICmps] Break eargerly out of loop

llvm-svn: 327972

6 years ago[MergeICmp] Fix a bug in entry block shuffled to middle of the chain
Xin Tong [Tue, 20 Mar 2018 11:57:54 +0000 (11:57 +0000)]
[MergeICmp] Fix a bug in entry block shuffled to middle of the chain

Summary: Fix a bug in entry block shuffled to middle of the chain.

Reviewers: davide, courbet

Subscribers: llvm-commits

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

llvm-svn: 327971

6 years agoRe-land: [lldb] Use vFlash commands when writing to target's flash memory regions
Pavel Labath [Tue, 20 Mar 2018 11:56:24 +0000 (11:56 +0000)]
Re-land: [lldb] Use vFlash commands when writing to target's flash memory regions

The difference between this and the previous patch is that now we use
ELF physical addresses only for loading objects into the target (and the
rest of the module load address logic still uses virtual addresses).

Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region.  A bare metal target may have this kind of setup.

- Update ObjectFileELF to set load addresses using physical addresses.  A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region

Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: llvm-commits, arichardson, emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw <llvm@owenpshaw.net>.

llvm-svn: 327970

6 years ago[llvm-opt-fuzzer] Add irce to the fuzzing options
Igor Laevsky [Tue, 20 Mar 2018 11:32:13 +0000 (11:32 +0000)]
[llvm-opt-fuzzer] Add irce to the fuzzing options

llvm-svn: 327969

6 years agoRevert "Fix layering between llvm-c and Support by factoring out some typedefs into...
Jonas Devlieghere [Tue, 20 Mar 2018 11:26:50 +0000 (11:26 +0000)]
Revert "Fix layering between llvm-c and Support by factoring out some typedefs into Support"

This reverts r327940 because it fails on several GreenDragon bots.

  http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/
  http://green.lab.llvm.org/green/job/clang-stage2-coverage-R/

llvm-svn: 327968

6 years ago[AVR] Add a regression test for struct return lowering
Dylan McKay [Tue, 20 Mar 2018 11:23:03 +0000 (11:23 +0000)]
[AVR] Add a regression test for struct return lowering

The test is taken from
https://github.com/avr-rust/rust/issues/57

The originally implementation of struct return lowering was made in
r325474.

Patch by Peter Nimmervoll

llvm-svn: 327967

6 years agoRevert r327964 "lit: Make config.llvm_libxml2_enabled an int, not a string"
Hans Wennborg [Tue, 20 Mar 2018 10:43:02 +0000 (10:43 +0000)]
Revert r327964 "lit: Make config.llvm_libxml2_enabled an int, not a string"

It seems @LLVM_LIBXML2_ENABLED@ doesn't always get set to 0 when not available,
but to nothing, which broke parsing of lit.site.cfg.py.

> @LLVM_LIBXML2_ENABLED@ will be replaced with 0 or 1. Putting quotes
> around that is unnecessary and just makes it harder to use the value.
> This matches what have_zlib does below.
>
> This also puts the flag together with the feature-related ones instead
> of the path-related flags.

llvm-svn: 327966

6 years ago[Release Notes] Add release note for llvm-mca.
Andrea Di Biagio [Tue, 20 Mar 2018 10:25:36 +0000 (10:25 +0000)]
[Release Notes] Add release note for llvm-mca.

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

llvm-svn: 327965

6 years agolit: Make config.llvm_libxml2_enabled an int, not a string
Hans Wennborg [Tue, 20 Mar 2018 10:14:31 +0000 (10:14 +0000)]
lit: Make config.llvm_libxml2_enabled an int, not a string

@LLVM_LIBXML2_ENABLED@ will be replaced with 0 or 1. Putting quotes
around that is unnecessary and just makes it harder to use the value.
This matches what have_zlib does below.

This also puts the flag together with the feature-related ones instead
of the path-related flags.

llvm-svn: 327964

6 years ago[ELF] - Add test case for "unsupported relocation reference" error. NFCI.
George Rimar [Tue, 20 Mar 2018 09:49:03 +0000 (09:49 +0000)]
[ELF] - Add test case for "unsupported relocation reference" error. NFCI.

We do not have test showing we explicitly reject objects
where relocation section goes before the target, i.e
.rel[a].text is listed before .text, for example.
The patch adds it.

llvm-svn: 327963

6 years ago[analyzer] Fix the crash in IteratorChecker.cpp when 'SymbolConjured' has a null...
Henry Wong [Tue, 20 Mar 2018 09:27:02 +0000 (09:27 +0000)]
[analyzer] Fix the crash in IteratorChecker.cpp when 'SymbolConjured' has a null Stmt.

When the loop has a null terminator statement and sets 'widen-loops=true', 'invalidateRegions' will constructs the 'SymbolConjured' with null 'Stmt'. And this will lead to a crash in 'IteratorChecker.cpp'. This patch use 'dyn_cast_or_null<>' instead of 'dyn_cast<>' in IteratorChecker.cpp.

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

llvm-svn: 327962

6 years ago[CGP] Avoid segmentation fault when doing PHI node simplifications
Bjorn Pettersson [Tue, 20 Mar 2018 09:06:37 +0000 (09:06 +0000)]
[CGP] Avoid segmentation fault when doing PHI node simplifications

Summary:
Made PHI node simplifiations more robust in several ways:

- Minor refactoring to let the SimplificationTracker own the
sets with new PHI/Select nodes that are introduced. This is
maybe not mapping to the original intention with the
SimplificationTracker, but IMHO it encapsulates the logic behind
those sets a little bit better.

- MatchPhiNode can sometimes populate the Matched set with
several entries, where it maps one PHI node to different candidates
for replacement. The Matched set is changed into a SmallSetVector
to make sure we get a deterministic iteration when doing
the replacements.

- As described above we may get several different replacements
for a single PHI node. The loop in MatchPhiSet that is doing
the replacements could end up calling eraseFromParent several
times for the same PHI node, resulting in segmentation faults.
This problem was supposed to be fixed in rL327250, but due to
the non-determinism(?) it only appeared to be fixed (I still
got crashes sometime when turning on/off -print-after-all etc
to get different iteration order in the DenseSets).
With this patch we follow the deterministic ordering in the
Matched set when replacing the PHI nodes. If we find a new
replacement for an already replaced PHI node we replace the
new replacement by the old replacement instead. This is quite
similar to what happened in the rl327250 patch, but here we
also recursively verify that the old replacement hasn't been
replaced already.

- It was really hard to track down the fault described above
(segementation fault due to doing eraseFromParent multiple
times for the same instruction). The fault was intermittent and
small changes in the code, or simply turning on -print-after-all
etc could make the problem go away. This was basically due to
the iteration over PhiNodesToMatch in MatchPhiSet no being
deterministic. Therefore I've changed the data structure for
the SimplificationTracker::AllPhiNodes into an SmallSetVector.
This gives a deterministic behavior.

Reviewers: skatkov, john.brawn

Reviewed By: skatkov

Subscribers: llvm-commits

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

llvm-svn: 327961

6 years ago[LV] Let recordVectorLoopValueForInductionCast to check if IV was created from the...
Andrei Elovikov [Tue, 20 Mar 2018 09:04:39 +0000 (09:04 +0000)]
[LV] Let recordVectorLoopValueForInductionCast to check if IV was created from the cast.

Summary:
It turned out to be error-prone to expect the callers to handle that - better to
leave the decision to this routine and make the required data to be explicitly
passed to the function.

This handles the case that was missed in the r322473 and fixes the assert
mentioned in PR36524.

Reviewers: dorit, mssimpso, Ayal, dcaballe

Reviewed By: dcaballe

Subscribers: Ka-Ka, hiraditya, dneilson, hsaito, llvm-commits

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

llvm-svn: 327960

6 years ago[ms] Parse #pragma optimize and ignore it behind its own flag
Hans Wennborg [Tue, 20 Mar 2018 08:53:11 +0000 (08:53 +0000)]
[ms] Parse #pragma optimize and ignore it behind its own flag

This allows users to turn off warnings about this pragma specifically,
while still receiving warnings about other ignored pragmas.

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

llvm-svn: 327959

6 years ago[SystemZ] Add "REQUIRES: asserts" to test case to fix build bots.
Jonas Paulsson [Tue, 20 Mar 2018 08:29:19 +0000 (08:29 +0000)]
[SystemZ]  Add "REQUIRES: asserts" to test case to fix build bots.

llvm-svn: 327958