platform/upstream/llvm.git
6 years ago[clangd] Do not build AST if no diagnostics were requested
Ilya Biryukov [Tue, 31 Jul 2018 13:45:37 +0000 (13:45 +0000)]
[clangd] Do not build AST if no diagnostics were requested

Summary:
It can be removed from the cache before the first access anyway, so
building it can be a waste of time.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: javed.absar, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 338378

6 years ago[ELF][ARM] Implement support for Tag_ABI_VFP_args
Peter Smith [Tue, 31 Jul 2018 13:41:59 +0000 (13:41 +0000)]
[ELF][ARM] Implement support for Tag_ABI_VFP_args

The Tag_ABI_VFP_args build attribute controls the procedure call standard
used for floating point parameters on ARM. The values are:
0 - Base AAPCS (FP Parameters passed in Core (Integer) registers
1 - VFP AAPCS (FP Parameters passed in FP registers)
2 - Toolchain specific (Neither Base or VFP)
3 - Compatible with all (No use of floating point parameters)

If the Tag_ABI_VFP_args build attribute is missing it has an implicit value
of 0.

We use the attribute in two ways:
- Detect a clash in calling convention between Base, VFP and Toolchain.
we follow ld.bfd's lead and do not error if there is a clash between an
implicit Base AAPCS caused by a missing attribute. Many projects
including the hard-float (VFP AAPCS) version of glibc contain assembler
files that do not use floating point but do not have Tag_ABI_VFP_args.
- Set the EF_ARM_ABI_FLOAT_SOFT or EF_ARM_ABI_FLOAT_HARD ELF header flag
for Base or VFP AAPCS respectively. This flag is used by some ELF
loaders.

References:
- Addenda to, and Errata in, the ABI for the ARM Architecture for
Tag_ABI_VFP_args
- Elf for the ARM Architecture for ELF header flags

Fixes PR36009

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

llvm-svn: 338377

6 years agoAMDGPU: Fold undef fcanonicalize to qNaN
Matt Arsenault [Tue, 31 Jul 2018 13:34:31 +0000 (13:34 +0000)]
AMDGPU: Fold undef fcanonicalize to qNaN

We could choose a free 0 for this, but this
matches the behavior for fmul undef, 1.0. Also,
the NaN use is more useful for folding use operations
although if it's not eliminated it is more expensive
in terms of code size.

llvm-svn: 338376

6 years ago[LLD][ELF] - ICF: add test case testing we do not fold sections with the different...
George Rimar [Tue, 31 Jul 2018 13:32:16 +0000 (13:32 +0000)]
[LLD][ELF] - ICF: add test case testing we do not fold sections with the different flags. NFCI.

Previously the following condition was not tested at all:
https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L300

Patch adds a test for `A->Flags != B->Flags` part.

llvm-svn: 338375

6 years agoAMDGPU: Fix test check line bugs
Matt Arsenault [Tue, 31 Jul 2018 13:25:23 +0000 (13:25 +0000)]
AMDGPU: Fix test check line bugs

llvm-svn: 338374

6 years ago[ARM] Complete enumeration values for Tag_ABI_VFP_args
Peter Smith [Tue, 31 Jul 2018 13:24:49 +0000 (13:24 +0000)]
[ARM] Complete enumeration values for Tag_ABI_VFP_args

The LLD implementation of Tag_ABI_VFP_args needs to check the rarely seen
values of 3 (toolchain specific) and 4 compatible with both Base and VFP.
Add the missing enumeration values so that LLD can refer to them without
having to use the raw numbers.

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

llvm-svn: 338373

6 years ago[llvm-mca][BtVer2] Teach how to identify dependency-breaking idioms.
Andrea Di Biagio [Tue, 31 Jul 2018 13:21:43 +0000 (13:21 +0000)]
[llvm-mca][BtVer2] Teach how to identify dependency-breaking idioms.

This patch teaches llvm-mca how to identify dependency breaking instructions on
btver2.

An example of dependency breaking instructions is the zero-idiom XOR (example:
`XOR %eax, %eax`), which always generates zero regardless of the actual value of
the input register operands.
Dependency breaking instructions don't have to wait on their input register
operands before executing. This is because the computation is not dependent on
the inputs.

Not all dependency breaking idioms are also zero-latency instructions. For
example, `CMPEQ %xmm1, %xmm1` is independent on
the value of XMM1, and it generates a vector of all-ones.
That instruction is not eliminated at register renaming stage, and its opcode is
issued to a pipeline for execution. So, the latency is not zero.

This patch adds a new method named isDependencyBreaking() to the MCInstrAnalysis
interface. That method takes as input an instruction (i.e. MCInst) and a
MCSubtargetInfo.
The default implementation of isDependencyBreaking() conservatively returns
false for all instructions. Targets may override the default behavior for
specific CPUs, and return a value which better matches the subtarget behavior.

In future, we should teach to Tablegen how to automatically generate the body of
isDependencyBreaking from scheduling predicate definitions. This would allow us
to expose the knowledge about dependency breaking instructions to the machine
schedulers (and, potentially, other codegen passes).

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

llvm-svn: 338372

6 years ago[debuginfo-tests] tweak new test to be compatible with wider range of compilers.
Tim Northover [Tue, 31 Jul 2018 13:19:01 +0000 (13:19 +0000)]
[debuginfo-tests] tweak new test to be compatible with wider range of compilers.

emplace_back was added in C++11, and its usage isn't critical to what's being
tested so using push_back instead will allow this test to work with more
compilers.

llvm-svn: 338371

6 years ago[ELF][ARM] Add Arm ABI names for float ABI ELF Header flags
Peter Smith [Tue, 31 Jul 2018 13:03:54 +0000 (13:03 +0000)]
[ELF][ARM] Add Arm ABI names for float ABI ELF Header flags

The ELF for the Arm architecture document defines, for EF_ARM_EABI_VER5 and
above, the flags EF_ARM_ABI_FLOAT_HARD and EF_ARM_ABI_FLOAT_SOFT. These
have been defined to be compatible with the existing EF_ARM_VFP_FLOAT and
EF_ARM_SOFT_FLOAT used by gcc for EF_ARM_EABI_UNKNOWN.

This patch adds the flags in addition to the existing ones so that any code
depending on the old names will still work.

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

llvm-svn: 338370

6 years agoRevert r338365: [X86] Improved sched models for X86 BT*rr instructions.
Simon Pilgrim [Tue, 31 Jul 2018 13:00:51 +0000 (13:00 +0000)]
Revert r338365: [X86] Improved sched models for X86 BT*rr instructions.
https://reviews.llvm.org/D49243

Contains WIP code that should not have been included.

llvm-svn: 338369

6 years ago[SystemZ] Improve decoding in case of instructions with four register operands.
Jonas Paulsson [Tue, 31 Jul 2018 13:00:42 +0000 (13:00 +0000)]
[SystemZ] Improve decoding in case of instructions with four register operands.

Since z13, the max group size will be 2 if any μop has more than 3 register
sources.

This has been ignored sofar in the SystemZHazardRecognizer, but is now
handled by recognizing those instructions and adjusting the tracking of
decoding and the cost heuristic for grouping.

Review: Ulrich Weigand
https://reviews.llvm.org/D49847

llvm-svn: 338368

6 years ago[InstCombine] simplify code for A & (A ^ B) --> A & ~B
Sanjay Patel [Tue, 31 Jul 2018 13:00:03 +0000 (13:00 +0000)]
[InstCombine] simplify code for A & (A ^ B) --> A & ~B

This fold was written in an odd way and tried to avoid
an endless loop by bailing out on all constants instead
of the supposedly problematic case of -1. But (X & -1)
should always be simplified before we reach here, so I'm
not sure how that is a problem.

There were no tests for the commuted patterns, so I added
those at rL338364.

llvm-svn: 338367

6 years agoclang-format: try to make the doc for ConstructorInitializerAllOnOneLineOrOnePerLine...
Hans Wennborg [Tue, 31 Jul 2018 12:42:02 +0000 (12:42 +0000)]
clang-format: try to make the doc for ConstructorInitializerAllOnOneLineOrOnePerLine more clear

PR38080 complained that the "OnePerLine" case wasn't previously shown.

llvm-svn: 338366

6 years ago[X86] Improved sched models for X86 BT*rr instructions.
Andrew V. Tischenko [Tue, 31 Jul 2018 12:33:48 +0000 (12:33 +0000)]
[X86] Improved sched models for X86 BT*rr instructions.
https://reviews.llvm.org/D49243

llvm-svn: 338365

6 years ago[InstCombine] move/add tests for xor+add fold; NFC
Sanjay Patel [Tue, 31 Jul 2018 12:31:00 +0000 (12:31 +0000)]
[InstCombine] move/add tests for xor+add fold; NFC

llvm-svn: 338364

6 years agowindows_support.rst: Add links for downloading
Hans Wennborg [Tue, 31 Jul 2018 12:02:03 +0000 (12:02 +0000)]
windows_support.rst: Add links for downloading

llvm-svn: 338363

6 years agoindex.rst: pe/coff does support pdbs now
Hans Wennborg [Tue, 31 Jul 2018 12:00:26 +0000 (12:00 +0000)]
index.rst: pe/coff does support pdbs now

llvm-svn: 338362

6 years ago[clangd] Report diagnostics even if WantDiags::No AST was reused
Ilya Biryukov [Tue, 31 Jul 2018 11:47:52 +0000 (11:47 +0000)]
[clangd] Report diagnostics even if WantDiags::No AST was reused

Summary:
After r338256, clangd stopped reporting diagnostics if WantDiags::No request
is followed by a WantDiags::Yes request but the AST can be reused.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: javed.absar, MaskRay, jkorous, arphaman, jfb, cfe-commits

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

llvm-svn: 338361

6 years agoFix linux-header-search.cpp with CLANG_DEFAULT_CXX_STDLIB
Jonas Hahnfeld [Tue, 31 Jul 2018 11:36:14 +0000 (11:36 +0000)]
Fix linux-header-search.cpp with CLANG_DEFAULT_CXX_STDLIB

This configuration was broken after r338294 because Clang might
be configured to always use libc++.

llvm-svn: 338360

6 years ago[X86] Improved sched models for X86 SHLD/SHRD* instructions.
Andrew V. Tischenko [Tue, 31 Jul 2018 10:14:43 +0000 (10:14 +0000)]
[X86] Improved sched models for X86 SHLD/SHRD* instructions.
Differential Revision: https://reviews.llvm.org/D9611

llvm-svn: 338359

6 years ago[X86][SSE] isFNEG - Use getTargetConstantBitsFromNode to handle all constant cases
Simon Pilgrim [Tue, 31 Jul 2018 10:13:17 +0000 (10:13 +0000)]
[X86][SSE] isFNEG - Use getTargetConstantBitsFromNode to handle all constant cases

isFNEG was duplicating much of what was done by getTargetConstantBitsFromNode in its own calls to getTargetConstantFromNode.

Noticed while reviewing D48467.

llvm-svn: 338358

6 years ago[ARM] Allow automatically deducing the thumb instruction size for .inst
Martin Storsjo [Tue, 31 Jul 2018 09:27:07 +0000 (09:27 +0000)]
[ARM] Allow automatically deducing the thumb instruction size for .inst

This matches GAS, that allows unsuffixed .inst for thumb.

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

llvm-svn: 338357

6 years ago[ARM] Support the .inst directive for MachO and COFF targets
Martin Storsjo [Tue, 31 Jul 2018 09:27:01 +0000 (09:27 +0000)]
[ARM] Support the .inst directive for MachO and COFF targets

Contrary to ELF, we don't add any markers that distinguish data generated
with .short/.long from normal instructions, so the .inst directive only
adds compatibility with assembly that uses it.

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

llvm-svn: 338356

6 years ago[AArch64] Support the .inst directive for MachO and COFF targets
Martin Storsjo [Tue, 31 Jul 2018 09:26:52 +0000 (09:26 +0000)]
[AArch64] Support the .inst directive for MachO and COFF targets

Contrary to ELF, we don't add any markers that distinguish data generated
with .long from normal instructions, so the .inst directive only adds
compatibility with assembly that uses it.

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

llvm-svn: 338355

6 years ago[ARM] Revert r337821
Sam Parker [Tue, 31 Jul 2018 09:04:14 +0000 (09:04 +0000)]
[ARM] Revert r337821

Re-enabling ARMCodeGenPrepare by default after failing to reproduce
the bootstrap issues that I was concerned it was causing.

llvm-svn: 338354

6 years agoImprove support of PDB as an external layout source
Aleksandr Urakov [Tue, 31 Jul 2018 08:27:06 +0000 (08:27 +0000)]
Improve support of PDB as an external layout source

Summary:
This patch improves support of PDB as an external layout source
in the next cases:

- Multiple non-virtual inheritance from packed base classes. When using
  external layout, there's no need to align `NonVirtualSize` of a base class.
  It may cause an overlapping when the next base classes will be layouted
  (but there is a slightly different case in the test because I can't find
  a way to specify a base offset);
- Support of nameless structs and unions. There is no info about nameless child
  structs and unions in Microsoft cl-emitted PDBs. Instead all its fields
  are just treated as outer structure's (union's) fields. This also causes
  a fields overlapping, and makes it possible for unions to have fields located
  at a non-zero offset.

