platform/upstream/llvm.git
4 years ago[OpenMP] Permit map with DSA on combined directive
Joel E. Denny [Thu, 22 Aug 2019 03:34:30 +0000 (03:34 +0000)]
[OpenMP] Permit map with DSA on combined directive

For `map`, the following restriction changed in OpenMP 5.0:

* OpenMP 4.5 [2.15.5.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct.

* OpenMP 5.0 [2.19.7.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct unless the construct is a combined construct."

This patch removes this restriction in the case of combined constructs
and OpenMP 5.0, and it updates Sema not to capture a scalar by copy in
the target region when `firstprivate` and `map` appear for that scalar
on a combined target construct.

This patch also adds a fixme to a test that now reveals that a
diagnostic about loop iteration variables is dropped in the case of
OpenMP 5.0.  That bug exists regardless of this patch's changes.

Reviewed By: ABataev, jdoerfert, hfinkel, kkwli0

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

llvm-svn: 369619

4 years ago[lldb] Replace std::once_flag with llvm::once_flag.
Davide Italiano [Thu, 22 Aug 2019 03:12:49 +0000 (03:12 +0000)]
[lldb] Replace std::once_flag with llvm::once_flag.

Summary:
The former seems like it's not working on some platforms.
All the other uses use `llvm::`, so, let's change for consistency.

Reviewers: jasonmolenda, friss

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 369618

4 years ago[FormatManage] Fix the format info order
Jonas Devlieghere [Thu, 22 Aug 2019 03:12:25 +0000 (03:12 +0000)]
[FormatManage] Fix the format info order

The format info entries need to match the order of the enum entries.
This should fix the two failing data-formatter tests.

llvm-svn: 369617

4 years ago[analyzer] Enable control dependency condition tracking by default
Kristof Umann [Thu, 22 Aug 2019 03:08:48 +0000 (03:08 +0000)]
[analyzer] Enable control dependency condition tracking by default

This patch concludes my GSoC'19 project by enabling track-conditions by default.

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

llvm-svn: 369616

4 years ago[analyzer] CastValueChecker: Model isa(), isa_and_nonnull()
Csaba Dabis [Thu, 22 Aug 2019 02:57:59 +0000 (02:57 +0000)]
[analyzer] CastValueChecker: Model isa(), isa_and_nonnull()

Summary: -

Reviewed By: NoQ

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

llvm-svn: 369615

4 years ago[FormatManager] Add static_assert to keep formats in sync.
Jonas Devlieghere [Thu, 22 Aug 2019 02:56:00 +0000 (02:56 +0000)]
[FormatManager] Add static_assert to keep formats in sync.

This adds a static assert that ensures that there's a format info entry
for every format enum value. This should prevent others from making the
same mistake I made and Jason kindly fixed in r369611. (Thanks!)

llvm-svn: 369614

4 years ago[analyzer] Don't track the condition of foreach loops
Kristof Umann [Thu, 22 Aug 2019 02:44:19 +0000 (02:44 +0000)]
[analyzer] Don't track the condition of foreach loops

As discussed on the mailing list, notes originating from the tracking of foreach
loop conditions are always meaningless.

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

llvm-svn: 369613

4 years ago[X86] Making X86OptimizeLEAs pass public. NFC
Pengfei Wang [Thu, 22 Aug 2019 02:29:27 +0000 (02:29 +0000)]
[X86] Making X86OptimizeLEAs pass public. NFC

Reviewers: wxiao3, LuoYuanke, andrew.w.kaylor, craig.topper, annita.zhang, liutianle, pengfei, xiangzhangllvm, RKSimon, spatel, andreadb

Reviewed By: RKSimon

Subscribers: andreadb, hiraditya, llvm-commits

Tags: #llvm

Patch by Gen Pei (gpei)

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

llvm-svn: 369612

4 years agoThe g_format_infos table needs to be updated in concert with the
Jason Molenda [Thu, 22 Aug 2019 02:06:03 +0000 (02:06 +0000)]
The g_format_infos table needs to be updated in concert with the
enum Format entries; else we can crash in a place like
FormatManager::GetFormatAsCString().  We should add  bounds checks
to prevent this more reliably, but for tonight I'm just adding this
entry to keep an address-sanitizer test run working.

llvm-svn: 369611

4 years ago[COFF] Fix section name for constants larger than 64 bits on Windows
Fangrui Song [Thu, 22 Aug 2019 01:48:34 +0000 (01:48 +0000)]
[COFF] Fix section name for constants larger than 64 bits on Windows

APIntToHexString returns wrong value ("0000000000000000ffffffffffffffff")
for integer larger than 64 bits, and thus
TargetLoweringObjectFileCOFF::getSectionForConstant returns same section name
for all numbers larger than 64 bits. This patch tries to fix it.

Differential Revision: https://reviews.llvm.org/D66458
Patch by Senran Zhang

llvm-svn: 369610

4 years ago[analyzer] CastValueChecker: Try to fix the buildbots
Csaba Dabis [Thu, 22 Aug 2019 01:41:06 +0000 (01:41 +0000)]
[analyzer] CastValueChecker: Try to fix the buildbots

llvm-svn: 369609

4 years agogn build: Merge r369605
Nico Weber [Thu, 22 Aug 2019 00:40:55 +0000 (00:40 +0000)]
gn build: Merge r369605

llvm-svn: 369608

4 years ago[analyzer] CastValueChecker: Rewrite dead header hotfix
Csaba Dabis [Thu, 22 Aug 2019 00:36:42 +0000 (00:36 +0000)]
[analyzer] CastValueChecker: Rewrite dead header hotfix

llvm-svn: 369607

4 years ago[GWP-ASan] Remove c++ standard lib dependency.
Petr Hosek [Thu, 22 Aug 2019 00:22:56 +0000 (00:22 +0000)]
[GWP-ASan] Remove c++ standard lib dependency.

Remove c++ standard library dependency for now for @phosek. They have a
complicated build system that breaks with the fuzzer target here.

Also added a todo to remedy later.

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

llvm-svn: 369606

4 years ago[analyzer] CastValueChecker: Store the dynamic types and casts
Csaba Dabis [Thu, 22 Aug 2019 00:20:36 +0000 (00:20 +0000)]
[analyzer] CastValueChecker: Store the dynamic types and casts

Summary:
This patch introduces `DynamicCastInfo` similar to `DynamicTypeInfo` which
is stored in `CastSets` which are storing the dynamic cast informations of
objects based on memory regions. It could be used to store and check the
casts and prevent infeasible paths.

Reviewed By: NoQ

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

llvm-svn: 369605

4 years ago[analyzer] TrackConstraintBRVisitor: Do not track unknown values
Csaba Dabis [Thu, 22 Aug 2019 00:06:58 +0000 (00:06 +0000)]
[analyzer] TrackConstraintBRVisitor: Do not track unknown values

Summary: -

Reviewers: NoQ, Szelethus

Reviewed By: NoQ, Szelethus

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

llvm-svn: 369604

4 years agogn build: Merge r369600
Nico Weber [Thu, 22 Aug 2019 00:01:59 +0000 (00:01 +0000)]
gn build: Merge r369600

llvm-svn: 369603

4 years ago[Object] FIX: update PlatformKind name in TapiFile
Cyndy Ishida [Wed, 21 Aug 2019 23:57:57 +0000 (23:57 +0000)]
[Object] FIX: update PlatformKind name in TapiFile

Buildbots that use GCC failed to compile because overwritten
namespace with variable name

llvm-svn: 369602

4 years ago[TSan] #include header instead of forward declaring interceptees
Julian Lettner [Wed, 21 Aug 2019 23:42:06 +0000 (23:42 +0000)]
[TSan] #include header instead of forward declaring interceptees

llvm-svn: 369601

4 years ago[Object] Add tapi files to object
Cyndy Ishida [Wed, 21 Aug 2019 23:30:53 +0000 (23:30 +0000)]
[Object] Add tapi files to object

Summary:
The intention for this is to allow reading and printing symbols out from
llvm-nm. Tapi file, and Tapi universal follow a similiar format to
their respective MachO Object format.

The tests are dependent on llvm-nm processing tbd files which is why its in D66160

Reviewers: ributzka, steven_wu, lhames

Reviewed By: ributzka, lhames

Subscribers: mgorny, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 369600

4 years ago[X86] Correct the scheduler classes for TAILJMP and TCRETURN CodeGenOnly instructions.
Craig Topper [Wed, 21 Aug 2019 23:17:52 +0000 (23:17 +0000)]
[X86] Correct the scheduler classes for TAILJMP and TCRETURN CodeGenOnly instructions.

We had an odd combination of WriteJump applied to some memory
instructions and WriteJumpLd applied to register and immediate
instructions.

Thsi should hopefully assign them all correctly.

llvm-svn: 369599

4 years ago[X86] Replace a couple hardcoded '5's with X86::AddrNumOperands for readability. NFC
Craig Topper [Wed, 21 Aug 2019 22:40:07 +0000 (22:40 +0000)]
[X86] Replace a couple hardcoded '5's with X86::AddrNumOperands for readability. NFC

llvm-svn: 369598

4 years agolibcxx: Rename last two .hpp files in libcxx to .h
Nico Weber [Wed, 21 Aug 2019 22:38:38 +0000 (22:38 +0000)]
libcxx: Rename last two .hpp files in libcxx to .h

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

llvm-svn: 369597

4 years ago[analyzer] Mention whether an event is about a condition in a bug report part 2
Kristof Umann [Wed, 21 Aug 2019 22:38:00 +0000 (22:38 +0000)]
[analyzer] Mention whether an event is about a condition in a bug report part 2

In D65724, I do a pretty thorough explanation about how I'm solving this
problem, I think that summary nails whats happening here ;)

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

llvm-svn: 369596

4 years ago[test] Update test so it matches the Windows output
Jonas Devlieghere [Wed, 21 Aug 2019 22:32:21 +0000 (22:32 +0000)]
[test] Update test so it matches the Windows output

llvm-svn: 369595

4 years agogn build: Merge r369591
Nico Weber [Wed, 21 Aug 2019 22:26:02 +0000 (22:26 +0000)]
gn build: Merge r369591

llvm-svn: 369594

4 years agogn build: Merge r369587
Nico Weber [Wed, 21 Aug 2019 22:25:57 +0000 (22:25 +0000)]
gn build: Merge r369587

llvm-svn: 369593

4 years ago[Attributor] FIX: Try to make bots happy
Johannes Doerfert [Wed, 21 Aug 2019 22:21:13 +0000 (22:21 +0000)]
[Attributor] FIX: Try to make bots happy

Locally the tight iterations bounds work fine but the bots seem unhappy.
Try to get green bots and some time to determine the underlying problem.

llvm-svn: 369592

4 years ago[LifetimeAnalysis] Support more STL idioms (template forward declaration and Dependen...
Matthias Gehre [Wed, 21 Aug 2019 22:08:59 +0000 (22:08 +0000)]
[LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)

Summary:
This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator
on the template is a DependentNameType - we can only put the gsl::Pointer attribute
on the underlaying record after instantiation)

inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared,
we added the gsl::Pointer on the canonical decl (the forward decl), and later when the
template was instantiated, there was no attribute on the definition so it was not instantiated).

