platform/upstream/llvm.git
6 years ago[llvm-pdbutil] Support PDBs without a DBI stream
Alexandre Ganea [Mon, 6 Aug 2018 19:35:00 +0000 (19:35 +0000)]
[llvm-pdbutil] Support PDBs without a DBI stream

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

llvm-svn: 339045

6 years agoFix for broken build on clang-hexagon-elf for ambiguous call to
Leonard Chan [Mon, 6 Aug 2018 19:31:00 +0000 (19:31 +0000)]
Fix for broken build on clang-hexagon-elf for ambiguous call to
std::abs.

llvm-svn: 339044

6 years ago[X86] Recognize a splat of negate in isFNEG
Easwaran Raman [Mon, 6 Aug 2018 19:23:38 +0000 (19:23 +0000)]
[X86] Recognize a splat of negate in isFNEG

Summary:
Expand isFNEG so that we generate the appropriate F(N)M(ADD|SUB)
instructions in more cases. For example, the following sequence
a = _mm256_broadcast_ss(f)
d = _mm256_fnmadd_ps(a, b, c)

generates an fsub and fma without this patch and an fnma with this
change.

Reviewers: craig.topper

Subscribers: llvm-commits, davidxl, wmi

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

llvm-svn: 339043

6 years ago[ELF] Don't copy STT_TLS in copy relocation
Fangrui Song [Mon, 6 Aug 2018 19:09:40 +0000 (19:09 +0000)]
[ELF] Don't copy STT_TLS in copy relocation

During copy relocation of a variable defined in a DSO, if a TLS variable in that DSO happens to have the same st_value, it would also be copied. This was unnecessary because the addresses of TLS variables are relative to TLS segment. They don't interfere with non-TLS variables.

This copying behavior can be harmful in the following scenario:

For function-scope thread-local variables with non-trivial constructors,
they have guard variables. In the case of x86_64 general-dynamic model:

template <int N>
void foo() {
  thread_local std::string a;
}

GOT[n]   R_X86_64_DTPMOD64 guard variable for a
GOT[n+1] R_X86_64_DTPOFF64 guard variable for a
GOT[n+2] R_X86_64_DTPMOD64 a
GOT[n+3] R_X86_64_DTPOFF64 a

a and its guard variable are both represented as TLS variables, which
should be within the same module. If one is copy relocated to the main
module while the other is not, their module ID will mismatch and can
cause access without prior construction.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 339042

6 years ago[X86] When using "and $0" and "orl $-1" to store 0 and -1 for minsize, make sure...
Craig Topper [Mon, 6 Aug 2018 18:44:26 +0000 (18:44 +0000)]
[X86] When using "and $0" and "orl $-1" to store 0 and -1 for minsize, make sure the store isn't volatile

If the store is volatile this might be a memory mapped IO access. In that case we shouldn't generate a load that didn't exist in the source

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

llvm-svn: 339041

6 years ago[X86] Add test cases to show bad use of "and $0" and "orl $-1" for minsize when the...
Craig Topper [Mon, 6 Aug 2018 18:44:21 +0000 (18:44 +0000)]
[X86] Add test cases to show bad use of "and $0" and "orl $-1" for minsize when the store is volatile

If the store is volatile we shouldn't be adding a little that didn't exist in the source.

llvm-svn: 339040

6 years ago[NFC] Remove TODO comment that no longer applies (ParsedAttr)
Erich Keane [Mon, 6 Aug 2018 18:11:48 +0000 (18:11 +0000)]
[NFC] Remove TODO comment that no longer applies (ParsedAttr)

llvm-svn: 339039

6 years agoRemoved the OverflowConversionsToFract tests for now. Will add them back
Leonard Chan [Mon, 6 Aug 2018 18:02:16 +0000 (18:02 +0000)]
Removed the OverflowConversionsToFract tests for now. Will add them back
in once I figure out why this doesn't work on windows.

llvm-svn: 339038

6 years agoFix for failing test from sanitizer-x86_64-linux-fast where there was a
Leonard Chan [Mon, 6 Aug 2018 17:55:38 +0000 (17:55 +0000)]
Fix for failing test from sanitizer-x86_64-linux-fast where there was a
left shift on a negative value.

llvm-svn: 339037

6 years agoForce test/Driver/fuchsia.c(pp) to use lld
David Greene [Mon, 6 Aug 2018 17:35:44 +0000 (17:35 +0000)]
Force test/Driver/fuchsia.c(pp) to use lld

The Fuchsia driver relies on lld so invoke clang with
-fuse-ld=lld. This gets the test passing when the clang default linker
is something other than lld.

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

llvm-svn: 339036

6 years ago[RegisterCoalescer] Delay live interval update work until the rematerialization
Wei Mi [Mon, 6 Aug 2018 17:30:45 +0000 (17:30 +0000)]
[RegisterCoalescer] Delay live interval update work until the rematerialization
for all the uses from the same def is done.

We run into a compile time problem with flex generated code combined with
`-fno-jump-tables`. The cause is that machineLICM hoists a lot of invariants
outside of a big loop, and drastically increases the compile time in global
register splitting and copy coalescing.  https://reviews.llvm.org/D49353
relieves the problem in global splitting. This patch is to handle the problem
in copy coalescing.

About the situation where the problem in copy coalescing happens. After
machineLICM, we have several defs outside of a big loop with hundreds or
thousands of uses inside the loop. Rematerialization in copy coalescing
happens for each use and everytime rematerialization is done, shrinkToUses
will be called to update the huge live interval. Because we have 'n' uses
for a def, and each live interval update will have at least 'n' complexity,
the total update work is n^2.

To fix the problem, we try to do the live interval update work in a collective
way. If a def has many copylike uses larger than a threshold, each time
rematerialization is done for one of those uses, we won't do the live interval
update in time but delay that work until rematerialization for all those uses
are completed, so we only have to do the live interval update work once.