Reviewers: rsmith, zturner, rnk, mstorsjo, majnemer

Reviewed By: rnk

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 338353

6 years agoTest commit.
Hsiangkai Wang [Tue, 31 Jul 2018 06:09:29 +0000 (06:09 +0000)]
Test commit.

llvm-svn: 338352

6 years ago[InstSimplify] tests for D48828, D49981: fold extraction from std::pair
Hiroshi Inoue [Tue, 31 Jul 2018 05:29:20 +0000 (05:29 +0000)]
[InstSimplify] tests for D48828, D49981: fold extraction from std::pair

Minor touch up in the previous comment.

llvm-svn: 338351

6 years ago[InstSimplify] tests for D48828, D49981: fold extraction from std::pair
Hiroshi Inoue [Tue, 31 Jul 2018 05:10:36 +0000 (05:10 +0000)]
[InstSimplify] tests for D48828, D49981: fold extraction from std::pair

Updated unit tests for D48828 and D49981.

llvm-svn: 338350

6 years ago[XRay][compiler-rt] Update test to use similar structure
Dean Michael Berris [Tue, 31 Jul 2018 04:47:37 +0000 (04:47 +0000)]
[XRay][compiler-rt] Update test to use similar structure

This is a follow-up to D50037.

llvm-svn: 338349