and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to
a incomplete instantiation, and then another was copied from the template definition
when the instantiation was completed).

We now add the attributes to all redeclarations to fix thos issues and make their usage easier.

Reviewers: gribozavr

Subscribers: Szelethus, xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 369591

4 years ago[RISCV] Remove fix introduced by r369573, superseded by r369580
Luis Marques [Wed, 21 Aug 2019 22:02:56 +0000 (22:02 +0000)]
[RISCV] Remove fix introduced by r369573, superseded by r369580

llvm-svn: 369590

4 years ago[analyzer] Don't make ConditionBRVisitor events prunable when the condition is an...
Kristof Umann [Wed, 21 Aug 2019 21:59:22 +0000 (21:59 +0000)]
[analyzer] Don't make ConditionBRVisitor events prunable when the condition is an interesting field

Exactly what it says on the tin! Note that we're talking about interestingness
in general, hence this isn't a control-dependency-tracking specific patch.

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

llvm-svn: 369589

4 years ago[Attributor] Fix: Gracefully handle non-instruction users
Johannes Doerfert [Wed, 21 Aug 2019 21:48:56 +0000 (21:48 +0000)]
[Attributor] Fix: Gracefully handle non-instruction users

Function can have users that are not instructions, e.g., bitcasts. For
now, we simply give up when we see them.