Delaying the live interval update could potentially change the copy coalescing
result, so we hope to limit that change to those defs with many
(like above a hundred) copylike uses, and the cutoff can be adjusted by the
option -mllvm -late-remat-update-threshold=xxx.

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

llvm-svn: 339035

6 years agoFix more offsetof issues.
Greg Clayton [Mon, 6 Aug 2018 17:26:53 +0000 (17:26 +0000)]
Fix more offsetof issues.

llvm-svn: 339034

6 years agoFix offsetof usage that got lost when passing patches between linux and mac.
Greg Clayton [Mon, 6 Aug 2018 17:07:50 +0000 (17:07 +0000)]
Fix offsetof usage that got lost when passing patches between linux and mac.

llvm-svn: 339033

6 years agoAdd support for ARM and ARM64 breakpad generated minidump files (version 2).
Greg Clayton [Mon, 6 Aug 2018 16:56:10 +0000 (16:56 +0000)]
Add support for ARM and ARM64 breakpad generated minidump files (version 2).

In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value.

This is a fixed version of: https://reviews.llvm.org/D49750

The changes from D49750 are:

Don't init the m_arch in the Initialize call as a system info isn't required. This keeps the thread list, module list and other tests from failing
Added -Wextended-offsetof to Xcode project so we catch use extended usages of offsetof before submission
Fixed any extended offset of warnings

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

llvm-svn: 339032

6 years ago[Fixed Point Arithmetic] Remove unused include.
Benjamin Kramer [Mon, 6 Aug 2018 16:53:21 +0000 (16:53 +0000)]
[Fixed Point Arithmetic] Remove unused include.

lib/Basic cannot depend on lib/AST.

llvm-svn: 339031

6 years ago[AST] Remove unnecessary indirections in DeclarationNameTable
Bruno Ricci [Mon, 6 Aug 2018 16:47:31 +0000 (16:47 +0000)]
[AST] Remove unnecessary indirections in DeclarationNameTable

DeclarationNameTable currently hold 3 "void *" to
FoldingSet<CXXSpecialName>, FoldingSet<CXXLiteralOperatorIdName>
and FoldingSet<CXXDeductionGuideNameExtra>.

CXXSpecialName, CXXLiteralOperatorIdName and
CXXDeductionGuideNameExtra are private classes holding extra
information about a "special" declaration name and are in
AST/DeclarationName.cpp. The original intent seems to have
been to keep these classes private and only expose
DeclarationNameExtra and DeclarationName (the code dates from
2008 and has not been significantly changed since).

However this make the code less straightforward than necessary
because of the need to have "void *" in DeclarationNameTable
(with 1 of 3 comments wrong) and to manually allocate/deallocate
the FoldingSets.

Moreover removing the extra indirections reduce the run-time of
an fsyntax-only on all of Boost by 2.3% which is not totally
unexpected given how frequently this data structure is used
(especially for C++).

A concern raised by erichkeane during the review was that
including Type.h would increase the compile time unreasonably.
However test builds (both clean and incremental) showed that
this patch did not result in any compile time increase.

Reviewed By: erichkeane

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

llvm-svn: 339030

6 years agoFix typo in the MSVC Visualizer for SmallVector class
Daniil Fukalov [Mon, 6 Aug 2018 16:47:24 +0000 (16:47 +0000)]
Fix typo in the MSVC Visualizer for SmallVector class

llvm-svn: 339029

6 years ago[Fixed Point Arithmetic] Fixed Point Constant
Leonard Chan [Mon, 6 Aug 2018 16:42:37 +0000 (16:42 +0000)]
[Fixed Point Arithmetic] Fixed Point Constant

This patch proposes an abstract type that represents fixed point numbers, similar to APInt or APSInt that was discussed in https://reviews.llvm.org/D48456#inline-425585. This type holds a value, scale, and saturation and is meant to perform intermediate calculations on constant fixed point values.

Currently this class is used as a way for handling the conversions between fixed point numbers with different sizes and radixes. For example, if I'm casting from a signed _Accum to a saturated unsigned short _Accum, I will need to check the value of the signed _Accum to see if it fits into the short _Accum which involves getting and comparing against the max/min values of the short _Accum. The FixedPointNumber class currently handles the radix shifting and extension when converting to a signed _Accum.

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

llvm-svn: 339028

6 years agoFix raw_fd_ostream::write_impl hang due to an infinite loop with large output
Owen Reynolds [Mon, 6 Aug 2018 16:21:41 +0000 (16:21 +0000)]
Fix raw_fd_ostream::write_impl hang due to an infinite loop with large output

On windows when raw_fd_ostream::write_impl calls write, a 32 bit input is required for character count. As a variable with size_t is used for this argument, on x64 integral demotion occurs. In the case of large files an infinite loop follows.
See: https://bugs.llvm.org/show_bug.cgi?id=37926
This fix allows the output of files larger than the previous int32 limit.

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

llvm-svn: 339027

6 years ago[Fixed Point Arithmetic] Fix for FixedPointValueToString
Leonard Chan [Mon, 6 Aug 2018 16:05:08 +0000 (16:05 +0000)]
[Fixed Point Arithmetic] Fix for FixedPointValueToString

- Print negative numbers correctly
- Handle APInts of different sizes
- Add formal unit tests for FixedPointValueToString
- Add tests for checking correct printing when padding is set
- Restrict to printing in radix 10 since that's all we need for now

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

llvm-svn: 339026

6 years agoAMDGPU: Fold v_lshl_or_b32 with 0 src0
Matt Arsenault [Mon, 6 Aug 2018 15:40:20 +0000 (15:40 +0000)]
AMDGPU: Fold v_lshl_or_b32 with 0 src0

Appears from expansion of some packed cases.

llvm-svn: 339025