6 years ago[NFC] Collect statistics in GuardWidening
Max Kazantsev [Tue, 31 Jul 2018 04:37:11 +0000 (04:37 +0000)]
[NFC] Collect statistics in GuardWidening

llvm-svn: 338348

6 years ago[XRay][compiler-rt] Profiling Mode: Include file header in buffers
Dean Michael Berris [Tue, 31 Jul 2018 04:16:54 +0000 (04:16 +0000)]
[XRay][compiler-rt] Profiling Mode: Include file header in buffers

Summary:
This change provides access to the file header even in the in-memory
buffer processing. This allows in-memory processing of the buffers to
also check the version, and the format, of the profile data.

Reviewers: eizan, kpw

Reviewed By: eizan

Subscribers: llvm-commits

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

llvm-svn: 338347

6 years ago[VPlan] Introduce VPLoopInfo analysis.
Diego Caballero [Tue, 31 Jul 2018 01:57:29 +0000 (01:57 +0000)]
[VPlan] Introduce VPLoopInfo analysis.

The patch introduces loop analysis (VPLoopInfo/VPLoop) for VPBlockBases.
This analysis will be necessary to perform some H-CFG transformations and
detect and introduce regions representing a loop in the H-CFG.

Reviewers: fhahn, rengolin, mkuper, hfinkel, mssimpso

Reviewed By: fhahn

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

llvm-svn: 338346

6 years agoRemove Stream::UnitTest
Raphael Isemann [Tue, 31 Jul 2018 01:21:36 +0000 (01:21 +0000)]
Remove Stream::UnitTest

Summary: No one is using this method, and it also doesn't really make a lot of sense to have it around.

Reviewers: davide

Reviewed By: davide

Subscribers: davide, lldb-commits

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

llvm-svn: 338345

6 years agoRevert r338340 "[MS Demangler] Better demangling of template arguments."
Reid Kleckner [Tue, 31 Jul 2018 01:08:42 +0000 (01:08 +0000)]
Revert r338340 "[MS Demangler] Better demangling of template arguments."

Breaks the build with GCC, apparently.

llvm-svn: 338344

6 years ago[coroutines] Fix handling of dependent co_await in StmtProfiler.
Richard Smith [Tue, 31 Jul 2018 00:47:41 +0000 (00:47 +0000)]
[coroutines] Fix handling of dependent co_await in StmtProfiler.

Fix "Invalid operator call kind" error (llvm_unreachable) in
DecodeOperatorCall when profiling a dependent co_await.

Patch by Victor Zverovich!

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

llvm-svn: 338343

6 years ago[X86] Stop accidentally running the Bonnell LEA fixup path on Goldmont.
Craig Topper [Tue, 31 Jul 2018 00:43:54 +0000 (00:43 +0000)]
[X86] Stop accidentally running the Bonnell LEA fixup path on Goldmont.

In one place we checked X86Subtarget.slowLEA() to decide if the pass should run. But to decide what the pass should we only check isSLM. This resulted in Goldmont going down the Bonnell path.

llvm-svn: 338342

6 years ago[RISCV] Fixed test case failure due to r338047
Ana Pazos [Tue, 31 Jul 2018 00:36:28 +0000 (00:36 +0000)]
[RISCV] Fixed test case failure due to r338047

llvm-svn: 338341

6 years ago[MS Demangler] Better demangling of template arguments.
Zachary Turner [Tue, 31 Jul 2018 00:26:52 +0000 (00:26 +0000)]
[MS Demangler] Better demangling of template arguments.

This patch fixes demangling of template aliases as template-template
arguments, and also fixes function pointers and references as
not type template parameters.  All of these can be properly
demangled now, so I've ported over the test
clang/test/CodeGenCXX/ms-template-callbacks.cpp.  All of these
tests pass

llvm-svn: 338340

6 years ago[analyzer] Rename test: cxx17-mandatory-elision.cpp -> copy-elision.cpp
Artem Dergachev [Tue, 31 Jul 2018 00:18:35 +0000 (00:18 +0000)]
[analyzer] Rename test: cxx17-mandatory-elision.cpp -> copy-elision.cpp

It reflects its contents more accurately. No functional change intended.

llvm-svn: 338339

6 years ago[Sema] Relax a failing assert in TemplateArgumentLoc
Erik Pilkington [Tue, 31 Jul 2018 00:18:30 +0000 (00:18 +0000)]
[Sema] Relax a failing assert in TemplateArgumentLoc

Any of these template argument kinds can be represented with an expression, so
accept them in this constructor.

Patch by Balaji Iyer!

rdar://41459965

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

llvm-svn: 338338

6 years ago[AArch64][GlobalISel] Add isel support for G_BLOCK_ADDR.
Amara Emerson [Tue, 31 Jul 2018 00:09:02 +0000 (00:09 +0000)]
[AArch64][GlobalISel] Add isel support for G_BLOCK_ADDR.