llvm-svn: 369588

4 years agoAdd FileWriter to GSYM and encode/decode functions to AddressRange and AddressRanges
Greg Clayton [Wed, 21 Aug 2019 21:48:11 +0000 (21:48 +0000)]
Add FileWriter to GSYM and encode/decode functions to AddressRange and AddressRanges

The full GSYM patch started with: https://reviews.llvm.org/D53379

This patch add the ability to encode data using the new llvm::gsym::FileWriter class.

FileWriter is a simplified binary data writer class that doesn't require targets, target definitions, architectures, or require any other optional compile time libraries to be enabled via the build process. This class needs the ability to seek to different spots in the binary data that it produces to fix up offsets and sizes in GSYM data. It currently uses std::ostream over llvm::raw_ostream because llvm::raw_ostream doesn't support seeking which is required when encoding and decoding GSYM data.

AddressRange objects are encoded and decoded to be relative to a base address. This will be the FunctionInfo's start address if the AddressRange is directly contained in a FunctionInfo, or a base address of the containing parent AddressRange or AddressRanges. This allows address ranges to be efficiently encoded using ULEB128 encodings as we encode the offset and size of each range instead of full addresses. This also makes encoded addresses easy to relocate as we just need to relocate one base address.

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

llvm-svn: 369587

4 years ago[Attributor][NFCI] Introduce tight iteration bounds in the tests
Johannes Doerfert [Wed, 21 Aug 2019 21:42:46 +0000 (21:42 +0000)]
[Attributor][NFCI] Introduce tight iteration bounds in the tests

Summary:
To be able to track how many iterations we need to manifest all
information we check for we now make the maximum iteration count
explicit. The count is set tightly now and should be kept that way.

Reviewers: uenoku, sstefan1

Subscribers: bollu, llvm-commits

Tags: #llvm

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

llvm-svn: 369586

4 years agoNFCI: Simplify SourceManager::translateFile by removing code path that should never...
Alex Lorenz [Wed, 21 Aug 2019 21:37:09 +0000 (21:37 +0000)]
NFCI: Simplify SourceManager::translateFile by removing code path that should never be taken

I noticed that SourceManager::translateFile has code that doesn't really make sense.
In particular, if it fails to find a FileID by comparing FileEntry * values, it tries to
look through files that have the same filename, to see if they have a matching inode to try to
find the right FileID. However, the inode comparison seem redundant, as Clang's FileManager
already deduplicates FileEntry * values by inode.
Thus the comparisons between inodes should never actually succeed, and the comparison between FileEntry * values should be sufficient here.

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

llvm-svn: 369585

4 years agoWhen building file without debug info, include the architecture
Jason Molenda [Wed, 21 Aug 2019 21:34:17 +0000 (21:34 +0000)]
When building file without debug info, include the architecture
setting in the cflags on Darwin systems.

llvm-svn: 369584

4 years ago[analyzer][NFC] Add different interestingness kinds
Kristof Umann [Wed, 21 Aug 2019 21:33:25 +0000 (21:33 +0000)]
[analyzer][NFC] Add different interestingness kinds

We defined (on the mailing list and here on phabricator) 2 different cases where
retrieving information about a control dependency condition is very important:

* When the condition's last write happened in a different stack frame
* When the collapse point of the condition (when we can constrain it to be
true/false) didn't happen in the actual condition.

It seems like we solved this problem with the help of expression value tracking,
and have started working on better diagnostics notes about this process.

Expression value tracking is nothing more than registering a variety of visitors
to construct reports about it. Each of the registered visitors (ReturnVisitor,
FindLastStoreVisitor, NoStoreFuncVisitor, etc) have something to go by: a
MemRegion, an SVal, an ExplodedNode, etc. For this reason, better explaining a
last write is super simple, we can always just pass on some more information to
the visitor in question (as seen in D65575).

ConditionBRVisitor is a different beast, as it was built for a different
purpose. It is responsible for constructing events at, well, conditions, and is
registered only once, and isn't a part of the "expression value tracking
family". Unfortunately, it is also the visitor to tinker with for constructing
better diagnostics about the collapse point problem.

