platform/upstream/llvm.git
5 years agoAdd an assertion to aid in tracking down a bug
Adrian Prantl [Fri, 21 Dec 2018 01:09:15 +0000 (01:09 +0000)]
Add an assertion to aid in tracking down a bug

llvm-svn: 349865

5 years agoRemove ineffective (misspelled) sanitizer option
Adrian Prantl [Fri, 21 Dec 2018 01:09:14 +0000 (01:09 +0000)]
Remove ineffective (misspelled) sanitizer option

llvm-svn: 349864

5 years agoRevert "Revert "[driver] [analyzer] Fix a backward compatibility issue after r348038.""
George Karpenkov [Fri, 21 Dec 2018 00:26:19 +0000 (00:26 +0000)]
Revert "Revert "[driver] [analyzer] Fix a backward compatibility issue after r348038.""

This reverts commit 144927939587b790c0536f4ff08245043fc8d733.

Fixes the bug in the original commit.

llvm-svn: 349863

5 years ago[analyzer] RetainCount: Suppress retain detection heuristic on some CM methods.
Artem Dergachev [Fri, 21 Dec 2018 00:18:58 +0000 (00:18 +0000)]
[analyzer] RetainCount: Suppress retain detection heuristic on some CM methods.

If it ends with "Retain" like CFRetain and returns a CFTypeRef like CFRetain,
then it is not necessarily a CFRetain. But it is indeed true that these two
return something retained.

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

rdar://problem/39390714

llvm-svn: 349862

5 years agoFix typo
Adrian Prantl [Thu, 20 Dec 2018 23:50:32 +0000 (23:50 +0000)]
Fix typo

llvm-svn: 349861

5 years agoRemove dead code.
Rui Ueyama [Thu, 20 Dec 2018 23:47:39 +0000 (23:47 +0000)]
Remove dead code.

This code is no-op because of r349849.

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

llvm-svn: 349859

5 years agoFix stack-buffer-overflow in lldb_private::Host::FindProcesses
Jonas Devlieghere [Thu, 20 Dec 2018 23:45:26 +0000 (23:45 +0000)]
Fix stack-buffer-overflow in lldb_private::Host::FindProcesses

Found by the address sanitizer on GreenDragon:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-sanitized/1628/console

llvm-svn: 349858

5 years ago[ARM] Complete the Thumb1 shift+and->shift+shift transforms.
Eli Friedman [Thu, 20 Dec 2018 23:39:54 +0000 (23:39 +0000)]
[ARM] Complete the Thumb1 shift+and->shift+shift transforms.

This saves materializing the immediate.  The additional forms are less
common (they don't usually show up for bitfield insert/extract), but
they're still relevant.

I had to add a new target hook to prevent DAGCombine from reversing the
transform. That isn't the only possible way to solve the conflict, but
it seems straightforward enough.

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

llvm-svn: 349857

5 years ago[lldb] Add a "display-recognized-arguments" target setting to show recognized argumen...
Kuba Mracek [Thu, 20 Dec 2018 23:38:19 +0000 (23:38 +0000)]
[lldb] Add a "display-recognized-arguments" target setting to show recognized arguments by default

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

llvm-svn: 349856

5 years ago[NativePDB] Create VarDecls for global variables.
Zachary Turner [Thu, 20 Dec 2018 23:32:37 +0000 (23:32 +0000)]
[NativePDB] Create VarDecls for global variables.

Previously we would create these for local variables but not for
global variables.

Also updated existing tests which created global variables to check
for them in the resulting AST.

llvm-svn: 349854

5 years ago[CodeGen] Fix a test from r349848 by replacing `objc_` with `llvm.objc.`
Volodymyr Sapsai [Thu, 20 Dec 2018 23:26:29 +0000 (23:26 +0000)]
[CodeGen] Fix a test from r349848 by replacing `objc_` with `llvm.objc.`

llvm-svn: 349853

5 years agoRevert "[asan] Disable test on powerpc64be"
Vitaly Buka [Thu, 20 Dec 2018 23:25:26 +0000 (23:25 +0000)]
Revert "[asan] Disable test on powerpc64be"

Now the test is passing on that bot. Some incremental build issues?

This reverts commit e00b5a5229ae02088d9f32a4e328eaa08abaf354.

llvm-svn: 349852

5 years agoDisable a few tests on the green dragon sanitzier bot.
Adrian Prantl [Thu, 20 Dec 2018 23:16:47 +0000 (23:16 +0000)]
Disable a few tests on the green dragon sanitzier bot.

These are tests that found actual, but hard to fix, bugs that are
tracked elsewhere. Leaving them red only distracts from new failures
this bot finds.

llvm-svn: 349851

5 years agoSimplify. NFC.
Rui Ueyama [Thu, 20 Dec 2018 22:54:41 +0000 (22:54 +0000)]
Simplify. NFC.

llvm-svn: 349850

5 years ago[ELF] Move IsNeeded logic from SymbolTable::addShared to MarkLive, and check IsUsedIn...
Fangrui Song [Thu, 20 Dec 2018 22:46:01 +0000 (22:46 +0000)]
[ELF] Move IsNeeded logic from SymbolTable::addShared to MarkLive, and check IsUsedInRegularObj

Summary:
In glibc, libc.so is a linker script with an as-needed dependency on ld-linux-x86-64.so.2

    GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a  AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) )

ld-linux-x86-64.so.2 (as-needed) defines some symbols which resolve undefined references in libc.so.6, it will therefore be added as a DT_NEEDED entry, which isn't necessary.