Also refactors some existing code to materialize addresses for the large code
model so it can be shared between G_GLOBAL_VALUE and G_BLOCK_ADDR.

This implements PR36390.

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

llvm-svn: 338337

6 years ago[AArch64][GlobalISel] Make G_BLOCK_ADDR legal.
Amara Emerson [Tue, 31 Jul 2018 00:08:56 +0000 (00:08 +0000)]
[AArch64][GlobalISel] Make G_BLOCK_ADDR legal.

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

llvm-svn: 338336

6 years ago[GlobalISel] Add a G_BLOCK_ADDR opcode to handle IR blockaddress constants.
Amara Emerson [Tue, 31 Jul 2018 00:08:50 +0000 (00:08 +0000)]
[GlobalISel] Add a G_BLOCK_ADDR opcode to handle IR blockaddress constants.

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

llvm-svn: 338335

6 years agoPacify sanitizer lint script that still does not run on Windows
Reid Kleckner [Tue, 31 Jul 2018 00:08:26 +0000 (00:08 +0000)]
Pacify sanitizer lint script that still does not run on Windows

llvm-svn: 338334

6 years ago[analyzer] CStringChecker: Remember to highlight the argument expression range.
Artem Dergachev [Mon, 30 Jul 2018 23:44:37 +0000 (23:44 +0000)]
[analyzer] CStringChecker: Remember to highlight the argument expression range.

When emitting a bug report, it is important to highlight which argument of the
call-expression is causing the problem.

Before:
warning: Null pointer argument in call to string comparison function
  strcmp(a, b);
  ^~~~~~~~~~~~

After:
warning: Null pointer argument in call to string comparison function
  strcmp(a, b);
  ^      ~

Affects other output modes as well, not just text.

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

llvm-svn: 338333

6 years agoCode cleanup - change naked 'throw' expressions to call helpre function '__throw_futu...
Marshall Clow [Mon, 30 Jul 2018 23:33:48 +0000 (23:33 +0000)]
Code cleanup - change naked 'throw' expressions to call helpre function '__throw_future_error'. The behavior change is that if you build libc++ with exceptions disabled, and then use that in a program that sets the value of the future twice (for example), it will now abort instead of behaving unpredictably.

llvm-svn: 338332

6 years ago[asan/win] Use SRW locks to fix a race in BlockingMutex
Reid Kleckner [Mon, 30 Jul 2018 23:32:33 +0000 (23:32 +0000)]
[asan/win] Use SRW locks to fix a race in BlockingMutex

Summary:
Before my change, BlockingMutex used Windows critial sections. Critical
sections can only be initialized by calling InitializeCriticalSection,
dynamically.

The primary sanitizer allocator expects to be able to reinterpret zero
initialized memory as a BlockingMutex and immediately lock it.
RegionInfo contains a mutex, and it placement new is never called for
it. These objects are accessed via:
  RegionInfo *GetRegionInfo(uptr class_id) const {
    DCHECK_LT(class_id, kNumClasses);
    RegionInfo *regions = reinterpret_cast<RegionInfo *>(SpaceEnd());
    return &regions[class_id];
  }
The memory comes from the OS without any other initialization.

For various reasons described in the comments, BlockingMutex::Lock would
check if the object appeared to be zero-initialized, and it would lazily
call the LinkerInitialized constructor to initialize the critical
section. This pattern is obviously racy, and the code had a bunch of
FIXMEs about it.

The best fix here is to use slim reader writer locks, which can start
out zero-initialized. They are available starting in Windows Vista. I
think it's safe to go ahead and use them today.

Reviewers: kcc, vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 338331

6 years ago[MS Demangler] Add ms-return-qualifiers.test.
Zachary Turner [Mon, 30 Jul 2018 23:22:39 +0000 (23:22 +0000)]
[MS Demangler] Add ms-return-qualifiers.test.

This is a copy of the tests from
clang/CodeGenCXX/ms-return-qualifiers.cpp converted to demangling
tests.

llvm-svn: 338330

6 years ago[DAGCombiner][TargetLowering] Pass a SmallVector instead of a std::vector to BuildSDI...
Craig Topper [Mon, 30 Jul 2018 23:22:00 +0000 (23:22 +0000)]
[DAGCombiner][TargetLowering] Pass a SmallVector instead of a std::vector to BuildSDIV/BuildUDIV/etc.

The vector contains the SDNodes that these functions create. The number of nodes is always a small number so we should use SmallVector to avoid a heap allocation.

llvm-svn: 338329

6 years agoRevert "Add a definition for FieldSize that seems to make sense here."
Eric Christopher [Mon, 30 Jul 2018 23:21:51 +0000 (23:21 +0000)]
Revert "Add a definition for FieldSize that seems to make sense here."

This reverts commit r338327, the problem was previously fixed in r338321.

llvm-svn: 338328

6 years agoAdd a definition for FieldSize that seems to make sense here.
Eric Christopher [Mon, 30 Jul 2018 23:17:27 +0000 (23:17 +0000)]
Add a definition for FieldSize that seems to make sense here.
This could be sunk out of the if statements, but fix the warning for now.

llvm-svn: 338327

6 years ago[docs] Sort ld.lld.1 options
Fangrui Song [Mon, 30 Jul 2018 23:07:44 +0000 (23:07 +0000)]
[docs] Sort ld.lld.1 options

Reviewers: ruiu

Subscribers: llvm-commits

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

llvm-svn: 338326

6 years ago[libcxx] fix `>> 42` UB in <experimental/simd>
Tim Shen [Mon, 30 Jul 2018 23:05:40 +0000 (23:05 +0000)]
[libcxx] fix `>> 42` UB in <experimental/simd>

llvm-svn: 338325

6 years ago[MS Demangler] Add rudimentary C++11 Support
Zachary Turner [Mon, 30 Jul 2018 23:02:10 +0000 (23:02 +0000)]
[MS Demangler] Add rudimentary C++11 Support

This patch adds support for demangling r-value references, new
operators such as the ""_foo operator, lambdas, alias types,
nullptr_t, and various other C++11'isms.

There is 1 failing test remaining in this file, which appears to
be related to back-referencing. This type of problem has the
potential to get ugly so I'd rather fix it in a separate patch.

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

llvm-svn: 338324

6 years ago[analyzer] [tests] Add an option for showing statistics after running tests.
George Karpenkov [Mon, 30 Jul 2018 23:01:47 +0000 (23:01 +0000)]
[analyzer] [tests] Add an option for showing statistics after running tests.

Do not show statistics by default.

llvm-svn: 338323