This creates a need for alternative way to communicate with ConditionBRVisitor
that a specific condition is being tracked for for the reason of being a control
dependency. Since at almost all PathDiagnosticEventPiece construction the
visitor checks interestingness, it makes sense to pair interestingness with a
reason as to why we marked an entity as such.

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

llvm-svn: 369583

4 years agoAdd char8_t support (C++20)
Jonas Devlieghere [Wed, 21 Aug 2019 21:30:55 +0000 (21:30 +0000)]
Add char8_t support (C++20)

This patch adds support for the char8_t type introduced in C++20
char8_t. The original patch was submitted by James Blachly  on the LLDB
mailing list [1]. I modified the patch a bit and added a test.

[1] http://lists.llvm.org/pipermail/lldb-dev/2019-August/015393.html

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

llvm-svn: 369582

4 years agoUse C++14 heteregenous lookup for a couple of std::map<std::string, ...>
Benjamin Kramer [Wed, 21 Aug 2019 21:17:34 +0000 (21:17 +0000)]
Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>

These call find with a StringRef, heterogenous lookup saves a temporary
std::string there.

llvm-svn: 369581

4 years ago[RISCV] Fix use of side-effects in asserts in decoder functions
Luis Marques [Wed, 21 Aug 2019 21:11:37 +0000 (21:11 +0000)]
[RISCV] Fix use of side-effects in asserts in decoder functions

llvm-svn: 369580

4 years ago[BinaryFormat] Teach identify_magic about Tapi files.
Cyndy Ishida [Wed, 21 Aug 2019 21:00:16 +0000 (21:00 +0000)]
[BinaryFormat] Teach identify_magic about Tapi files.

Summary:
Tapi files are YAML files that start with the !tapi tag. The only execption are
TBD v1 files, which don't have a tag. In that case we have to scan a little
further and check if the first key "archs" exists.

This is the first patch in a series of patches to add libObject support for
text-based dynamic library (.tbd) files.

This patch is practically exactly the same as D37820, that was never pushed to master,
and is needed for future commits related to reading tbd files for llvm-nm

Reviewers: ributzka, steven_wu, bollu, espindola, jfb, shafik, jdoerfert

Reviewed By: steven_wu

Subscribers: dexonsmith, llvm-commits

Tags: #llvm, #clang, #sanitizers, #lldb, #libc, #openmp

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

llvm-svn: 369579

4 years agoFix documentation build after rL369568
Yuanfang Chen [Wed, 21 Aug 2019 20:59:16 +0000 (20:59 +0000)]
Fix documentation build after rL369568

llvm-svn: 369578

4 years ago[Attributor][NFC] Fix copy & paste error
Johannes Doerfert [Wed, 21 Aug 2019 20:57:20 +0000 (20:57 +0000)]
[Attributor][NFC] Fix copy & paste error

llvm-svn: 369577

4 years ago[Attributor][NFC] Remove leftover semicolon
Johannes Doerfert [Wed, 21 Aug 2019 20:56:56 +0000 (20:56 +0000)]
[Attributor][NFC] Remove leftover semicolon

llvm-svn: 369576

4 years ago[Attributor] Use existing unreachable instead of introducing new ones
Johannes Doerfert [Wed, 21 Aug 2019 20:56:41 +0000 (20:56 +0000)]
[Attributor] Use existing unreachable instead of introducing new ones

So far we split the unreachable off and placed a new one, this is not
necessary.

llvm-svn: 369575

4 years ago[analyzer] Mention whether an event is about a condition in a bug report part 1
Kristof Umann [Wed, 21 Aug 2019 20:43:27 +0000 (20:43 +0000)]
[analyzer] Mention whether an event is about a condition in a bug report part 1

Can't add much more to the title! This is part 1, the case where the collapse
point isn't in the condition point is the responsibility of ConditionBRVisitor,
which I'm addressing in part 2.

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

llvm-svn: 369574

4 years agoFix -Werror=unused-variable error after r369528.
Richard Smith [Wed, 21 Aug 2019 20:42:37 +0000 (20:42 +0000)]
Fix -Werror=unused-variable error after r369528.

llvm-svn: 369573

4 years agogn build: Merge r369568
Nico Weber [Wed, 21 Aug 2019 20:20:36 +0000 (20:20 +0000)]
gn build: Merge r369568

llvm-svn: 369572

4 years agogn build: Make sync script not exit 1 if it writes changes
Nico Weber [Wed, 21 Aug 2019 20:13:00 +0000 (20:13 +0000)]
gn build: Make sync script not exit 1 if it writes changes

llvm-svn: 369571

4 years ago[GVN] Do PHI translations across all edges between the load and the unavailable pred.
Florian Hahn [Wed, 21 Aug 2019 20:06:50 +0000 (20:06 +0000)]
[GVN] Do PHI translations across all edges between the load and the unavailable pred.

Currently we do not properly translate addresses with PHIs if LoadBB !=
LI->getParent(), because PHITranslateAddr expects a direct predecessor as argument,
because it considers all instructions outside of the current block to
not requiring translation.

The amount of cases that trigger this should be very low, as most single
predecessor blocks should be folded into their predecessor by GVN before
we actually start with value numbering. It is still not guaranteed to
happen, so we should do PHI translation along all edges between the
loads' block and the predecessor where we have to place a load.

There are a few test cases showing current limits of the PHI translation, which
could be improved later.

Reviewers: spatel, reames, efriedma, john.brawn

Reviewed By: efriedma

Tags: #llvm

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

llvm-svn: 369570

