Commit Graph

326851 Commits

Author SHA1 Message Date
Sanjay Patel 2bfb955c51 [InstCombine] rename variable for readability; NFC
There's more that can be done here, but "OpI"
doesn't convey that we casted to BinaryOperator.

llvm-svn: 371682
2019-09-11 22:31:34 +00:00
David Blaikie ffe5466c79 Add some missing changes to GSYM that was addressing a gcc compilation error due to a type and variable with the same name
llvm-svn: 371681
2019-09-11 22:24:45 +00:00
Vitaly Buka 92002bd75b Fix mac build
llvm-svn: 371680
2019-09-11 22:19:18 +00:00
David Blaikie d79cc14822 PR43278: Temporarily disable llvm-reduce tests due to exhausting temp files
llvm-svn: 371679
2019-09-11 22:15:16 +00:00
Reid Kleckner ff45955fc8 [X86] Fix latent bugs in 32-bit CMPXCHG8B inserter
I found three issues:
1. the loop over E[ABCD]X copies run over BB start
2. the direct address of cmpxchg8b could be a frame index
3. the displacement of cmpxchg8b could be a global instead of an
   immediate

These were all introduced together in r287875, and should be fixed with
this change.

Issue reported by Zachary Turner.

llvm-svn: 371678
2019-09-11 21:56:17 +00:00
Evandro Menezes ed5f452645 [ConstantFolding] Refactor math functions to use LLVM ones (NFC)
When possible, replace calls to library routines on the host with equivalent
ones in LLVM.

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

llvm-svn: 371677
2019-09-11 21:46:57 +00:00
Cyndy Ishida bc40836a43 Revert [llvm-nm] Add tapi file support
This reverts r371576 (git commit f88f46358d)

llvm-svn: 371676
2019-09-11 21:35:28 +00:00
Vitaly Buka 48eb4a27d1 Update compiler-rt cpplint.py
adb3500107

llvm-svn: 371675
2019-09-11 21:33:06 +00:00
Cyndy Ishida aeeb9e3895 Revert [Object][TextAPI] NFC, fix tapi lit tests
This reverts r371577 (git commit b2b0ccab2f)

llvm-svn: 371674
2019-09-11 21:32:55 +00:00
Craig Topper 5278b0a04e [X86] Add test case for v16i64->v16i32 truncate on min-legal-vector-width=256.
I think this case would crash before I added back the -x86-experimental-vector-widening command line option. Adding this test case to prevent breaking it again when we remove the option.

llvm-svn: 371673
2019-09-11 21:30:42 +00:00
Craig Topper 08474ca091 [X86] Move x86_64 fp128 conversion to libcalls from type legalization to DAG legalization
fp128 is considered a legal type for a register, but has almost no legal operations so everything needs to be converted to a libcall. Previously this was implemented by tricking type legalization into softening the operations with various checks for "is legal in hardware register" to change the behavior to still use f128 as the resulting type instead of converting to i128.

This patch abandons this approach and instead moves the libcall conversions to LegalizeDAG. This is the approach taken by AArch64 where they also have a legal fp128 type, but no legal operations. I think this is more in spirit with how SelectionDAG's phases are supposed to work.

I had to make some hacks for STRICT_FP_ROUND because some of the strict FP handling checks if ISD::FP_ROUND is Legal for a given result type, but I had to make ISD::FP_ROUND Custom to allow making a libcall when the input is f128. For all other types the Custom handler just returns the original node. These hacks are incomplete and don't work for a strict truncate from f128, but I don't think it worked before either since LegalizeFloatTypes doesn't know about strict ops yet. I've also raised PR43209 against AArch64 which currently crashes on a strict ftrunc from f64->f32 because of FP_ROUND being marked Custom for the same reason there.

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

llvm-svn: 371672
2019-09-11 21:30:09 +00:00
Austin Kerbow 666af6714c AMDGPU: Move m0 initializations earlier
Summary:
After hoisting and merging m0 initializations schedule them as early as
possible in the MBB. This helps the scheduler avoid hazards in some
cases.

Reviewers: rampitec, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 371671
2019-09-11 21:28:41 +00:00
Nico Weber 9769a5e7d5 gn build: Merge r371661
llvm-svn: 371670
2019-09-11 21:24:15 +00:00
Nico Weber efbd7371a0 gn build: Merge r371657
llvm-svn: 371669
2019-09-11 21:24:11 +00:00
Vedant Kumar 21d417dc18 [DWARF] Evaluate DW_OP_entry_value
Add support for evaluating DW_OP_entry_value. This involves parsing
DW_TAG_call_site_parameter and wiring the information through to the expression
evaluator.