6 years ago[analyzer] [tests] Style fixes for testing harness.
George Karpenkov [Mon, 30 Jul 2018 23:01:20 +0000 (23:01 +0000)]
[analyzer] [tests] Style fixes for testing harness.

llvm-svn: 338322

6 years agoFix use of uninitialized variable in r338299
Scott Linder [Mon, 30 Jul 2018 22:52:07 +0000 (22:52 +0000)]
Fix use of uninitialized variable in r338299

llvm-svn: 338321

6 years ago[docs] Add missing options to ld.lld.1
Fangrui Song [Mon, 30 Jul 2018 22:31:00 +0000 (22:31 +0000)]
[docs] Add missing options to ld.lld.1

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

llvm-svn: 338320

6 years ago[llvm-mca][docs] Add instruction flow documentation. NFC.
Matt Davis [Mon, 30 Jul 2018 22:30:14 +0000 (22:30 +0000)]
[llvm-mca][docs] Add instruction flow documentation. NFC.

Summary:
This patch mostly copies the existing Instruction Flow, and stage descriptions
from the mca README.  I made a few text tweaks, but no semantic changes,
and made reference to the "default pipeline."  I also removed the internals
references (e.g., reference to class names and header files).  I did leave the
LSUnit name around, but only as an abbreviated word for the load-store unit.

Reviewers: andreadb, courbet, RKSimon, gbedwell, filcab

Reviewed By: andreadb

Subscribers: tschuett, jfb, llvm-commits

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

llvm-svn: 338319

6 years agoRe-apply "[libcxx] implement <simd> ABI for Clang/GCC vector extension, constructors...
Tim Shen [Mon, 30 Jul 2018 22:27:38 +0000 (22:27 +0000)]
Re-apply "[libcxx] implement <simd> ABI for Clang/GCC vector extension, constructors, copy_from and copy_to."

...with proper guarding #ifdefs for unsupported C++11.

llvm-svn: 338318

6 years ago[DAGCombiner] transform sub-of-shifted-signbit to add
Sanjay Patel [Mon, 30 Jul 2018 22:21:37 +0000 (22:21 +0000)]
[DAGCombiner] transform sub-of-shifted-signbit to add

This is exchanging a sub-of-1 with add-of-minus-1:
https://rise4fun.com/Alive/plKAH

This is another step towards improving select-of-constants codegen (see D48970).

x86 is the motivating target, and those diffs all appear to be wins. PPC and AArch64 look neutral.
I've limited this to early combining (!LegalOperations) in case a target wants to reverse it, but
I think canonicalizing to 'add' is more likely to produce further transforms because we have more
folds for 'add'.

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

llvm-svn: 338317

6 years agoRevert "[libcxx] implement <simd> ABI for Clang/GCC vector extension, constructors...
Tim Shen [Mon, 30 Jul 2018 22:21:22 +0000 (22:21 +0000)]
Revert "[libcxx] implement <simd> ABI for Clang/GCC vector extension, constructors, copy_from and copy_to."

This reverts commit r338309.

llvm-svn: 338316

6 years ago[analyzer] [NFC] Simplify some visitors by giving a convenient getter from state...
George Karpenkov [Mon, 30 Jul 2018 22:18:47 +0000 (22:18 +0000)]
[analyzer] [NFC] Simplify some visitors by giving a convenient getter from state to analysis manager

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

llvm-svn: 338315

6 years ago[analyzer] Bugfix for autorelease + main run loop leak checker
George Karpenkov [Mon, 30 Jul 2018 22:18:21 +0000 (22:18 +0000)]
[analyzer] Bugfix for autorelease + main run loop leak checker

Do not warn when the other message-send-expression is correctly wrapped
in a different autorelease pool.

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

llvm-svn: 338314

6 years ago[OpenMP] Fix tasking + parallel bug
Jonathan Peyton [Mon, 30 Jul 2018 21:47:56 +0000 (21:47 +0000)]
[OpenMP] Fix tasking + parallel bug

From the bug report, the runtime needs to initialize the nproc variables
(inside middle init) for each root when the task is encountered, otherwise,
a segfault can occur.

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

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

llvm-svn: 338313

6 years ago[analyzer] Fix crash in RunLoopAutoreleaseChecker on empty children
George Karpenkov [Mon, 30 Jul 2018 21:44:15 +0000 (21:44 +0000)]
[analyzer] Fix crash in RunLoopAutoreleaseChecker on empty children

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

llvm-svn: 338312

6 years agoRemove unnecessary newlines from break command help text.
Raphael Isemann [Mon, 30 Jul 2018 21:41:13 +0000 (21:41 +0000)]
Remove unnecessary newlines from break command help text.

Summary:
We usually don't have trailing newlines in the short help strings. This just adds
unnecessary extra lines when printing the help text of these commands.

Subscribers: lldb-commits

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

llvm-svn: 338311

6 years ago[VPlan] Introduce VPlan-based dominator analysis.
Diego Caballero [Mon, 30 Jul 2018 21:33:31 +0000 (21:33 +0000)]
[VPlan] Introduce VPlan-based dominator analysis.

The patch introduces dominator analysis for VPBlockBases and extend
VPlan's GraphTraits specialization with the required interfaces. Dominator
analysis will be necessary to perform some H-CFG transformations and
to introduce VPLoopInfo (LoopInfo analysis on top of the VPlan representation).

Reviewers: fhahn, rengolin, mkuper, hfinkel, mssimpso

Reviewed By: fhahn

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

llvm-svn: 338310

6 years ago[libcxx] implement <simd> ABI for Clang/GCC vector extension, constructors, copy_from...
Tim Shen [Mon, 30 Jul 2018 21:23:13 +0000 (21:23 +0000)]
[libcxx] implement <simd> ABI for Clang/GCC vector extension, constructors, copy_from and copy_to.

Summary:
This patch adds a new macro _LIBCPP_HAS_NO_VECTOR_EXTENSION for detecting
whether a vector extension (\_\_attribute\_\_((vector_size(num_bytes)))) is
available.

On the top of that, this patch implements the following API:
* all constructors
* operator[]
* copy_from
* copy_to

It also defines simd_abi::native to use vector extension, if available.
In GCC and Clang, certain values with vector extension are passed by registers,
instead of memory.

Based on D41148.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits, MaskRay, lichray, sanjoy

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

llvm-svn: 338309

6 years agoThis fixes a crash when a second pass is required for the Codeview Type merging ...
Alexandre Ganea [Mon, 30 Jul 2018 21:14:25 +0000 (21:14 +0000)]
This fixes a crash when a second pass is required for the Codeview Type merging *and* the index points outside of the table (which should lead to an error being printed).

