Tim Renouf [Thu, 23 Aug 2018 17:28:33 +0000 (17:28 +0000)]
[RegisterCoalescer] Fix for assert in removePartialRedundancy
Summary:
I got "Use not jointly dominated by defs" when removePartialRedundancy
attempted to prune then re-extend a subrange whose only liveness was a
dead def at the copy being removed.
V2: Removed junk from test. Improved comment.
V3: Addressed minor review comments.
Subscribers: MatzeB, qcolombet, nhaehnle, llvm-commits
Differential Revision: https://reviews.llvm.org/D50914
Change-Id: I6f894e9f517f71e921e0c6d81d28c5f344db8dad
llvm-svn: 340549
Adrian Prantl [Thu, 23 Aug 2018 17:19:08 +0000 (17:19 +0000)]
lldbtest.py: Work around macOS SIP when testing ASANified builds.
llvm-svn: 340548
Shuai Wang [Thu, 23 Aug 2018 17:16:06 +0000 (17:16 +0000)]
[ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50617
llvm-svn: 340547
Craig Topper [Thu, 23 Aug 2018 17:15:02 +0000 (17:15 +0000)]
[ValueTracking] Fix an assert from r340480.
We need to allow ConstantExpr Selects in addition to SelectInst.
I'll try to put together a test case, but I wanted to fix the issues being reported.
Fixes PR38677
llvm-svn: 340546
Andrea Di Biagio [Thu, 23 Aug 2018 17:09:08 +0000 (17:09 +0000)]
[llvm-mca] Fix wrong call to setCustomStrategy().
Thanks to @waltl for reporting this issue.
I have also added an assert to check for invalid null strategy objects, and I
have reworded a couple of code comments in Scheduler.h
llvm-svn: 340545
Erik Pilkington [Thu, 23 Aug 2018 17:08:02 +0000 (17:08 +0000)]
Comment out #define __cpp_lib_node_extract, we only support half of that functionality
Differential revision: https://reviews.llvm.org/D51172
llvm-svn: 340544
Adrian Prantl [Thu, 23 Aug 2018 17:02:39 +0000 (17:02 +0000)]
Add libc++ data formatter for std::function
- Added LibcxxFunctionSummaryProvider
- Removed LibcxxFunctionFrontEnd
- Modified data formatter tests to test new summary functionality
Patch by Shafik Yaghmour!
Differential Revision: https://reviews.llvm.org/D50864
llvm-svn: 340543
Alexandre Eichenberger [Thu, 23 Aug 2018 16:22:42 +0000 (16:22 +0000)]
[OpenMP][libomptarget] Bringing up to spec with respect to OMP_TARGET_OFFLOAD env var
Summary:
Right now, only the OMP_TARGET_OFFLOAD=DISABLED was implemented. Added support for the other MANDATORY and DEFAULT values.
Reviewers: gtbercea, ABataev, grokos, caomhin, Hahnfeld
Reviewed By: Hahnfeld
Subscribers: protze.joachim, gtbercea, AlexEichenberger, RaviNarayanaswamy, Hahnfeld, guansong, openmp-commits
Differential Revision: https://reviews.llvm.org/D50522
llvm-svn: 340542
Raphael Isemann [Thu, 23 Aug 2018 16:06:30 +0000 (16:06 +0000)]
Re-land [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Lands r340468 again, but this time we mark the test as unsupported on Windows
because it seems that try/catch crashes CodeGen at the moment.
llvm-svn: 340541
Sanjay Patel [Thu, 23 Aug 2018 15:58:07 +0000 (15:58 +0000)]
[x86] add debug option for and-immediate shrinking
The commit that added this functionality:
rL322957
may be causing/exposing a miscompile in PR38648:
https://bugs.llvm.org/show_bug.cgi?id=38648
so allow enabling/disabling to make debugging easier.
llvm-svn: 340540
Kadir Cetinkaya [Thu, 23 Aug 2018 15:55:27 +0000 (15:55 +0000)]
[clangd] Check for include overlapping looks for only the line now.
Summary:
Currently we match an include only if we are inside filename, with this patch we
will match whenever we are on the starting line of the include.
Reviewers: ilya-biryukov, hokein, ioeric
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D51163
llvm-svn: 340539
David Bolvansky [Thu, 23 Aug 2018 15:22:15 +0000 (15:22 +0000)]
[InstCombine] Fold Select with binary op - FP opcodes
Summary:
Follow up for https://reviews.llvm.org/rL339520 and https://reviews.llvm.org/rL338300
Alive:
```
%A = fcmp oeq float %x, 0.0
%B = fadd nsz float %x, %z
%C = select i1 %A, float %B, float %y
=>
%C = select i1 %A, float %z, float %y
----------
%A = fcmp oeq float %x, 0.0
%B = fadd nsz float %x, %z
%C = select %A, float %B, float %y
=>
%C = select %A, float %z, float %y
Done: 1
Optimization is correct
%A = fcmp une float %x, -0.0
%B = fadd nsz float %x, %z
%C = select i1 %A, float %y, float %B
=>
%C = select i1 %A, float %y, float %z
----------
%A = fcmp une float %x, -0.0
%B = fadd nsz float %x, %z
%C = select %A, float %y, float %B
=>
%C = select %A, float %y, float %z
Done: 1
Optimization is correct
```
Reviewers: spatel, lebedev.ri
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50714
llvm-svn: 340538
Brian Homerding [Thu, 23 Aug 2018 15:05:22 +0000 (15:05 +0000)]
[FunctionAttrs] Infer WriteOnly Function Attribute
These changes expand the FunctionAttr logic in order to mark functions as
WriteOnly when appropriate. This is done through an additional bool variable
and extended logic.
Reviewers: hfinkel, jdoerfert
Differential Revision: https://reviews.llvm.org/D48387
llvm-svn: 340537
Andrea Di Biagio [Thu, 23 Aug 2018 15:04:52 +0000 (15:04 +0000)]
[llvm-mca] Allow the definition of custom strategies for selecting processor resource units.
With this patch, users can now customize the pipeline selection strategy for
scheduler resources. The resource selection strategy can be defined at processor
resource granularity. This enables the definition of different strategies for
different hardware schedulers.
To override the strategy associated with a processor resource, users can call
method ResourceManager::setCustomStrategy(), and pass a 'ResourceStrategy'
object in input.
Class ResourceStrategy is an abstract class which declares virtual method
`ResourceStrategy::select()`. Method select() is meant to implement the actual
strategy; it is responsible for picking the next best resource from a set of
available pipeline resources. Custom strategy must simply override that method.
By default, processor resources are associated with instances of
'DefaultResourceStrategy'. A 'DefaultResourceStrategy' internally implements a
simple round-robin selector. For more details, please refer to the code comments
in Scheduler.h.
llvm-svn: 340536
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:35 +0000 (13:21 +0000)]
[analyzer] added cache for SMT queries in the SMTConstraintManager
Summary:
This patch implements a new cache for the result of SMT queries; with this patch the regression tests are 25% faster.
It's implemented as a `llvm::DenseMap` where the key is the hash of the set of the constraints in a state.
There is still one method that does not use the cache, `getSymVal`, because it needs to get a symbol interpretation from the SMT, which is not cached yet.
Reviewers: NoQ, george.karpenkov
Reviewed By: george.karpenkov
Subscribers: xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50773
llvm-svn: 340535
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:31 +0000 (13:21 +0000)]
[analyzer] Moved all CSA code from the SMT API to a new header, `SMTConv.h`. NFC.
Summary:
With this patch, the SMT backend is almost completely detached from the CSA.
Unfortunate consequence is that we missed the `ConditionTruthVal` from the CSA and had to use `Optional<bool>`.
The Z3 solver implementation is still in the same file as the `Z3ConstraintManager`, in `lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp` though, but except for that, the SMT API can be moved to anywhere in the codebase.
Reviewers: NoQ, george.karpenkov
Reviewed By: george.karpenkov
Subscribers: xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50772
llvm-svn: 340534
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:00 +0000 (13:21 +0000)]
[analyzer] Templatefy SMTConstraintManager so more generic code can be moved from solver specific implementations. NFC.
Summary:
By making SMTConstraintManager a template and passing the SMT constraint type and expr, we can further move code from the Z3ConstraintManager class to the generic SMT constraint Manager.
Now, each SMT specific constraint manager only needs to implement the method `bool canReasonAbout(SVal X) const`.
Reviewers: NoQ, george.karpenkov
Reviewed By: george.karpenkov
Subscribers: mgorny, xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50770
llvm-svn: 340533
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:20:18 +0000 (13:20 +0000)]
[analyzer] Delete SMTContext. NFC.
Summary: There is no reason to have a base class for a context anymore as each SMT object carries a reference to the specific solver context.
Reviewers: NoQ, george.karpenkov, hiraditya
Reviewed By: hiraditya
Subscribers: hiraditya, xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50768
llvm-svn: 340532
Mikael Holmen [Thu, 23 Aug 2018 13:18:27 +0000 (13:18 +0000)]
Change dyn_cast<CXXMethodDecl>(FD) to isa<CXXMethodDecl>(FD) [NFC]
The result of the dyn_cast wasn't used to we can just check isa.
llvm-svn: 340531
Kadir Cetinkaya [Thu, 23 Aug 2018 13:14:50 +0000 (13:14 +0000)]
[clangd] Suggest code-completions for overriding base class virtual methods.
Summary:
Whenever a code-completion is triggered within a class/struct/union looks at
base classes and figures out non-overriden virtual functions. Than suggests
completions for those.
Reviewers: ilya-biryukov, hokein, ioeric
Reviewed By: hokein
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50898
llvm-svn: 340530
John Brawn [Thu, 23 Aug 2018 12:48:17 +0000 (12:48 +0000)]
[GVN] Invalidate cached info for phis when setting dead predecessors to undef
When GVN sets the incoming value for a phi to undef because the incoming block
is unreachable it needs to also invalidate the cached info for that phi in
MemoryDependenceAnalysis, otherwise later queries will return stale information.
Differential Revision: https://reviews.llvm.org/D51099
llvm-svn: 340529
Victor Leschuk [Thu, 23 Aug 2018 12:43:33 +0000 (12:43 +0000)]
[DWARF] Unify warning callbacks. NFC.
Both DWARFDebugLine and DWARFDebugAddr used the same callback mechanism
for handling recoverable errors. They both implemented similar warn() function
to be used as such callbacks.
In this revision we get rid of code duplication and move this warn() function
to DWARFContext as DWARFContext::dumpWarning().
Reviewers: lhames, jhenderson, aprantl, probinson, dblaikie, JDevlieghere
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D51033
llvm-svn: 340528
Kadir Cetinkaya [Thu, 23 Aug 2018 12:19:39 +0000 (12:19 +0000)]
[clangd] Move function argument snippet disable mechanism from LSP rendering to internal clangd reprensentation.
Summary:
We were handling the EnableFunctionArgSnippets only when we are producing LSP
response. Move that code into CompletionItem generation so that internal clients
can benefit from that as well.
Reviewers: ilya-biryukov, ioeric, hokein
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D51102
llvm-svn: 340527
Florian Hahn [Thu, 23 Aug 2018 11:17:59 +0000 (11:17 +0000)]
[SCCP] Remove unused variable added in r340525.
llvm-svn: 340526
Florian Hahn [Thu, 23 Aug 2018 11:04:00 +0000 (11:04 +0000)]
Recommit r333268: [IPSCCP] Use PredicateInfo to propagate facts from cmp instructions.
This version of the patch fixes cleaning up ssa_copy intrinsics, so it does not
crash for instructions in blocks that have been marked unreachable.
This patch updates IPSCCP to use PredicateInfo to propagate
facts to true branches predicated by EQ and to false branches
predicated by NE.
As a follow up, we should be able to extend it to also propagate additional
facts about nonnull.
Reviewers: davide, mssimpso, dberlin, efriedma
Reviewed By: davide, dberlin
Differential Revision: https://reviews.llvm.org/D45330
llvm-svn: 340525
Mikael Holmen [Thu, 23 Aug 2018 10:59:49 +0000 (10:59 +0000)]
Removed unused variable [NFC]
The compiler warned:
../tools/clang/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp:329:19: error: unused variable 'MD' [-Werror,-Wunused-variable]
if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
^
1 error generated.
llvm-svn: 340524
Ilya Biryukov [Thu, 23 Aug 2018 10:25:07 +0000 (10:25 +0000)]
[clangd] Increase the timeouts in TUScheduler tests to 10 seconds.
Some of them timeout on our buildbots in certain configurations.
The timeouts are there to avoid hanging indefinitely on deadlocks, so
the exact number we put there does not matter.
llvm-svn: 340523
Alexander Richardson [Thu, 23 Aug 2018 10:21:36 +0000 (10:21 +0000)]
Update avr attributes test for output change in r340519
After this commit there is an addrspace(1) before the attribute #. Since
these tests are only checking the value of the attribute add a {{.*}} to
make the test resilient to future output changes.
llvm-svn: 340522
Ivan Donchevskii [Thu, 23 Aug 2018 09:48:11 +0000 (09:48 +0000)]
[libclang] Fix cursors for arguments of Subscript and Call operators
The DeclRefExpr of CXXOperatorCallExpr refering to the custom operator
is visited before the arguments to the operator call. For the Call and
Subscript operator the range of this DeclRefExpr includes the whole call
expression, so that all tokens in that range were mapped to the operator
function, even the tokens of the arguments.
Fix this by ensuring that this particular DeclRefExpr is visited last.
Fixes PR25775.
Fix by Nikolai Kosjar.
Differential Revision: https://reviews.llvm.org/D40481
llvm-svn: 340521
Sven van Haastregt [Thu, 23 Aug 2018 09:42:58 +0000 (09:42 +0000)]
[Support] Fix some Wundef warnings
For the _WIN32 macro, it is the definedness that matters rather than
the value. Most uses of the macro already rely on the definedness.
This commit fixes the few remaining uses that relied on the value.
Differential Revision: https://reviews.llvm.org/D51105
llvm-svn: 340520
Alexander Richardson [Thu, 23 Aug 2018 09:25:17 +0000 (09:25 +0000)]
Allow creating llvm::Function in non-zero address spaces
Most users won't have to worry about this as all of the
'getOrInsertFunction' functions on Module will default to the program
address space.
An overload has been added to Function::Create to abstract away the
details for most callers.
This is based on https://reviews.llvm.org/D37054 but without the changes to
make passing a Module to Function::Create() mandatory. I have also added
some more tests and fixed the LLParser to accept call instructions for
types in the program address space.
Reviewed By: bjope
Differential Revision: https://reviews.llvm.org/D47541
llvm-svn: 340519
Nicolai Haehnle [Thu, 23 Aug 2018 08:02:02 +0000 (08:02 +0000)]
TableGen/SearchableTables: Cast enums to unsigned in generated code
Summary:
This should fix signedness warnings when compiling with MSVC.
Change-Id: I4664cce0ba91e9b42d21a86fd4a7e82f2320c451
Reviewers: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51097
llvm-svn: 340518
Vitaly Buka [Thu, 23 Aug 2018 07:12:05 +0000 (07:12 +0000)]
Fix comparison of char and int64 in TestWriteFixNegativeInt
It was broken on clang-ppc64le-linux-lnt bot.
llvm-svn: 340517
Peter Collingbourne [Thu, 23 Aug 2018 06:57:49 +0000 (06:57 +0000)]
Initialize the address-significance table fragment's layout order.
This fragment is created after layout, which is where the order
normally gets set.
Should fix a test failure under msan.
llvm-svn: 340516
Chandler Carruth [Thu, 23 Aug 2018 06:06:38 +0000 (06:06 +0000)]
[x86/retpoline] Split the LLVM concept of retpolines into separate
subtarget features for indirect calls and indirect branches.
This is in preparation for enabling *only* the call retpolines when
using speculative load hardening.
I've continued to use subtarget features for now as they continue to
seem the best fit given the lack of other retpoline like constructs so
far.
The LLVM side is pretty simple. I'd like to eventually get rid of the
old feature, but not sure what backwards compatibility issues that will
cause.
This does remove the "implies" from requesting an external thunk. This
always seemed somewhat questionable and is now clearly not desirable --
you specify a thunk the same way no matter which set of things are
getting retpolines.
I really want to keep this nicely isolated from end users and just an
LLVM implementation detail, so I've moved the `-mretpoline` flag in
Clang to no longer rely on a specific subtarget feature by that name and
instead to be directly handled. In some ways this is simpler, but in
order to preserve existing behavior I've had to add some fallback code
so that users who relied on merely passing -mretpoline-external-thunk
continue to get the same behavior. We should eventually remove this
I suspect (we have never tested that it works!) but I've not done that
in this patch.
Differential Revision: https://reviews.llvm.org/D51150
llvm-svn: 340515
Peter Collingbourne [Thu, 23 Aug 2018 05:39:36 +0000 (05:39 +0000)]
MC: Don't align COFF section contents.
Aligning section contents is not required, but only
recommended, by the specification. Microsoft's documentation says
(https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#section-table-section-headers):
"For object files, the value should be aligned on a 4-byte boundary
for best performance."
However, according to my measurements, aligning section contents has
a neutral to negative effect on performance.
I measured the median run time of 100 links of Chromium's
base_unittests on Linux with lld-link and on Windows with link.exe with
both aligned and unaligned sections. On Linux I didn't see a measurable
performance difference, and on Windows the link was slightly faster
with unaligned sections (presumably because on Windows the bottleneck
is I/O).
Also, the sections created by cl.exe are unaligned, so we should expect
tools to broadly accept unaligned sections.
Differential Revision: https://reviews.llvm.org/D51149
llvm-svn: 340514
Chandler Carruth [Thu, 23 Aug 2018 05:39:02 +0000 (05:39 +0000)]
Revert r340508: [DebugInfo] Fix bug in LiveDebugVariables.
This patch's test case relies on debug prints which isn't generally an
OK way to test stuff in LLVM and fails whenever asserts aren't enabled.
I've send a heads-up to the commit and detailed comments on the review.
llvm-svn: 340513
David Bolvansky [Thu, 23 Aug 2018 05:18:23 +0000 (05:18 +0000)]
[LibCalls] Added returned attribute to libcalls
Reviewers: efriedma
Reviewed By: efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51092
llvm-svn: 340512
JF Bastien [Thu, 23 Aug 2018 04:09:49 +0000 (04:09 +0000)]
Missing quote in previous commit
The test was failing because I missed a quote.
llvm-svn: 340511
JF Bastien [Thu, 23 Aug 2018 03:55:24 +0000 (03:55 +0000)]
Improve incompatible triple error
When complaining that the triple is incompatible with all targets, print out the triple not just a generic error about triples not matching.
llvm-svn: 340510
JF Bastien [Thu, 23 Aug 2018 03:40:31 +0000 (03:40 +0000)]
Improve incompatible triple error
When complaining that the triple is incompatible with all targets, print out the triple not just a generic error about triples not matching.
llvm-svn: 340509
Hsiangkai Wang [Thu, 23 Aug 2018 03:28:24 +0000 (03:28 +0000)]
[DebugInfo] Fix bug in LiveDebugVariables.
In lib/CodeGen/LiveDebugVariables.cpp, it uses std::prev(MBBI) to
get DebugValue's SlotIndex. However, the previous instruction may be
also a debug instruction. It could not use a debug instruction to query
SlotIndex in mi2iMap.
Scan all debug instructions and use the first debug instruction to query
SlotIndex for following debug instructions. Only handle DBG_VALUE in
handleDebugValue().
Differential Revision: https://reviews.llvm.org/D50621
llvm-svn: 340508
Scott Linder [Thu, 23 Aug 2018 02:51:09 +0000 (02:51 +0000)]
Fix undefined behavior in r340457
llvm-svn: 340507
David Blaikie [Thu, 23 Aug 2018 02:01:30 +0000 (02:01 +0000)]
Add new .def file introduced for BinaryFormat/MsgPack
Patch by Kristina Brooks!
llvm-svn: 340506
Thomas Lively [Thu, 23 Aug 2018 00:48:37 +0000 (00:48 +0000)]
[WebAssembly] SIMD Bitwise binary arithmetic
Summary: AND, OR, and XOR. This CL depends on D51113.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51136
llvm-svn: 340505
Thomas Lively [Thu, 23 Aug 2018 00:43:47 +0000 (00:43 +0000)]
[WebAssembly][NFC] Reorganize SIMD instructions
Summary:
Reorganize WebAssemblyInstrSIMD.td to put all of the instruction
definitions together, making it easier to see which instructions have
been implemented already. Depends on D51143.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51113
llvm-svn: 340504
Thomas Lively [Thu, 23 Aug 2018 00:36:43 +0000 (00:36 +0000)]
[WebAssembly][NFC] Move specific instruction formats to specific files
Summary:
WebAssemblyInstrFormats.td retains only multiclasses that are used in
multiple other tablegen files.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D51143
llvm-svn: 340503
George Karpenkov [Thu, 23 Aug 2018 00:26:59 +0000 (00:26 +0000)]
[analyzer] Preliminary version of retain count checking for OSObjects
Has quite a lot of false positives, disabled behind the flag.
Differential Revision: https://reviews.llvm.org/D50880
llvm-svn: 340502
George Karpenkov [Thu, 23 Aug 2018 00:02:35 +0000 (00:02 +0000)]
Revert "[CStringSyntaxChecker] Check strlcat sizeof check"
This reverts commit
3073790e87378fea9a68fb052185fec9596ef135.
The check is not correct, strlact(dest, "mystr", sizeof(dest)) is fine.
llvm-svn: 340501
George Karpenkov [Thu, 23 Aug 2018 00:02:12 +0000 (00:02 +0000)]
Revert "[CStringSyntaxChecker] Reduces space around error message for strlcat."
This reverts commit
6b43b80320722da41ca6ef7a3b57cc300fb83094.
llvm-svn: 340500
Peter Collingbourne [Wed, 22 Aug 2018 23:58:16 +0000 (23:58 +0000)]
MC: Teach the COFF object writer to write address-significance tables.
The format is the same as in ELF: a sequence of ULEB128-encoded
symbol indexes.
Differential Revision: https://reviews.llvm.org/D51047
llvm-svn: 340499
Nico Weber [Wed, 22 Aug 2018 23:53:39 +0000 (23:53 +0000)]
win: Omit ".exe" from clang and clang-cl driver-level diagnostics.
Like https://reviews.llvm.org/D51133 but for clang.
https://reviews.llvm.org/D51134
llvm-svn: 340498
Nico Weber [Wed, 22 Aug 2018 23:52:13 +0000 (23:52 +0000)]
win: Omit ".exe" from lld warning and error messages.
This is a minor follow-up to https://reviews.llvm.org/D49189. On Windows, lld
used to print "lld-link.exe: error: ...". Now it just prints "lld-link: error:
...". This matches what link.exe does (it prints "LINK : ...") and makes lld's
output less dependent on the host system.
https://reviews.llvm.org/D51133
llvm-svn: 340487
Raphael Isemann [Wed, 22 Aug 2018 23:50:30 +0000 (23:50 +0000)]
Revert "[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt"
This test breaks llvm-clang-x86_64-expensive-checks-win.
llvm-svn: 340483
Nico Weber [Wed, 22 Aug 2018 23:45:05 +0000 (23:45 +0000)]
lld-link: Separate 'undefined symbol' errors with just one newline, not two.
newline() in ErrorHandler.cpp already tries to insert newlines between messages
that contain embedded newlines, so getSymbolLocations() shouldn't return a
string that ends in a newline -- else we end up with two newlines between error
messages.
Makes lld-link's output look more like ld.lld output.
https://reviews.llvm.org/D51117
llvm-svn: 340482
Nico Weber [Wed, 22 Aug 2018 23:44:03 +0000 (23:44 +0000)]
Fix two RUN: lines that were unintentionally spelled "RN:".
https://reviews.llvm.org/D51140
llvm-svn: 340481
Craig Topper [Wed, 22 Aug 2018 23:27:50 +0000 (23:27 +0000)]
[ValueTracking] Teach computeNumSignBits to understand min/max clamp patterns with constant/splat values
If we have a min/max pair we can do a better job of counting sign bits if we look at them together. This is similar to what is done in the SelectionDAG version of computeNumSignBits for ISD::SMAX/SMIN.
Differential Revision: https://reviews.llvm.org/D51112
llvm-svn: 340480
George Karpenkov [Wed, 22 Aug 2018 23:23:17 +0000 (23:23 +0000)]
[NFC] Add tags file to .gitignore
Differential Revision: https://reviews.llvm.org/D50109
llvm-svn: 340479
Craig Topper [Wed, 22 Aug 2018 23:19:01 +0000 (23:19 +0000)]
[X86] Teach combineLoopSADPattern to handle cases where there is no loop and the add has two absolute difference inputs
Previously we asumed a vector reduction add is part of a loop and one of the input is a phi. But the code in SelectionDAGBuilder that sets vector reduction flag handles more cases than that. It just requires that the use chain ends in a horizontal reduction. And there are no other uses. This means it can handle unrolled reduction loops.
If the initial value of the reduction was 0, an unrolled loop would begin with a vector reduction add that has two sad inputs. Previously we would only transform one side of the add, but for this case we need to transform both sides.
I've created a lambda to reuse some of the code for both sides. And fixed the variables names to remove reference to "phi".
Differential Revision: https://reviews.llvm.org/D50817
llvm-svn: 340478
Craig Topper [Wed, 22 Aug 2018 23:18:58 +0000 (23:18 +0000)]
[X86] Add test cases for D50817. NFC
llvm-svn: 340477
Evandro Menezes [Wed, 22 Aug 2018 23:18:02 +0000 (23:18 +0000)]
[NFC] Refactor simplification of pow()
llvm-svn: 340476
George Karpenkov [Wed, 22 Aug 2018 23:17:25 +0000 (23:17 +0000)]
[analyzer] Track non-zero values in ReturnVisitor
Tracking those can help to provide much better diagnostics in many cases.
In general, most of the visitor machinery should be refactored to allow
tracking the origin of arbitrary values.
rdar://
36039765
Differential Revision: https://reviews.llvm.org/D51131
llvm-svn: 340475
George Karpenkov [Wed, 22 Aug 2018 23:17:02 +0000 (23:17 +0000)]
[analyzer] Track the problematic subexpression in UndefResultChecker
This is tested in a subsequent commit, which allows tracking those values.
Differential Revision: https://reviews.llvm.org/D51139
llvm-svn: 340474
George Karpenkov [Wed, 22 Aug 2018 23:16:44 +0000 (23:16 +0000)]
[analyzer] [NFC] Minor refactoring of BugReporterVisitors
Differential Revision: https://reviews.llvm.org/D51130
llvm-svn: 340473
Thomas Lively [Wed, 22 Aug 2018 23:06:27 +0000 (23:06 +0000)]
[WebAssembly] Arbitrary BUILD_VECTOR and remove i64x2.mul
Summary:
This CL adds support for arbitrary BUILD_VECTORS, i.e. not splats and
not consts. This is the last feature needed to properly lower v2i64
multiplies without a i64x2.mul instruction (which is not in the spec),
so i64x2.mul is removed as well.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51082
Remove unnecessary condition and fix whitespace
llvm-svn: 340472
Petr Hosek [Wed, 22 Aug 2018 22:56:46 +0000 (22:56 +0000)]
[Driver] Check normalized triples for multiarch runtime path
Previously we only used target triple as provided which matches the
GCC behavior, but it also means that all clients have to be consistent
in their spelling of target triples since e.g. x86_64-linux-gnu and
x86_64-unknown-linux-gnu will result in Clang driver looking at two
different paths when searching for runtime libraries.
Unfortunatelly, as it turned out many clients aren't consistent in
their spelling of target triples, e.g. many Linux distributions use
the shorter spelling but config.guess and rustc insist on using the
normalized variant which is causing issues. To avoid having to ship
multiple copies of runtimes for different triple spelling or rely on
symlinks which are not portable, we should also check the normalized
triple when constructing paths for multiarch runtimes.
Differential Revision: https://reviews.llvm.org/D50547
llvm-svn: 340471
Kostya Serebryany [Wed, 22 Aug 2018 22:55:16 +0000 (22:55 +0000)]
[hwasan] make error reporting look more like in asan, print the memory tag around the buggy access, simplify one test
llvm-svn: 340470
Sanjay Patel [Wed, 22 Aug 2018 22:52:05 +0000 (22:52 +0000)]
[SelectionDAG] unroll unsupported vector FP ops earlier to avoid libcalls on undef elements (PR38527)
This solves the motivating case from:
https://bugs.llvm.org/show_bug.cgi?id=38527
If we are legalizing an FP vector op that maps to 1 of the LLVM intrinsics that mimic libm calls,
but we're going to end up with scalar libcalls for that vector type anyway, then we should unroll
the vector op into scalars before widening. This avoids libcalls because we've lost the knowledge
that some of the scalar elements are undef.
Differential Revision: https://reviews.llvm.org/D50791
llvm-svn: 340469
Raphael Isemann [Wed, 22 Aug 2018 22:51:37 +0000 (22:51 +0000)]
[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51121
llvm-svn: 340468
Raphael Isemann [Wed, 22 Aug 2018 22:50:45 +0000 (22:50 +0000)]
[ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.
Summary:
The `array-init-loop-expr` test is currently not testing the importing of ArrayInitLoopExprs.
This is because we import the `S` struct into the `test.cpp` context
and only do a copy-assignment in `test.cpp`, so the actual ArrayInitLoopExpr we wanted to
import is generated by clang directly in the target context. This means we actually
never test the importing of ArrayInitLoopExpr with this test, which becomes obvious
when looking at the missing test coverage for the respective VisitArrayInitLoopExpr method.
This patch moves the copy-assignment of our struct to the `S.cpp` context, which means
that `test.cpp` now actually has to import the ArrayInitLoopExpr.
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51115
llvm-svn: 340467
Raphael Isemann [Wed, 22 Aug 2018 22:49:32 +0000 (22:49 +0000)]
[ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.
Summary:
`CXXNamedCastExpr` importing is already handled in the respective `VisitCXXNamedCastExpr` method.
So this code here can never be reached under normal circumstances and we might as well remove it.
This patch shouldn't change any observable behavior of the ASTImporter.
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51110
llvm-svn: 340466
Raphael Isemann [Wed, 22 Aug 2018 22:48:40 +0000 (22:48 +0000)]
[ASTImporter] Add test for ObjCTypeParamDecl
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51059
llvm-svn: 340465
Raphael Isemann [Wed, 22 Aug 2018 22:47:10 +0000 (22:47 +0000)]
[ASTImporter] Add test for SwitchStmt
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51056
llvm-svn: 340464
Raphael Isemann [Wed, 22 Aug 2018 22:45:04 +0000 (22:45 +0000)]
[ASTImporter] Add test for ObjCAutoreleasePoolStmt
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51123
llvm-svn: 340463
Evandro Menezes [Wed, 22 Aug 2018 22:44:06 +0000 (22:44 +0000)]
[NFC] Expand test cases for simplifying pow()
llvm-svn: 340462
George Burgess IV [Wed, 22 Aug 2018 22:34:38 +0000 (22:34 +0000)]
[MemorySSA] Invalidate optimized Defs upon moving them; NFC
We're currently getting this behavior implicitly, since we determine if
a Def's optimization is valid based on the ID of its defining access.
This is incorrect, though I wouldn't be surprised if this was masked in
part by that we're using a WeakVH to track what Defs are optimized to.
(Not to mention that we don't move Defs super often, AFAICT). I'll
submit a patch to fix this shortly.
This also includes a minor refactor to reduce duplication a bit.
No test is included, since like said, this already happens to be our
behavior. I'll add a test for this with my fix to the other bug
mentioned above.
llvm-svn: 340461
Stephane Sezer [Wed, 22 Aug 2018 22:25:45 +0000 (22:25 +0000)]
Add include directory for libxml on macOS
Summary:
Builds fail because libxml/xmlreader.h isn't found. Adding the include
directory to the include list fixes the issue. This is what we already do on
non-macOS platforms in the same file.
Reviewers: clayborg, xiaobai, lanza
Reviewed By: clayborg, lanza
Subscribers: mgorny
Differential Revision: https://reviews.llvm.org/D50918
llvm-svn: 340460
Aaron Puchert [Wed, 22 Aug 2018 22:14:53 +0000 (22:14 +0000)]
Thread safety analysis: Allow relockable scopes
Summary:
It's already allowed to prematurely release a scoped lock, now we also
allow relocking it again, possibly even in another mode.
This is the second attempt, the first had been merged as r339456 and
reverted in r339558 because it caused a crash.
Reviewers: delesley, aaron.ballman
Reviewed By: delesley, aaron.ballman
Subscribers: hokein, cfe-commits
Differential Revision: https://reviews.llvm.org/D49885
llvm-svn: 340459
Eli Friedman [Wed, 22 Aug 2018 21:47:14 +0000 (21:47 +0000)]
[ARM] Lower llvm.ctlz.i32 to a libcall when clz is not available.
The inline sequence is very long (about 70 bytes on Thumb1), so it's
not really a good idea to inline it, especially when optimizing for
size.
Differential Revision: https://reviews.llvm.org/D47917
llvm-svn: 340458
Scott Linder [Wed, 22 Aug 2018 21:42:50 +0000 (21:42 +0000)]
[BinaryFormat] Add MessagePack reader/writer
Add support for reading and writing MessagePack, a binary object serialization
format which aims to be more compact than text formats like JSON or YAML.
The specification can be found at
https://github.com/msgpack/msgpack/blob/master/spec.md
Will be used for encoding metadata in AMDGPU code objects.
Differential Revision: https://reviews.llvm.org/D44429
llvm-svn: 340457
Eli Friedman [Wed, 22 Aug 2018 21:38:57 +0000 (21:38 +0000)]
[SafeStack] Handle unreachable code with safe stack coloring.
Instead of asserting that the function doesn't have any unreachable
code, just ignore it for the purpose of computing liveness.
Differential Revision: https://reviews.llvm.org/D51070
llvm-svn: 340456
Yonghong Song [Wed, 22 Aug 2018 21:21:03 +0000 (21:21 +0000)]
bpf: fix an assertion in BPFAsmBackend applyFixup()
Fix bug https://bugs.llvm.org/show_bug.cgi?id=38643
In BPFAsmBackend applyFixup(), there is an assertion for FixedValue to be 0.
This may not be true, esp. for optimiation level 0.
For example, in the above bug, for the following two
static variables:
@bpf_map_lookup_elem = internal global i8* (i8*, i8*)*
inttoptr (i64 1 to i8* (i8*, i8*)*), align 8
@bpf_map_update_elem = internal global i32 (i8*, i8*, i8*, i64)*
inttoptr (i64 2 to i32 (i8*, i8*, i8*, i64)*), align 8
The static variable @bpf_map_update_elem will have a symbol
offset of 8 and a FK_SecRel_8 with FixupValue 8 will cause
the assertion if llvm is built with -DLLVM_ENABLE_ASSERTIONS=ON.
The above relocations will not exist if the program is compiled
with optimization level -O1 and above as the compiler optimizes
those static variables away. In the below error message, -O2
is suggested as this is the common practice.
Note that FixedValue = 0 in applyFixup() does exist and is valid,
e.g., for the global variable my_map in the above bug. The bpf
loader will process them properly for map_id's before loading
the program into the kernel.
The static variables, which are not optimized away by compiler,
may have FK_SecRel_8 relocation with non-zero FixedValue.
The patch removed the offending assertion and will issue
a hard error as below if the FixedValue in applyFixup()
is not 0.
$ llc -march=bpf -filetype=obj fixup.ll
LLVM ERROR: Unsupported relocation: try to compile with -O2 or above,
or check your static variable usage
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 340455
Heejin Ahn [Wed, 22 Aug 2018 21:13:49 +0000 (21:13 +0000)]
[WebAssembly] Don't write SP back when prolog is generated only for EH
Summary:
When we don't actually have stack-allocated variables but need SP only
to support EH, we don't need to write SP back in the epilog, because we
don't bump down the stack pointer.
Reviewers: dschuff
Subscribers: jgravelle-google, sbc100, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51114
llvm-svn: 340454
Philip Reames [Wed, 22 Aug 2018 21:10:56 +0000 (21:10 +0000)]
[AST] Add a test for attribute intersection
Already works, but I initially convinced myself it doesn't, so add a test which shows it does. :)
llvm-svn: 340453
Aaron Puchert [Wed, 22 Aug 2018 21:06:04 +0000 (21:06 +0000)]
[NFC] Test commit
llvm-svn: 340452
Martin Storsjo [Wed, 22 Aug 2018 20:34:12 +0000 (20:34 +0000)]
[ARM] Avoid injecting constant islands in movw+movt pairs on Windows
On Windows, movw+movt pairs with relocations are handled with a single
relocation that covers them both. Therefore we can't inject anything
between these instructions, otherwise the relocation (which in LLVM
only is treated as the movw instruction's relocation, while the movt
instruction's relocation is dropped) will end up bogus.
These instructions are bundled up until right before the constant
islands pass, making this effectively the only place that can split
them apart.
Differential Revision: https://reviews.llvm.org/D51032
llvm-svn: 340451
Martin Storsjo [Wed, 22 Aug 2018 20:34:06 +0000 (20:34 +0000)]
[ARM] Move machine operand target flags to ARMBaseInstrInfo
This makes sure the flags are available for use for thumb MIR as well.
A test that requires this will be added in the next commit.
llvm-svn: 340450
Alex Lorenz [Wed, 22 Aug 2018 20:30:06 +0000 (20:30 +0000)]
[clangd] send diagnostic categories only when 'categorySupport'
capability was given by the client
After r339738 Clangd started sending categories with each diagnostic, but that
broke the eglot client. This commit puts the categories behind a capability to
fix that breakage.
Differential Revision: https://reviews.llvm.org/D51077
llvm-svn: 340449
Raphael Isemann [Wed, 22 Aug 2018 20:22:34 +0000 (20:22 +0000)]
Add unit test for StringLexer
Reviewers: labath, #lldb
Reviewed By: labath
Subscribers: jloser, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D50298
llvm-svn: 340448
Krzysztof Parzyszek [Wed, 22 Aug 2018 20:15:04 +0000 (20:15 +0000)]
[Hexagon] Enable interleaving in loop vectorizer
llvm-svn: 340447
Eli Friedman [Wed, 22 Aug 2018 20:13:45 +0000 (20:13 +0000)]
[ARM] Handle all-ones mask explicitly in targetShrinkDemandedConstant.
This avoids a potential infinite loop setting and unsetting bits in the
mask.
Reduced from a failure on the polly-aosp bot.
Differential Revision: https://reviews.llvm.org/D51066
llvm-svn: 340446
Alina Sbirlea [Wed, 22 Aug 2018 20:10:21 +0000 (20:10 +0000)]
Update MemorySSA in LoopSimplifyCFG.
Summary:
Add MemorySSA as a dependency to LoopSimplifyCFG and preserve it.
Disabled by default until all passes preserve MemorySSA.
Reviewers: bogner, chandlerc
Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits
Differential Revision: https://reviews.llvm.org/D50911
llvm-svn: 340445
Alina Sbirlea [Wed, 22 Aug 2018 20:05:21 +0000 (20:05 +0000)]
Update MemorySSA in LoopInstSimplify.
Summary:
Add MemorySSA as a depency to LoopInstInstSimplify and preserve it.
Disabled by default until all passes preserve MemorySSA.
Reviewers: chandlerc
Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits
Differential Revision: https://reviews.llvm.org/D50906
llvm-svn: 340444
Philip Reames [Wed, 22 Aug 2018 19:50:45 +0000 (19:50 +0000)]
[AA] Remove a needless variable [NFC]
There's no need to track a seperate variable for argmemonly aliasing. This falls out naturally of the modinfo union. Note that we may return earlier than we would have earlier if all arguments are explicitly readnone. The overall result doesn't change, just how we get there.
llvm-svn: 340443
Kostya Serebryany [Wed, 22 Aug 2018 19:47:19 +0000 (19:47 +0000)]
[hwasan] remove stale data field
llvm-svn: 340442
Craig Topper [Wed, 22 Aug 2018 19:39:09 +0000 (19:39 +0000)]
[X86] Replace (32/64 - n) shift amounts with (neg n) since the shift amount is masked in hardware
Inspired by what AArch64 does for shifts, this patch attempts to replace shift amounts with neg if we can.
This is done directly as part of isel so its as late as possible to avoid breaking some BZHI patterns since those patterns need an unmasked (32-n) to be correct.
To avoid manual load folding and custom instruction selection for the negate. I've inserted new nodes in the DAG above the shift node in topological order.
Differential Revision: https://reviews.llvm.org/D48789
llvm-svn: 340441
Philip Reames [Wed, 22 Aug 2018 19:30:46 +0000 (19:30 +0000)]
[AST] Minor whitespace cleanup [NFC]
llvm-svn: 340440
Elizabeth Andrews [Wed, 22 Aug 2018 19:05:19 +0000 (19:05 +0000)]
Currently clang does not emit unused static constants. GCC emits these
constants by default when there is no optimization.
GCC's option -fno-keep-static-consts can be used to not emit
unused static constants.
In Clang, since default behavior does not keep unused static constants,
-fkeep-static-consts can be used to emit these if required. This could be
useful for producing identification strings like SVN identifiers
inside the object file even though the string isn't used by the program.
Differential Revision: https://reviews.llvm.org/D40925
llvm-svn: 340439
Heejin Ahn [Wed, 22 Aug 2018 18:53:48 +0000 (18:53 +0000)]
[WebAssembly] Remove MachineFrameInfo arg from checking functions (NFC)
Summary:
There are several functions in the form of `has***` or `needs***` in
`WebAssemblyFrameLowering` and its `MachineFrameInfo` argument can be
obtained from `MachineFunction` so it is not necessarily has to be
passed from a caller. Also, it is more in line with other overriden
fuctions like `hasBP` or `hasReservedCallFrame`, which also take only
`MachineFunction` argument.
Reviewers: dschuff
Subscribers: sbc100, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51116
llvm-svn: 340438
Chris Bieneman [Wed, 22 Aug 2018 18:41:14 +0000 (18:41 +0000)]
[CMake] Remove unneeded and outdated policy
This was needed way back because we didn't properly handle that the SOURCES property of a target could have things that weren't source files to compile. Almost 2 years ago Takumi fixed that, and now CMake is throwing warnings that we should get off the old behavior.
llvm-svn: 340436