6 years ago[AST] Add individual size info for Types in -print-stats
Bruno Ricci [Mon, 6 Aug 2018 15:17:32 +0000 (15:17 +0000)]
[AST] Add individual size info for Types in -print-stats

This mirrors what is done for Decls and Stmts in the -print-stats
output, ie instead of printing "57426 LValueReference types"
we print "57426 LValueReference types, 40 each (2297040 bytes)".

llvm-svn: 339024

6 years agoValueTracking: Handle canonicalize in CannotBeNegativeZero
Matt Arsenault [Mon, 6 Aug 2018 15:16:26 +0000 (15:16 +0000)]
ValueTracking: Handle canonicalize in CannotBeNegativeZero

Also fix apparently missing test coverage for any of the
handling here.

llvm-svn: 339023

6 years agoAMDGPU: Rename check prefixes in test
Matt Arsenault [Mon, 6 Aug 2018 15:16:12 +0000 (15:16 +0000)]
AMDGPU: Rename check prefixes in test

Will avoid noisy diff in future change.

llvm-svn: 339022

6 years ago[NFC] Fixed unused function warnings
David Bolvansky [Mon, 6 Aug 2018 15:09:15 +0000 (15:09 +0000)]
[NFC] Fixed unused function warnings

llvm-svn: 339021

6 years agoRevert unused function fix
David Bolvansky [Mon, 6 Aug 2018 15:05:51 +0000 (15:05 +0000)]
Revert unused function fix

llvm-svn: 339020

6 years ago[NFC] Fixed unused function warning
David Bolvansky [Mon, 6 Aug 2018 14:42:07 +0000 (14:42 +0000)]
[NFC] Fixed unused function warning

llvm-svn: 339019

6 years ago[ASTmporter] SourceRange-free function parameter checking for declarations
Gabor Marton [Mon, 6 Aug 2018 14:38:37 +0000 (14:38 +0000)]
[ASTmporter] SourceRange-free function parameter checking for declarations

Summary: The previous code which avoided infinite recursion (because of reparsing declarations in function parameter lists) contained SourceRange dependent code which had some problems when parameter types were coming from macros. The new solution is not using macros and therefore much safer. A couple of importer problems are fixed in redis and tmux by this fix. Various unittests are included.

Reviewers: a.sidorin, r.stahl, a_sidorin

Reviewed By: a_sidorin

Subscribers: cfe-commits, dkrupp, balazske, martong

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

Patch by Zoltan Gera!

llvm-svn: 339018

6 years ago[AST] Move the enum in ObjCMethodDeclBitfields
Bruno Ricci [Mon, 6 Aug 2018 14:33:45 +0000 (14:33 +0000)]
[AST] Move the enum in ObjCMethodDeclBitfields

Move the enum { ObjCMethodFamilyBitWidth = 4 } to the top of
the class. For some dark reason having the enum between the
bitfields breaks the packing with gcc version 7.3-win32 20180312.

Reported by: Abramo Bagnara (by email)

llvm-svn: 339017

6 years ago[clang] Fix broken include_next in float.h
Louis Dionne [Mon, 6 Aug 2018 14:29:47 +0000 (14:29 +0000)]
[clang] Fix broken include_next in float.h

Summary:
The code defines __FLOAT_H and then includes the next <float.h>, which is
guarded on __FLOAT_H so it gets skipped entirely. This commit uses the header
guard __CLANG_FLOAT_H, like other headers (such as limits.h) do.

Reviewers: jfb

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 339016

6 years agoFix Mangled::Compare()
Stefan Granitz [Mon, 6 Aug 2018 14:15:21 +0000 (14:15 +0000)]
Fix Mangled::Compare()

llvm-svn: 339015

6 years agoAdd ConstString::IsNull() to tell between null vs. empty strings and fix usage in...
Stefan Granitz [Mon, 6 Aug 2018 14:15:17 +0000 (14:15 +0000)]
Add ConstString::IsNull() to tell between null vs. empty strings and fix usage in Mangled::GetDemangledName()

Summary: `IsEmpty()` and `operator bool() == false` have equal semantics. Usage in Mangled::GetDemangledName() was incorrect. What it actually wants is a check for null-string. Split this off of D50071 and added a test to clarify usage.

Reviewers: labath, jingham

Subscribers: erik.pilkington, lldb-commits

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

llvm-svn: 339014

6 years ago[AArch64] Fix assertion failure on widened f16 BUILD_VECTOR
Bryan Chan [Mon, 6 Aug 2018 14:14:41 +0000 (14:14 +0000)]
[AArch64] Fix assertion failure on widened f16 BUILD_VECTOR

Summary:
Ensure that NormalizedBuildVector returns a BUILD_VECTOR with operands of the
same type. This fixes an assertion failure in VerifySDNode.

Reviewers: SjoerdMeijer, t.p.northover, javed.absar

Reviewed By: SjoerdMeijer

Subscribers: kristof.beyls, llvm-commits

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

llvm-svn: 339013

6 years ago[libc++] Add the _LIBCPP_HIDE_FROM_ABI_AFTER_V1 macro
Louis Dionne [Mon, 6 Aug 2018 14:11:50 +0000 (14:11 +0000)]
[libc++] Add the _LIBCPP_HIDE_FROM_ABI_AFTER_V1 macro

Summary:
This macro allows hiding symbols from the ABI when the library is built
with an ABI version after ABI v1, which is currently the only stable ABI.
This commit defines `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` to be
`_LIBCPP_HIDE_FROM_ABI_AFTER_V1`, meaning that symbols that were only
exported by the library for historical reasons are not exported anymore
in the unstable ABI.

Because of that, this commit is an ABI break for ABI v2. This ABI version
is not stable, however, so this should not be a problem.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, cfe-commits

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

llvm-svn: 339012

6 years ago[clangd] Index Interfaces for Xrefs
Haojian Wu [Mon, 6 Aug 2018 13:14:32 +0000 (13:14 +0000)]
[clangd] Index Interfaces for Xrefs