This occurs currently until MS precompiled headers .obj is added (see D45213)

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

llvm-svn: 338308

6 years ago[NFC] Rename test/ubsan/TestCases/{ImplicitCast => ImplicitConversion}
Roman Lebedev [Mon, 30 Jul 2018 21:11:34 +0000 (21:11 +0000)]
[NFC] Rename test/ubsan/TestCases/{ImplicitCast => ImplicitConversion}

Just to be consistent with the rest.
I should have done that in the commit itself, but the filepaths
is one thing i forgot to verify :S

llvm-svn: 338307

6 years ago[docs] UndefinedBehaviorSanitizer.rst: {,un}signed-integer-overflow: tune docs
Roman Lebedev [Mon, 30 Jul 2018 21:11:32 +0000 (21:11 +0000)]
[docs] UndefinedBehaviorSanitizer.rst: {,un}signed-integer-overflow: tune docs

Yes, i erroneously assumed that the "after" was meant,
but i was wrong:
> I really meant "performed before", for cases like 4u / -2,
> where -2 is implicitly converted to UINT_MAX - 2 before
> the computation. Conversions that are performed after
> a computation aren't part of the computation at all,
> so I think it's much clearer that they're not in scope
> for this sanitizer.

llvm-svn: 338306

6 years ago[ORC] Add SerializationTraits for std::set and std::map.
Lang Hames [Mon, 30 Jul 2018 21:08:06 +0000 (21:08 +0000)]
[ORC] Add SerializationTraits for std::set and std::map.

Also, make SerializationTraits for pairs forward the actual pair
template type arguments to the underlying serializer. This allows, for example,
std::pair<StringRef, bool> to be passed as an argument to an RPC call expecting
a std::pair<std::string, bool>, since there is an underlying serializer from
StringRef to std::string that can be used.

llvm-svn: 338305

6 years ago[TargetLowering] In BuildSDIV, add the MULHS/SMUL_LOHI to the Created vector.
Craig Topper [Mon, 30 Jul 2018 21:04:38 +0000 (21:04 +0000)]
[TargetLowering] In BuildSDIV, add the MULHS/SMUL_LOHI to the Created vector.

BuildUDIV was already correct.

llvm-svn: 338304

6 years ago[DAGCombiner][PowerPC][AArch64] Pass Created vector by reference to BuildSDIVPow2.
Craig Topper [Mon, 30 Jul 2018 21:04:34 +0000 (21:04 +0000)]
[DAGCombiner][PowerPC][AArch64] Pass Created vector by reference to BuildSDIVPow2.

llvm-svn: 338303

6 years agoAvoid returning an invalid end source loc
Stephen Kelly [Mon, 30 Jul 2018 20:39:14 +0000 (20:39 +0000)]
Avoid returning an invalid end source loc

llvm-svn: 338301

6 years ago[InstCombine] Fold Select with binary op
David Bolvansky [Mon, 30 Jul 2018 20:38:53 +0000 (20:38 +0000)]
[InstCombine] Fold Select with binary op

Summary:
Fold
  %A = icmp eq i8 %x, 0
  %B = xor i8 %x, %z
  %C = select i1 %A, i8 %B, i8 %y
To
  %C = select i1 %A, i8 %z, i8 %y

Fixes https://bugs.llvm.org/show_bug.cgi?id=38345
Proof: https://rise4fun.com/Alive/43J

Reviewers: lebedev.ri, spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 338300

6 years ago[DebugInfo][OpenCL] Generate correct block literal debug info for OpenCL
Scott Linder [Mon, 30 Jul 2018 20:31:11 +0000 (20:31 +0000)]
[DebugInfo][OpenCL] Generate correct block literal debug info for OpenCL

OpenCL block literal structs have different fields which are now correctly
identified in the debug info.

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

llvm-svn: 338299

6 years agoRevert r338222 "[DAGCombiner] Remove unnecessary calls to AddToWorklist."
Craig Topper [Mon, 30 Jul 2018 20:27:10 +0000 (20:27 +0000)]
Revert r338222 "[DAGCombiner] Remove unnecessary calls to AddToWorklist."

Thinking about it more it might be possible for the later nodes to be folded in getNode in such a way that the other created nodes are left dead. This can cause use counts to be incorrect on nodes that aren't dead.

So its probably safer to leave this alone.

llvm-svn: 338298

6 years agoRevert "[GVNHoist] Re-enable GVNHoist by default"
Vlad Tsyrklevich [Mon, 30 Jul 2018 20:07:33 +0000 (20:07 +0000)]
Revert "[GVNHoist] Re-enable GVNHoist by default"

This reverts commit r338240 because it was causing OOMs on the UBSan
buildbot when building clang/lib/Sema/SemaChecking.cpp

llvm-svn: 338297

6 years ago[compiler-rt] integer-truncation-blacklist.c: XFAIL on android/ios
Roman Lebedev [Mon, 30 Jul 2018 20:05:24 +0000 (20:05 +0000)]
[compiler-rt] integer-truncation-blacklist.c: XFAIL on android/ios

The Builder sanitizer-x86_64-linux-android is failing
starting with rL338287 / D48959.

It runs the tests via android_compile.py, so i'm not sure this
is actually *this* issue:
  https://code.google.com/p/address-sanitizer/issues/detail?id=316
but this seems oddly similar to the other XFAIL'ed cases...

Right now that seems to be the only failing builder,
so i *think* it makes sense to try to just blacklist it for now.

llvm-svn: 338296

6 years ago[OpenMP] Fix new task creation
Gheorghe-Teodor Bercea [Mon, 30 Jul 2018 19:51:51 +0000 (19:51 +0000)]
[OpenMP] Fix new task creation

Summary:
When OMPT is not supported the __kmp_omp_task() function is passed the parameters in the wrong order. This is a fix related to patch D47709.

Reviewers: Hahnfeld, sconvent, caomhin, jlpeyton

Reviewed By: Hahnfeld

Subscribers: guansong, openmp-commits

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

llvm-svn: 338295

6 years ago[OpenEmbedded] Fix lib paths for OpenEmbedded targets
Mandeep Singh Grang [Mon, 30 Jul 2018 19:44:13 +0000 (19:44 +0000)]
[OpenEmbedded] Fix lib paths for OpenEmbedded targets

Summary:
The lib paths are not correctly picked up for OpenEmbedded sysroots (like arm-oe-linux-gnueabi) for 2 reasons:

1. OpenEmbedded sysroots are of the form <sysroot>/usr/lib/<triple>/x.y.z. This form is handled in clang but only for Freescale vendor.

2. 64-bit OpenEmbedded sysroots may not have a /usr/lib dir. So they cannot find /usr/lib64 as it is referenced as /usr/lib/../lib64 in clang.

This is a follow-up to the llvm patch: D48861

Reviewers: dlj, rengolin, fedor.sergeev, javed.absar, hfinkel, rsmith

Reviewed By: rsmith

Subscribers: rsmith, kristof.beyls, cfe-commits

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

llvm-svn: 338294

6 years agoRemove trailing space
Fangrui Song [Mon, 30 Jul 2018 19:41:25 +0000 (19:41 +0000)]
Remove trailing space

sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}

llvm-svn: 338293

6 years ago[Inline] Copy "null-pointer-is-valid" attribute in caller.
Manoj Gupta [Mon, 30 Jul 2018 19:33:53 +0000 (19:33 +0000)]
[Inline] Copy "null-pointer-is-valid" attribute in caller.

Summary:
Normally, inling does not happen if caller does not have
"null-pointer-is-valid"="true" attibute but callee has it.

However, alwaysinline may force callee to be inlined.
In this case, if the caller has the "null-pointer-is-valid"="true"
attribute, copy the attribute to caller.

Reviewers: efriedma, a.elovikov, lebedev.ri, jyknight

Reviewed By: efriedma

Subscribers: eraman, llvm-commits

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

llvm-svn: 338292

6 years agoRemove trailing space
Fangrui Song [Mon, 30 Jul 2018 19:24:48 +0000 (19:24 +0000)]
Remove trailing space

sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}

llvm-svn: 338291

6 years agoMake test/Driver/baremetal.cpp work with linkers other than lld
David Greene [Mon, 30 Jul 2018 19:08:20 +0000 (19:08 +0000)]
Make test/Driver/baremetal.cpp work with linkers other than lld

This test fails if clang is configure with, for example, gold as the
default linker. It does not appear that this test really relies on lld
so make the checks accept ld, ld.gold and ld.bfd too.

llvm-svn: 338290

6 years ago[clang][ubsan] Implicit Conversion Sanitizer - integer truncation - clang part
Roman Lebedev [Mon, 30 Jul 2018 18:58:30 +0000 (18:58 +0000)]
[clang][ubsan] Implicit Conversion Sanitizer - integer truncation  - clang part

Summary:
C and C++ are interesting languages. They are statically typed, but weakly.
The implicit conversions are allowed. This is nice, allows to write code
while balancing between getting drowned in everything being convertible,
and nothing being convertible. As usual, this comes with a price:

```
unsigned char store = 0;

bool consume(unsigned int val);

void test(unsigned long val) {
  if (consume(val)) {
    // the 'val' is `unsigned long`, but `consume()` takes `unsigned int`.
    // If their bit widths are different on this platform, the implicit
    // truncation happens. And if that `unsigned long` had a value bigger
    // than UINT_MAX, then you may or may not have a bug.

    // Similarly, integer addition happens on `int`s, so `store` will
    // be promoted to an `int`, the sum calculated (0+768=768),
    // and the result demoted to `unsigned char`, and stored to `store`.
    // In this case, the `store` will still be 0. Again, not always intended.
    store = store + 768; // before addition, 'store' was promoted to int.
  }

  // But yes, sometimes this is intentional.
  // You can either make the conversion explicit
  (void)consume((unsigned int)val);
  // or mask the value so no bits will be *implicitly* lost.
  (void)consume((~((unsigned int)0)) & val);
}
```