rdar://54496008

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

llvm-svn: 371668
2019-09-11 21:23:45 +00:00
Vedant Kumar bb58118525 [Status] Add a LLDB_ERRORF macro for error reporting (similar to LLDB_LOGF)
llvm-svn: 371667
2019-09-11 21:23:42 +00:00
Vedant Kumar 0b91333d59 [DWARF] Emit call site parameter info when tuning for lldb
Emit debug entry values using standard DWARF5 opcodes when the debugger
tuning is set to lldb.

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

llvm-svn: 371666
2019-09-11 21:23:39 +00:00
Volodymyr Sapsai fdb83b5055 Fix up a test updated in r371655 - require case-insensitive file system.
On case-sensitive file systems include with wrong case is not found instead of
showing a warning.

llvm-svn: 371665
2019-09-11 21:19:27 +00:00
Alex Lorenz 428d92832c [clang-scan-deps] cast Result to ErrorOr<unique_ptr<vfs::File>> explicitly to avoid s390x-linux buildbot failure
llvm-svn: 371664
2019-09-11 21:00:13 +00:00
Reid Kleckner a685f5161d Start porting ivfsoverlay tests to Windows
Part of PR43272, the changes are:

1. Use @ as the sed pattern delimiter instead of : so that the drive
letter in lit substitutions isn't an issue.

2. Use the %/t and %/S substitutions to get paths with forward slashes
to work around string quoting issues in the yaml file.

3. Replace REQUIRES:shell with XFAIL:windows. These tests should pass on
Windows, but do not for reasons that are not yet understood. We would
like to know if they pass unexpectedly.

I was able to remove the XFAILs from two tests, since they already pass
with my sed fix:
  clang/test/VFS/module_missing_vfs.m
  clang/test/VFS/test_nonmodular.c

Reviewers: amccarth

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

llvm-svn: 371663
2019-09-11 20:56:25 +00:00
Chris Bieneman 393b4eac49 All Errors must be checked
Summary: If an error is ever returned from any of the functions called here, the error must be joined with the Result Error before being returned otherwise the Result Error will assert on destruction.

Reviewers: lhames

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 371662
2019-09-11 20:54:38 +00:00
Artem Dergachev f0bb45fac3 [analyzer] NFC: Move PathDiagnostic classes to libAnalysis.
At this point the PathDiagnostic, PathDiagnosticLocation, PathDiagnosticPiece
structures no longer rely on anything specific to Static Analyzer, so we can
move them out of it for everybody to use.

PathDiagnosticConsumers are still to be handed off.

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

llvm-svn: 371661
2019-09-11 20:54:27 +00:00
Artem Dergachev 2bce23a4f8 [analyzer] NFC: Move resetDiagnosticLocationToMainFile() to BugReporter.
This method of PathDiagnostic is a part of Static Analyzer's particular
path diagnostic construction scheme. As such, it doesn't belong to
the PathDiagnostic class, but to the Analyzer.

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

llvm-svn: 371660
2019-09-11 20:54:24 +00:00
Artem Dergachev 6b85f8e99b [analyzer] NFC: Move getStmt() and createEndOfPath() out of PathDiagnostic.
These static functions deal with ExplodedNodes which is something we don't want
the PathDiagnostic interface to know anything about, as it's planned to be
moved out of libStaticAnalyzerCore.

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

llvm-svn: 371659
2019-09-11 20:54:21 +00:00
Artem Dergachev 8535b8ecf2 [analyzer] NFC: Re-implement stack hints as a side map in BugReport.
That's one of the few random entities in the PathDiagnostic interface that
are specific to the Static Analyzer. By moving them out we could let
everybody use path diagnostics without linking against Static Analyzer.

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

llvm-svn: 371658
2019-09-11 20:54:17 +00:00
Greg Clayton 7fcc2c2b5a Add a LineTable class to GSYM and test it.
This patch adds the ability to create a gsym::LineTable object, populate it, encode and decode it and test all functionality.

The full format of the LineTable encoding is specified in the header file LineTable.h.

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

llvm-svn: 371657
2019-09-11 20:51:03 +00:00
Alex Lorenz ca6e60971e [clang-scan-deps] add skip excluded conditional preprocessor block preprocessing optimization
This commit adds an optimization to clang-scan-deps and clang's preprocessor that skips excluded preprocessor
blocks by bumping the lexer pointer, and not lexing the tokens until reaching appropriate #else/#endif directive.
The skip positions and lexer offsets are computed when the file is minimized, directly from the minimized tokens.