4 years agoRevert r369549 as it broke the bots.
Aaron Ballman [Wed, 21 Aug 2019 20:00:41 +0000 (20:00 +0000)]
Revert r369549 as it broke the bots.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/13605/

llvm-svn: 369569

4 years ago[clang-tidy] Check for dynamically initialized statics in headers.
Yuanfang Chen [Wed, 21 Aug 2019 20:00:01 +0000 (20:00 +0000)]
[clang-tidy] Check for dynamically initialized statics in headers.

Finds instances where variables with static storage are initialized dynamically in header files.

Reviewed By: aaron.ballman, alexfh

Patch by Charles Zhang!

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

llvm-svn: 369568

4 years agoRevert r367389 (and follow-up r368404); it caused PR43073.
Nico Weber [Wed, 21 Aug 2019 19:53:42 +0000 (19:53 +0000)]
Revert r367389 (and follow-up r368404); it caused PR43073.

llvm-svn: 369567

4 years ago[WebAssembly] Handle aliases in WebAssemblyFixFunctionBitcasts
Sam Clegg [Wed, 21 Aug 2019 19:52:33 +0000 (19:52 +0000)]
[WebAssembly] Handle aliases in WebAssemblyFixFunctionBitcasts

Fixes: https://github.com/emscripten-core/emscripten/issues/8770

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

llvm-svn: 369566

4 years ago[MVT] Add v16f16 and v32f16 vectors.
Craig Topper [Wed, 21 Aug 2019 19:14:48 +0000 (19:14 +0000)]
[MVT] Add v16f16 and v32f16 vectors.

I might look at improving PR43065 which will require being
able to mark a 256 and 512 bit vector of f16 as Legal.

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

llvm-svn: 369565

4 years ago[TableGen] Include ValueTypes.td directly into the intrinsic-varargs.td test.
Craig Topper [Wed, 21 Aug 2019 19:14:38 +0000 (19:14 +0000)]
[TableGen] Include ValueTypes.td directly into the intrinsic-varargs.td test.

This prevents needing to keep the test in sync with ValueTypes.td

This is not the only test that includes ValueTypes.td.

llvm-svn: 369564

4 years ago[mips] Replace call `expandLoadAddress` by `loadAndAddSymbolAddress`. NFC
Simon Atanasyan [Wed, 21 Aug 2019 18:54:51 +0000 (18:54 +0000)]
[mips] Replace call `expandLoadAddress` by `loadAndAddSymbolAddress`. NFC

In case of expanding `lw/sw $reg, symbol($reg)` instruction for PIC it's
enough to call the `loadAndAddSymbolAddress` method. Additional work
performed by the `expandLoadAddress` is not required here.

llvm-svn: 369563

4 years ago[mips] Remove duplicated case from the `StringSwitch`. NFC
Simon Atanasyan [Wed, 21 Aug 2019 18:54:41 +0000 (18:54 +0000)]
[mips] Remove duplicated case from the `StringSwitch`. NFC

llvm-svn: 369562

4 years ago[DAGCombiner] Remove mostly redundant calls to AddToWorklist
Amaury Sechet [Wed, 21 Aug 2019 18:51:08 +0000 (18:51 +0000)]
[DAGCombiner] Remove mostly redundant calls to AddToWorklist

Summary:
These calls change the order in which some nodes are processed and so have an effect on codegen.

The change in fixup-bw-copy.ll is due to (and (load anyext)) gets transformed into (load zext) while previously the and was removed by SimplifyDemandedBits, so the (load anyext) remained.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 369561

4 years ago[docs] Add GwpAsan to toctree.
Mitch Phillips [Wed, 21 Aug 2019 18:31:03 +0000 (18:31 +0000)]
[docs] Add GwpAsan to toctree.

Reverts rL369556 in the process, as it's no longer needed.

llvm-svn: 369560

4 years ago[lld-link] implement -lto-obj-path
Bob Haarman [Wed, 21 Aug 2019 18:24:59 +0000 (18:24 +0000)]
[lld-link] implement -lto-obj-path

Summary:
This adds the -lto-obj-path option to lld-link. This can be
used to specify a path at which to write a native object file for
the full LTO part when using LTO unit splitting.

Reviewers: ruiu, tejohnson, pcc, rnk

Reviewed By: ruiu, rnk

Subscribers: mehdi_amini, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 369559

4 years ago[BitcodeReader] Check if we can create a null constant for type.
Florian Hahn [Wed, 21 Aug 2019 18:20:11 +0000 (18:20 +0000)]
[BitcodeReader] Check if we can create a null constant for type.

We cannot create null constants for certain types, e.g. VoidTy,
FunctionTy or LabelTy. getNullValue asserts if we pass in an
unsupported type. We should also check for opaque types, but I'm not
sure how.

This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14795.

Reviewers: t.p.northover, jfb, vsk

Reviewed By: vsk

Tags: #llvm

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

llvm-svn: 369557

4 years ago[docs] Fix GwpAsan.rst
Jordan Rupprecht [Wed, 21 Aug 2019 18:09:31 +0000 (18:09 +0000)]
[docs] Fix GwpAsan.rst

llvm-svn: 369556

4 years agoGeneralize FindTypes with CompilerContext to support fuzzy lookup
Adrian Prantl [Wed, 21 Aug 2019 18:06:56 +0000 (18:06 +0000)]
Generalize FindTypes with CompilerContext to support fuzzy lookup

This patch generalizes the FindTypes with CompilerContext interface to
support looking up a type of unknown kind by name, as well as looking
up a type inside an unspecified submodule. These features are
motivated by the Swift branch, but are fully tested via unit tests and
lldb-test on llvm.org.  Specifically, this patch adds an AnyModule and
an AnyType CompilerContext kind.

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