The test case as-needed-not-in-regular.s emulates the libc.so scenario, where ld.bfd and gold don't add DT_NEEDED for a.so

The relevant code in gold/resolve.cc:

  // If we have a non-WEAK reference from a regular object to a
  // dynamic object, mark the dynamic object as needed.
  if (to->is_from_dynobj() && to->in_reg() && !to->is_undef_binding_weak())
    to->object()->set_is_needed();

in_reg() appears to do something similar to IsUsedInRegularObj.

This patch makes lld do the similar thing, but moves the check from
addShared to a later stage MarkLive where all symbols are scanned.

Reviewers: ruiu, pcc, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 349849

5 years ago[CodeGen] Fix assertion on emitting cleanup for object with inlined inherited constru...
Volodymyr Sapsai [Thu, 20 Dec 2018 22:43:26 +0000 (22:43 +0000)]
[CodeGen] Fix assertion on emitting cleanup for object with inlined inherited constructor and non-trivial destructor.

Fixes assertion
> Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/Support/Casting.h, line 255.

It was triggered by trying to cast `FunctionDecl` to `CXXMethodDecl` as
`CGF.CurCodeDecl` in `CallBaseDtor::Emit`. It was happening because
cleanups were emitted in `ScalarExprEmitter::VisitExprWithCleanups`
after destroying `InlinedInheritingConstructorScope`, so
`CodeGenFunction.CurCodeDecl` didn't correspond to expected cleanup decl.

Fix the assertion by emitting cleanups before leaving
`InlinedInheritingConstructorScope` and changing `CurCodeDecl`.

Test cases based on a patch by Shoaib Meenai.

Fixes PR36748.

rdar://problem/45805151

Reviewers: rsmith, rjmccall

Reviewed By: rjmccall

Subscribers: jkorous, dexonsmith, cfe-commits, smeenai, compnerd

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

llvm-svn: 349848

5 years ago[InstCombine] [NFC] testcases for canonicalize MUL with NEG operand
Chen Zheng [Thu, 20 Dec 2018 22:37:05 +0000 (22:37 +0000)]
[InstCombine] [NFC] testcases for canonicalize MUL with NEG operand

llvm-svn: 349847

5 years agoFix Windows build failures caused by r349839
Tom Stellard [Thu, 20 Dec 2018 22:36:02 +0000 (22:36 +0000)]
Fix Windows build failures caused by r349839

llvm-svn: 349846

5 years agoAdd support for namespaces on #pragma clang attribute
Erik Pilkington [Thu, 20 Dec 2018 22:32:04 +0000 (22:32 +0000)]
Add support for namespaces on #pragma clang attribute

Namespaces are introduced by adding an "identifier." before a
push/pop directive. Pop directives with namespaces can only pop a
attribute group that was pushed with the same namespace. Push and pop
directives that don't opt into namespaces have the same semantics.

This is necessary to prevent a pitfall of using multiple #pragma
clang attribute directives spread out in a large file, particularly
when macros are involved. It isn't easy to see which pop corripsonds
to which push, so its easy to inadvertently pop the wrong group.

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

llvm-svn: 349845

5 years ago[asan] Disable test on powerpc64be
Vitaly Buka [Thu, 20 Dec 2018 22:29:54 +0000 (22:29 +0000)]
[asan] Disable test on powerpc64be

llvm-svn: 349844

5 years agoRevert "[driver] [analyzer] Fix a backward compatibility issue after r348038."
Artem Dergachev [Thu, 20 Dec 2018 22:29:49 +0000 (22:29 +0000)]
Revert "[driver] [analyzer] Fix a backward compatibility issue after r348038."

This reverts commits r349824, r349828, r349835.

More buildbot failures were noticed.

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

rdar://problem/46504165

llvm-svn: 349843

5 years ago[ObjC] Messages to 'self' in class methods that return 'instancetype' should
Alex Lorenz [Thu, 20 Dec 2018 22:11:11 +0000 (22:11 +0000)]
[ObjC] Messages to 'self' in class methods that return 'instancetype' should
use the pointer to the class as the result type of the message

Prior to this commit, messages to self in class methods were treated as instance
methods to a Class value. When these methods returned instancetype the compiler
only saw id through the instancetype, and not the Interface *. This caused
problems when that return value was a receiver in a message send, as the
compiler couldn't select the right method declaration and had to rely on a
selection from the global method pool.

