James Molloy [Sat, 21 Sep 2019 08:19:41 +0000 (08:19 +0000)]
[MachinePipeliner] Improve the TargetInstrInfo API analyzeLoop/reduceLoopCount
Recommit: fix asan errors.
The way MachinePipeliner uses these target hooks is stateful - we reduce trip
count by one per call to reduceLoopCount. It's a little overfit for hardware
loops, where we don't have to worry about stitching a loop induction variable
across prologs and epilogs (the induction variable is implicit).
This patch introduces a new API:
/// Analyze loop L, which must be a single-basic-block loop, and if the
/// conditions can be understood enough produce a PipelinerLoopInfo object.
virtual std::unique_ptr<PipelinerLoopInfo>
analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const;
The return value is expected to be an implementation of the abstract class:
/// Object returned by analyzeLoopForPipelining. Allows software pipelining
/// implementations to query attributes of the loop being pipelined.
class PipelinerLoopInfo {
public:
virtual ~PipelinerLoopInfo();
/// Return true if the given instruction should not be pipelined and should
/// be ignored. An example could be a loop comparison, or induction variable
/// update with no users being pipelined.
virtual bool shouldIgnoreForPipelining(const MachineInstr *MI) const = 0;
/// Create a condition to determine if the trip count of the loop is greater
/// than TC.
///
/// If the trip count is statically known to be greater than TC, return
/// true. If the trip count is statically known to be not greater than TC,
/// return false. Otherwise return nullopt and fill out Cond with the test
/// condition.
virtual Optional<bool>
createTripCountGreaterCondition(int TC, MachineBasicBlock &MBB,
SmallVectorImpl<MachineOperand> &Cond) = 0;
/// Modify the loop such that the trip count is
/// OriginalTC + TripCountAdjust.
virtual void adjustTripCount(int TripCountAdjust) = 0;
/// Called when the loop's preheader has been modified to NewPreheader.
virtual void setPreheader(MachineBasicBlock *NewPreheader) = 0;
/// Called when the loop is being removed.
virtual void disposed() = 0;
};
The Pipeliner (ModuloSchedule.cpp) can use this object to modify the loop while
allowing the target to hold its own state across all calls. This API, in
particular the disjunction of creating a trip count check condition and
adjusting the loop, improves the code quality in ModuloSchedule.cpp.
llvm-svn: 372463
Kristof Umann [Sat, 21 Sep 2019 07:56:40 +0000 (07:56 +0000)]
Attempt to fix a windows buildbot failure
llvm-svn: 372462
Kamil Rytarowski [Sat, 21 Sep 2019 07:45:02 +0000 (07:45 +0000)]
Add __lsan::ScopedInterceptorDisabler for strerror(3)
Summary:
strerror(3) on NetBSD uses internally TSD with a destructor that is never
fired for exit(3). It's correctly called for pthread_exit(3) scenarios.
This is a case when a leak on exit(3) is expected, unavoidable and harmless.
Reviewers: joerg, vitalybuka, dvyukov, mgorny
Reviewed By: vitalybuka
Subscribers: dmgreen, kristof.beyls, jfb, llvm-commits, #sanitizers
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D67337
llvm-svn: 372461
Kamil Rytarowski [Sat, 21 Sep 2019 07:43:55 +0000 (07:43 +0000)]
Avoid memory leak in ASan test
Summary:
Add missing free(3) for the malloc(3) call.
Detected on NetBSD with LSan.
Reviewers: joerg, mgorny, vitalybuka, dvyukov
Reviewed By: vitalybuka
Subscribers: llvm-commits, #sanitizers
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D67330
llvm-svn: 372460
Kamil Rytarowski [Sat, 21 Sep 2019 07:30:42 +0000 (07:30 +0000)]
Stop tracking atexit/__cxa_atexit/pthread_atfork allocations in LSan/NetBSD
Summary:
The atexit(3) and __cxa_atexit() calls allocate internally memory and free on exit,
after executing all callback. This causes false positives as DoLeakCheck() is called
from the atexit handler. In the LSan/ASan tests there are strict checks triggering
false positives here.
Intercept all atexit(3) and __cxa_atexit() calls and disable LSan when calling the
real functions.
Stop tracing allocations in pthread_atfork(3) funtions, as there are performed
internal allocations that are not freed for the time of running StopTheWorld()
code. This avoids false-positives.
The same changes have to be replicated in the ASan and LSan runtime.
Non-NetBSD OSs are not tested and this code is restricted to NetBSD only.
Reviewers: dvyukov, joerg, mgorny, vitalybuka, eugenis
Reviewed By: vitalybuka
Subscribers: jfb, llvm-commits, #sanitizers
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D67331
llvm-svn: 372459
Craig Topper [Sat, 21 Sep 2019 06:44:29 +0000 (06:44 +0000)]
[X86] Use sse_load_f32/f64 and timm in patterns for memory form of vgetmantss/sd.
Previously we only matched scalar_to_vector and scalar load, but
we should be able to narrow a vector load or match vzload.
Also need to match TargetConstant instead of Constant. The register
patterns were previously updated, but not the memory patterns.
llvm-svn: 372458
Craig Topper [Sat, 21 Sep 2019 06:44:24 +0000 (06:44 +0000)]
[X86] Add test case to show failure to fold load with getmantss due to isel pattern looking for Constant instead of TargetConstant
The intrinsic has an immarg so its gets created with a TargetConstant
instead of a Constant after r372338. The isel pattern was only
updated for the register form, but not the memory form.
llvm-svn: 372457
Nandor Licker [Sat, 21 Sep 2019 05:29:18 +0000 (05:29 +0000)]
[Clang Interpreter] Fixed Bug 43362, build failure on GCC
free() was not directly included in InterpStack.cpp, added include now.
llvm-svn: 372455
Richard Trieu [Sat, 21 Sep 2019 04:18:54 +0000 (04:18 +0000)]
Fix bad APInt compare.
APInt comparison require both to have the same bitwidth. Since only the value
is needed, use the compare function APInt::isSameValue instead.
llvm-svn: 372454
Richard Trieu [Sat, 21 Sep 2019 03:02:26 +0000 (03:02 +0000)]
Merge and improve code that detects same value in comparisons.
-Wtautological-overlap-compare and self-comparison from -Wtautological-compare
relay on detecting the same operand in different locations. Previously, each
warning had it's own operand checker. Now, both are merged together into
one function that each can call. The function also now looks through member
access and array accesses.
Differential Revision: https://reviews.llvm.org/D66045
llvm-svn: 372453
Yaxun Liu [Sat, 21 Sep 2019 02:51:44 +0000 (02:51 +0000)]
Revert assertion added by r372394
The assertion added by r372394 causes CUDA test in test-suite to assert.
The assertion was not there originally, so revert it.
llvm-svn: 372452
Nico Weber [Sat, 21 Sep 2019 02:43:32 +0000 (02:43 +0000)]
avr targetinfo: remove unneeded dep on MC
llvm-svn: 372451
Matt Arsenault [Sat, 21 Sep 2019 02:37:33 +0000 (02:37 +0000)]
AMDGPU/GlobalISel: Allow selection of scalar min/max
I believe all of the uniform/divergent pattern predicates are
redundant and can be removed. The uniformity bit already influences
the register class, and nothhing has broken when I've removed this and
others.
llvm-svn: 372450
Matt Arsenault [Sat, 21 Sep 2019 02:37:28 +0000 (02:37 +0000)]
LiveIntervals: Add missing operator!= for segments
llvm-svn: 372449
Richard Trieu [Sat, 21 Sep 2019 02:37:10 +0000 (02:37 +0000)]
Improve -Wtautological-overlap-compare
Allow this warning to detect a larger number of constant values, including
negative numbers, and handle non-int types better.
Differential Revision: https://reviews.llvm.org/D66044
llvm-svn: 372448
Artur Pilipenko [Sat, 21 Sep 2019 01:37:14 +0000 (01:37 +0000)]
Support for 64-bit PC-relative relocations for X86_64
ELF files generated for X86_64 targets may contain 64-bit PC-relative
relocations. For instance, an exception handler table entry contains the start
of exception-throwing frame relative to the start of exception handler. As these
two labels belong to different sections, their difference and so the relocation
is 64-bit.
An attempt to parse such file, i.e. in DWARFContext::create, results in "failed
to compute relocation" error.
This fix adds support for such relocations to RelocationResolver.cpp.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D67779
Patch by Oleg Pliss (Oleg.Pliss@azul.com)
llvm-svn: 372447
GN Sync Bot [Sat, 21 Sep 2019 01:27:09 +0000 (01:27 +0000)]
gn build: Merge r372445
llvm-svn: 372446
Stephane Moore [Sat, 21 Sep 2019 01:22:22 +0000 (01:22 +0000)]
[clang-tidy] Add check for classes missing -hash ⚠️
Summary:
Apple documentation states that:
"If two objects are equal, they must have the same hash value. This last
point is particularly important if you define isEqual: in a subclass and
intend to put instances of that subclass into a collection. Make sure
you also define hash in your subclass."
https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418795-isequal?language=objc
In many or all versions of libobjc, -[NSObject isEqual:] is a pointer
equality check and -[NSObject hash] returns the messaged object's
pointer. A relatively common form of developer error is for a developer to
override -isEqual: in a subclass without overriding -hash to ensure that
hashes are equal for objects that are equal.
It is assumed that an override of -isEqual: is a strong signal for
changing the object's equality operator to something other than pointer
equality which implies that a missing override of -hash could result in
distinct objects being equal but having distinct hashes because they are
independent instances. This added check flags classes that override
-isEqual: but inherit NSObject's implementation of -hash to warn of the
potential for unexpected behavior.
The proper implementation of -hash is the responsibility of the
developer and the check will only verify that the developer made an
effort to properly implement -hash. Developers can set up unit tests
to verify that their implementation of -hash is appropriate.
Test Notes:
Ran check-clang-tools.
Reviewers: aaron.ballman, benhamilton
Reviewed By: aaron.ballman
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67737
llvm-svn: 372445
Alex Lorenz [Sat, 21 Sep 2019 00:17:26 +0000 (00:17 +0000)]
[clang-scan-deps] strip the --serialize-diagnostics argument
This ensures that clang-scan-deps won't write out diagnostics when
scanning dependencies.
llvm-svn: 372444
Amara Emerson [Fri, 20 Sep 2019 23:52:07 +0000 (23:52 +0000)]
[GlobalISel] Defer setting HasCalls on MachineFrameInfo to selection time.
We currently always set the HasCalls on MFI during translation and legalization if
we're handling a call or legalizing to a libcall. However, if that call is later
optimized to a tail call then we don't need the flag. The flag being set to true
causes frame lowering to always save and restore FP/LR, which adds unnecessary code.
This change does the same thing as SelectionDAG and ports over some code that scans
instructions after selection, using TargetInstrInfo to determine if target opcodes
are known calls.
Code size geomean improvements on CTMark:
-O0 : 0.1%
-Os : 0.3%
Differential Revision: https://reviews.llvm.org/D67868
llvm-svn: 372443
Jonas Devlieghere [Fri, 20 Sep 2019 23:41:32 +0000 (23:41 +0000)]
prepare_binding_Python: print readable errors if SWIG fails
When swig fails, all the errors are squished onto one line with \n
quoting. It's very hard to read. This will print them out in a more
reasonable format.
Patch by: Lawrence D'Anna
Differential revision: https://reviews.llvm.org/D67790
llvm-svn: 372442
Jonas Devlieghere [Fri, 20 Sep 2019 23:41:29 +0000 (23:41 +0000)]
dotest.py: bugfix: test filters with -f do not work on Python3
dotest -f does not work on Python3.
The name types.UnboundMethodType was an alias for types.MethodType in
2.7, but it does not exist in python3. MethodType works in both.
Also the actual type returned from SomeClass.some_method in python3
will be types.Function, not MethodType.
Patch by: Lawrence D'Anna
Differential revision: https://reviews.llvm.org/D67791
llvm-svn: 372441
Teresa Johnson [Fri, 20 Sep 2019 23:29:17 +0000 (23:29 +0000)]
[Inliner] Remove incorrect early exit during switch cost computation
Summary:
The CallAnalyzer::visitSwitchInst has an early exit when the estimated
lower bound of the switch cost will put the overall cost of the inline
above the threshold. However, this code is not correctly estimating the
lower bound for switches that can be transformed into bit tests, leading
to unnecessary lost inlines, and also differing behavior with
optimization remarks enabled.
First, the early exit is controlled by whether ComputeFullInlineCost is
enabled or not, and that in turn is disabled by default but enabled when
enabling -pass-remarks=missed. This by itself wouldn't lead to a
problem, except that as described below, the lower bound can be above
the real lower bound, so we can sometimes get different inline decisions
with inline remarks enabled, which is problematic.
The early exit was added in along with a new switch cost model in D31085.
The reason why this early exit was added is due to a concern one reviewer
raised about compile time for large switches:
https://reviews.llvm.org/D31085?id=94559#inline-276200
However, the code just below there calls
getEstimatedNumberOfCaseClusters, which in turn immediately calls
BasicTTIImpl getEstimatedNumberOfCaseClusters, which in the worst case
does a linear scan of the cases to get the high and low values. The
bit test handling in particular is guarded by whether the number of
cases fits into the max bit width. There is no suggestion that anyone
measured a compile time issue, it appears to be theoretical.
The problem is that the reviewer's comment about the lower bound
calculation is incorrect, specifically in the case of a switch that can
be lowered to a bit test. This isn't followed up on the comment
thread, but the author does add a FIXME to that effect above the early
exit added when they subsequently revised the patch.
As a result, we were incorrectly early exiting and not inlining
functions with switch statements that would be lowered to bit tests in
cases where we were nearing the threshold. Combined with the fact that
this early exit was skipped with opt remarks enabled, this caused
different inlining decisions to be made when -pass-remarks=missed is
enabled to debug the missing inline.
Remove the early exit for the above reasons.
I also copied over an existing AArch64 inlining test to X86, and
adjusted the threshold so that the bit test inline only occurs with the
fix in this patch.
Reviewers: davidxl
Subscribers: eraman, kristof.beyls, haicheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67716
llvm-svn: 372440
Wei Mi [Fri, 20 Sep 2019 23:24:50 +0000 (23:24 +0000)]
[SampleFDO] Expose an interface to return the size of a section or the size
of the profile for profile in ExtBinary format.
Sometimes we want to limit the size of the profile by stripping some functions
with low sample count or by stripping some function names with small text size
from profile symbol list. That requires the profile reader to have the
interfaces returning the size of a section or the size of total profile. The
patch add those interfaces.
At the same time, add some dump facility to show the size of each section.
llvm-svn: 372439
Richard Smith [Fri, 20 Sep 2019 23:12:51 +0000 (23:12 +0000)]
Remove outdated FIXME.
llvm-svn: 372438
Richard Smith [Fri, 20 Sep 2019 23:08:59 +0000 (23:08 +0000)]
Fix assertion failure when constant evaluation of a switch jumps over an
uninitialized variable in an init-statement of a 'for' or 'if'.
llvm-svn: 372437
Ulrich Weigand [Fri, 20 Sep 2019 23:06:03 +0000 (23:06 +0000)]
[SystemZ] Support z15 processor name
The recently announced IBM z15 processor implements the architecture
already supported as "arch13" in LLVM. This patch adds support for
"z15" as an alternate architecture name for arch13.
Corrsponding LLVM support was committed as rev. 372435.
llvm-svn: 372436
Ulrich Weigand [Fri, 20 Sep 2019 23:04:45 +0000 (23:04 +0000)]
[SystemZ] Support z15 processor name
The recently announced IBM z15 processor implements the architecture
already supported as "arch13" in LLVM. This patch adds support for
"z15" as an alternate architecture name for arch13.
The patch also uses z15 in a number of places where we used arch13
as long as the official name was not yet announced.
llvm-svn: 372435
Sterling Augustine [Fri, 20 Sep 2019 22:26:55 +0000 (22:26 +0000)]
Fix missed case of switching getConstant to getTargetConstant. Try 2.
Summary: This fixes a crasher introduced by r372338.
Reviewers: echristo, arsenm
Subscribers: wdng, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67850
llvm-svn: 372434
DeForest Richards [Fri, 20 Sep 2019 22:16:39 +0000 (22:16 +0000)]
[Docs] Add a custom sidebar to doc pages
Adds a custom sidebar to LLVM docs. Sidebar includes links to How to submit a bug and FAQ topics, as well as a Show Source link and search box.
llvm-svn: 372432
Simon Pilgrim [Fri, 20 Sep 2019 21:27:49 +0000 (21:27 +0000)]
[PPC] PPCLoopPreIncPrep - silence static analyzer null dereference warning.
llvm-svn: 372430
Simon Pilgrim [Fri, 20 Sep 2019 20:52:21 +0000 (20:52 +0000)]
[AddressSanitizer] Don't dereference dyn_cast<ConstantInt> results. NFCI.
The static analyzer is warning about potential null dereference, but we can use cast<ConstantInt> directly and if not assert will fire for us.
llvm-svn: 372429
DeForest Richards [Fri, 20 Sep 2019 20:51:33 +0000 (20:51 +0000)]
[Docs] Move topics to new categories
This commit moves several topics to new categories.
llvm-svn: 372428
Saleem Abdulrasool [Fri, 20 Sep 2019 20:46:33 +0000 (20:46 +0000)]
Unwind: avoid warning about unused typedef
Move the definition of Elf_Addr typedef to the only place it is used, to avoid:
```
llvm-project/libunwind/src/AddressSpace.hpp:501:28: warning: unused typedef 'Elf_Addr' [-Wunused-local-typedef]
```
when compiling for Android with _LIBUNWIND_ARM_EHABI defined and
_LIBUNWIND_SUPPORT_DWARF_UNWIND not defined.
Patch by Joel Klinghed!
llvm-svn: 372427
Jinsong Ji [Fri, 20 Sep 2019 20:31:37 +0000 (20:31 +0000)]
[NFC][PowerPC] Consolidate testing of common linkage symbols
Add a new file to test the code gen for common linkage symbol.
Remove common linkage in some other testcases to avoid distraction.
llvm-svn: 372426
Mitch Phillips [Fri, 20 Sep 2019 20:25:16 +0000 (20:25 +0000)]
Revert "[MachinePipeliner] Improve the TargetInstrInfo API analyzeLoop/reduceLoopCount"
This commit broke the ASan buildbot. See comments in rL372376 for more
information.
This reverts commit
15e27b0b6d9d51362fad85dbe95ac5b3fadf0a06.
llvm-svn: 372425
Jan Kratochvil [Fri, 20 Sep 2019 20:19:18 +0000 (20:19 +0000)]
[lldb] Process formatters in reverse-chronological order
If one reverts D66398 then the TestDataFormatterStdList does fail - as the C++
formatters are initialized in the opposite order. But the current state of
trunk does not mind the order for C++ formatters.
It is using now a single std::vector as suggested by Pavel Labath.
Differential Revision: https://reviews.llvm.org/D66654
llvm-svn: 372424
Matt Morehouse [Fri, 20 Sep 2019 19:39:50 +0000 (19:39 +0000)]
[docs] Update structure-aware-fuzzing link.
The document has been moved to the google/fuzzing GitHub repo.
llvm-svn: 372423
Erich Keane [Fri, 20 Sep 2019 19:17:31 +0000 (19:17 +0000)]
Ensure AtomicExpr goes through SEMA checking after TreeTransform
RebuildAtomicExpr was skipping doing semantic analysis which broke in
the cases where the expressions were not dependent. This resulted in the
ImplicitCastExpr from an array to a pointer being lost, causing a crash
in IR CodeGen.
Differential Revision: https://reviews.llvm.org/D67854
llvm-svn: 372422
Michael Trent [Fri, 20 Sep 2019 19:13:24 +0000 (19:13 +0000)]
Can't pass .dSYM directory to llvm-objdump -dsym= (and error message is wrong)
Summary:
Allow users to pass the path to a .dSYM directory to llvm-objdump's -dsym
flag rather than requiring users to find the DWARF DSYM Mach-O within the
bundle structure by hand.
rdar://
46873333
Reviewers: pete, lhames, friss, aprantl
Reviewed By: pete, aprantl
Subscribers: MaskRay, aprantl, rupprecht, seiya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67780
llvm-svn: 372421
Craig Topper [Fri, 20 Sep 2019 18:52:49 +0000 (18:52 +0000)]
[Mips] Remove immarg test for intrinsics that no longer have an immarg after r372409.
llvm-svn: 372420
Kristof Umann [Fri, 20 Sep 2019 18:28:04 +0000 (18:28 +0000)]
Fix a documentation error
llvm-svn: 372419
Simon Pilgrim [Fri, 20 Sep 2019 18:21:31 +0000 (18:21 +0000)]
Fix -Wdocumentation warning. NFCI.
llvm-svn: 372418
Jinsong Ji [Fri, 20 Sep 2019 18:21:07 +0000 (18:21 +0000)]
[NFC][PowerPC] Refactor classifyGlobalReference
We always(and only) check the NLP flag after calling
classifyGlobalReference to see whether it is accessed
indirectly.
Refactor to code to use isGVIndirectSym instead.
llvm-svn: 372417
Simon Pilgrim [Fri, 20 Sep 2019 18:10:17 +0000 (18:10 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.
llvm-svn: 372416
Richard Smith [Fri, 20 Sep 2019 18:09:05 +0000 (18:09 +0000)]
[www] Turn 'Clang 9' boxes green in C++ status pages now Clang 9 is
released.
llvm-svn: 372415
Kristof Umann [Fri, 20 Sep 2019 17:59:20 +0000 (17:59 +0000)]
Reland '[analyzer][MallocChecker][NFC] Document and reorganize some functions'
Differential Revision: https://reviews.llvm.org/D54823
llvm-svn: 372414
Roman Lebedev [Fri, 20 Sep 2019 17:43:46 +0000 (17:43 +0000)]
[NFC][InstCombine] Fixup newly-added tests
llvm-svn: 372413
Evgeniy Stepanov [Fri, 20 Sep 2019 17:36:27 +0000 (17:36 +0000)]
[MTE] Handle MTE instructions in AArch64LoadStoreOptimizer.
Summary: Generate pre- and post-indexed forms of ST*G and STGP when possible.
Reviewers: ostannard, vitalybuka
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67741
llvm-svn: 372412
Adrian Prantl [Fri, 20 Sep 2019 17:15:57 +0000 (17:15 +0000)]
Doxygenify comments.
llvm-svn: 372411
Yitzhak Mandelbaum [Fri, 20 Sep 2019 17:11:03 +0000 (17:11 +0000)]
[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.
Summary:
Adds two new combinators and corresponding tests to the RangeSelector library.
* `ifBound` -- conditional evaluation of range-selectors, based on whether a
given node id is bound in the match.
* `elseBranch` -- selects the source range of the else and its statement.
Reviewers: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67621
llvm-svn: 372410
Craig Topper [Fri, 20 Sep 2019 16:49:51 +0000 (16:49 +0000)]
[SelectionDAG][Mips][Sparc] Don't allow SimplifyDemandedBits to constant fold TargetConstant nodes to a Constant.
Summary:
After the switch in SimplifyDemandedBits, it tries to create a
constant when possible. If the original node is a TargetConstant
the default in the switch will call computeKnownBits on the
TargetConstant which will succeed. This results in the
TargetConstant becoming a Constant. But TargetConstant exists to
avoid being changed.
I've fixed the two cases that relied on this in tree by explicitly
making the nodes constant instead of target constant. The Sparc
case is an old bug. The Mips case was recently introduced now that
ImmArg on intrinsics gets turned into a TargetConstant when the
SelectionDAG is created. I've removed the ImmArg since it lowers
to generic code.
Reviewers: arsenm, RKSimon, spatel
Subscribers: jyknight, sdardis, wdng, arichardson, hiraditya, fedor.sergeev, jrtc27, atanasyan, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67802
llvm-svn: 372409
Sebastian Pop [Fri, 20 Sep 2019 16:33:33 +0000 (16:33 +0000)]
[aarch64] add def-pats for dot product
This patch adds the patterns to select the dot product instructions.
Tested on aarch64-linux with make check-all.
Differential Revision: https://reviews.llvm.org/D67645
llvm-svn: 372408
Saleem Abdulrasool [Fri, 20 Sep 2019 15:53:42 +0000 (15:53 +0000)]
Unwind: prevent unw_get_proc_info from returning stale data
If unwind info is not available at the current IP, unw_get_proc_info should
return a zero-filled structure rather than the info of the previous IP.
This change also makes unw_get_proc_info return UNW_ENOINFO instead of
UNW_ESUCCESS.
Patch by Amanieu d'Antras!
llvm-svn: 372407
Stanislav Mekhanoshin [Fri, 20 Sep 2019 15:26:10 +0000 (15:26 +0000)]
Remove assert from MachineLoop::getLoopPredecessor()
According to the documentation method returns predecessor
if the given loop's header has exactly one unique predecessor
outside the loop. Otherwise return null.
In reality it asserts if there is no predecessor outside of
the loop.
The testcase has the loop where predecessors outside of the
loop were not identified as analyzeBranch() was unable to
process the mask branch and returned true. That is also not
correct to assert for the truly dead loops.
Differential Revision: https://reviews.llvm.org/D67634
llvm-svn: 372405
Krzysztof Parzyszek [Fri, 20 Sep 2019 15:19:20 +0000 (15:19 +0000)]
[MVT] Add v256i1 to MachineValueType
This type can show up when lowering some HVX vector code on Hexagon.
llvm-svn: 372403
Roman Lebedev [Fri, 20 Sep 2019 15:06:47 +0000 (15:06 +0000)]
[InstCombine] Tests for (a+b)<=a && (a+b)!=0 fold (PR43259)
https://rise4fun.com/Alive/knp
https://rise4fun.com/Alive/ALap
llvm-svn: 372402
Oliver Cruickshank [Fri, 20 Sep 2019 15:03:44 +0000 (15:03 +0000)]
[ARM] Fix CTTZ not generating correct instructions MVE
CTTZ intrinsic should have been set to Custom, not Expand
llvm-svn: 372401
Fangrui Song [Fri, 20 Sep 2019 15:03:21 +0000 (15:03 +0000)]
[ELF] Error if the linked-to section of a SHF_LINK_ORDER section is discarded
Summary:
If st_link(A)=B, and A has the SHF_LINK_ORDER flag, we may dereference
a null pointer if B is garbage collected (PR43147):
1. In Wrter.cpp:compareByFilePosition, `aOut->sectionIndex` or `bOut->sectionIndex`
2. In OutputSections::finalize, `d->getParent()->sectionIndex`
Simply error and bail out to avoid null pointer dereferences. ld.bfd has
a similar error:
sh_link of section `.bar' points to discarded section `.foo0' of `a.o'
ld.bfd is more permissive in that it just checks whether the linked-to
section of the first input section is discarded. This is likely because
it sets sh_link of the output section according to the first input
section.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D67761
llvm-svn: 372400
Francesco Petrogalli [Fri, 20 Sep 2019 15:02:32 +0000 (15:02 +0000)]
[docs] Remove training whitespaces. NFC
Subscribers: jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67835
llvm-svn: 372399
David Stenberg [Fri, 20 Sep 2019 14:41:41 +0000 (14:41 +0000)]
Add a missing space in a MIR parser error message
llvm-svn: 372398
GN Sync Bot [Fri, 20 Sep 2019 14:39:52 +0000 (14:39 +0000)]
gn build: Merge r372396
llvm-svn: 372397
Cyndy Ishida [Fri, 20 Sep 2019 14:32:34 +0000 (14:32 +0000)]
[TextAPI] Arch&Platform to Target
Summary:
This is a patch for updating TextAPI/Macho to read in targets as opposed to arch/platform.
This is because in previous versions tbd files only supported a single platform but that is no longer the case,
so, now its tracked by unique triples.
This precedes a seperate patch that will add the TBD-v4 format
Reviewers: ributzka, steven_wu, plotfi, compnerd, smeenai
Reviewed By: ributzka
Subscribers: mgorny, hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67527
llvm-svn: 372396
Fangrui Song [Fri, 20 Sep 2019 14:31:42 +0000 (14:31 +0000)]
Use llvm::StringLiteral instead of StringRef in few places
llvm-svn: 372395
Yaxun Liu [Fri, 20 Sep 2019 14:28:09 +0000 (14:28 +0000)]
[CUDA][HIP] Fix hostness of defaulted constructor
Clang does not respect the explicit device host attributes of defaulted special members.
Also clang does not respect the hostness of special members determined by their
first declarations.
Clang also adds duplicate implicit device or host attributes in certain cases.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D67509
llvm-svn: 372394
Sanjay Patel [Fri, 20 Sep 2019 14:17:00 +0000 (14:17 +0000)]
[SLPVectorizer] add tests for bogus reductions; NFC
https://bugs.llvm.org/show_bug.cgi?id=42708
https://bugs.llvm.org/show_bug.cgi?id=43146
llvm-svn: 372393
David Zarzycki [Fri, 20 Sep 2019 13:52:47 +0000 (13:52 +0000)]
[Testing] Python 3 requires `print` to use parens
llvm-svn: 372392
Luis Marques [Fri, 20 Sep 2019 13:48:02 +0000 (13:48 +0000)]
[RISCV] Fix static analysis issues
Unlikely to be problematic but still worth fixing.
Differential Revision: https://reviews.llvm.org/D67640
llvm-svn: 372391
Guillaume Chatelet [Fri, 20 Sep 2019 13:40:31 +0000 (13:40 +0000)]
[Alignment][NFC] migrate DataLayout internal struct to llvm::Align
Summary:
This is patch is part of a series 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
With this patch the PointerAlignElem struct goes from 20B to 16B.
Reviewers: courbet
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67400
llvm-svn: 372390
David Tellenbach [Fri, 20 Sep 2019 13:22:59 +0000 (13:22 +0000)]
[FastISel] Fix insertion of unconditional branches during FastISel
The insertion of an unconditional branch during FastISel can differ depending on
building with or without debug information. This happens because FastISel::fastEmitBranch
emits an unconditional branch depending on the size of the current basic block
without distinguishing between debug and non-debug instructions.
This patch fixes this issue by ignoring debug instructions when getting the size
of the basic block.
Reviewers: aprantl
Reviewed By: aprantl
Subscribers: ormris, aprantl, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67703
llvm-svn: 372389
Dmitri Gribenko [Fri, 20 Sep 2019 13:19:32 +0000 (13:19 +0000)]
[clang-tidy] Fix relative path in header-filter.
Summary:
Clang-tidy supports output diagnostics from header files if user
specifies --header-filter. But it can't handle relative path well.
For example, the folder structure of a project is:
```
// a.h is in /src/a/a.h
// b.h is in /src/b/b.h
...
// c.cpp is in /src/c.cpp
```
Now, we set --header-filter as --header-filter=/a/. That means we only
want to check header files under /src/a/ path, and ignore header files
uder /src/b/ path, but in current implementation, clang-tidy will check
/src/b/b.h also, because the name of b.h used in clang-tidy is
/src/a/../b/b.h.
This change tries to fix this issue.
Reviewers: alexfh, hokein, aaron.ballman, gribozavr
Reviewed By: gribozavr
Subscribers: MyDeveloperDay, xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D67501
Patch by Yubo Xie.
llvm-svn: 372388
Jonas Paulsson [Fri, 20 Sep 2019 13:13:50 +0000 (13:13 +0000)]
[SystemZ] Add SystemZ as supporting target in help text for -mfentry.
=> "Insert calls to fentry at function entry (x86/SystemZ only)"
Review: Ulrich Weigand
llvm-svn: 372387
Benjamin Kramer [Fri, 20 Sep 2019 12:59:29 +0000 (12:59 +0000)]
[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places
StringRef's constexpr constructor seems to be extremely slow in MSVC
2017, so don't use it for generated tables. Should make PR43369 a bit
better, no functionality change.
llvm-svn: 372386
Raphael Isemann [Fri, 20 Sep 2019 12:52:55 +0000 (12:52 +0000)]
Move decl completion out of the ASTImporterDelegate and document it [NFC]
Summary:
The ASTImporterDelegate is currently responsible for both recording and also completing
types. This patch moves the actual completion and recording code outside the ASTImporterDelegate
to reduce the amount of responsibilities the ASTImporterDelegate has to fulfill.
As I anyway had to touch the code when moving I also documented and refactored most of it
(e.g. no more asserts that we call the deporting start/end function always as a pair).
Note that I had to make the ASTImporterDelegate and it's related functions public now so that
I can move out the functionality in another class (that doesn't need to be in the header).
Reviewers: shafik, aprantl, martong, a.sidorin
Reviewed By: martong
Subscribers: rnkovacs, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D61478
llvm-svn: 372385
Bjorn Pettersson [Fri, 20 Sep 2019 12:13:12 +0000 (12:13 +0000)]
[AMDGPU] Use std::make_tuple to make some toolchains happy again
My toolchain stopped working (LLVM 8.0 , libstdc++ 5.4.0) after
r372338.
The same problem was seen in clang-cuda-build buildbots:
clang-cuda-build/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp:763:12:
error: chosen constructor is explicit in copy-initialization
return {Reg, 0, nullptr};
^~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/tuple:479:19:
note: explicit constructor declared here
constexpr tuple(_UElements&&... __elements)
^
This commit adds explicit calls to std::make_tuple to work around
the problem.
llvm-svn: 372384
Nico Weber [Fri, 20 Sep 2019 12:05:29 +0000 (12:05 +0000)]
Revert r372366 "Use getTargetConstant for BLENDI, and add a test to catch it."
This reverts commit
52621307bcab2013e8833f3317cebd63a6db3885.
Tests have been failing all night with
[0/2] ACTION //llvm/test:check-llvm(//llvm/utils/gn/build/toolchain:unix)
-- Testing: 33647 tests, 64 threads --
Testing: 0 .. 10..
UNRESOLVED: LLVM :: CodeGen/AMDGPU/GlobalISel/isel-blendi-gettargetconstant.ll (6943 of 33647)
******************** TEST 'LLVM :: CodeGen/AMDGPU/GlobalISel/isel-blendi-gettargetconstant.ll' FAILED ********************
Test has no run line!
********************
Since there were other concerns on https://reviews.llvm.org/D67785,
I'm just reverting for now.
llvm-svn: 372383
Raphael Isemann [Fri, 20 Sep 2019 10:30:38 +0000 (10:30 +0000)]
[lldb][NFC] Remove unused include in TestLineEntry.cpp
llvm-svn: 372381
Kerry McLaughlin [Fri, 20 Sep 2019 09:48:21 +0000 (09:48 +0000)]
[IntrinsicEmitter] Add overloaded types for SVE intrinsics (Subdivide2 & Subdivide4)
Summary:
Both match the type of another intrinsic parameter of a vector type, but where each element is subdivided to form a vector with more elements of a smaller type.
Subdivide2Argument allows intrinsics such as the following to be defined:
- declare <vscale x 4 x i32> @llvm.something.nxv4i32(<vscale x 8 x i16>)
Subdivide4Argument allows intrinsics such as:
- declare <vscale x 4 x i32> @llvm.something.nxv4i32(<vscale x 16 x i8>)
Tests are included in follow up patches which add intrinsics using these types.
Reviewers: sdesmalen, SjoerdMeijer, greened, rovka
Reviewed By: sdesmalen
Subscribers: rovka, tschuett, jdoerfert, cfe-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67549
llvm-svn: 372380
David Tellenbach [Fri, 20 Sep 2019 09:43:31 +0000 (09:43 +0000)]
[NFC] Test commit, deleting some whitespace
llvm-svn: 372379
Djordje Todorovic [Fri, 20 Sep 2019 09:25:11 +0000 (09:25 +0000)]
[llvm-dwarfdump] Adjust Windows path to be acceptable by JSON
Backslash is a special character according to JSON specification,
so we should avoid that when printing a file path with the
--statistics option.
Differential Revision: https://reviews.llvm.org/D67699
llvm-svn: 372378
George Rimar [Fri, 20 Sep 2019 09:15:36 +0000 (09:15 +0000)]
[yaml2obj/obj2yaml] - Do not trigger llvm_unreachable when dumping/parsing relocations and e_machine is unsupported.
Currently when e_machine is set to something that is not supported by YAML lib,
then tools fail with llvm_unreachable.
In this patch I allow them to handle relocations in this case.
It can be used to dump and create objects for broken or unsupported targets.
Differential revision: https://reviews.llvm.org/D67657
llvm-svn: 372377
James Molloy [Fri, 20 Sep 2019 08:57:46 +0000 (08:57 +0000)]
[MachinePipeliner] Improve the TargetInstrInfo API analyzeLoop/reduceLoopCount
The way MachinePipeliner uses these target hooks is stateful - we reduce trip
count by one per call to reduceLoopCount. It's a little overfit for hardware
loops, where we don't have to worry about stitching a loop induction variable
across prologs and epilogs (the induction variable is implicit).
This patch introduces a new API:
/// Analyze loop L, which must be a single-basic-block loop, and if the
/// conditions can be understood enough produce a PipelinerLoopInfo object.
virtual std::unique_ptr<PipelinerLoopInfo>
analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const;
The return value is expected to be an implementation of the abstract class:
/// Object returned by analyzeLoopForPipelining. Allows software pipelining
/// implementations to query attributes of the loop being pipelined.
class PipelinerLoopInfo {
public:
virtual ~PipelinerLoopInfo();
/// Return true if the given instruction should not be pipelined and should
/// be ignored. An example could be a loop comparison, or induction variable
/// update with no users being pipelined.
virtual bool shouldIgnoreForPipelining(const MachineInstr *MI) const = 0;
/// Create a condition to determine if the trip count of the loop is greater
/// than TC.
///
/// If the trip count is statically known to be greater than TC, return
/// true. If the trip count is statically known to be not greater than TC,
/// return false. Otherwise return nullopt and fill out Cond with the test
/// condition.
virtual Optional<bool>
createTripCountGreaterCondition(int TC, MachineBasicBlock &MBB,
SmallVectorImpl<MachineOperand> &Cond) = 0;
/// Modify the loop such that the trip count is
/// OriginalTC + TripCountAdjust.
virtual void adjustTripCount(int TripCountAdjust) = 0;
/// Called when the loop's preheader has been modified to NewPreheader.
virtual void setPreheader(MachineBasicBlock *NewPreheader) = 0;
/// Called when the loop is being removed.
virtual void disposed() = 0;
};
The Pipeliner (ModuloSchedule.cpp) can use this object to modify the loop while
allowing the target to hold its own state across all calls. This API, in
particular the disjunction of creating a trip count check condition and
adjusting the loop, improves the code quality in ModuloSchedule.cpp.
llvm-svn: 372376
Florian Hahn [Fri, 20 Sep 2019 08:33:11 +0000 (08:33 +0000)]
[CallSiteSplitting] Remove unused includes (NFC).
llvm-svn: 372375
Owen Reynolds [Fri, 20 Sep 2019 08:10:14 +0000 (08:10 +0000)]
Reapply [llvm-ar] Include a line number when failing to parse an MRI script
Reapply r372309
Errors that occur when reading an MRI script now include a corresponding
line number.
Differential Revision: https://reviews.llvm.org/D67449
llvm-svn: 372374
Craig Topper [Fri, 20 Sep 2019 07:00:22 +0000 (07:00 +0000)]
[X86] Convert tbm_bextri_u32/tbm_bextri_u64 intrinsics TargetConstant argument to a regular Constant during lowering.
We reuse an ISD opcode here that can be reached from BMI that
doesn't require it to be an immediate. Our isel patterns to match
the TBM immediate form require a Constant and not a TargetConstant.
We were accidentally getting the Constant due to a quirk of
combineBEXTR calling SimplifyDemandedBits. The call to
SimplifyDemandedBits ended up constant folding the TargetConstant
to a regular Constant. But we should probably instead be asserting
if SimplifyDemandedBits on a TargetConstant so we shouldn't rely
on this behavior.
llvm-svn: 372373
Yuanfang Chen [Fri, 20 Sep 2019 06:33:03 +0000 (06:33 +0000)]
[llvm-readobj] flush output before crash
Otherwise the output could be lost.
llvm-svn: 372372
Craig Topper [Fri, 20 Sep 2019 06:00:35 +0000 (06:00 +0000)]
[X86] Use timm in MMX pinsrw/pextrw isel patterns. Add missing test cases.
This fixes an isel failure after r372338.
llvm-svn: 372371
Fangrui Song [Fri, 20 Sep 2019 04:40:44 +0000 (04:40 +0000)]
[llvm-ar] Removes repetition in the error message
As per bug 40244, fixed an error where the error message was repeated.
Differential Revision: https://reviews.llvm.org/D67038
Patch by Yu Jian (wyjw)
llvm-svn: 372370
Fangrui Song [Fri, 20 Sep 2019 04:40:38 +0000 (04:40 +0000)]
[Object] Uncapitalize an error message
Test case will be added by my next commit.
llvm-svn: 372369
Richard Smith [Fri, 20 Sep 2019 03:29:19 +0000 (03:29 +0000)]
Finish building the full-expression for a static_assert expression
before evaluating it rather than afterwards.
This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.
No significant functionality change intended (though this fixes a bug
only visible through libclang / -ast-dump / tooling: we now store the
converted condition on the StaticAssertDecl rather than the original).
llvm-svn: 372368
Nico Weber [Fri, 20 Sep 2019 03:13:16 +0000 (03:13 +0000)]
llvm-undname: Delete an empty, unused method.
llvm-svn: 372367
Sterling Augustine [Fri, 20 Sep 2019 02:29:16 +0000 (02:29 +0000)]
Use getTargetConstant for BLENDI, and add a test to catch it.
Summary: This fixes a crasher introduced by r372338.
Reviewers: echristo, arsenm
Subscribers: jvesely, wdng, nhaehnle, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67785
Tighten up the test case.
llvm-svn: 372366
Craig Topper [Fri, 20 Sep 2019 01:49:46 +0000 (01:49 +0000)]
[X86] Remove the special isBuildVectorOfConstantSDNodes handling from LowerBUILD_VECTORvXi1.
The later code that generates a constant when there are
some non-const elements works basically the same and doesn't
require there to be any non-const elements.
llvm-svn: 372365
Haibo Huang [Fri, 20 Sep 2019 00:45:26 +0000 (00:45 +0000)]
Revert "Fix swig python package path"
Summary: This reverts commit
5a115e81cdd40c758b10c382aeffc0c8de6930e2.
Reviewers: JDevlieghere, ZeGentzy
Subscribers: mgorny, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67781
llvm-svn: 372364
Alex Langford [Fri, 20 Sep 2019 00:16:32 +0000 (00:16 +0000)]
[NFCI] Always initialize const members of AttributeCommonInfo
Some compilers require that const fields of an object must be explicitly
initialized by the constructor. I ran into this issue building with
clang 3.8 on Ubuntu 16.04.
llvm-svn: 372363
Matt Arsenault [Fri, 20 Sep 2019 00:09:15 +0000 (00:09 +0000)]
MachineScheduler: Fix missing dependency with multiple subreg defs
If an instruction had multiple subregister defs, and one of them was
undef, this would improperly conclude all other lanes are
killed. There could still be other defs of those read-undef lanes in
other operands. This would improperly remove register uses from
CurrentVRegUses, so the visitation of later operands would not find
the necessary register dependency. This would also mean this would
fail or not depending on how different subregister def operands were
ordered.
On an undef subregister def, scan the instruction for other
subregister defs and avoid killing those.
This possibly should be deferring removing anything from
CurrentVRegUses until the entire instruction has been processed
instead.
llvm-svn: 372362
Nicholas Allegra [Thu, 19 Sep 2019 23:00:31 +0000 (23:00 +0000)]
[Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.
Differential Revision: https://reviews.llvm.org/D67743
llvm-svn: 372361
Alex Lorenz [Thu, 19 Sep 2019 22:39:24 +0000 (22:39 +0000)]
Fix for stringized function-macro args continued across lines
In case of certain #define'd macros, there's a space just before line continuation
that the minimized-source lexer was missing to include, resulting in invalid stringize.
Patch by: kousikk (Kousik Kumar)
Differential Revision: https://reviews.llvm.org/D67635
llvm-svn: 372360
Richard Smith [Thu, 19 Sep 2019 22:00:16 +0000 (22:00 +0000)]
Model converted constant expressions as full-expressions.
This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.
No functionality change intended.
llvm-svn: 372359
Thomas Lively [Thu, 19 Sep 2019 21:51:52 +0000 (21:51 +0000)]
[WebAssembly][NFC] Remove unnecessary braces
llvm-svn: 372358