On an 18-core iMacPro with macOS Catalina Beta I got 10-15% speed-up from this optimization when running clang-scan-deps on
the compilation database for a recent LLVM and Clang (3511 files).

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

llvm-svn: 371656
2019-09-11 20:40:31 +00:00
Volodymyr Sapsai 2f84361684 Fix -Wnonportable-include-path suppression for header maps with absolute paths.
In `DirectoryLookup::LookupFile` parameter `HasBeenMapped` doesn't cover
the case when clang finds a file through a header map but doesn't remap
the lookup filename because the target path is an absolute path. As a
result, -Wnonportable-include-path suppression for header maps
introduced in r301592 wasn't triggered.

Change parameter `HasBeenMapped` to `IsInHeaderMap` and use parameter
`MappedName` to track the filename remapping. This way we can handle
both relative and absolute paths in header maps, and account for their
specific properties, like filename remapping being a property preserved
across lookups in multiple directories.

rdar://problem/39516483

Reviewers: dexonsmith, bruno

Reviewed By: dexonsmith

Subscribers: jkorous, cfe-commits, ributzka

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

llvm-svn: 371655
2019-09-11 20:39:04 +00:00
Alex Langford 1b385a1802 [Plugins/Process] Remove direct use of ClangASTContext from InferiorCallPOSIX
Summary:
InferiorCallPOSIX directly grabs a ClangASTContext from the Target it
has and does no error checking. I don't think these functions have a
reason to know about clang specifically. Additionally, using
`GetScratchTypeSystemForLanguage` forces us to do error checking since
it returns an Expected.

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

llvm-svn: 371654
2019-09-11 20:36:28 +00:00
Reid Kleckner 6d5f0029fc [llvm-reduce] Fix a bug, improve error handling when running test
llvm::sys::ExecuteAndWait can report errors, so let's make use of that.

Second, while iterating uses of functions to remove, a call can appear
multiple times. Use a SetVector so we don't attempt to erase such a call
twice.

llvm-svn: 371653
2019-09-11 20:29:22 +00:00
Adrian Prantl 09f320ad34 Update link to the DWARF spec.
llvm-svn: 371650
2019-09-11 19:57:29 +00:00
Michael Liao 7957d4c015 [AMDGPU] Fix crash in phi-elimination hook.
Summary: - Pre-check in case there's just a single PHI insn.

Reviewers: alex-t, rampitec, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, hiraditya, llvm-commits, yaxunl

Tags: #llvm

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

llvm-svn: 371649
2019-09-11 19:55:20 +00:00
Adrian Prantl 4a5dd4a881 Update documentation.
llvm-svn: 371648
2019-09-11 19:49:38 +00:00
Max Moroz aff633f68d [libFuzzer] Remove hardcoded number of new features in merge_two_step.test.
Summary:
The number of features can be different on different platforms.

This should fixed broken builders, e.g.
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/7946

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: kristof.beyls, delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 371647
2019-09-11 19:43:03 +00:00
David Bolvansky 82d9e0e122 [NFC] Added triple to test file to avoid arm buildbots failures
llvm-svn: 371646
2019-09-11 18:55:56 +00:00
Matt Arsenault f5c3bb60b3 Fix test failures after r371640
r371640 evidently fixed bug 39481

llvm-svn: 371645
2019-09-11 18:55:20 +00:00
Eli Friedman 403e08d4cf [ConstantHoisting] Fix non-determinism.
Differential Revision: https://reviews.llvm.org/D66114

llvm-svn: 371644
2019-09-11 18:55:00 +00:00
Pirama Arumuga Nainar 8b46544641 [IRMover] Don't map globals if their types are the same
Summary:
During IR Linking, if the types of two globals in destination and source
modules are the same, it can only be because the global in the
destination module is originally from the source module and got added to
the destination module from a shared metadata.

We shouldn't map this type to itself in case the type's components get
remapped to a new type from the destination (for instance, during the
loop over SrcM->getIdentifiedStructTypes() further below in
IRLinker::computeTypeMapping()).

Fixes PR40312.

Reviewers: tejohnson, pcc, srhines

Subscribers: mehdi_amini, hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 371643
2019-09-11 18:35:49 +00:00
Reid Kleckner abcc2a879c [MS] Consder constexpr globals to be inline, as in C++17
Summary:
Microsoft seems to do this regardless of the language mode, so we must
also do it in order to be ABI compatible.

Fixes PR36125

Reviewers: thakis

Subscribers: cfe-commits

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