rdar://problem/54471165

llvm-svn: 369555

4 years agoAdd newline to GWP-ASan sphinx document.
Mitch Phillips [Wed, 21 Aug 2019 18:03:11 +0000 (18:03 +0000)]
Add newline to GWP-ASan sphinx document.
Should fix the document builder.

llvm-svn: 369554

4 years ago[docs] Convert remaining command guide entries from md to rst.
Jordan Rupprecht [Wed, 21 Aug 2019 18:00:17 +0000 (18:00 +0000)]
[docs] Convert remaining command guide entries from md to rst.

Summary:
Linking between markdown and rst files is currently not supported very well, e.g. the current llvm-addr2line docs [1] link to "llvm-symbolizer" instead of "llvm-symbolizer.html". This is weirdly broken in different ways depending on which versions of sphinx and recommonmark are being used, so workaround the bug by using rst everywhere.

[1] http://llvm.org/docs/CommandGuide/llvm-addr2line.html

Reviewers: jhenderson

Reviewed By: jhenderson

Subscribers: lebedev.ri, llvm-commits

Tags: #llvm

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

llvm-svn: 369553

4 years ago[GWP-ASan] Add public-facing documentation [6].
Mitch Phillips [Wed, 21 Aug 2019 17:53:51 +0000 (17:53 +0000)]
[GWP-ASan] Add public-facing documentation [6].

