platform/upstream/llvm.git
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

6 years ago[X86] Properly implement the calling convention for f80 for mingw/x86_64
Martin Storsjo [Tue, 20 Mar 2018 06:19:38 +0000 (06:19 +0000)]
[X86] Properly implement the calling convention for f80 for mingw/x86_64

In these cases, both parameters and return values are passed
as a pointer to a stack allocation.

MSVC doesn't use the f80 data type at all, while it is used
for long doubles on mingw.

Normally, this part of the calling convention is handled
within clang, but for intrinsics that are lowered to libcalls,
it may need to be handled within llvm as well.

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

llvm-svn: 327957

6 years ago[ORC] Don't fully qualify explicit destructor call -- it confuses some compilers.
Lang Hames [Tue, 20 Mar 2018 05:56:58 +0000 (05:56 +0000)]
[ORC] Don't fully qualify explicit destructor call -- it confuses some compilers.

This should fix the builder failure at
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/19224

llvm-svn: 327955

6 years ago[X86] Rename MOVSX32_NOREXrr8 to MOVSX32rr8_NOREX so that the scheduler model regular...
Craig Topper [Tue, 20 Mar 2018 05:00:20 +0000 (05:00 +0000)]
[X86] Rename MOVSX32_NOREXrr8 to MOVSX32rr8_NOREX so that the scheduler model regular expressions will pick it up with the regular version.

Do the same for MOVSX32_NOREXrm8, MOVZX32_NOREXrr8, and MOVZX32_NOREXrm8

llvm-svn: 327948

6 years ago[X86] Fix the SchedRW for memory forms of CMP and TEST.
Craig Topper [Tue, 20 Mar 2018 03:55:17 +0000 (03:55 +0000)]
[X86] Fix the SchedRW for memory forms of CMP and TEST.

They were incorrectly marked as RMW operations. Some of the CMP instrucions worked, but the ones that use a similar encoding as RMW form of ADD ended up marked as RMW.

TEST used the same tablegen class as some of the CMPs.

llvm-svn: 327947

6 years ago[ORC] Rename SymbolSource to MaterializationUnit, and make the materialization
Lang Hames [Tue, 20 Mar 2018 03:49:29 +0000 (03:49 +0000)]
[ORC] Rename SymbolSource to MaterializationUnit, and make the materialization
operation all-or-nothing, rather than allowing materialization on a per-symbol
basis.

This addresses a shortcoming of per-symbol materialization: If a
MaterializationUnit (/SymbolSource) wants to materialize more symbols than
requested (which is likely: most materializers will want to materialize whole
modules) then it needs a way to notify the symbol table about the extra symbols
being materialized. This process (checking what has been requested against what
is being provided and notifying the symbol table about the difference) has to
be repeated at every level of the JIT stack. Making materialization
all-or-nothing eliminates this issue, simplifying both materializer
implementations and the symbol table (VSO class) API. The cost is that
per-symbol materialization (e.g. for individual symbols in a module) now
requires multiple MaterializationUnits.

llvm-svn: 327946

6 years agoProperly construct `inline` members without initializers
George Burgess IV [Tue, 20 Mar 2018 03:27:44 +0000 (03:27 +0000)]
Properly construct `inline` members without initializers

Digging through commit logs, it appears the checks in this block predate
`inline` class variables. With them, we fail to emit dynamic
initializers for members that don't have an explicit initializer, and we
won't go out of our way to instantiate the class denoted by
`Var->getType()`.

Fixes PR35599.

llvm-svn: 327945

6 years ago[X86] Add TEST16mi/TEST32mi/TEST64mi32 to the Sandybridge/Haswell/Broadwell/Skylake...
Craig Topper [Tue, 20 Mar 2018 03:02:03 +0000 (03:02 +0000)]
[X86] Add TEST16mi/TEST32mi/TEST64mi32 to the Sandybridge/Haswell/Broadwell/Skylake scheduler models.

Move it from a load+store group on SNB to a load only group, the same group as CMP.

llvm-svn: 327944

6 years ago[X86] Add ROR/ROL/SHR/SAR by 1 instructions to the Sandy Bridge scheduler model.
Craig Topper [Tue, 20 Mar 2018 03:01:59 +0000 (03:01 +0000)]
[X86] Add ROR/ROL/SHR/SAR by 1 instructions to the Sandy Bridge scheduler model.

I assume these match the generic immediate version like they do in the other models.

llvm-svn: 327943