Summary:
This is the first step of implementing Xrefs in clangd:
  - add index interfaces, and related data structures.

Reviewers: sammccall

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 339011

6 years agoFix modules build with different technique to suppress Knuth debugging
Tim Northover [Mon, 6 Aug 2018 11:43:11 +0000 (11:43 +0000)]
Fix modules build with different technique to suppress Knuth debugging

Currently we use #pragma push_macro(LLVM_DEBUG) to fiddle with the LLVM_DEBUG
macro so that we can silence debugging the Knuth division algorithm unless it's
actually desired. Unfortunately this is incompatible with enabling modules
while building LLVM (via LLVM_ENABLE_MODULES=ON), probably due to a bug being
fixed by D33004.

llvm-svn: 339009

6 years agoclang-cl: Parse the new /JMC flag
Hans Wennborg [Mon, 6 Aug 2018 11:34:46 +0000 (11:34 +0000)]
clang-cl: Parse the new /JMC flag

llvm-svn: 339008

6 years agoARM-MachO: don't add Thumb bit for addend to non-external relocation.
Tim Northover [Mon, 6 Aug 2018 11:32:44 +0000 (11:32 +0000)]
ARM-MachO: don't add Thumb bit for addend to non-external relocation.

ld64 supplies its own Thumb bit for Thumb functions, and intentionally zeroes
out that part of any addend in an object file. But it only does that for
symbols marked N_EXT -- i.e. external symbols. So LLVM should avoid setting
that extra bit in other cases.

llvm-svn: 339007

6 years agoRe-enable "[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND"
Max Kazantsev [Mon, 6 Aug 2018 11:14:18 +0000 (11:14 +0000)]
Re-enable "[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND"

The patch was reverted because of bug detected by sanitizer. The bug is fixed,
respective tests added.

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

llvm-svn: 339005

6 years ago[ELF] - Remove dead code from LinkerScript::assignOffsets(). NFC-ihope.
George Rimar [Mon, 6 Aug 2018 10:44:17 +0000 (10:44 +0000)]
[ELF] - Remove dead code from LinkerScript::assignOffsets(). NFC-ihope.

Some parts of the code changed are a bit old. I found traces in 2016.

Initiall commits has test cases and perhaps reasonable comments.
For example, we had segfaults earlier and had the code to fix them.

Now, in 2018, I think it is excessive to have these parts, because
we do not have segfaults and our code was changed a lot (softly saying).

I reviewed the current sources and I think that at this point of the
execution flow, we should never face with
the conditions checked and so I removing them in this patch.

This helps to cleanup the code.

llvm-svn: 339003

6 years ago[docs] Continue working around broken Sphinx parsing of LLVM code blocks
Chandler Carruth [Mon, 6 Aug 2018 10:20:05 +0000 (10:20 +0000)]
[docs] Continue working around broken Sphinx parsing of LLVM code blocks
by switching to `text` in another place.

llvm-svn: 339001

6 years ago[ELF] Test undefined weak symbol for Thumb narrow branch
Peter Smith [Mon, 6 Aug 2018 10:06:24 +0000 (10:06 +0000)]
[ELF] Test undefined weak symbol for Thumb narrow branch

Add a test for the R_ARM_THM_JUMP11 relocation to an undefined symbol. We
have to use yaml2obj as llvm-mc relaxes the narrow branch to a b.w which
uses the R_ARM_THM_JUMP24 relocation instead.

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

llvm-svn: 338999

6 years ago[docs] Remove the `dso_local` tag from these functions.
Chandler Carruth [Mon, 6 Aug 2018 10:03:25 +0000 (10:03 +0000)]
[docs] Remove the `dso_local` tag from these functions.

The sphinx build bot is erroring on these examples for some unknown
reason, and really the dso_local doesn't seem to be relevant to the
example in any way so its cleaner to omit it. And now they will look
a bit more like other (successful) IR examples.

llvm-svn: 338998

6 years ago[docs] Stop trying to parse the ThinLTO summary IR fragments with the
Chandler Carruth [Mon, 6 Aug 2018 09:46:59 +0000 (09:46 +0000)]
[docs] Stop trying to parse the ThinLTO summary IR fragments with the
`llvm` syntax in Sphinx. This appears to just fail and create errors on
the docs buildbot.

llvm-svn: 338997

6 years ago[clang-rename] make clang-rename.py vim integration python3 compatible
Jonas Toth [Mon, 6 Aug 2018 09:08:06 +0000 (09:08 +0000)]
[clang-rename] make clang-rename.py vim integration python3 compatible

Summary:
This patch makes the clang-rename.py script useable for vim with only python3
support. It uses the print-function and adjust the doc slightly to mention
the correct python3 command for the letter mapping in vim.

Reviewers: arphaman, klimek, aaron.ballman, hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

llvm-svn: 338996

6 years agoChange ConstString::SetCStringWithMangledCounterpart to use StringRef
Pavel Labath [Mon, 6 Aug 2018 08:27:59 +0000 (08:27 +0000)]
Change ConstString::SetCStringWithMangledCounterpart to use StringRef

This should simplify the upcoming demangling patch (D50071). While I was
in there, I also added a quick test for the function.

llvm-svn: 338995

6 years agoRevert rL338990 to see if it causes sanitizer failures
Max Kazantsev [Mon, 6 Aug 2018 08:10:28 +0000 (08:10 +0000)]
Revert rL338990 to see if it causes sanitizer failures

Multiple failues reported by sanitizer-x86_64-linux, seem to be caused by this
patch. Reverting to see if they sustain without it.

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

llvm-svn: 338994

6 years agoRevert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"
Hsiangkai Wang [Mon, 6 Aug 2018 07:07:18 +0000 (07:07 +0000)]
Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"

Build failed in
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/27258