This commit modifies the semantics of such message sends and uses class messages
that are dispatched to the interface that corresponds to the class that contains
the class method. This ensures that instancetypes are correctly interpreted by
the compiler. This change is safe under ARC (as self can't be reassigned),
however, it also applies to MRR code as we are assuming that the user isn't
doing anything unreasonable.

rdar://20940997

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

llvm-svn: 349841

5 years agocmake: Remove uses of add_llvm_loadable_module macro
Tom Stellard [Thu, 20 Dec 2018 22:04:36 +0000 (22:04 +0000)]
cmake: Remove uses of add_llvm_loadable_module macro

This was removed from llvm in r349839.

llvm-svn: 349840

5 years agocmake: Remove add_llvm_loadable_module()
Tom Stellard [Thu, 20 Dec 2018 22:04:08 +0000 (22:04 +0000)]
cmake: Remove add_llvm_loadable_module()

Summary:
This function is very similar to add_llvm_library(),  so this patch merges it
into add_llvm_library() and replaces all calls to add_llvm_loadable_module(lib ...)
with add_llvm_library(lib MODULE ...)

Reviewers: philip.pfaffe, beanz, chandlerc

Reviewed By: philip.pfaffe

Subscribers: chapuni, mgorny, llvm-commits

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

llvm-svn: 349839

5 years ago[gn check] Unbreak check-lld if llvm_install_binutils_symlinks is false
Nico Weber [Thu, 20 Dec 2018 21:57:12 +0000 (21:57 +0000)]
[gn check] Unbreak check-lld if llvm_install_binutils_symlinks is false

The check-lld target was missing the dependency on llvm-nm and llvm-objdump in that case.

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

llvm-svn: 349836

5 years ago[driver] [analyzer] Fix redundant test output.
Artem Dergachev [Thu, 20 Dec 2018 21:56:49 +0000 (21:56 +0000)]
[driver] [analyzer] Fix redundant test output.

The -c flag causes a .o file to appear every time we run a test.
Remove it.

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

rdar://problem/46504165

llvm-svn: 349835

5 years ago[gn build] Add build file for clang/lib/CodeGen and llvm/lib/ProfileData/Coverage
Nico Weber [Thu, 20 Dec 2018 21:56:16 +0000 (21:56 +0000)]
[gn build] Add build file for clang/lib/CodeGen and llvm/lib/ProfileData/Coverage

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

llvm-svn: 349834

5 years ago[gn build] Add build files for clang/lib/{Frontend,Frontend/Rewrite,Serialization}
Nico Weber [Thu, 20 Dec 2018 21:55:28 +0000 (21:55 +0000)]
[gn build] Add build files for clang/lib/{Frontend,Frontend/Rewrite,Serialization}

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

llvm-svn: 349833

5 years ago[gn build] Add build file for clang/lib/Driver
Nico Weber [Thu, 20 Dec 2018 21:54:13 +0000 (21:54 +0000)]
[gn build] Add build file for clang/lib/Driver

Mostly boring, except for the spurious dependency on StaticAnalyzer/Checkers --
see comments in the code.

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

llvm-svn: 349832

5 years ago[gn build] Add build file for clang/lib/Parse
Nico Weber [Thu, 20 Dec 2018 21:53:05 +0000 (21:53 +0000)]
[gn build] Add build file for clang/lib/Parse

Nothing really interesting. One thing to consider is where the clang_tablegen()
invocations that generate files that are private to a library should be. The
CMake build puts them in clang/include/clang/Parse (in this case), but maybe
putting them right in clang/lib/Parse/BUILD.gn makes mor sense. (For
clang_tablegen() calls that generate .inc files used by the public headers,
putting the call in the public BUILD file makes sense.)

For now, I've put the build file in the public header folder, since that
matches CMake and what I did in the last 2 clang patches, but I'm not sure I
like this.

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

llvm-svn: 349831

5 years ago[gn build] Add build files for clang-format and lib/{Format,Rewrite,Tooling/Core...
Nico Weber [Thu, 20 Dec 2018 21:51:46 +0000 (21:51 +0000)]
[gn build] Add build files for clang-format and lib/{Format,Rewrite,Tooling/Core,Tooling/Inclusions}

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

llvm-svn: 349830

5 years ago[driver] [analyzer] Fix buildbots after r349824.
Artem Dergachev [Thu, 20 Dec 2018 21:45:33 +0000 (21:45 +0000)]
[driver] [analyzer] Fix buildbots after r349824.

Buildbots can't find the linker, which we don't really need in our tests.

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

rdar://problem/46504165

llvm-svn: 349828

5 years ago[llvm-objcopy] [COFF] Avoid memcpy() with null parameters in more places. NFC.
Martin Storsjo [Thu, 20 Dec 2018 21:35:59 +0000 (21:35 +0000)]
[llvm-objcopy] [COFF] Avoid memcpy() with null parameters in more places. NFC.

This fixes all cases of errors in asan+ubsan builds.

Also use std::copy instead of if+memcpy in the previously updated spot,
for consistency.

llvm-svn: 349826

5 years agoDeclares __cpu_model as dso local
Haibo Huang [Thu, 20 Dec 2018 21:33:59 +0000 (21:33 +0000)]
Declares __cpu_model as dso local

__builtin_cpu_supports and __builtin_cpu_is use information in __cpu_model to decide cpu features. Before this change, __cpu_model was not declared as dso local. The generated code looks up the address in GOT when reading __cpu_model. This makes it impossible to use these functions in ifunc, because at that time GOT entries have not been relocated. This change makes it dso local.

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

llvm-svn: 349825

5 years ago[driver] [analyzer] Fix a backward compatibility issue after r348038.
Artem Dergachev [Thu, 20 Dec 2018 21:26:40 +0000 (21:26 +0000)]
[driver] [analyzer] Fix a backward compatibility issue after r348038.

Since r348038 we emit an error every time an -analyzer-config option is not
found. The driver, however, suppresses this error with another flag,
-analyzer-config-compatibility-mode, so backwards compatibility is maintained,
while analyzer developers still enjoy the new typo-free experience.

The backwards compatibility turns out to be still broken when the -analyze
action is not specified; it is still possible to specify -analyzer-config
in that case. This should be fixed now.

Patch by Kristóf Umann!

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

rdar://problem/46504165

llvm-svn: 349824

5 years ago[CodeGen] Generate llvm.loop.parallel_accesses instead of llvm.mem.parallel_loop_acce...
Michael Kruse [Thu, 20 Dec 2018 21:24:54 +0000 (21:24 +0000)]
[CodeGen] Generate llvm.loop.parallel_accesses instead of llvm.mem.parallel_loop_access metadata.

Instead of generating llvm.mem.parallel_loop_access metadata, generate
llvm.access.group on instructions and llvm.loop.parallel_accesses on
loops. There is one access group per generated loop.

This is clang part of D52116/r349725.

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

llvm-svn: 349823

5 years ago[GlobalISel][AArch64] Add G_FCEIL to isPreISelGenericFloatingPointOpcode
Jessica Paquette [Thu, 20 Dec 2018 21:14:15 +0000 (21:14 +0000)]
[GlobalISel][AArch64] Add G_FCEIL to isPreISelGenericFloatingPointOpcode

If you don't do this, then if you hit a G_LOAD in getInstrMapping, you'll end
up with GPRs on the G_FCEIL instead of FPRs. This causes a fallback.

Add it to the switch, and add a test verifying that this happens.

llvm-svn: 349822

5 years ago[API] Remove redundants get() from smart pointers. NFC
Jonas Devlieghere [Thu, 20 Dec 2018 21:02:55 +0000 (21:02 +0000)]
[API] Remove redundants get() from smart pointers. NFC

Removes redundant calls to ::get() from smart pointers in the source/API
directory..

llvm-svn: 349821

5 years agoMake the "too many braces in scalar initialization" extension cause
Richard Smith [Thu, 20 Dec 2018 20:58:53 +0000 (20:58 +0000)]
Make the "too many braces in scalar initialization" extension cause
SFINAE failures.

llvm-svn: 349820

5 years agoDebugInfo: Fix for missing comp_dir handling with r349207
David Blaikie [Thu, 20 Dec 2018 20:46:55 +0000 (20:46 +0000)]
DebugInfo: Fix for missing comp_dir handling with r349207

When deciding lazily whether a CU would be split or non-split I
accidentally dropped some handling for the line tables comp_dir (by
doing it lazily it was too late to be handled properly by the MC line
table code).

Move that bit of the code back to the non-lazy place.

llvm-svn: 349819

5 years ago[dotest] Consider unexpected passes as failures.
Jonas Devlieghere [Thu, 20 Dec 2018 20:44:23 +0000 (20:44 +0000)]
[dotest] Consider unexpected passes as failures.

Unexpected successes should be considered failures because they can hide
regressions when not addressed. When a test is fixed and not re-enabled,
it can easily regress without us noticing.

I couldn't find a good way to make this change other than changing it in
the unittest2 framework. I know this is less than optimal but since we
have the dependency checked in and the change is pretty fundamental to
the framework I think it's not unreasonable.

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

llvm-svn: 349818

5 years ago[sanitizer] Support running without fd 0,1,2.
Evgeniy Stepanov [Thu, 20 Dec 2018 20:36:33 +0000 (20:36 +0000)]
[sanitizer] Support running without fd 0,1,2.

Summary:
Support running with no open file descriptors (as may happen to
"init" process on linux).
* Remove a check that writing to stderr succeeds.
* When opening a file (ex. for log_path option), dup the new fd out of
[0, 2] range to avoid confusing the program.

(2nd attempt, this time without the sanitizer_rtems change)

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 349817

5 years agoFix the example checker plugin after r349812.
Aaron Ballman [Thu, 20 Dec 2018 20:35:01 +0000 (20:35 +0000)]
Fix the example checker plugin after r349812.

llvm-svn: 349816

5 years agoFix build failures from r349812 due to a missing argument.
Aaron Ballman [Thu, 20 Dec 2018 20:32:59 +0000 (20:32 +0000)]
Fix build failures from r349812 due to a missing argument.

llvm-svn: 349815

5 years ago[NFC][pstl] Re-run Clang-format on the whole repository
Louis Dionne [Thu, 20 Dec 2018 20:28:56 +0000 (20:28 +0000)]
[NFC][pstl] Re-run Clang-format on the whole repository

llvm-svn: 349814

5 years ago[lldbsuite] Un-xfail several tests in TestInferiorCrashing on Windows
Stella Stamenova [Thu, 20 Dec 2018 20:26:05 +0000 (20:26 +0000)]
[lldbsuite] Un-xfail several tests in TestInferiorCrashing on Windows

Several of the tests are now passing. This change is enabling them.

llvm-svn: 349813

5 years agoAllow direct navigation to static analysis checker documentation through SARIF exports.
Aaron Ballman [Thu, 20 Dec 2018 20:20:20 +0000 (20:20 +0000)]
Allow direct navigation to static analysis checker documentation through SARIF exports.

This adds anchors to all of the documented checks so that you can directly link to a check by a stable name. This is useful because the SARIF file format has a field for specifying a URI to documentation for a rule and some viewers, like CodeSonar, make use of this information. These links are then exposed through the SARIF exporter.

llvm-svn: 349812

5 years ago[Sema] Don't try to account for the size of an incomplete type in CheckArrayAccess
Bruno Ricci [Thu, 20 Dec 2018 20:05:11 +0000 (20:05 +0000)]
[Sema] Don't try to account for the size of an incomplete type in CheckArrayAccess

When checking that the array access is not out-of-bounds in CheckArrayAccess
it is possible that the type of the base expression after IgnoreParenCasts is
incomplete, even though the type of the base expression before IgnoreParenCasts
is complete. In this case we have no information about whether the array access
is out-of-bounds and we should just bail-out instead. This fixes PR39746 which
was caused by trying to obtain the size of an incomplete type.

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

Reviewed By: efriedma

llvm-svn: 349811

5 years ago[llvm-objcopy] [COFF] Don't call memcpy() with a null argument. NFC.
Martin Storsjo [Thu, 20 Dec 2018 19:48:39 +0000 (19:48 +0000)]
[llvm-objcopy] [COFF] Don't call memcpy() with a null argument. NFC.

It is invalid to call memcpy with a null pointer, even if the size
is zero.

This should fix the sanitizer buildbot.

llvm-svn: 349808

5 years ago[ConstantFolding] Consolidate and extend bitcount intrinsic tests; NFC
Nikita Popov [Thu, 20 Dec 2018 19:46:52 +0000 (19:46 +0000)]
[ConstantFolding] Consolidate and extend bitcount intrinsic tests; NFC

Move constant folding tests into ConstantFolding/bitcount.ll and drop
various tests in other places. Add coverage for undefs.

llvm-svn: 349806

5 years ago[ConstantFolding] Add undef tests for overflow intrinsics; NFC
Nikita Popov [Thu, 20 Dec 2018 19:46:46 +0000 (19:46 +0000)]
[ConstantFolding] Add undef tests for overflow intrinsics; NFC

llvm-svn: 349805

5 years ago[ConstantFolding] Regenerate test checks; NFC
Nikita Popov [Thu, 20 Dec 2018 19:46:43 +0000 (19:46 +0000)]
[ConstantFolding] Regenerate test checks; NFC

Bring overflow-ops.ll into current format. Remove redundant entry
blocks.

llvm-svn: 349804

5 years ago[ConstantFolding] Add tests for funnel shifts with undef operands; NFC
Nikita Popov [Thu, 20 Dec 2018 19:46:39 +0000 (19:46 +0000)]
[ConstantFolding] Add tests for funnel shifts with undef operands; NFC

llvm-svn: 349803

5 years ago[ConstantFolding] Add tests for sat add/sub with undefs; NFC
Nikita Popov [Thu, 20 Dec 2018 19:46:35 +0000 (19:46 +0000)]
[ConstantFolding] Add tests for sat add/sub with undefs; NFC

llvm-svn: 349802

5 years ago[ConstantFolding] Split up saturating add/sub tests; NFC
Nikita Popov [Thu, 20 Dec 2018 19:46:30 +0000 (19:46 +0000)]
[ConstantFolding] Split up saturating add/sub tests; NFC

Split each test into a separate function.

llvm-svn: 349801

5 years ago[MC] [AArch64] Correctly resolve ":abs_g1:3" etc.
Eli Friedman [Thu, 20 Dec 2018 19:46:14 +0000 (19:46 +0000)]
[MC] [AArch64] Correctly resolve ":abs_g1:3" etc.

We have to treat constructs like this as if they were "symbolic", to use
the correct codepath to resolve them.  This mostly only affects movz
etc. because the other uses of classifySymbolRef conservatively treat
everything that isn't a constant as if it were a symbol.

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

llvm-svn: 349800

5 years ago[MC] [AArch64] Support resolving fixups for abs_g0 etc.
Eli Friedman [Thu, 20 Dec 2018 19:38:07 +0000 (19:38 +0000)]
[MC] [AArch64] Support resolving fixups for abs_g0 etc.

This requires a bit more code than other fixups, to distingush between
abs_g0/abs_g1/etc.  Actually, I think some of the other fixups are
missing some checks, but I won't try to address that here.

I haven't seen any real-world code that uses a construct like this, but
it clearly should work, and we're considering using it in the
implementation of localescape/localrecover on Windows (see
https://reviews.llvm.org/D53540). I've verified that binutils produces
the same code as llvm-mc for the testcase.

This currently doesn't include support for the *_s variants (that
requires a bit more work to set the opcode).

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

llvm-svn: 349799

5 years agoRevert "[analyzer] pr38668: Do not attempt to cast loaded values..."
Artem Dergachev [Thu, 20 Dec 2018 19:36:06 +0000 (19:36 +0000)]
Revert "[analyzer] pr38668: Do not attempt to cast loaded values..."

This reverts commit r349701.

The patch was incorrect. The whole point of CastRetrievedVal()
is to handle the case in which the type from which the cast is made
(i.e., the "type" of value `V`) has nothing to do with the type of
the region it was loaded from (i.e., `R->getValueType()`).

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

rdar://problem/45062567

llvm-svn: 349798

5 years ago[X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics...
Simon Pilgrim [Thu, 20 Dec 2018 19:01:13 +0000 (19:01 +0000)]
[X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (clang)

This emits FSHL/FSHR generic intrinsics for the XOP VPROT and AVX512 VPROL/VPROR rotation intrinsics.

LLVM counterpart: https://reviews.llvm.org/D55938

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

llvm-svn: 349796

5 years ago[X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics...
Simon Pilgrim [Thu, 20 Dec 2018 19:01:07 +0000 (19:01 +0000)]
[X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift intrinsics (llvm)

This emits FSHL/FSHR generic intrinsics for the XOP VPROT and AVX512 VPROL/VPROR rotation intrinsics.

Clang counterpart: https://reviews.llvm.org/D55937

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

llvm-svn: 349795

5 years ago[LAA] Avoid generating RT checks for known deps preventing vectorization.
Florian Hahn [Thu, 20 Dec 2018 18:49:09 +0000 (18:49 +0000)]
[LAA] Avoid generating RT checks for known deps preventing vectorization.

If we found unsafe dependences other than 'unknown', we already know at
compile time that they are unsafe and the runtime checks should always
fail. So we can avoid generating them in those cases.

This should have no negative impact on performance as the runtime checks
that would be created previously should always fail. As a sanity check,
I measured the test-suite, spec2k and spec2k6 and there were no regressions.

Reviewers: Ayal, anemet, hsaito

Reviewed By: Ayal

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

llvm-svn: 349794

5 years agoAdd missing -oso-prepend-path to dsymutil test.
Adrian Prantl [Thu, 20 Dec 2018 18:47:17 +0000 (18:47 +0000)]
Add missing -oso-prepend-path to dsymutil test.

Thanks to Galina Kistanova for pointing this out!

llvm-svn: 349793

5 years ago[CMake] Add libunwind when 'all' is being passed as LLVM_ENABLE_PROJECTS
Louis Dionne [Thu, 20 Dec 2018 18:39:47 +0000 (18:39 +0000)]
[CMake] Add libunwind when 'all' is being passed as LLVM_ENABLE_PROJECTS

Reviewers: zturner

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits

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

llvm-svn: 349792

5 years ago[lit] Skip stop-hook test on Windows
Stella Stamenova [Thu, 20 Dec 2018 18:23:08 +0000 (18:23 +0000)]
[lit] Skip stop-hook test on Windows

This test is now marked as unsupported on Windows - it is not technically  "unsupported" on Windows, but it fails because "expr ptr" does not evaluate correctly. However, the error message contains the expected string, so the test "passes" despite the fact that the commands failed
The following bug has been opened for it: llvm.org/pr40119

llvm-svn: 349784

5 years ago[lldbsuite] Un-xfail TestMiniDump and TestThreadJump
Stella Stamenova [Thu, 20 Dec 2018 18:21:17 +0000 (18:21 +0000)]
[lldbsuite] Un-xfail TestMiniDump and TestThreadJump

Both of these are now passing. I've resolved the bugs as well for verification.

llvm-svn: 349783

5 years agoUse @llvm.objc.clang.arc.use intrinsic instead of clang.arc.use function.
Pete Cooper [Thu, 20 Dec 2018 18:05:41 +0000 (18:05 +0000)]
Use @llvm.objc.clang.arc.use intrinsic instead of clang.arc.use function.

Calls to this function are deleted in the ARC optimizer.  However when the ARC
optimizer was updated to use intrinsics instead of functions (r349534), the corresponding
clang change (r349535) to use intrinsics missed this one so it wasn't being deleted.

llvm-svn: 349782

5 years ago[lldbsuite] Un-xfail TestEvents on Windows
Stella Stamenova [Thu, 20 Dec 2018 18:00:20 +0000 (18:00 +0000)]
[lldbsuite] Un-xfail TestEvents on Windows

There are a couple of tests in TestEvents that are now passing.

llvm-svn: 349781

5 years ago[libcxx] Fix order checking in unordered_multimap tests.
Louis Dionne [Thu, 20 Dec 2018 17:55:31 +0000 (17:55 +0000)]
[libcxx] Fix order checking in unordered_multimap tests.

Some tests assume that iteration through an unordered multimap elements
will return them in the same order as at the container creation. This
assumption is not true since the container is unordered, so that no
specific order of elements is ever guaranteed for such container. This
patch introduces checks verifying that any iteration will return elements
exactly from a set of valid values and without repetition, but in no
particular order.

Reviewed as https://reviews.llvm.org/D54838.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 349780

5 years agoAdd PLATFORM constants for iOS, tvOS, and watchOS simulators
Michael Trent [Thu, 20 Dec 2018 17:51:17 +0000 (17:51 +0000)]
Add PLATFORM constants for iOS, tvOS, and watchOS simulators

Summary:
Add PLATFORM constants for iOS, tvOS, and watchOS simulators, as well
as human readable names for these constants, to the Mach-O file format
header files.

rdar://46854119

Reviewers: ab, davide

Reviewed By: ab, davide

Subscribers: llvm-commits

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

llvm-svn: 349779

5 years ago[BPF] Disable relocation for .BTF.ext section
Yonghong Song [Thu, 20 Dec 2018 17:40:23 +0000 (17:40 +0000)]
[BPF] Disable relocation for .BTF.ext section

Build llvm with assertion on, and then build bcc against this llvm.
Run any bcc tool with debug=8 (turning on -g for clang compilation),
you will get the following assertion errors,
  /home/yhs/work/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:888:
  void llvm::RuntimeDyldELF::resolveBPFRelocation(const llvm::SectionEntry&, uint64_t,
    uint64_t, uint32_t, int64_t): Assertion `Value <= (4294967295U)' failed.

The .BTF.ext ELF section uses Fixup's to get the instruction
offsets. The data width of the Fixup is 4 bytes since we only need
the insn offset within the section.

This caused the above error though since R_BPF_64_32 expects
4-byte value and the Runtime Dyld tried to resolve the actual
insn address which is 8 bytes.

Actually the offset within the section is all what we need.
Therefore, there is no need to perform any kind of relocation
for .BTF.ext section and such relocation will actually cause
incorrect result.

This patch changed BPFELFObjectWriter::getRelocType() such that
for Fixup Kind FK_Data_4, if the relocation Target is a temporary
symbol, let us skip the relocation (ELF::R_BPF_NONE).

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 349778

5 years ago[CodeView] Emit global variables within lexical scopes to limit visibility
Brock Wyma [Thu, 20 Dec 2018 17:33:45 +0000 (17:33 +0000)]
[CodeView] Emit global variables within lexical scopes to limit visibility

Emit static locals within the correct lexical scope so variables with the same
name will not confuse the debugger into getting the wrong value.

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

llvm-svn: 349777

5 years agoCorrect the diagnose_if attribute documentation. Fixes PR35845.
Aaron Ballman [Thu, 20 Dec 2018 17:28:32 +0000 (17:28 +0000)]
Correct the diagnose_if attribute documentation. Fixes PR35845.

llvm-svn: 349776

5 years ago[lldbsuite] Skip TestConflictingSymbol (test_shadowed) on Windows
Stella Stamenova [Thu, 20 Dec 2018 17:19:56 +0000 (17:19 +0000)]
[lldbsuite] Skip TestConflictingSymbol (test_shadowed) on Windows

The test is "passing" on windows, but it is a false positive. Skip it on Windows until it is fixed on all platforms.

llvm-svn: 349775

5 years ago[InstCombine] Preserve access-group metadata.
Michael Kruse [Thu, 20 Dec 2018 17:11:02 +0000 (17:11 +0000)]
[InstCombine] Preserve access-group metadata.

Preserve llvm.access.group metadata when combining store instructions.
This was forgotten in r349725.

Fixes llvm.org/PR40117

llvm-svn: 349774

5 years ago[x86] add test to show missed movddup load fold; NFC
Sanjay Patel [Thu, 20 Dec 2018 17:05:57 +0000 (17:05 +0000)]
[x86] add test to show missed movddup load fold; NFC

llvm-svn: 349773

5 years ago[PPC64] Add toc-optimizations for got based relocations.
Sean Fertile [Thu, 20 Dec 2018 17:00:33 +0000 (17:00 +0000)]
[PPC64] Add toc-optimizations for got based relocations.

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

llvm-svn: 349772

5 years agoTest commit
Amilendra Kodithuwakku [Thu, 20 Dec 2018 16:44:26 +0000 (16:44 +0000)]
Test commit

Fix a simple typo.

llvm-svn: 349771

5 years ago[Hexagon] Add patterns for funnel shifts
Krzysztof Parzyszek [Thu, 20 Dec 2018 16:39:20 +0000 (16:39 +0000)]
[Hexagon] Add patterns for funnel shifts

llvm-svn: 349770

5 years ago[clangd] Try to workaround test failure by increasing the timeouts
Ilya Biryukov [Thu, 20 Dec 2018 16:27:19 +0000 (16:27 +0000)]
[clangd] Try to workaround test failure by increasing the timeouts

Ideally we'd figure out a way to run this test without any sleeps, this
workaround is only there to avoid annoying people with test failures
around the holiday period when everyone is on vacation.

llvm-svn: 349769

5 years ago[clangd] Expose FileStatus to LSP.
Haojian Wu [Thu, 20 Dec 2018 15:39:12 +0000 (15:39 +0000)]
[clangd] Expose FileStatus to LSP.

Summary:
Add an LSP extension "textDocument/clangd.fileStatus" to emit file-status information.

Reviewers: ilya-biryukov

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

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

llvm-svn: 349768

5 years agoOverload GetMemoryRegions for the ProcessMinidump
Tatyana Krasnukha [Thu, 20 Dec 2018 15:05:43 +0000 (15:05 +0000)]
Overload GetMemoryRegions for the ProcessMinidump

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

llvm-svn: 349767

5 years agoReplace MemoryRegionInfoSP with values and cleanup related code
Tatyana Krasnukha [Thu, 20 Dec 2018 15:02:58 +0000 (15:02 +0000)]
Replace MemoryRegionInfoSP with values and cleanup related code

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

llvm-svn: 349766

5 years ago[SelectionDAGBuilder] Enable funnel shift building to custom rotates
Simon Pilgrim [Thu, 20 Dec 2018 14:56:44 +0000 (14:56 +0000)]
[SelectionDAGBuilder] Enable funnel shift building to custom rotates

This patch enables funnel shift -> rotate building for all ROTL/ROTR custom/legal operations.

AFAICT X86 was the last target that was missing modulo support (PR38243), but I've tried to CC stakeholders for every target that has ROTL/ROTR custom handling for their final OK.

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

llvm-svn: 349765

5 years ago[RISCV] Properly evaluate fixup_riscv_pcrel_lo12
Alex Bradbury [Thu, 20 Dec 2018 14:52:15 +0000 (14:52 +0000)]
[RISCV] Properly evaluate fixup_riscv_pcrel_lo12

This is a update to D43157 to correctly handle fixup_riscv_pcrel_lo12.

Notable changes:

Rebased onto trunk
Handle and test S-type
Test case pcrel-hilo.s is merged into relocations.s

D43157 description:
VK_RISCV_PCREL_LO has to be handled specially. The MCExpr inside is
actually the location of an auipc instruction with a VK_RISCV_PCREL_HI fixup
pointing to the real target.

Differential Revision: https://reviews.llvm.org/D54029
Patch by Chih-Mao Chen and Michael Spencer.

llvm-svn: 349764

5 years ago[X86][AVX512] Don't custom lower v16i8 rotations.
Simon Pilgrim [Thu, 20 Dec 2018 14:38:35 +0000 (14:38 +0000)]
[X86][AVX512] Don't custom lower v16i8 rotations.

As discussed on D55747, the expansion to (wider) shifts is better on all AVX512 cases, not just BWI.

llvm-svn: 349763

5 years ago[Sanitizer] Enable vis api on FreeBSD
David Carlier [Thu, 20 Dec 2018 14:25:43 +0000 (14:25 +0000)]
[Sanitizer] Enable vis api on FreeBSD

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 349762

5 years ago[SystemZ] "Generic" vector assembler instructions shoud clobber CC
Ulrich Weigand [Thu, 20 Dec 2018 14:24:17 +0000 (14:24 +0000)]
[SystemZ] "Generic" vector assembler instructions shoud clobber CC

There are several vector instructions which may or may not set the
condition code register, depending on the value of an argument.

For codegen, we use two versions of the instruction, one that sets
CC and one that doesn't, which hard-code appropriate values of that
argument.  But we also have a "generic" version of the instruction
that is used for the assembler/disassembler.  These generic versions
should always be considered to clobber CC just to be safe.

llvm-svn: 349761

5 years agoFix gcc7 -Wdangling-else warning. NFCI.
Simon Pilgrim [Thu, 20 Dec 2018 14:09:15 +0000 (14:09 +0000)]
Fix gcc7 -Wdangling-else warning. NFCI.

llvm-svn: 349760

5 years ago[InstCombine] Make x86 PADDS/PSUBS constant folding tests generic
Simon Pilgrim [Thu, 20 Dec 2018 13:50:12 +0000 (13:50 +0000)]
[InstCombine] Make x86 PADDS/PSUBS constant folding tests generic

As discussed on D55894, this replaces the existing PADDS/PSUBUS intrinsics with the the sadd/ssub.sat generic intrinsics and moves the tests out of the x86 subfolder.

PR40110 has been raised to fix the regression with constant folding vectors containing undef elements.

llvm-svn: 349759

5 years ago[clang-tidy] Use translationUnitDecl() instead of a custom matcher.
Alexander Kornienko [Thu, 20 Dec 2018 13:50:04 +0000 (13:50 +0000)]
[clang-tidy] Use translationUnitDecl() instead of a custom matcher.

llvm-svn: 349758

5 years ago[gn build] Add build files for clang/lib/{Analysis,Edit,Sema}
Nico Weber [Thu, 20 Dec 2018 13:39:25 +0000 (13:39 +0000)]
[gn build] Add build files for clang/lib/{Analysis,Edit,Sema}

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

llvm-svn: 349757

5 years ago[gn build] Add build files for clang/lib/Lex and clang/lib/AST
Nico Weber [Thu, 20 Dec 2018 13:38:36 +0000 (13:38 +0000)]
[gn build] Add build files for clang/lib/Lex and clang/lib/AST

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

llvm-svn: 349756

5 years ago[Sema][NFC] Add test for static_assert diagnistics with constexpr template functions.
Clement Courbet [Thu, 20 Dec 2018 13:30:40 +0000 (13:30 +0000)]
[Sema][NFC] Add test for static_assert diagnistics with constexpr template functions.

llvm-svn: 349755

5 years ago[Driver] Fix accidentally reversed condition in r349752
Michal Gorny [Thu, 20 Dec 2018 13:27:37 +0000 (13:27 +0000)]
[Driver] Fix accidentally reversed condition in r349752

llvm-svn: 349754

5 years ago[SystemZ] Improve testing of vecintrin.h intrinsics
Ulrich Weigand [Thu, 20 Dec 2018 13:10:47 +0000 (13:10 +0000)]
[SystemZ] Improve testing of vecintrin.h intrinsics

This adds assembly-level tests to verify that the high-level
intrinsics generate the instructions they're supposed to.
These tests would have caught the codegen bugs I just fixed.

llvm-svn: 349753

5 years agoReplace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]
Michal Gorny [Thu, 20 Dec 2018 13:09:30 +0000 (13:09 +0000)]
Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

Replace multiple comparisons of getOS() value with FreeBSD, NetBSD,
OpenBSD and DragonFly with matching isOS*BSD() methods.  This should
improve the consistency of coding style without changing the behavior.
Direct getOS() comparisons were left whenever used in switch or switch-
like context.

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

llvm-svn: 349752

5 years ago[SystemZ] Fix wrong codegen caused by typos in vecintrin.h
Ulrich Weigand [Thu, 20 Dec 2018 13:09:09 +0000 (13:09 +0000)]
[SystemZ] Fix wrong codegen caused by typos in vecintrin.h

The following two bugs in SystemZ high-level vector intrinsics are
fixes by this patch:

- The float case of vec_insert_and_zero should generate a VLLEZF
  pattern, but currently erroneously generates VLLEZLF.

- The float and double versions of vec_orc erroneously generate
  and-with-complement instead of or-with-complement.

The patch also fixes a couple of typos in the associated test.

llvm-svn: 349751

5 years ago[clangd] Don't miss the expected type in merge.
Haojian Wu [Thu, 20 Dec 2018 13:05:46 +0000 (13:05 +0000)]
[clangd] Don't miss the expected type in merge.

Reviewers: ilya-biryukov

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

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

llvm-svn: 349750

5 years ago[SystemZ] Make better use of VLLEZ
Ulrich Weigand [Thu, 20 Dec 2018 13:05:03 +0000 (13:05 +0000)]
[SystemZ] Make better use of VLLEZ

This patch fixes two deficiencies in current code that recognizes
the VLLEZ idiom:

- For the floating-point versions, we have ISel patterns that match
  on a bitconvert as the top node.  In more complex cases, that
  bitconvert may already have been merged into something else.
  Fix the patterns to match the inner nodes instead.

- For the 64-bit integer versions, depending on the surrounding code,
  we may get either a DAG tree based on JOIN_DWORDS or one based on
  INSERT_VECTOR_ELT.  Use a PatFrags to simply match both variants.

llvm-svn: 349749

5 years ago[SystemZ] Make better use of VGEF/VGEG
Ulrich Weigand [Thu, 20 Dec 2018 13:01:20 +0000 (13:01 +0000)]
[SystemZ] Make better use of VGEF/VGEG

Current code in SystemZDAGToDAGISel::tryGather refuses to perform
any transformation if the Load SDNode has more than one use.  This
(erronously) counts uses of the chain result, which prevents the
optimization in many cases unnecessarily.  Fixed by this patch.

llvm-svn: 349748