Summary:
Note: Do not submit this documentation until Scudo support is reviewed and submitted (should be #[5]).

See D60593 for further information.

This patch introduces the public-facing documentation for GWP-ASan, as well as updating the definition of one of the options, which wasn't properly merged. The document describes the design and features of GWP-ASan, as well as how to use GWP-ASan from both a user's standpoint, and development documentation for supporting allocators.

Reviewers: jfb, morehouse, vlad.tsyrklevich

Reviewed By: morehouse, vlad.tsyrklevich

Subscribers: kcc, dexonsmith, kubamracek, cryptoad, jfb, #sanitizers, llvm-commits, vlad.tsyrklevich, morehouse

Tags: #sanitizers, #llvm

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

llvm-svn: 369552

4 years ago[GWP-ASan] Build stack_trace_compressor_fuzzer.
Mitch Phillips [Wed, 21 Aug 2019 17:52:51 +0000 (17:52 +0000)]
[GWP-ASan] Build stack_trace_compressor_fuzzer.

Summary:
Flips the switch to build stack_trace_compressor_fuzzer. This was recently
temporarily disabled in rL369079 as it was breaking the sanitizer buildbots.

My diagnosis of the problem is that on clang-only bootstrap builds, we build
gwp_asan before libfuzzer. This causes a discrepancy when the clang driver
attempts to link libclang_rt.fuzzer* as CMake doesn't see a dependency there.

I've (hopefully) fixed the issue by adding a direct dependency for the fuzz
target so CMake can resolve the build order properly. As part of this, the
libFuzzer 'fuzzer' target has to be discovered before the declaration of the
fuzz target.

pcc@ for mild review + notification as buildcop.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 369551

4 years ago[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1 under the new pass...
Leonard Chan [Wed, 21 Aug 2019 17:24:14 +0000 (17:24 +0000)]
[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1 under the new pass manager

Match the behavior of D65009 under the new pass manager. This addresses
the test clang/test/CodeGen/split-lto-unit.c when running under the new
PM.

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

llvm-svn: 369550

4 years agoFix -Wimplicit-fallthrough warnings in regcomp.c
Nathan Huckleberry [Wed, 21 Aug 2019 17:07:43 +0000 (17:07 +0000)]
Fix -Wimplicit-fallthrough warnings in regcomp.c

Summary:
Since clang does not support comment style fallthrough annotations
these should be switched.

Reviewers: aaron.ballman, nickdesaulniers, xbolva00

Reviewed By: aaron.ballman, nickdesaulniers, xbolva00

Subscribers: xbolva00, nickdesaulniers, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369549

4 years ago[LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it.
Alina Sbirlea [Wed, 21 Aug 2019 17:00:57 +0000 (17:00 +0000)]
[LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it.

Summary:
Add a flag to the FunctionToLoopAdaptor that allows enabling MemorySSA only for the loop pass managers that are known to preserve it.

If an LPM is known to have only loop transforms that *all* preserve MemorySSA, then use MemorySSA if `EnableMSSALoopDependency` is set.
If an LPM has loop passes that do not preserve MemorySSA, then the flag passed is `false`, regardless of the value of `EnableMSSALoopDependency`.

When using a custom loop pass pipeline via `passes=...`, use keyword `loop` vs `loop-mssa` to use MemorySSA in that LPM. If a loop that does not preserve MemorySSA is added while using the `loop-mssa` keyword, that's an error.

Add the new `loop-mssa` keyword to a few tests where a difference occurs when enabling MemorySSA.

Reviewers: chandlerc

Subscribers: mehdi_amini, Prazek, george.burgess.iv, sanjoy.google, llvm-commits

Tags: #llvm

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

llvm-svn: 369548

4 years agoGlobalISel: Implement moreElementsVector for G_UNMERGE_VALUES sources
Matt Arsenault [Wed, 21 Aug 2019 16:59:10 +0000 (16:59 +0000)]
GlobalISel: Implement moreElementsVector for G_UNMERGE_VALUES sources

This is necessary for handling <3 x s16> on AMDGPU, assuming this
should be handled as 2 separate legalization actions. The alternative
would be for fewerElementsVector to handle 3->2.

llvm-svn: 369547

4 years agoAdd a couple of extra test noticed in post-commit discussion of rL369541
Philip Reames [Wed, 21 Aug 2019 16:57:53 +0000 (16:57 +0000)]
Add a couple of extra test noticed in post-commit discussion of rL369541

llvm-svn: 369546

4 years ago[ARM] Formatting for ARMInstrMVE.td. NFC
David Green [Wed, 21 Aug 2019 16:20:35 +0000 (16:20 +0000)]
[ARM] Formatting for ARMInstrMVE.td. NFC

This is just some formatting cleanup, prior to the masked load and store patch
in D66534.

llvm-svn: 369545

4 years agogit-llvm: Make push --force suppress error on nothing to commit as well
Nico Weber [Wed, 21 Aug 2019 16:03:34 +0000 (16:03 +0000)]
git-llvm: Make push --force suppress error on nothing to commit as well

llvm-svn: 369544

4 years ago[Sanitizer] Disable -Wframe-larger-than on SystemZ
Ulrich Weigand [Wed, 21 Aug 2019 15:53:08 +0000 (15:53 +0000)]
[Sanitizer] Disable -Wframe-larger-than on SystemZ

SystemZ builds show -Wframe-larger-than warnings in two functions:
 'sanitizer::SuspendedThreadsListLinux::GetRegistersAndSP'
 'sanitizer::SizeClassAllocator32<__sanitizer::AP32>::PopulateFreeList'

In both cases, the frame size looks correct; each of the functions has
a large local variable that brings the frame size close to the limit
even on x86, and the extra 160 bytes of the default register save areas
on SystemZ pushes it over the limit.

PowerPC and MIPS already disable this warning; do the same on SystemZ.

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

llvm-svn: 369543

4 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:52:44 +0000 (15:52 +0000)]
clang: Fix typo in comment

llvm-svn: 369542

4 years ago[instcombine] icmp eq/ne (sub C, Y), C -> icmp eq/ne Y, 0
Philip Reames [Wed, 21 Aug 2019 15:51:57 +0000 (15:51 +0000)]
[instcombine] icmp eq/ne (sub C, Y), C -> icmp eq/ne Y, 0

Noticed while looking at pr43028.

llvm-svn: 369541

4 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:49:21 +0000 (15:49 +0000)]
clang: Fix typo in comment

(Sorry for all these commits; trying to sort out why svn doesn't want to store
my password.)

llvm-svn: 369540

4 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:41:29 +0000 (15:41 +0000)]
clang: Fix typo in comment

llvm-svn: 369539

4 years agogit-llvm: Give "push" a --force flag to disable confirm prompt on multiple commits
Nico Weber [Wed, 21 Aug 2019 15:41:20 +0000 (15:41 +0000)]
git-llvm: Give "push" a --force flag to disable confirm prompt on multiple commits

llvm-svn: 369538

4 years ago[libcxx] Only declare contents of threading API when
David Spickett [Wed, 21 Aug 2019 15:38:24 +0000 (15:38 +0000)]
[libcxx] Only declare contents of threading API when
_LIBCPP_HAS_THREAD_API_EXTERNAL is not defined.

When it is defined they will be declared by the
__external_threading header instead.

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

llvm-svn: 369537

4 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:37:27 +0000 (15:37 +0000)]
clang: Fix typo in comment

llvm-svn: 369536

4 years ago[ELF][ARM] Simplify some llvm-objdump tests with both ARM/Thumb states
Fangrui Song [Wed, 21 Aug 2019 15:30:55 +0000 (15:30 +0000)]
[ELF][ARM] Simplify some llvm-objdump tests with both ARM/Thumb states

llvm-objdump can switch between ARM/Thumb states after D60927.

In a few lld tests, we run both

* llvm-objdump -d -triple=thumbv7a-none-linux-gnueabi %t
* llvm-objdump -d -triple=armv7a-none-linux-gnueabi %t

to test ARM/Thumb parts of the same file. In many cases we can just
run one command. There is a problem that prevents us from cleaning
more tests (e.g. test/ELF/arm-thumb-interwork-thunk.s):

In llvm-objdump, while we have ARM/Thumb (primary and secondary)
MCDisassembler and MCSubtargetInfo, we have just one MCInstrAnalysis
which is used to resolve the targets of calls in both ARM/Thumb parts.

    // ThumbMCInstrAnalysis evaluating ARM parts or ARMMCInstrAnalysis evaluating Thumb parts
    // will have incorrect offsets.
    // An example of llvm-objdump -d -triple=thumbv7a on ARM part:
    1304: 3d ff ff fa  blx     #-780                 # no <...>
    1308: 06 00 00 ea  b       #24 <arm_caller+0x24> # wrong target due to wrong offset

Reviewed By: peter.smith

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

llvm-svn: 369535

4 years agocompiler-rt: Fix warning if COMPILER_RT_HAS_FCNTL_LCK is 0
Nico Weber [Wed, 21 Aug 2019 15:24:25 +0000 (15:24 +0000)]
compiler-rt: Fix warning if COMPILER_RT_HAS_FCNTL_LCK is 0

Fixes "warning: implicit declaration of function 'flock' is invalid in C99"
for flock().

llvm-svn: 369534

4 years agoImproving CodeView debug info type record's inline comments
Nilanjana Basu [Wed, 21 Aug 2019 15:19:58 +0000 (15:19 +0000)]
Improving CodeView debug info type record's inline comments

llvm-svn: 369533

4 years ago[AMDGPU] Prevent VGPR copies from moving across the EXEC mask definitions
Alexander Timofeev [Wed, 21 Aug 2019 15:15:04 +0000 (15:15 +0000)]
[AMDGPU] Prevent VGPR copies from moving across the EXEC mask definitions
Differential Revision: https://reviews.llvm.org/D63731
Reviewers: qcolombet, rampitec

llvm-svn: 369532

4 years ago[LLVM][Alignment] Introduce Alignment In MachineFrameInfo
Guillaume Chatelet [Wed, 21 Aug 2019 14:29:30 +0000 (14:29 +0000)]
[LLVM][Alignment] Introduce Alignment In MachineFrameInfo

Summary:
This is patch is part of a serie to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: jfb

Subscribers: hiraditya, dexonsmith, llvm-commits, courbet

Tags: #llvm

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

llvm-svn: 369531

4 years ago[lldb][NFC] Merge multiple TestApropos.py
Raphael Isemann [Wed, 21 Aug 2019 14:22:59 +0000 (14:22 +0000)]
[lldb][NFC] Merge multiple TestApropos.py

That's cleaner and makes lldb-dotest no longer fail due to conflicting names.

llvm-svn: 369530

4 years ago[DWARF] Adjust return type of DWARFUnit::getLength().
Igor Kudrin [Wed, 21 Aug 2019 14:10:57 +0000 (14:10 +0000)]
[DWARF] Adjust return type of DWARFUnit::getLength().

DWARFUnitHeader::getLength() returns uint64_t.
DWARFUnit::getLength() should do the same.

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

llvm-svn: 369529

4 years ago[RISCV] Add support for RVC HINT instructions
Luis Marques [Wed, 21 Aug 2019 14:00:58 +0000 (14:00 +0000)]
[RISCV] Add support for RVC HINT instructions

The hint instructions are enabled by default (if the standard C extension is
enabled). To disable them pass -mattr=-rvc-hints.

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

llvm-svn: 369528

4 years agoreland [gtest] Fix printing of StringRef and SmallString in assert messages.
Sam McCall [Wed, 21 Aug 2019 13:56:29 +0000 (13:56 +0000)]
reland [gtest] Fix printing of StringRef and SmallString in assert messages.

Renames GTEST_NO_LLVM_RAW_OSTREAM -> GTEST_NO_LLVM_SUPPORT and guards
the new features behind it.

This reverts commit a063bcf3ef5a879adbe9639a3c187d876eee0e66.

llvm-svn: 369527

4 years agoAdd 9.0 release bug to merge request script
Simon Atanasyan [Wed, 21 Aug 2019 13:42:10 +0000 (13:42 +0000)]
Add 9.0 release bug to merge request script

llvm-svn: 369526

4 years agoRevert "[gtest] Fix printing of StringRef and SmallString in assert messages."
Sam McCall [Wed, 21 Aug 2019 13:31:44 +0000 (13:31 +0000)]
Revert "[gtest] Fix printing of StringRef and SmallString in assert messages."

This reverts commit 4becb2ab4e9f52ce98272d1f5930d6942af5172b.

llvm-svn: 369525

4 years ago[lldb] Add tests for 'settings remove' and fix error message typos
Raphael Isemann [Wed, 21 Aug 2019 13:24:21 +0000 (13:24 +0000)]
[lldb] Add tests for 'settings remove' and fix error message typos

llvm-svn: 369524

4 years agoRecommit "Minidump/Windows: Fix module lookup""
Pavel Labath [Wed, 21 Aug 2019 13:20:25 +0000 (13:20 +0000)]
Recommit "Minidump/Windows: Fix module lookup""

This recommits r368416, which was reverted in r368838 because of test
failures under ASAN. These have been dealt with by llvm r369370.

The original commit message was:
When opening a minidump, we were failing to find an executable because
we were searching for i386-unknown-windows, whereas we recognize the
pe/coff files as i386-pc-windows. This fixes the triple computation code
in the minidump parser to match pe/coff, and adds an appropriate test.

NB: I'm not sure setting the vendor to "pc" is really correct for
arm(64) windows, but right now that seems to match what we do in the
pe/coff case (ArchSpec.cpp:935).

Reviewers: clayborg, amccarth

Subscribers: javed.absar, kristof.beyls, rnk, markmentovai, lldb-commits

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

llvm-svn: 369523

4 years agoFix two compiler warnings
Pavel Labath [Wed, 21 Aug 2019 13:11:30 +0000 (13:11 +0000)]
Fix two compiler warnings

llvm-svn: 369522

4 years ago[lldb] Add tests for setting completions and enable 'settings remove' completion
Raphael Isemann [Wed, 21 Aug 2019 12:57:06 +0000 (12:57 +0000)]
[lldb] Add tests for setting completions and enable 'settings remove' completion

llvm-svn: 369521

4 years ago[DAGCombiner] Various nits. NFC
Amaury Sechet [Wed, 21 Aug 2019 12:01:37 +0000 (12:01 +0000)]
[DAGCombiner] Various nits. NFC

llvm-svn: 369520

4 years ago[InstCombine] narrow icmp with extended operands of different widths
Sanjay Patel [Wed, 21 Aug 2019 11:56:08 +0000 (11:56 +0000)]
[InstCombine] narrow icmp with extended operands of different widths

An intermediate extend is used to widen the narrow operand to the width of
the other (wider) operand. At that point, we have the same logic as the
existing transform that was restricted to folds of equal width zext/sext.

This mostly solves PR42700:
https://bugs.llvm.org/show_bug.cgi?id=42700

llvm-svn: 369519