6 years ago[ShrinkWrap] Take into account landing pad
Quentin Colombet [Tue, 20 Mar 2018 02:44:40 +0000 (02:44 +0000)]
[ShrinkWrap] Take into account landing pad

When scanning the function for CSRs uses and defs, also check if
the basic block are landing pads.
Consider that landing pads needs the CSRs to be properly set.
That way we force the prologue/epilogue to always be pushed out
of the problematic "throw" region. The "throw" region is
problematic because the jumps are not properly modeled.

Fixes PR36513

llvm-svn: 327942

6 years agoAdd a suggestion to convert dotest tests to use run_to_source_breakpoint.
Jim Ingham [Tue, 20 Mar 2018 02:15:23 +0000 (02:15 +0000)]
Add a suggestion to convert dotest tests to use run_to_source_breakpoint.

llvm-svn: 327941

6 years agoFix layering between llvm-c and Support by factoring out some typedefs into Support
David Blaikie [Tue, 20 Mar 2018 02:14:50 +0000 (02:14 +0000)]
Fix layering between llvm-c and Support by factoring out some typedefs into Support

llvm-c depends on Support, but Support (TargetRegistry) uses some of
llvm-c's typedefs. Move those into a Support header to be used from both
llvm-c and Support.

llvm-svn: 327940

6 years ago[CodeGen] Ignore OpaqueValueExprs that are unique references to their
Akira Hatanaka [Tue, 20 Mar 2018 01:47:58 +0000 (01:47 +0000)]
[CodeGen] Ignore OpaqueValueExprs that are unique references to their
source expressions when iterating over a PseudoObjectExpr's semantic
subexpression list.

Previously the loop in emitPseudoObjectExpr would emit the IR for each
OpaqueValueExpr that was in a PseudoObjectExpr's semantic-form
expression list and use the result when the OpaqueValueExpr later
appeared in other expressions. This caused an assertion failure when
AggExprEmitter tried to copy the result of an OpaqueValueExpr and the
copied type didn't have trivial copy/move constructors or assignment
operators.

This patch adds flag IsUnique to OpaqueValueExpr which indicates it is a
unique reference to its source expression (it is not used in multiple
places). The loop in emitPseudoObjectExpr ignores OpaqueValueExprs that
are unique and CodeGen visitors simply traverse the source expressions
of such OpaqueValueExprs.

rdar://problem/34363596

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

llvm-svn: 327939

6 years ago[RISCV] Preserve stack space for outgoing arguments when the function contain variabl...
Shiva Chen [Tue, 20 Mar 2018 01:39:17 +0000 (01:39 +0000)]
[RISCV] Preserve stack space for outgoing arguments when the function contain variable size objects

E.g.

bar (int x)
{
  char p[x];

  push outgoing variables for foo.
  call foo
}

We need to generate stack adjustment instructions for outgoing arguments by
eliminateCallFramePseudoInstr when the function contains variable size
objects to avoid outgoing variables corrupt the variable size object.

Default hasReservedCallFrame will return !hasFP().
We don't want to generate extra sp adjustment instructions when hasFP()
return true, So We override hasReservedCallFrame as !hasVarSizedObjects().

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

llvm-svn: 327938

6 years ago[X86] Fix the SNB scheduler for BLENDVB.
Craig Topper [Tue, 20 Mar 2018 01:30:21 +0000 (01:30 +0000)]
[X86] Fix the SNB scheduler for BLENDVB.

PBLENDVBrr0 was with the memory version of VBLENDVB and PBLENDVBrm0 was missing.

llvm-svn: 327937

6 years agoRevert "[compiler-rt] Change std::sort to llvm::sort in response to r327219"
Mandeep Singh Grang [Tue, 20 Mar 2018 01:17:18 +0000 (01:17 +0000)]
Revert "[compiler-rt] Change std::sort to llvm::sort in response to r327219"

This reverts commit 2ee210e1963e03aacc0f71c50e4994bb5c66586e.

llvm-svn: 327936

6 years ago[analyzer] Improve performance of NoStoreFuncVisitor
George Karpenkov [Tue, 20 Mar 2018 01:16:46 +0000 (01:16 +0000)]
[analyzer] Improve performance of NoStoreFuncVisitor

Compute modifying frames lazily on demand.

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

llvm-svn: 327935

6 years agoRun dos2unix on a test. NFC.
Rafael Espindola [Tue, 20 Mar 2018 01:06:29 +0000 (01:06 +0000)]
Run dos2unix on a test. NFC.

llvm-svn: 327934