In lib/CodeGen/LiveDebugVariables.cpp:589, it uses std::prev(MBBI) to
get DebugValue's SlotIndex. however, the previous instruction may be
also a debug instruction.

llvm-svn: 338992

6 years agoTry to fix buildbot
Max Kazantsev [Mon, 6 Aug 2018 06:35:21 +0000 (06:35 +0000)]
Try to fix buildbot

llvm-svn: 338991

6 years ago[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND
Max Kazantsev [Mon, 6 Aug 2018 06:11:36 +0000 (06:11 +0000)]
[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND

`isKnownNonNullFromDominatingCondition` is able to prove non-null basing on `br` or `guard`
by `%p != null` condition, but is unable to do so basing on `(%p != null) && %other_cond`.
This patch allows it to do so.

Differential Revision: https://reviews.llvm.org/D50172
Reviewed By: reames

llvm-svn: 338990

6 years ago[DebugInfo] Generate debug information for labels. (Fix PR37395)
Hsiangkai Wang [Mon, 6 Aug 2018 05:58:59 +0000 (05:58 +0000)]
[DebugInfo] Generate debug information for labels. (Fix PR37395)

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.

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

llvm-svn: 338989

6 years ago[GuardWidening] Widen guards with conditions of frequently taken dominated branches
Max Kazantsev [Mon, 6 Aug 2018 05:49:19 +0000 (05:49 +0000)]
[GuardWidening] Widen guards with conditions of frequently taken dominated branches

If there is a frequently taken branch dominated by a guard, and its condition is available
at the point of the guard, we can widen guard with condition of this branch and convert
the branch into unconditional:

  guard(cond1)
  if (cond2) {
    // taken in 99.9% cases
    // do something
  } else {
    // do something else
  }

Converts to

  guard(cond1 && cond2)
  // do something

Differential Revision: https://reviews.llvm.org/D49974
Reviewed By: reames

llvm-svn: 338988

6 years ago[NFC] Fix typo
Xin Tong [Mon, 6 Aug 2018 05:03:21 +0000 (05:03 +0000)]
[NFC] Fix typo

llvm-svn: 338987

6 years ago[NFC] Fixed unused function warning
David Bolvansky [Mon, 6 Aug 2018 04:45:46 +0000 (04:45 +0000)]
[NFC] Fixed unused function warning

llvm-svn: 338986

6 years ago[DebugInfo] Use DbgVariableIntrinsic as the base class of variables.
Hsiangkai Wang [Mon, 6 Aug 2018 04:00:08 +0000 (04:00 +0000)]
[DebugInfo] Use DbgVariableIntrinsic as the base class of variables.

After refactoring DbgInfoIntrinsic class hierarchy, we use
DbgVariableIntrinsic as the base class of variable debug info.

In resolveTopLevelMetadata() in CGVTables.cpp, we only care about
dbg.value, so we try to cast the instructions to DbgVariableIntrinsic
before resolving variables.

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

llvm-svn: 338985

6 years ago[DebugInfo] Refactor DbgInfoIntrinsic class hierarchy.
Hsiangkai Wang [Mon, 6 Aug 2018 03:59:47 +0000 (03:59 +0000)]
[DebugInfo] Refactor DbgInfoIntrinsic class hierarchy.

In the past, DbgInfoIntrinsic has a strong assumption that these
intrinsics all have variables and expressions attached to them.
However, it is too strong to derive the class for other debug entities.
Now, it has problems for debug labels.

In order to make DbgInfoIntrinsic as a base class for 'debug info', I
create a class for 'variable debug info', DbgVariableIntrinsic.

DbgDeclareInst, DbgAddrIntrinsic, and DbgValueInst will be derived from it.

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

llvm-svn: 338984

6 years ago[docs] Switch debug info metadata blocks to use `text` instead of `llvm`
Chandler Carruth [Mon, 6 Aug 2018 03:35:36 +0000 (03:35 +0000)]
[docs] Switch debug info metadata blocks to use `text` instead of `llvm`
highlighting syntax.

Most of them already were like this, and the Sphinx runs on the docs
build bot seems to be substantially more picky and/or not have support
for a bunch of the syntax here. Hopefully this will let it progress past
this.

My previous attempt to fix the syntax made the `opt` tool happy, but no
idea what the Sphinx stuff is really looking for, and the fact that
other blocks already just use `text` led me to this solution.

llvm-svn: 338983

6 years ago[docs] Correct the basic syntax structure of the DISubrange example.
Chandler Carruth [Mon, 6 Aug 2018 02:30:01 +0000 (02:30 +0000)]
[docs] Correct the basic syntax structure of the DISubrange example.

Notably, just close two of the debug info metadata nodes early rather
than leaving them open with `...` which won't ever lex correctly. And
add the missing `:` on the count labels.

Slowly progressing through all of the warnings on the documentation
build bot. Sorry to do this one commit at a time, but despite my best
efforts I can't trigger these errors locally.

llvm-svn: 338982

6 years ago[docs] Remove an example that isn't well formed LLVM IR and trips up the
Chandler Carruth [Mon, 6 Aug 2018 02:02:09 +0000 (02:02 +0000)]
[docs] Remove an example that isn't well formed LLVM IR and trips up the
Sphinx syntax highlighter.

This example also doesn't really make sense. There is no control flow or
clarification of what the `Safe:` block exists to do... If we want
examples here, we should make them much more clear in addition to making
them well formed IR sequences.

llvm-svn: 338981

6 years ago[docs] Fix an LLVM-syntax code block to actually be valid LLVM synatx.
Chandler Carruth [Mon, 6 Aug 2018 01:41:25 +0000 (01:41 +0000)]
[docs] Fix an LLVM-syntax code block to actually be valid LLVM synatx.

Hopefully fixes an issue on the docs build bot.

llvm-svn: 338980

6 years ago[docs] Don't use the `asm` syntax highlighting (which our docs builder
Chandler Carruth [Mon, 6 Aug 2018 01:28:42 +0000 (01:28 +0000)]
[docs] Don't use the `asm` syntax highlighting (which our docs builder
errors on) and clean up the formattting.

This isn't actualy assembly anyways, so dropping the highlighting is
probably for the best.

llvm-svn: 338979

6 years ago[docs] Turn of `nasm` highlighting for a code block.
Chandler Carruth [Mon, 6 Aug 2018 01:19:43 +0000 (01:19 +0000)]
[docs] Turn of `nasm` highlighting for a code block.

This appears to produce a warning on the docs build bot. It doesn't
reproduce for me, likely because I have a newer (or more full featured)
pygments install.

llvm-svn: 338978

6 years ago[docs] Reinstate r337730 - Add support for Markdown documentation in
Chandler Carruth [Mon, 6 Aug 2018 00:38:31 +0000 (00:38 +0000)]
[docs] Reinstate r337730 - Add support for Markdown documentation in
Sphinx.

We think the bot is updated now, so trying this again. I'm landing it
(with permission) as Michael is at a con at the moment.

Actual patch largely by Michael Spencer.

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

llvm-svn: 338977

6 years agoRemove duplicated code in CommandObjectQuit
Raphael Isemann [Mon, 6 Aug 2018 00:04:51 +0000 (00:04 +0000)]
Remove duplicated code in CommandObjectQuit

Summary:
We already have the same check directly before, so this code can never be
reached (as seen in the test coverage).

Subscribers: lldb-commits

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

llvm-svn: 338976

6 years ago[ORC] Remove an incorrect use of 'cantFail'.
Lang Hames [Sun, 5 Aug 2018 23:55:35 +0000 (23:55 +0000)]
[ORC] Remove an incorrect use of 'cantFail'.

This code was moved out from BasicObjectLayerMaterializationUnit, which required
the supplied object to be well formed. The getObjectSymbolFlags function does
not require a well-formed object, so we have to propagate the error here.

llvm-svn: 338975

6 years ago[ORC] Change JITSymbolFlags debug output, add a function for getting a symbol
Lang Hames [Sun, 5 Aug 2018 22:35:37 +0000 (22:35 +0000)]
[ORC] Change JITSymbolFlags debug output, add a function for getting a symbol
flags map from a buffer representing an object file.

llvm-svn: 338974

6 years ago[NFC] Fixed inliner tests - 2
David Bolvansky [Sun, 5 Aug 2018 16:53:36 +0000 (16:53 +0000)]
[NFC] Fixed inliner tests - 2

llvm-svn: 338973

6 years ago[NFC] Fixed inliner tests
David Bolvansky [Sun, 5 Aug 2018 16:30:46 +0000 (16:30 +0000)]
[NFC] Fixed inliner tests

llvm-svn: 338972

6 years agoFix tests for changed opt remarks format
David Bolvansky [Sun, 5 Aug 2018 14:53:34 +0000 (14:53 +0000)]
Fix tests for changed opt remarks format

Summary:
Optimization remark format is slightly changed by LLVM patch D49412.
Two tests are fixed with expected messages changed.
Frankly speaking I have not tested this change yet. I will test when manage to setup the project.

Reviewers: xbolva00

Reviewed By: xbolva00

Subscribers: mehdi_amini, eraman, steven_wu, dexonsmith

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

llvm-svn: 338971

6 years agoFix one test for changed opt remarks format
David Bolvansky [Sun, 5 Aug 2018 14:53:14 +0000 (14:53 +0000)]
Fix one test for changed opt remarks format

Summary:
Optimization remark format is slightly changed by LLVM patch D49412.
One test is fixed with expected messages changed.
Frankly speaking I have not tested this change yet. I will test when manage to setup the project.

Reviewers: xbolva00, espindola

Reviewed By: xbolva00

Subscribers: emaste, arichardson, steven_wu, dexonsmith

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

llvm-svn: 338970

6 years agoEnrich inline messages
David Bolvansky [Sun, 5 Aug 2018 14:53:08 +0000 (14:53 +0000)]
Enrich inline messages

Summary:
This patch improves Inliner to provide causes/reasons for negative inline decisions.
1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message.
2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision.
3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost.
4. Adjusted tests for changed printing.

Patch by: yrouban (Yevgeny Rouban)

Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00

Reviewed By: tejohnson, xbolva00

Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith

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

llvm-svn: 338969

6 years agoRevert "Add a warning if someone attempts to add extra section flags to sections"
Eric Christopher [Sun, 5 Aug 2018 14:23:37 +0000 (14:23 +0000)]
Revert "Add a warning if someone attempts to add extra section flags to sections"

There are a bunch of edge cases and inconsistencies in how we're emitting sections
cause this warning to fire and it needs more work.

This reverts commit r335558.

llvm-svn: 338968

6 years ago[NFC][InstCombine] Add tests for sinking 'not' into 'xor' (PR38446)
Roman Lebedev [Sun, 5 Aug 2018 10:15:04 +0000 (10:15 +0000)]
[NFC][InstCombine] Add tests for sinking 'not' into 'xor' (PR38446)

https://rise4fun.com/Alive/IT3

Comes up in the [most ugliest]  signed int -> signed char  case of
-fsanitize=implicit-conversion (https://reviews.llvm.org/D50250)

Not sure if we want to do it always, or only when it is free to invert.

llvm-svn: 338967

6 years ago[AST][NFC] Remove unneeded forward declarations in Type.h
Bruno Ricci [Sun, 5 Aug 2018 09:48:59 +0000 (09:48 +0000)]
[AST][NFC] Remove unneeded forward declarations in Type.h

These forward declarations for various classes in the Type
hierarchy are not needed since they are all forward declared
systematically a few lines below.

llvm-svn: 338966

6 years ago[NFC][InstCombine] Regenerate set.ll test
Roman Lebedev [Sun, 5 Aug 2018 08:53:40 +0000 (08:53 +0000)]
[NFC][InstCombine] Regenerate set.ll test

llvm-svn: 338965

6 years ago[X86] Remove stale comments from a test. NFC
Craig Topper [Sun, 5 Aug 2018 06:25:01 +0000 (06:25 +0000)]
[X86] Remove stale comments from a test. NFC

The 16-bit case was recently fixed so this comment no longer applies.

llvm-svn: 338964

6 years ago[InstCombine] [NFC] Tests for strcmp to memcmp transformation
David Bolvansky [Sun, 5 Aug 2018 05:46:56 +0000 (05:46 +0000)]
[InstCombine] [NFC] Tests for strcmp to memcmp transformation

llvm-svn: 338963

6 years agoUse Optional instead of unique_ptr; NFC
George Burgess IV [Sun, 5 Aug 2018 01:37:07 +0000 (01:37 +0000)]
Use Optional instead of unique_ptr; NFC

Looks like the only reason we use a unique_ptr here is so that we can
conditionally construct a LogicalErrorHandler. It's a small type, and
Optional can do the same thing with 100% fewer heap allocations.

llvm-svn: 338962

6 years agoAdded unit test for StringList
Raphael Isemann [Sat, 4 Aug 2018 17:28:21 +0000 (17:28 +0000)]
Added unit test for StringList

Reviewers: labath

Reviewed By: labath

Subscribers: mgorny, lldb-commits

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

llvm-svn: 338961

6 years ago[LLD][ELD] - Revert r338959 "[LLD][ELF] - Added file name and a test for case when...
George Rimar [Sat, 4 Aug 2018 13:41:12 +0000 (13:41 +0000)]
[LLD][ELD] - Revert r338959 "[LLD][ELF] - Added file name and a test for case when we fail to write the output."

It broke BB:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/34382/steps/test/logs/stdio
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/21932/steps/test_lld/logs/stdio

llvm-svn: 338960

6 years ago[LLD][ELF] - Added file name and a test for case when we fail to write the output.
George Rimar [Sat, 4 Aug 2018 12:48:38 +0000 (12:48 +0000)]
[LLD][ELF] - Added file name and a test for case when we fail to write the output.

We did not report the file name and had no test for that case.

llvm-svn: 338959

6 years ago[LLD][ELF] - Remove excessive requirement from the test.
George Rimar [Sat, 4 Aug 2018 11:33:38 +0000 (11:33 +0000)]
[LLD][ELF] - Remove excessive requirement from the test.

It feels "shell" is excessive. Lets try without it.

llvm-svn: 338958

6 years ago[LLD][ELF] - Removed dead code from rangeToString(). NFC.
George Rimar [Sat, 4 Aug 2018 10:56:26 +0000 (10:56 +0000)]
[LLD][ELF] - Removed dead code from rangeToString(). NFC.

This change removes the dead code and makes cosmetic change
showing why it was dead.

llvm-svn: 338957

6 years ago[LLD][ELF] - Fix bug when reporting memory intersections.
George Rimar [Sat, 4 Aug 2018 10:34:52 +0000 (10:34 +0000)]
[LLD][ELF] - Fix bug when reporting memory intersections.

rangeToString() takes addres and length,
previously it was called incorrectly.

llvm-svn: 338956

6 years ago[ADT] Add an early-increment iterator-like type and range adaptor.
Chandler Carruth [Sat, 4 Aug 2018 08:17:26 +0000 (08:17 +0000)]
[ADT] Add an early-increment iterator-like type and range adaptor.

This allows us to model the common LLVM idiom of incrementing
immediately after dereferencing so that we can remove or update the
entity w/o losing our ability to reach the "next".

However, these are not real or proper iterators. They are just enough to
allow range based for loops and very simple range algorithms to work,
but should not be considered full general.

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

llvm-svn: 338955

6 years ago[TailCallElim] Preserve DT and PDT
Chijun Sima [Sat, 4 Aug 2018 08:13:47 +0000 (08:13 +0000)]
[TailCallElim] Preserve DT and PDT

Summary:
Previously, in the NewPM pipeline, TailCallElim recalculates the DomTree when it modifies any instruction in the Function.
For example,
```
CallInst *CI = dyn_cast<CallInst>(&I);
...
CI->setTailCall();
Modified = true;
...
if (!Modified || ...)
  return PreservedAnalyses::all();
```
After applying this patch, the DomTree only recalculates if needed (plus an extra insertEdge() + an extra deleteEdge() call).

When optimizing SQLite with `-passes="default<O3>"` pipeline of the newPM, the number of DomTree recalculation decreases by 6.2%, the number of nodes visited by DFS decreases by 2.9%. The time used by DomTree will decrease approximately 1%~2.5% after applying the patch.

Statistics:
```
Before the patch:
 23010 dom-tree-stats               - Number of DomTree recalculations
489264 dom-tree-stats               - Number of nodes visited by DFS -- DomTree
After the patch:
 21581 dom-tree-stats               - Number of DomTree recalculations
475088 dom-tree-stats               - Number of nodes visited by DFS -- DomTree
```

Reviewers: kuhar, dmgreen, brzycki, grosser, davide

Reviewed By: kuhar, brzycki

Subscribers: llvm-commits

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

llvm-svn: 338954

6 years ago[ELF] - Refactor readCallGraph().
George Rimar [Sat, 4 Aug 2018 07:31:19 +0000 (07:31 +0000)]
[ELF] - Refactor readCallGraph().

This simplifies the code a bit.

It is NFC except that it removes early exit for Count == 0
which does not seem to be useful (we have no such tests either).

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

llvm-svn: 338953

6 years agoFixed header of StringLexer.h
Raphael Isemann [Sat, 4 Aug 2018 05:53:07 +0000 (05:53 +0000)]
Fixed header of StringLexer.h

llvm-svn: 338952

6 years ago[llvm-objdump] Remove continue after report_error which is unreachable
Fangrui Song [Sat, 4 Aug 2018 05:19:00 +0000 (05:19 +0000)]
[llvm-objdump] Remove continue after report_error which is unreachable

llvm-svn: 338951

6 years ago[ADCE] Remove the need of DomTree
Chijun Sima [Sat, 4 Aug 2018 02:50:12 +0000 (02:50 +0000)]
[ADCE] Remove the need of DomTree

Summary: ADCE doesn't need to query domtree.

Reviewers: kuhar, brzycki, dmgreen, davide, grosser

Reviewed By: kuhar

Subscribers: llvm-commits

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

llvm-svn: 338950

6 years agoFix a bug in VMRange
Leonard Mosescu [Sat, 4 Aug 2018 02:15:26 +0000 (02:15 +0000)]
Fix a bug in VMRange

I noticed a suspicious failure:

[ RUN ] VMRange.CollectionContains
llvm/src/tools/lldb/unittests/Utility/VMRangeTest.cpp:146: Failure
Value of: VMRange::ContainsRange(collection, VMRange(0x100, 0x104))

Actual: false
Expected: true

Looking at the code, it is a very real bug:

class RangeInRangeUnaryPredicate {
public:
  RangeInRangeUnaryPredicate(VMRange range) : _range(range) {} // note that _range binds to a temporary!
  bool operator()(const VMRange &range) const {
    return range.Contains(_range);
  }
  const VMRange &_range;
};

This change fixes the bug.

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

llvm-svn: 338949

6 years agoReverted r338825 and all the following tries to fix issues introduced by that commit...
Galina Kistanova [Sat, 4 Aug 2018 01:59:12 +0000 (01:59 +0000)]
Reverted r338825 and all the following tries to fix issues introduced by that commit (r338826, r338827, r338829, r338880).

This commit has broken build bots and has been left unattended for too long.

llvm-svn: 338948

6 years ago[clangd] Fix fuzzer build.
Matt Morehouse [Sat, 4 Aug 2018 01:51:10 +0000 (01:51 +0000)]
[clangd] Fix fuzzer build.

llvm-svn: 338947

6 years ago[clang-fuzzer] Remove unused typedef.
Matt Morehouse [Sat, 4 Aug 2018 01:42:47 +0000 (01:42 +0000)]
[clang-fuzzer] Remove unused typedef.

llvm-svn: 338946

6 years agoAvoid creating conditional cleanup blocks that contain only @llvm.lifetime.end calls
Richard Smith [Sat, 4 Aug 2018 01:25:06 +0000 (01:25 +0000)]
Avoid creating conditional cleanup blocks that contain only @llvm.lifetime.end calls

When a non-extended temporary object is created in a conditional branch, the
lifetime of that temporary ends outside the conditional (at the end of the
full-expression). If we're inserting lifetime markers, this means we could end
up generating

  if (some_cond) {
    lifetime.start(&tmp);
    Tmp::Tmp(&tmp);
  }
  // ...
  if (some_cond) {
    lifetime.end(&tmp);
  }

... for a full-expression containing a subexpression of the form `some_cond ?
Tmp().x : 0`. This patch moves the lifetime start for such a temporary out of
the conditional branch so that we don't need to generate an additional basic
block to hold the lifetime end marker.

This is disabled if we want precise lifetime markers (for asan's
stack-use-after-scope checks) or of the temporary has a non-trivial destructor
(in which case we'd generate an extra basic block anyway to hold the destructor
call).

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

llvm-svn: 338945

6 years ago[GISel]: Add Opcodes for CTLZ/CTTZ/CTPOP
Aditya Nandakumar [Sat, 4 Aug 2018 01:22:12 +0000 (01:22 +0000)]
[GISel]: Add Opcodes for CTLZ/CTTZ/CTPOP

https://reviews.llvm.org/D48600

Added IRTranslator support to translate these known intrinsics into GISel opcodes.

llvm-svn: 338944

6 years agoLLVM Proto Fuzzer - Run Functions on Suite of Inputs
Emmett Neyman [Sat, 4 Aug 2018 01:18:37 +0000 (01:18 +0000)]
LLVM Proto Fuzzer - Run Functions on Suite of Inputs

Summary:
Added corpus of arrays to use as inputs for the functions. Check that the two
functions modify the inputted arrays in the same way.

Reviewers: kcc, morehouse

Reviewed By: morehouse

Subscribers: mgorny, cfe-commits, llvm-commits

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

llvm-svn: 338943

6 years ago[www] Update cxx_status and cxx_dr_status now that Clang 7 has branched.
Richard Smith [Sat, 4 Aug 2018 01:02:00 +0000 (01:02 +0000)]
[www] Update cxx_status and cxx_dr_status now that Clang 7 has branched.

llvm-svn: 338942

6 years ago[constexpr] Support for constant evaluation of __builtin_memcpy and
Richard Smith [Sat, 4 Aug 2018 00:57:17 +0000 (00:57 +0000)]
[constexpr] Support for constant evaluation of __builtin_memcpy and
__builtin_memmove (in non-type-punning cases).

This is intended to permit libc++ to make std::copy etc constexpr
without sacrificing the optimization that uses memcpy on
trivially-copyable types.

__builtin_strcpy and __builtin_wcscpy are not handled by this change.
They'd be straightforward to add, but we haven't encountered a need for
them just yet.

This reinstates r338455, reverted in r338602, with a fix to avoid trying
to constant-evaluate a memcpy call if either pointer operand has an
invalid designator.

llvm-svn: 338941

6 years agoFix buildbot breakage.
Rui Ueyama [Sat, 4 Aug 2018 00:23:37 +0000 (00:23 +0000)]
Fix buildbot breakage.

llvm-svn: 338940