llvm-svn: 371642
2019-09-11 18:09:10 +00:00
Matt Arsenault 81196a595c LiveIntervals: Split live intervals on multiple dead defs
If there are multiple dead defs of the same virtual register, these
are required to be split into multiple virtual registers with separate
live intervals to avoid a verifier error.

llvm-svn: 371640
2019-09-11 17:59:21 +00:00
Zoe Carver b51d5605b1 Consolidate swap, swap_ranges, and iter_swap in <type_traits>.
NFC. Thanks to @Quuxplusone (Arthur O'Dwyer) for this change.

llvm-svn: 371639
2019-09-11 17:39:24 +00:00
Louis Dionne 340b725202 [libc++] Add a CMake cache for Apple-specific configuration options
llvm-svn: 371638
2019-09-11 16:57:19 +00:00
Sergey Dmitriev e39b5710c9 [Clang][Bundler] Replace std::vector by SmallVector [NFC]
Differential Revision: https://reviews.llvm.org/D67413

llvm-svn: 371637
2019-09-11 16:28:47 +00:00
Nico Weber 85eff49d74 gn build: Merge r371635
llvm-svn: 371636
2019-09-11 16:26:59 +00:00
Petr Hosek 7bdad08429 Reland "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM"
This patch contains the basic functionality for reporting potentially
incorrect usage of __builtin_expect() by comparing the developer's
annotation against a collected PGO profile. A more detailed proposal and
discussion appears on the CFE-dev mailing list
(http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a
prototype of the initial frontend changes appear here in D65300

We revised the work in D65300 by moving the misexpect check into the
LLVM backend, and adding support for IR and sampling based profiles, in
addition to frontend instrumentation.

We add new misexpect metadata tags to those instructions directly
influenced by the llvm.expect intrinsic (branch, switch, and select)
when lowering the intrinsics. The misexpect metadata contains
information about the expected target of the intrinsic so that we can
check against the correct PGO counter when emitting diagnostics, and the
compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight.
We use these branch weight values to determine when to emit the
diagnostic to the user.

A future patch should address the comment at the top of
LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and
UnlikelyBranchWeight values into a shared space that can be accessed
outside of the LowerExpectIntrinsic pass. Once that is done, the
misexpect metadata can be updated to be smaller.

In the long term, it is possible to reconstruct portions of the
misexpect metadata from the existing profile data. However, we have
avoided this to keep the code simple, and because some kind of metadata
tag will be required to identify which branch/switch/select instructions
are influenced by the use of llvm.expect

Patch By: paulkirth
Differential Revision: https://reviews.llvm.org/D66324

llvm-svn: 371635
2019-09-11 16:19:50 +00:00
Florian Hahn 51de22c8ee Revert [InstCombine] Use SimplifyFMulInst to simplify multiply in fma.
This introduces additional rounding error in some cases. See D67434.

This reverts r371518 (git commit 18a1f0818b)

llvm-svn: 371634
2019-09-11 16:17:03 +00:00
Sergey Dmitriev 0c1257f517 [Clang][Bundler] Fix for a potential memory leak [NFC]
Bundler leaks memory if it is called with -type=o but given input isn't an object file (though it has to have a known binary type like IR, archive, etc...). Memory leak is happening when binary object returned by the createBinary(...) call cannot be casted to an ObjectFile type. In this case returned BinaryOrErr object releases ownership of the binary, but no one is taking it (see line 626).

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

llvm-svn: 371633
2019-09-11 16:03:21 +00:00
Alexey Bataev 1be634044d [OPENMP] Update the diagnosis message for canonical loop form, by Chi
Chun Chen.

The previous patch (https://reviews.llvm.org/D54441) support the
relational-op != very well for openmp canonical loop form, however,
it didn't update the diagnosis message. So this patch is simply
update the diagnosis message by adding !=, update the test
related to it, and update the section number for canonical loop
form for OpenMP 5.0 in comment.

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

llvm-svn: 371631
2019-09-11 15:44:06 +00:00
Roman Lebedev 00c1ee48e4 [InstSimplify] Pass SimplifyQuery into simplifyUnsignedRangeCheck() and use it for isKnownNonZero()
This was actually the original intention in D67332,
but i messed up and forgot about it.
This patch was originally part of D67411, but precommitting this.

llvm-svn: 371630
2019-09-11 15:32:46 +00:00
Roman Lebedev 8aeb7bb013 [NFC][InstSimplify] Add extra test for D67411 with @llvm.assume
llvm-svn: 371629
2019-09-11 15:28:03 +00:00