6 years ago[DebugInfoPDB] Add backward support flags to PDB_NameSearchFlags
Aaron Smith [Tue, 20 Mar 2018 01:04:21 +0000 (01:04 +0000)]
[DebugInfoPDB] Add backward support flags to PDB_NameSearchFlags

For NS_CaseInFileNameExt support.

llvm-svn: 327933

6 years agoAllow builtins for Cross-DSO CFI on Android
Petr Hosek [Tue, 20 Mar 2018 00:56:08 +0000 (00:56 +0000)]
Allow builtins for Cross-DSO CFI on Android

This is needed to avoid the test failure in case when compiler-rt
is set as the default runtime library for Clang.

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

llvm-svn: 327932

6 years ago[ELF] Make SectionHeaderOffset less sensitive.
Fangrui Song [Tue, 20 Mar 2018 00:55:39 +0000 (00:55 +0000)]
[ELF] Make SectionHeaderOffset less sensitive.

llvm-svn: 327931

6 years agoObject: Fix handling of @@@ in .symver directive
Vitaly Buka [Tue, 20 Mar 2018 00:45:03 +0000 (00:45 +0000)]
Object: Fix handling of @@@ in .symver directive

Summary:
name@@@nodename is going to be replaced with name@@nodename if symbols is
defined in the assembled file, or name@nodename if undefined.
https://sourceware.org/binutils/docs/as/Symver.html

Fixes PR36623

Reviewers: pcc, espindola

Subscribers: mehdi_amini, hiraditya

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

llvm-svn: 327930

6 years ago[compiler-rt] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Tue, 20 Mar 2018 00:44:59 +0000 (00:44 +0000)]
[compiler-rt] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Reviewers: kcc, rsmith, RKSimon, eugenis

Reviewed By: RKSimon

Subscribers: efriedma, kubamracek, dberris, #sanitizers, llvm-commits

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

llvm-svn: 327929

6 years agoObject: Move attribute calculation into RecordStreamer. NFC
Vitaly Buka [Tue, 20 Mar 2018 00:38:33 +0000 (00:38 +0000)]
Object: Move attribute calculation into RecordStreamer. NFC

Summary: Preparation for D44274

Reviewers: pcc, espindola

Subscribers: hiraditya

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

llvm-svn: 327928

6 years ago[SymbolFilePDB] Simplify code with newer methods
Aaron Smith [Tue, 20 Mar 2018 00:34:18 +0000 (00:34 +0000)]
[SymbolFilePDB] Simplify code with newer methods

llvm-svn: 327927

6 years ago[analyzer] Fix the assertion failure when static globals are used in lambda by reference
George Karpenkov [Tue, 20 Mar 2018 00:20:58 +0000 (00:20 +0000)]
[analyzer] Fix the assertion failure when static globals are used in lambda by reference

Also use the opportunity to clean up the code and remove unnecessary duplication.

rdar://37625895

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

llvm-svn: 327926

6 years ago[SymbolFilePDB] Simplify getting the source file path
Aaron Smith [Tue, 20 Mar 2018 00:18:22 +0000 (00:18 +0000)]
[SymbolFilePDB] Simplify getting the source file path

Summary: Replace SymbolFilePDB::GetSourceFileNameForPDBCompiland() with PDBSymbolCompiland::getSourceFileFullPath().

Reviewers: zturner, rnk, lldb-commits

Subscribers: llvm-commits

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

llvm-svn: 327925

6 years agoModernize a test.
Jim Ingham [Mon, 19 Mar 2018 23:15:06 +0000 (23:15 +0000)]
Modernize a test.

llvm-svn: 327924

6 years agoOpenBSD UBsan support missing bits
Vitaly Buka [Mon, 19 Mar 2018 23:12:14 +0000 (23:12 +0000)]
OpenBSD UBsan support missing bits

Summary:
Lost bits since the WIP ticket

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

Subscribers: srhines, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers

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

llvm-svn: 327923

6 years agoRename remotectl_com.apple.internal.xpc.remote.debugserver.plist
Jason Molenda [Mon, 19 Mar 2018 23:07:31 +0000 (23:07 +0000)]
Rename remotectl_com.apple.internal.xpc.remote.debugserver.plist
to com.apple.internal.xpc.remote.debugserver.plist, not sure where
that remotectl_ prefix came from.

<rdar://problem/36751222>

llvm-svn: 327922

6 years agoRemove GnuHashTableSection::getShift2().
Rui Ueyama [Mon, 19 Mar 2018 23:04:13 +0000 (23:04 +0000)]
Remove GnuHashTableSection::getShift2().