Yes, there is a `-Wconversion`` diagnostic group, but first, it is kinda
noisy, since it warns on everything (unlike sanitizers, warning on an
actual issues), and second, there are cases where it does **not** warn.
So a Sanitizer is needed. I don't have any motivational numbers, but i know
i had this kind of problem 10-20 times, and it was never easy to track down.

The logic to detect whether an truncation has happened is pretty simple
if you think about it - https://godbolt.org/g/NEzXbb - basically, just
extend (using the new, not original!, signedness) the 'truncated' value
back to it's original width, and equality-compare it with the original value.

The most non-trivial thing here is the logic to detect whether this
`ImplicitCastExpr` AST node is **actually** an implicit conversion, //or//
part of an explicit cast. Because the explicit casts are modeled as an outer
`ExplicitCastExpr` with some `ImplicitCastExpr`'s as **direct** children.
https://godbolt.org/g/eE1GkJ

Nowadays, we can just use the new `part_of_explicit_cast` flag, which is set
on all the implicitly-added `ImplicitCastExpr`'s of an `ExplicitCastExpr`.
So if that flag is **not** set, then it is an actual implicit conversion.

As you may have noted, this isn't just named `-fsanitize=implicit-integer-truncation`.
There are potentially some more implicit conversions to be warned about.
Namely, implicit conversions that result in sign change; implicit conversion
between different floating point types, or between fp and an integer,
when again, that conversion is lossy.

One thing i know isn't handled is bitfields.

This is a clang part.
The compiler-rt part is D48959.

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=37552 | PR37552 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=35409 | PR35409 ]].
Partially fixes [[ https://bugs.llvm.org/show_bug.cgi?id=9821 | PR9821 ]].
Fixes https://github.com/google/sanitizers/issues/940. (other than sign-changing implicit conversions)

Reviewers: rjmccall, rsmith, samsonov, pcc, vsk, eugenis, efriedma, kcc, erichkeane

Reviewed By: rsmith, vsk, erichkeane

Subscribers: erichkeane, klimek, #sanitizers, aaron.ballman, RKSimon, dtzWill, filcab, danielaustin, ygribov, dvyukov, milianw, mclow.lists, cfe-commits, regehr

Tags: #sanitizers

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

llvm-svn: 338288

6 years ago[compiler-rt][ubsan] Implicit Conversion Sanitizer - integer truncation - compiler...
Roman Lebedev [Mon, 30 Jul 2018 18:58:30 +0000 (18:58 +0000)]
[compiler-rt][ubsan] Implicit Conversion Sanitizer - integer truncation  - compiler-rt part

Summary:
This is a compiler-rt part.
The clang part is D48958.

See [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], https://github.com/google/sanitizers/issues/940.

Reviewers: #sanitizers, samsonov, vsk, rsmith, pcc, eugenis, kcc, filcab

Reviewed By: #sanitizers, vsk, filcab

Subscribers: llvm-commits, eugenis, filcab, kubamracek, dberris, #sanitizers, regehr

Tags: #sanitizers

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

llvm-svn: 338287

6 years ago[analyzer] Store ValueDecl in DeclRegion
George Karpenkov [Mon, 30 Jul 2018 18:57:13 +0000 (18:57 +0000)]
[analyzer] Store ValueDecl in DeclRegion

All use cases of DeclRegion actually have ValueDecl there,
and getting the name from declaration comes in very handy.

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

llvm-svn: 338286

6 years ago[InstSimplify] [NFC] Tests for Select with AND/OR fold
David Bolvansky [Mon, 30 Jul 2018 18:22:18 +0000 (18:22 +0000)]
[InstSimplify] [NFC] Tests for Select with AND/OR fold

llvm-svn: 338285

6 years ago[cmake] [ARM] Exclude any VFP builtins if VFP is not supported
Azharuddin Mohammed [Mon, 30 Jul 2018 18:18:59 +0000 (18:18 +0000)]
[cmake] [ARM] Exclude any VFP builtins if VFP is not supported

Summary:
rL325492 disables FPU features when using soft floating point
(-mfloat-abi=soft), which is used internally when building for arm. This causes
errors with builtins that utililize VFP instructions.

With this change we check if VFP is enabled (by checking if the preprocessor
macro __VFP_FP__ is defined), and exclude such builtins if it is not enabled.

Reviewers: rengolin, samsonov, compnerd, smeenai, javed.absar, peter.smith

Reviewed By: peter.smith

Subscribers: delcypher, peter.smith, mgorny, kristof.beyls, chrib, llvm-commits

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

llvm-svn: 338284

6 years ago[CMake] Disable -Wstringop-overflow
Jonas Hahnfeld [Mon, 30 Jul 2018 18:16:22 +0000 (18:16 +0000)]
[CMake] Disable -Wstringop-overflow

GCC 8 produces false-positives with this:
In file included from <openmp>/src/runtime/src/kmp_os.h:950,
                 from <openmp>/src/runtime/src/kmp.h:78,
                 from <openmp>/src/runtime/src/kmp_environment.cpp:54:
<openmp>/src/runtime/src/kmp_environment.cpp: In function ‘char* __kmp_env_get(const char*)’:
<openmp>/src/runtime/src/kmp_safe_c_api.h:52:50: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
 #define KMP_STRNCPY_S(dst, bsz, src, cnt) strncpy(dst, src, cnt)
                                           ~~~~~~~^~~~~~~~~~~~~~~
<openmp>/src/runtime/src/kmp_environment.cpp:97:5: note: in expansion of macro ‘KMP_STRNCPY_S’
     KMP_STRNCPY_S(result, len, value, len);
     ^~~~~~~~~~~~~
<openmp>/src/runtime/src/kmp_environment.cpp:92:28: note: length computed here
     size_t len = KMP_STRLEN(value) + 1;

This is stupid because result is allocated with KMP_INTERNAL_MALLOC(len),
so the arguments are correct.

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

llvm-svn: 338283

6 years agoDelete some unreachable AST printing code.
Richard Smith [Mon, 30 Jul 2018 18:05:19 +0000 (18:05 +0000)]
Delete some unreachable AST printing code.

llvm-svn: 338282

6 years ago[OpenMP] Add GOMP version symbols for OMP_4.5 API
Jonathan Peyton [Mon, 30 Jul 2018 17:50:35 +0000 (17:50 +0000)]
[OpenMP] Add GOMP version symbols for OMP_4.5 API

This patch adds the appropriate version symbols to the relevant API functions

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

llvm-svn: 338281

6 years ago[OpenMP] Implement GOMP doacross compatibility
Jonathan Peyton [Mon, 30 Jul 2018 17:48:33 +0000 (17:48 +0000)]
[OpenMP] Implement GOMP doacross compatibility

This change introduces GOMP doacross compatibility. There are 12 new interface
functions 6 for long type and 6 for unsigned long long type:
GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_doacross_[schedule]_start
where schedule can be static, dynamic, guided, or runtime.

These functions just translate the parameters if necessary and send them
to the corresponding kmp function.
E.g., GOMP_doacross_post() -> __kmpc_doacross_post()

For the GOMP_doacross_post function, there is template specialization to
account for when long is a four byte vs an eight byte type. If it is a
four byte type, then a temporary array has to be created to convert the
four byte integers into eight byte integers and then sending that into
__kmpc_doacross_post(). Because GOMP_doacross_wait uses varargs, it
always needs a temporary array and does not need template specialization.

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

llvm-svn: 338280

6 years ago[ARM, AArch64]: Use unadjusted alignment when passing composites as arguments
Momchil Velikov [Mon, 30 Jul 2018 17:48:23 +0000 (17:48 +0000)]
[ARM, AArch64]: Use unadjusted alignment when passing composites as arguments

The "Procedure Call Procedure Call Standard for the ARM® Architecture"
(https://static.docs.arm.com/ihi0042/f/IHI0042F_aapcs.pdf), specifies that
composite types are passed according to their "natural alignment", i.e. the
alignment before alignment adjustment on the entire composite is applied.

The same applies for AArch64 ABI.

Clang, however, used the adjusted alignment.

GCC already implements the ABI correctly. With this patch Clang becomes
compatible with GCC and passes such arguments in accordance with AAPCS.

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

llvm-svn: 338279

6 years ago[MachineOutliner][AArch64] Add support for saving LR to a register
Jessica Paquette [Mon, 30 Jul 2018 17:45:28 +0000 (17:45 +0000)]
[MachineOutliner][AArch64] Add support for saving LR to a register

This teaches the outliner to save LR to a register rather than the stack when
possible. This allows us to avoid bumping the stack in outlined functions in
some cases. By doing this, in a later patch, we can teach the outliner to do
something like this:

f1:
  ...
  bl OUTLINED_FUNCTION
  ...

f2:
  ...
  move LR's contents to a register
  bl OUTLINED_FUNCTION
  move the register's contents back

instead of falling back to saving LR in both cases.

llvm-svn: 338278

6 years ago[OpenMP] Fix build errors when building with KMP_DEBUG_ADAPTIVE_LOCKS=1
Jonathan Peyton [Mon, 30 Jul 2018 17:45:23 +0000 (17:45 +0000)]
[OpenMP] Fix build errors when building with KMP_DEBUG_ADAPTIVE_LOCKS=1

This change fixes build errors when building a runtime with adaptive lock stats
enabled. Most of the errors were due to the recent changes in the runtime, but
it seems that we have not tried to build this debug runtime on Windows for a
long time.

Patch by Hansang Bae

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

llvm-svn: 338277