Choosing a Shift2 value based on wordsize is cargo-culted from gold.
Assuming that djb hash is a good hash function, choosing bits [4,9]
shouldn't be any worse or better than choosing bits [5,10]. We shouldn't
have copied that behavior that we can't justify in the first place.

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

llvm-svn: 327921

6 years agoallow-multiple-definitions should completely suppress errors instead of making them...
Rui Ueyama [Mon, 19 Mar 2018 23:04:04 +0000 (23:04 +0000)]
allow-multiple-definitions should completely suppress errors instead of making them warnings.

We found that when you pass --allow-multiple-definitions or `-z muldefs`
to GNU linkers, they don't complain about duplicate symbols at all. They
don't even print out warnings on it. We emit warnings in that case.
If you pass --fatal-warnings, that difference results in a link failure.

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

llvm-svn: 327920

6 years ago[SelectionDAG] Transfer DbgValues when integer operations are promoted
Aaron Smith [Mon, 19 Mar 2018 22:58:50 +0000 (22:58 +0000)]
[SelectionDAG] Transfer DbgValues when integer operations are promoted

Summary:
DbgValue nodes were not transferred when integer DAG nodes were promoted. For example, if an i32 add node was promoted to an i64 add node by DAGTypeLegalizer::PromoteIntegerResult(), its DbgValue node was not transferred to the new node. The simple fix is to update SetPromotedInteger() to transfer DbgValues.

Add AArch64/dbg-value-i8.ll to test this change and fix ARM/debug-info-d16-reg.ll which had the wrong DILocalVariable nodes with arg numbers even though they are not for function parameters.

Patch by Se Jong Oh!

Reviewers: vsk, JDevlieghere, aprantl

Reviewed By: JDevlieghere

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #debug-info

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

llvm-svn: 327919

6 years agoI didn't see that SocketAddress.cpp was already being pulled
Jason Molenda [Mon, 19 Mar 2018 22:55:19 +0000 (22:55 +0000)]
I didn't see that SocketAddress.cpp was already being pulled
in to debugserver; my re-addition resulted in duplicated
symbols.  Remove my added SocketAddress.cpp, and change the
original one to also be included for the debugserver-mini target.

llvm-svn: 327918

6 years ago[MachineOutliner] AArch64: Emit CFI instructions when outlining calls
Jessica Paquette [Mon, 19 Mar 2018 22:48:40 +0000 (22:48 +0000)]
[MachineOutliner] AArch64: Emit CFI instructions when outlining calls

When outlining calls, the outliner needs to update CFI to ensure that, say,
exception handling works. This commit adds that functionality and adds a test
just for call outlining.

Call outlining stuff in machine-outliner.mir should be moved into
machine-outliner-calls.mir in a later commit.

llvm-svn: 327917

6 years ago[DAGCombiner] Fix type in comment. NFC
Craig Topper [Mon, 19 Mar 2018 22:25:26 +0000 (22:25 +0000)]
[DAGCombiner] Fix type in comment. NFC

llvm-svn: 327916

6 years agoAdd the ios-mini target to the top-level xcodeproj, which builds
Jason Molenda [Mon, 19 Mar 2018 22:04:45 +0000 (22:04 +0000)]
Add the ios-mini target to the top-level xcodeproj, which builds
the debugserver-mini target in debugserver.  Add a new plist
which needs to be installed for debugserver-mini.
<rdar://problem/36751222>

llvm-svn: 327915

6 years ago[X86] Simplify the AVX512 code in LowerTruncate a little.
Craig Topper [Mon, 19 Mar 2018 21:58:02 +0000 (21:58 +0000)]
[X86] Simplify the AVX512 code in LowerTruncate a little.

We don't need to create an ISD::TRUNCATE node to return, we started with one and can return it. Also remove the call to getExtendInVec, the result is just going to be a getNode of that value passed in.

llvm-svn: 327914

6 years agoAdd DWARFUnit.cpp to the correct target.
Jason Molenda [Mon, 19 Mar 2018 21:55:48 +0000 (21:55 +0000)]
Add DWARFUnit.cpp to the correct target.

llvm-svn: 327913

6 years agoAccept any filepath in llvm_check_source_file_list
Serge Guelton [Mon, 19 Mar 2018 21:35:30 +0000 (21:35 +0000)]
Accept any filepath in llvm_check_source_file_list

Cmake function llvm_check_source_file_list currently only accepts paths
relative to current CMAKE_SOURCE_DIR or relative to argument SOURCE_DIR.

Extend it to accept any path, including absolute ones.

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

llvm-svn: 327912

6 years agoFixup test to explicitly use -fexceptions since exceptions are disabled by default...
Douglas Yung [Mon, 19 Mar 2018 21:22:58 +0000 (21:22 +0000)]
Fixup test to explicitly use -fexceptions since exceptions are disabled by default on the PS4 target.

llvm-svn: 327911

6 years ago[PDB] Add a method to get the full path of the source file for PDBSymbolCompiland
Aaron Smith [Mon, 19 Mar 2018 21:20:04 +0000 (21:20 +0000)]
[PDB] Add a method to get the full path of the source file for PDBSymbolCompiland

Summary:
Redefine PDBSymbolCompiland::getSourceFileName() to return the filename (w/o directory) of the source file that is used to compile the compiland. This is because the result returned previously is ambiguous. It could be the filename, relative path or full path of the source file.

Move the implementation of SymbolFilePDB::GetSourceFileNameForPDBCompiland() into a new method PDBSymbolCompiland::getSourceFileFullPath().

Reviewers: zturner, rnk, llvm-commits

Reviewed By: zturner

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

llvm-svn: 327910

6 years ago[PDB] Add exclusive methods to derived symbol class
Aaron Smith [Mon, 19 Mar 2018 21:18:39 +0000 (21:18 +0000)]
[PDB] Add exclusive methods to derived symbol class

Summary: This commit adds two methods to the PDBSymboFunc class used in parsing symbols. getLineNumbers() is used to determine a Function symbol's declaration and getCompilandId() is used to initialize the SymbolContext field sc.comp_unit.

Reviewers: zturner, rnk, llvm-commits

Reviewed By: zturner

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

llvm-svn: 327909

6 years ago[SymbolFilePDB] Remove a few null pointer checks by passing ref
Aaron Smith [Mon, 19 Mar 2018 21:14:19 +0000 (21:14 +0000)]
[SymbolFilePDB] Remove a few null pointer checks by passing ref

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327908

6 years ago[Hexagon] Add REQUIRES: asserts to test/CodeGen/Hexagon/v6vec_inc1.ll
Krzysztof Parzyszek [Mon, 19 Mar 2018 21:05:21 +0000 (21:05 +0000)]
[Hexagon] Add REQUIRES: asserts to test/CodeGen/Hexagon/v6vec_inc1.ll

llvm-svn: 327907

6 years ago[test] Skip flaky tests in TestMiSyntax on Darwin
Vedant Kumar [Mon, 19 Mar 2018 20:50:50 +0000 (20:50 +0000)]
[test] Skip flaky tests in TestMiSyntax on Darwin

These tests tend to time out locally and on our bots.

llvm-svn: 327906

6 years ago[test] Skip flaky TestThreadStates tests on Darwin
Vedant Kumar [Mon, 19 Mar 2018 20:50:49 +0000 (20:50 +0000)]
[test] Skip flaky TestThreadStates tests on Darwin

These tests do not pass/fail consistently, so just skip them.

This is llvm.org/pr15824 & rdar://problem/28557237.

llvm-svn: 327905

6 years agoCleanup of "extern char **environ" declaration
Vitaly Buka [Mon, 19 Mar 2018 20:44:06 +0000 (20:44 +0000)]
Cleanup of "extern char **environ" declaration

llvm-svn: 327904

6 years agoRevert "Support embedding natvis files in PDBs."
Zachary Turner [Mon, 19 Mar 2018 20:41:59 +0000 (20:41 +0000)]
Revert "Support embedding natvis files in PDBs."

This is causing a test failure on a certain bot, so I'm removing
this temporarily until we can figure out the source of the error.

llvm-svn: 327903

6 years ago[clangd] Fix undefined behavior due to misaligned type cast
Jan Korous [Mon, 19 Mar 2018 20:26:18 +0000 (20:26 +0000)]
[clangd] Fix undefined behavior due to misaligned type cast

The current code was casting pointer to a misaligned type which is undefined behavior.
Found by compiling with Undefined Behavior Sanitizer and running tests (check-clang-tools).

llvm-svn: 327902

6 years ago[clangd][nfc] Give name to a magic constant
Jan Korous [Mon, 19 Mar 2018 20:26:15 +0000 (20:26 +0000)]
[clangd][nfc] Give name to a magic constant

llvm-svn: 327901

6 years agoRemove an unused private variable.
Zachary Turner [Mon, 19 Mar 2018 20:22:48 +0000 (20:22 +0000)]
Remove an unused private variable.

llvm-svn: 327900