Mitch Phillips [Tue, 2 Jul 2019 21:58:19 +0000 (21:58 +0000)]
Only use -mno-omit-leaf-frame-pointer with clang builds.
Fix build breakage caused by D64085
llvm-svn: 364972
Alex Lorenz [Tue, 2 Jul 2019 21:37:00 +0000 (21:37 +0000)]
[triple] add 'macCatalyst' environment type
Mac Catalyst is a new deployment platform in macOS Catalina.
Differential Revision: https://reviews.llvm.org/D64097
llvm-svn: 364971
Eli Friedman [Tue, 2 Jul 2019 21:35:15 +0000 (21:35 +0000)]
[ARM] Fix unwind info for Thumb1 functions that save high registers.
There were two issues here: one, some of the relevant instructions were
missing the expected "FrameSetup" flag, and two,
ARMAsmPrinter::EmitUnwindingInstruction wasn't expecting "mov"
instructions in the prologue.
I'm sticking the additional state into ARMFunctionInfo so it's obvious
it only applies to the current function.
I considered a few alternative approaches where we would compute the
correct unwind information as part of the prologue/epilogue lowering,
but it seems like a lot of work to introduce pseudo-instructions, and
the current code seems to be reliable enough.
Fixes https://bugs.llvm.org/show_bug.cgi?id=42408.
Differential Revision: https://reviews.llvm.org/D63964
llvm-svn: 364970
David Bolvansky [Tue, 2 Jul 2019 21:16:34 +0000 (21:16 +0000)]
[NFC] Strenghten isInteger condition for rL364940
llvm-svn: 364969
Teresa Johnson [Tue, 2 Jul 2019 21:07:45 +0000 (21:07 +0000)]
[ThinLTO] Address post-review suggestions for index-based WPD summary
Removes a couple of unnecessary and/or redundant checks introduced by
r364960.
llvm-svn: 364968
Raphael Isemann [Tue, 2 Jul 2019 21:07:25 +0000 (21:07 +0000)]
[lldb] Mention automatic codesign setup script [NFC]
The script is the modern way of getting the certificate, so we should mention it in
the documentation.
Patch idea by Davidino Italiano!
llvm-svn: 364967
Mitch Phillips [Tue, 2 Jul 2019 20:33:19 +0000 (20:33 +0000)]
[GWP-ASan] [Scudo] Add GWP-ASan backtrace for alloc/free to Scudo.
Summary:
Adds allocation and deallocation stack trace support to Scudo. The
default provided backtrace library for GWP-ASan is supplied by the libc
unwinder, and is suitable for production variants of Scudo. If Scudo in future
has its own unwinder, it may choose to use its own over the generic unwinder
instead.
Reviewers: cryptoad
Reviewed By: cryptoad
Subscribers: kubamracek, mgorny, #sanitizers, llvm-commits, morehouse, vlad.tsyrklevich, eugenis
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D64085
llvm-svn: 364966
Teresa Johnson [Tue, 2 Jul 2019 20:24:00 +0000 (20:24 +0000)]
[gold] Fix test after BitStream reader error changes
The recent change to the BitStream reader error handling in r364464
changed the error message format (from "LLVM ERROR:" to just "error"),
leading to a failure in this test which is only executed for very recent
versions of gold. Fix this by removing that part of the error message
check, leaving only the interesting part of the message to be checked.
llvm-svn: 364965
Vasileios Porpodas [Tue, 2 Jul 2019 20:20:28 +0000 (20:20 +0000)]
[SLP] Recommit: Look-ahead operand reordering heuristic.
Summary: This patch introduces a new heuristic for guiding operand reordering. The new "look-ahead" heuristic can look beyond the immediate predecessors. This helps break ties when the immediate predecessors have identical opcodes (see lit test for an example).
Reviewers: RKSimon, ABataev, dtemirbulatov, Ayal, hfinkel, rnk
Reviewed By: RKSimon, dtemirbulatov
Subscribers: hiraditya, phosek, rnk, rcorcs, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60897
llvm-svn: 364964
Julie Hockett [Tue, 2 Jul 2019 19:59:56 +0000 (19:59 +0000)]
[clang-doc] Serialize child namespaces and records
Serialization of child namespaces and records is now handled.
Namespaces can have child records and child namespaces.
Records can only have child records.
Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com).
Differential Revision: https://reviews.llvm.org/D63911
llvm-svn: 364963
Alex Langford [Tue, 2 Jul 2019 19:53:07 +0000 (19:53 +0000)]
[Symbol] Add DeclVendor::FindTypes
Summary:
Following up on the plan I outlined in D63622, we can remove the
dependence on clang in all the places where we only want to find the
types from the DeclVendor. This means that currently DeclVendor depends
on clang, but centralizing the dependency makes it easier to refactor
cleanly.
Differential Revision: https://reviews.llvm.org/D63853
llvm-svn: 364962
Jessica Paquette [Tue, 2 Jul 2019 19:44:16 +0000 (19:44 +0000)]
[AArch64][GlobalISel] Teach tryOptSelect to handle G_ICMP
This teaches `tryOptSelect` to handle folding G_ICMP, and removes the
requirement that the G_SELECT we're dealing with is floating point.
Some refactoring to make this work nicely as well:
- Factor out the scalar case from the selection code for G_ICMP into
`emitIntegerCompare`.
- Make `tryOptCMN` return a MachineInstr* instead of a bool.
- Make `tryOptCMN` not modify the instruction being selected.
- Factor out the CMN emission into `emitCMN` for readability.
By doing this this way, we can get all of the compare selection optimizations
in select emission.
Differential Revision: https://reviews.llvm.org/D64084
llvm-svn: 364961
Teresa Johnson [Tue, 2 Jul 2019 19:38:02 +0000 (19:38 +0000)]
[ThinLTO] Add summary entries for index-based WPD
Summary:
If LTOUnit splitting is disabled, the module summary analysis computes
the summary information necessary to perform single implementation
devirtualization during the thin link with the index and no IR. The
information collected from the regular LTO IR in the current hybrid WPD
algorithm is summarized, including:
1) For vtable definitions, record the function pointers and their offset
within the vtable initializer (subsumes the information collected from
IR by tryFindVirtualCallTargets).
2) A record for each type metadata summarizing the vtable definitions
decorated with that metadata (subsumes the TypeIdentiferMap collected
from IR).
Also added are the necessary bitcode records, and the corresponding
assembly support.
The follow-on index-based WPD patch is D55153.
Depends on D53890.
Reviewers: pcc
Subscribers: mehdi_amini, Prazek, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D54815
llvm-svn: 364960
Matt Arsenault [Tue, 2 Jul 2019 19:15:45 +0000 (19:15 +0000)]
AMDGPU: Custom lower vector_shuffle for v4i16/v4f16
Ordinarily it is lowered as a build_vector of each extract_vector_elt,
which in turn get lowered to bitcasts and bit shifts. Very little
understand the lowered extract pattern, resulting in much worse
code. We treat concat_vectors of v2i16 as legal, so prefer that.
llvm-svn: 364959
Teresa Johnson [Tue, 2 Jul 2019 18:54:03 +0000 (18:54 +0000)]
[RA] Fix spelling of Greedy register allocator internal option
The internal option added with r323870 has a typo. It isn't being used
by any tests, but I decided to fix the spelling and leave it in for use
in debugging the changes added in that patch.
llvm-svn: 364958
Craig Topper [Tue, 2 Jul 2019 18:39:59 +0000 (18:39 +0000)]
[X86] Copy test cases from vector-zext.ll to vector-zext-widen.ll. Same for vector-sext.ll. NFC
llvm-svn: 364957
Lang Hames [Tue, 2 Jul 2019 18:39:32 +0000 (18:39 +0000)]
[lli] Fix a typo in a header.
llvm-svn: 364956
Yuanfang Chen [Tue, 2 Jul 2019 18:38:17 +0000 (18:38 +0000)]
[llvm-objdump] Warn if no user specified sections (-j) are not found.
Match GNU objdump.
https://bugs.llvm.org/show_bug.cgi?id=41898
Reviewers: jhenderson, grimar, MaskRay, rupprecht
Reviewed by: jhenderson, grimar, MaskRay
Differential Revision: https://reviews.llvm.org/D63779
llvm-svn: 364955
Erik Pilkington [Tue, 2 Jul 2019 18:28:13 +0000 (18:28 +0000)]
[C++2a] Add __builtin_bit_cast, used to implement std::bit_cast
This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a
bit_cast from a value v to a type T. This expression can be evaluated at
compile time under specific circumstances.
The compile time evaluation currently doesn't support bit-fields, but I'm
planning on fixing this in a follow up (some of the logic for figuring this out
is in CodeGen). I'm also planning follow-ups for supporting some more esoteric
types that the constexpr evaluator supports, as well as extending
__builtin_memcpy constexpr evaluation to use the same infrastructure.
rdar://
44987528
Differential revision: https://reviews.llvm.org/D62825
llvm-svn: 364954
Simon Pilgrim [Tue, 2 Jul 2019 18:20:38 +0000 (18:20 +0000)]
[X86] getTargetConstantBitsFromNode - remove unnecessary getZExtValue() (PR42486)
Don't use APInt::getZExtValue() if you can avoid it - eventually someone will call it with i128 or something that doesn't fit into 64-bits.
In this case it was completely superfluous as we'd moved the rest of the code to always use APInt.
Fixes the <1 x i128> addition bug in PR42486
llvm-svn: 364953
Alexander Timofeev [Tue, 2 Jul 2019 18:16:42 +0000 (18:16 +0000)]
[AMDGPU] LCSSA pass added in preISel. Fixing typo in previous commit
llvm-svn: 364952
Jonas Devlieghere [Tue, 2 Jul 2019 18:04:55 +0000 (18:04 +0000)]
Revert "[swig] Define attribute(ref) instead of accessing swig internals."
This reverts commit
f9b91a52797325ccaaee229e414beae7c03f1948.
llvm-svn: 364951
Alexander Timofeev [Tue, 2 Jul 2019 17:59:44 +0000 (17:59 +0000)]
[AMDGPU] LCSSA pass added in preISel. Uniform values defined in the divergent loop and used outside
Differential Revision: https://reviews.llvm.org/D63953
Reviewers: rampitec, nhaehnle, arsenm
llvm-svn: 364950
Julie Hockett [Tue, 2 Jul 2019 17:57:11 +0000 (17:57 +0000)]
[clang-doc] Fix segfault in comment sorting
Differential Revision: https://reviews.llvm.org/D63962
llvm-svn: 364949
Craig Topper [Tue, 2 Jul 2019 17:51:02 +0000 (17:51 +0000)]
[X86] Add patterns to select (scalar_to_vector (loadf32)) as (V)MOVSSrm instead of COPY_TO_REGCLASS + (V)MOVSSrm_alt.
Similar for (V)MOVSD. Ultimately, I'd like to see about folding
scalar_to_vector+load to vzload. Which would select as (V)MOVSSrm
so this is closer to that.
llvm-svn: 364948
Julian Lettner [Tue, 2 Jul 2019 17:32:04 +0000 (17:32 +0000)]
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.7
Factor out `ExtractLongJmpSp` helper function and move platform-specific
code to tsan_platform_{linux,mac}.cc.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D64050
llvm-svn: 364947
Jonas Devlieghere [Tue, 2 Jul 2019 17:25:20 +0000 (17:25 +0000)]
[swig] Define attribute(ref) instead of accessing swig internals.
As of SWIG 4.0, __swig_getmethods__ and __swig_setmethods__ are no
longer defined. The solution is to stop using these internal swig
dictionaries and use %attribute and %attributeref instead. I plan on
doing this incrementally, with this differential serving as an example.
Differential revision: https://reviews.llvm.org/D63530
llvm-svn: 364946
Roman Lebedev [Tue, 2 Jul 2019 16:48:49 +0000 (16:48 +0000)]
[NFC][Codegen][X86][AArch64][ARM][PowerPC] Recommit: Add test coverage for "add-of-inc" vs "sub-of-not"
I initially committed it with --check-prefix instead of --check-prefixes
(again, shame on me, and utils/update_*.py not complaining!)
and did not have a moment to understand the failure,
so i reverted it initially in rL64939.
llvm-svn: 364945
Vitaly Buka [Tue, 2 Jul 2019 16:08:10 +0000 (16:08 +0000)]
Fix GN build
llvm-svn: 364942
Mitch Phillips [Tue, 2 Jul 2019 16:04:52 +0000 (16:04 +0000)]
[GWP-ASan] Add generic unwinders and structure backtrace output.
Summary:
Adds two flavours of generic unwinder and all the supporting cruft. If the
supporting allocator is okay with bringing in sanitizer_common, they can use
the fast frame-pointer based unwinder from sanitizer_common. Otherwise, we also
provide the backtrace() libc-based unwinder as well. Of course, the allocator
can always specify its own unwinder and unwinder-symbolizer.
The slightly changed output format is exemplified in the first comment on this
patch. It now better incorporates backtrace information, and displays
allocation details on the second line.
Reviewers: eugenis, vlad.tsyrklevich
Reviewed By: eugenis, vlad.tsyrklevich
Subscribers: srhines, kubamracek, mgorny, cryptoad, #sanitizers, llvm-commits, morehouse
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D63841
llvm-svn: 364941
David Bolvansky [Tue, 2 Jul 2019 15:58:45 +0000 (15:58 +0000)]
[SimplifyLibCalls] powf(x, sitofp(n)) -> powi(x, n)
Summary:
Partially solves https://bugs.llvm.org/show_bug.cgi?id=42190
Reviewers: spatel, nikic, efriedma
Reviewed By: efriedma
Subscribers: efriedma, nikic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63038
llvm-svn: 364940
Roman Lebedev [Tue, 2 Jul 2019 15:54:24 +0000 (15:54 +0000)]
Revert "[NFC][Codegen][X86][AArch64][ARM][PowerPC] Add test coverage for "add-of-inc" vs "sub-of-not""
Some test failures i don't have a moment to investigate.
This reverts commit r364930.
llvm-svn: 364939
Sam McCall [Tue, 2 Jul 2019 15:53:14 +0000 (15:53 +0000)]
clang-format: Add new style option AlignConsecutiveMacros
This option behaves similarly to AlignConsecutiveDeclarations and
AlignConsecutiveAssignments, aligning the assignment of C/C++
preprocessor macros on consecutive lines.
I've worked in many projects (embedded, mostly) where header files full
of large, well-aligned "#define" blocks are a common pattern. We
normally avoid using clang-format on these files, since it ruins any
existing alignment in said blocks. This style option will align "simple"
PP macros (no parameters) and PP macros with parameter lists on
consecutive lines.
Related Bugzilla entry (thanks mcuddie):
https://llvm.org/bugs/show_bug.cgi?id=20637
Patch by Nick Renieris (VelocityRa)!
Differential Revision: https://reviews.llvm.org/D28462
llvm-svn: 364938
Serge Guelton [Tue, 2 Jul 2019 15:52:39 +0000 (15:52 +0000)]
Provide basic Full LTO extension points
Differential Revision: https://reviews.llvm.org/D61738
llvm-svn: 364937
Sam McCall [Tue, 2 Jul 2019 15:42:37 +0000 (15:42 +0000)]
getMainExecutable: handle realpath() failure, falling back to getprogpath().
Summary:
Previously, we'd pass a nullptr to std::string and crash().
This case happens when the binary is deleted while being used (e.g. rebuilding clangd).
Reviewers: kadircet
Subscribers: ilya-biryukov, kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64068
llvm-svn: 364936
Matt Arsenault [Tue, 2 Jul 2019 15:34:40 +0000 (15:34 +0000)]
AMDGPU: Fix broken test
llvm-svn: 364935
Andrey Churbanov [Tue, 2 Jul 2019 15:10:20 +0000 (15:10 +0000)]
Create a runtime option to disable task throttling.
Patch by viroulep (Philippe Virouleau)
Differential Revision: https://reviews.llvm.org/D63196
llvm-svn: 364934
Matt Arsenault [Tue, 2 Jul 2019 14:52:16 +0000 (14:52 +0000)]
AMDGPU/GlobalISel: Try generated matcher with intrinsics
llvm-svn: 364933
Matt Arsenault [Tue, 2 Jul 2019 14:52:14 +0000 (14:52 +0000)]
AMDGPU/GlobalISel: Select mul
llvm-svn: 364932
Matt Arsenault [Tue, 2 Jul 2019 14:49:29 +0000 (14:49 +0000)]
GlobalISel: Define GINodeEquiv for G_UMULH/G_SMULH
llvm-svn: 364931
Roman Lebedev [Tue, 2 Jul 2019 14:48:52 +0000 (14:48 +0000)]
[NFC][Codegen][X86][AArch64][ARM][PowerPC] Add test coverage for "add-of-inc" vs "sub-of-not"
As it is pointed out in https://reviews.llvm.org/D63992,
before we get to pick canonical variant in middle-end
we should ensure best codegen in backend.
llvm-svn: 364930
Paul Robinson [Tue, 2 Jul 2019 14:47:49 +0000 (14:47 +0000)]
Use --defsym instead of sed in a test. NFC
llvm-svn: 364929
Matt Arsenault [Tue, 2 Jul 2019 14:40:22 +0000 (14:40 +0000)]
AMDGPU/GlobalISel: Fix G_GEP with mixed SGPR/VGPR operands
The register bank for the destination of the sample argument copy was
wrong. We shouldn't be constraining each source to the result register
bank. Allow constraining the original register to the right size.
llvm-svn: 364928
Matt Arsenault [Tue, 2 Jul 2019 14:17:38 +0000 (14:17 +0000)]
AMDGPU/GlobalISel: Select G_FENCE
Manually select to workaround tablegen emitter emitting checks for
G_CONSTANT.
llvm-svn: 364927
Matt Arsenault [Tue, 2 Jul 2019 14:16:39 +0000 (14:16 +0000)]
GlobalISel: Add G_FENCE
The pattern importer is for some reason emitting checks for G_CONSTANT
for the immediate operands.
llvm-svn: 364926
Andrey Churbanov [Tue, 2 Jul 2019 13:45:40 +0000 (13:45 +0000)]
Cleanup of unused code
Patch by Terry Wilmarth
Differential Revision: https://reviews.llvm.org/D63891
llvm-svn: 364925
Simon Pilgrim [Tue, 2 Jul 2019 13:30:04 +0000 (13:30 +0000)]
[X86][AVX] combineX86ShuffleChain - pull out CombineShuffleWithExtract lambda. NFCI.
Pull out CombineShuffleWithExtract lambda to new combineX86ShuffleChainWithExtract wrapper and refactored it to handle more than 2 shuffle inputs - this will allow combineX86ShufflesRecursively to call this in a future patch.
llvm-svn: 364924
Kristof Umann [Tue, 2 Jul 2019 13:25:41 +0000 (13:25 +0000)]
Removed extra ; after function definition
llvm-svn: 364923
Yitzhak Mandelbaum [Tue, 2 Jul 2019 13:25:07 +0000 (13:25 +0000)]
[clang-tidy] Extend TransformerClangTidyCheck to support adding includes.
Summary:
This revision implements support for the `AddedIncludes` field in
RewriteRule cases; that is, it supports specifying the addition of include
directives in files modified by the clang tidy check.
Reviewers: ilya-biryukov, gribozavr
Subscribers: xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63893
llvm-svn: 364922
Roman Lebedev [Tue, 2 Jul 2019 13:21:23 +0000 (13:21 +0000)]
[NFC][TargetLowering] Some preparatory cleanups around 'prepareUREMEqFold()' from D63963
llvm-svn: 364921
Roman Lebedev [Tue, 2 Jul 2019 13:21:17 +0000 (13:21 +0000)]
[APIntTest] multiplicativeInverse(): clarify test
Clarify that multiplicative inverse exists for all odd numbers,
and does not exist for all even numbers (including 0).
llvm-svn: 364920
Paul Robinson [Tue, 2 Jul 2019 13:13:36 +0000 (13:13 +0000)]
Fix line endings (NFC)
llvm-svn: 364919
James Henderson [Tue, 2 Jul 2019 13:11:34 +0000 (13:11 +0000)]
[docs][llvm-readelf] Delete old llvm-readelf.md
This was accidentally missed when committing r364800.
llvm-svn: 364918
Yitzhak Mandelbaum [Tue, 2 Jul 2019 13:11:04 +0000 (13:11 +0000)]
[LibTooling] Extend `RewriteRule` with support for adding includes.
Summary:
This revision allows users to specify the insertion of an included directive (at
the top of the file being rewritten) as part of a rewrite rule. These
directives are bundled with `RewriteRule` cases, so that different cases can
potentially result in different include actions.
Reviewers: ilya-biryukov, gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63892
llvm-svn: 364917
George Rimar [Tue, 2 Jul 2019 12:58:37 +0000 (12:58 +0000)]
[Object/invalid.test] - Convert Object/corrupt.test to YAML and merge the result into invalid.test
Object/corrupt.test has the same purpose as Object/invalid.test:
it tests the behavior on invalid inputs.
In this patch I converted it to YAML, merged into invalid.test,
added comments and removed a few precompiled binaries.
Differential revision: https://reviews.llvm.org/D63927
llvm-svn: 364916
Roman Lebedev [Tue, 2 Jul 2019 12:54:48 +0000 (12:54 +0000)]
[InstCombine] Shift amount reassociation: fixup constantexpr handling (PR42484)
I was actually wondering if there was some nicer way than m_Value()+cast,
but apparently what i was really "subconsciously" thinking about
was correctness issue.
hasNoUnsignedWrap()/hasNoUnsignedWrap() exist for Instruction,
not for BinaryOperator, so let's just use m_Instruction(),
thus both avoiding a cast, and a crash.
Fixes https://bugs.llvm.org/show_bug.cgi?id=42484,
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15587
llvm-svn: 364915
Kristof Umann [Tue, 2 Jul 2019 12:40:29 +0000 (12:40 +0000)]
Attempt to fix buildbot failures with MSVC
llvm-svn: 364914
Fangrui Song [Tue, 2 Jul 2019 11:37:21 +0000 (11:37 +0000)]
[ELF] Only allow the binding of SharedSymbol to change for the first undef ref
Fixes PR42442
t.o has a STB_GLOBAL undef ref to f
t2.so has a STB_WEAK undef ref to f
t1.so defines f
ld.lld t.o t1.so t2.so currently sets the binding of `f` to STB_WEAK.
This is not correct because there exists a STB_GLOBAL undef ref from a
regular object. The problem is that resolveUndefined() doesn't check
if the undef ref is seen for the first time:
if (isShared() || isLazy() || (isUndefined() && Other.Binding != STB_WEAK))
Binding = Other.Binding;
The isShared() condition should be `isShared() && !Referenced`
where Referenced is set to true after an undef ref is seen.
In practice, when linking a pthread program with glibc:
// a.o
#include <pthread.h>
pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
int main() { pthread_mutex_unlock(&mu); }
{clang,gcc} -fuse-ld=lld a.o -lpthread # libpthread.so is linked before libgcc_s.so.1
The weak undef pthread_mutex_unlock in libgcc_s.so.1 makes the result
weak, which diverges from GNU linkers where STB_DEFAULT is used:
23:
0000000000000000 0 FUNC WEAK DEFAULT UND pthread_mutex_lock
(Note, if -pthread is used instead, libpthread.so will be linked **after**
libgcc_s.so.1 . lld sets the binding to the expected STB_GLOBAL)
Similar linking sequences (ld.lld t.o t1.so t2.so) appear to be used by
Go, which cause a build error https://github.com/golang/go/issues/31912.
Reviewed By: grimar, ruiu
Differential Revision: https://reviews.llvm.org/D63974
llvm-svn: 364913
Michal Gorny [Tue, 2 Jul 2019 11:32:03 +0000 (11:32 +0000)]
[llvm] [Support] Clean PrintStackTrace() ptr arithmetic up
Use '%tu' modifier for pointer arithmetic since we are using C++11
already. Prefer static_cast<> over C-style cast. Remove unnecessary
conversion of result, and add const qualifier to converted pointers,
to silence the following warning:
In file included from /home/mgorny/llvm-project/llvm/lib/Support/Signals.cpp:220:0:
/home/mgorny/llvm-project/llvm/lib/Support/Unix/Signals.inc: In function ‘void llvm::sys::PrintStackTrace(llvm::raw_ostream&)’:
/home/mgorny/llvm-project/llvm/lib/Support/Unix/Signals.inc:546:53: warning: cast from type ‘const void*’ to type ‘char*’ casts away qualifiers [-Wcast-qual]
(char*)dlinfo.dli_saddr));
^~~~~~~~~
Differential Revision: https://reviews.llvm.org/D63888
llvm-svn: 364912
Kristof Umann [Tue, 2 Jul 2019 11:30:12 +0000 (11:30 +0000)]
[IDF] Generalize IDFCalculator to be used with Clang's CFG
I'm currently working on a GSoC project that aims to improve the the bug reports
of the analyzer. The main heuristic I plan to use is to explain values that are
a control dependency of the bug location better.
01 bool b = messyComputation();
02 int i = 0;
03 if (b) // control dependency of the bug site, let's explain why we assume val
04 // to be true
05 10 / i; // warn: division by zero
Because of this, I'd like to generalize IDFCalculator so that I could use it for
Clang's CFG: D62883.
In detail:
* Rename IDFCalculator to IDFCalculatorBase, make it take a general CFG node
type as a template argument rather then strictly BasicBlock (but preserve
ForwardIDFCalculator and ReverseIDFCalculator)
* Move IDFCalculatorBase from llvm/include/llvm/Analysis to
llvm/include/llvm/Support (but leave the BasicBlock variants in
llvm/include/llvm/Analysis)
* clang-format the file since this patch messes up git blame anyways
* Change typedef to using
* Add the new type ChildrenGetterTy, and store an instance of it in
IDFCalculatorBase. This is important because I'll have to specialize it for
Clang's CFG to filter out nullpointer successors, similarly to D62507.
Differential Revision: https://reviews.llvm.org/D63389
llvm-svn: 364911
Simon Tatham [Tue, 2 Jul 2019 11:26:11 +0000 (11:26 +0000)]
[ARM] MVE: allow soft-float ABI to pass vector types.
Passing a vector type over the soft-float ABI involves it being split
into four GPRs, so the first thing that has to happen at the start of
the function is to recombine those into a vector register. The ABI
types all vectors as v2f64, so we need to support BUILD_VECTOR for
that type, which I do in this patch by allowing it to be expanded in
terms of INSERT_VECTOR_ELT, and writing an ISel pattern for that in
turn. Similarly, I provide a rule for EXTRACT_VECTOR_ELT so that a
returned vector can be marshalled back into GPRs.
While I'm here, I've also added ISD::UNDEF to the list of operations
we turn back on in `setAllExpand`, because I noticed that otherwise it
gets expanded into a BUILD_VECTOR with explicit zero inputs, leading
to pointless machine instructions to zero out a vector register that's
about to have every lane overwritten of in any case.
Reviewers: dmgreen, ostannard
Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63937
llvm-svn: 364910
Simon Tatham [Tue, 2 Jul 2019 11:26:00 +0000 (11:26 +0000)]
[ARM] Stop using scalar FP instructions in integer-only MVE mode.
If you compile with `-mattr=+mve` (enabling integer MVE instructions
but not floating-point ones), then the scalar FP //registers// exist
and it's legal to move things in and out of them, load and store them,
but it's not legal to do arithmetic on them.
In D60708, the calls to `addRegisterClass` in ARMISelLowering that
enable use of the scalar FP registers became conditionalised on
`Subtarget->hasFPRegs()` instead of `Subtarget->hasVFP2Base()`, so
that loads, stores and moves of those registers would work. But I
didn't realise that that would also enable all the operations on those
types by default.
Now, if the target doesn't have basic VFP, we follow up those
`addRegisterClass` calls by turning back off all the nontrivial
operations you can perform on f32 and f64. That causes several
knock-on failures, which are fixed by allowing the `VMOVDcc` and
`VMOVScc` instructions to be selected even if all you have is
`HasFPRegs`, and adjusting several checks for 'is this a double in a
single-precision-only world?' to the more general 'is this any FP type
we can't do arithmetic on?'. Between those, the whole of the
`float-ops.ll` and `fp16-instructions.ll` tests can now run in
MVE-without-FP mode and generate correct-looking code.
One odd side effect is that I had to relax the check lines in that
test so that they permit test functions like `add_f` to be generated
as tailcalls to software FP library functions, instead of ordinary
calls. Doing that is entirely legal, but the mystery is why this is
the first RUN line that's needed the relaxation: on the usual kind of
non-FP target, no tailcalls ever seem to be generated. Going by the
llc messages, I think `SoftenFloatResult` must be perturbing the code
generation in some way, but that's as much as I can guess.
Reviewers: dmgreen, ostannard
Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63938
llvm-svn: 364909
Nico Weber [Tue, 2 Jul 2019 11:20:40 +0000 (11:20 +0000)]
gn build: Merge r364866
llvm-svn: 364908
George Rimar [Tue, 2 Jul 2019 11:02:09 +0000 (11:02 +0000)]
[yaml2obj] - An attempt to fix a ppc64be build bot after r364898
I guess the problem is because of endianess of
the bytes tested by "od" tool. I changed the Content
sequence as it does not actually matter.
llvm-svn: 364907
Simon Pilgrim [Tue, 2 Jul 2019 10:53:17 +0000 (10:53 +0000)]
[X86] resolveTargetShuffleInputsAndMask - add repeated input handling.
We were relying on combineX86ShufflesRecursively to handle this - this patch gets it done earlier which should make it easier for other code to use resolveTargetShuffleInputsAndMask.
llvm-svn: 364906
George Rimar [Tue, 2 Jul 2019 10:47:13 +0000 (10:47 +0000)]
[test/Object] - Fix build bot.
Fixed mistype in the test case.
BB: http://lab.llvm.org:8011/builders/lld-x86_64-ubuntu-fast/builds/2720/steps/test-check-all/logs/stdio
llvm-svn: 364905
Kadir Cetinkaya [Tue, 2 Jul 2019 10:45:53 +0000 (10:45 +0000)]
[clang][ArgumentAdjusters] Do not add fsyntax-only if already exists
Reviewers: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64063
llvm-svn: 364904
George Rimar [Tue, 2 Jul 2019 10:30:06 +0000 (10:30 +0000)]
[Object/invalid.test] - Convert 3 more sub-tests to YAML
This allows to remove 3 more precompiled binaries from the inputs.
Differential revision: https://reviews.llvm.org/D63880
llvm-svn: 364903
Simon Atanasyan [Tue, 2 Jul 2019 10:22:14 +0000 (10:22 +0000)]
[mips] Mark P5600 scheduling model as complete
llvm-svn: 364902
Nico Weber [Tue, 2 Jul 2019 10:22:11 +0000 (10:22 +0000)]
clang-cl: Make /d1reportAllClassLayout actually work and improve test
See review thread for r301567.
llvm-svn: 364901
Simon Atanasyan [Tue, 2 Jul 2019 10:22:06 +0000 (10:22 +0000)]
[mips] Add missing schedinfo for FPU load/store/conv instructions
llvm-svn: 364900
Simon Atanasyan [Tue, 2 Jul 2019 10:21:59 +0000 (10:21 +0000)]
[mips] Map SNOP, NOP to the P5600Nop scheduler resource
llvm-svn: 364899
George Rimar [Tue, 2 Jul 2019 10:20:12 +0000 (10:20 +0000)]
[yaml2obj] - Allow overriding sh_offset field from the YAML.
Some of our test cases are using objects which
has sections with a broken sh_offset field.
There was no way to set it from YAML until this patch.
Differential revision: https://reviews.llvm.org/D63879
llvm-svn: 364898
Roman Lebedev [Tue, 2 Jul 2019 10:02:25 +0000 (10:02 +0000)]
[NFC][InstCombine] Revisit tests for "redundant shift input masking" (PR42456)
llvm-svn: 364897
Igor Kudrin [Tue, 2 Jul 2019 09:57:28 +0000 (09:57 +0000)]
[DWARF] Simplify dumping of a .debug_addr section.
This patch removes the part which tried to interpret addresses
in that section as offsets and simplifies the remaining code.
Differential Revision: https://reviews.llvm.org/D64020
llvm-svn: 364896
Alexandros Lamprineas [Tue, 2 Jul 2019 09:45:24 +0000 (09:45 +0000)]
[clang][Driver][ARM] NFC: Remove unused function parameter
Removes a vector reference that was added by D62998, since the
preexisting function parameter is sufficient.
Differential Revision: https://reviews.llvm.org/D64044
llvm-svn: 364895
Roman Lebedev [Tue, 2 Jul 2019 09:27:34 +0000 (09:27 +0000)]
[NFC][InstCombine] Add tests for "redundant shift input masking" (PR42456)
https://bugs.llvm.org/show_bug.cgi?id=42456
https://rise4fun.com/Alive/Vf1p
llvm-svn: 364894
Haojian Wu [Tue, 2 Jul 2019 09:16:21 +0000 (09:16 +0000)]
[clangd] Collect the refs when the main file is header.
Summary:
Previously, we only collect refs of the symbols which are declared in
the preamble and referenced in the main file, it works well when the
main file is .cpp file.
However, when the main file is .h file (when opening a .h file in the
editor), we don't collect refs of the symbol declared in this file, so we miss
these refs in our dynamic index.
A typical scenario:
1. Open Foo.h (which contains class Foo)
2. Open Foo.cpp, call find references for Foo
And we only get refs from Foo.cpp.
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63818
llvm-svn: 364893
Rainer Orth [Tue, 2 Jul 2019 08:40:29 +0000 (08:40 +0000)]
[Sanitizers] Remove obsolete OpenFile from sanitizer_solaris.cc
I noticed that the instance of OpenFile in sanitizer_solaris.cc is no
longer needed.
Removed as follows, tested on x86_64-pc-solaris2.11.
Differential Revision: https://reviews.llvm.org/D63764
llvm-svn: 364892
Benjamin Kramer [Tue, 2 Jul 2019 08:01:41 +0000 (08:01 +0000)]
[ASTImporter] Make headers self-contained
llvm-svn: 364891
Pavel Labath [Tue, 2 Jul 2019 07:57:08 +0000 (07:57 +0000)]
[DWARF] Add one more type unit test
This test passes already, but it seems interesting to test that we can
jump between type units in different dwo files nonetheless.
llvm-svn: 364890
Gabor Marton [Tue, 2 Jul 2019 07:36:39 +0000 (07:36 +0000)]
[ASTImporter] Structural eq: handle DependentScopeDeclRefExpr
Summary:
Structural equivalence did not handle dependent template args properly
when the arg contained a DependentScopeDeclRefExpr.
Reviewers: a_sidorin, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62329
llvm-svn: 364889
Amara Emerson [Tue, 2 Jul 2019 06:04:46 +0000 (06:04 +0000)]
[TailDuplicator] Fix copy instruction emitting into the wrong block.
The code for duplicating instructions could sometimes try to emit copies
intended to deal with unconstrainable register classes to the tail block of the
original instruction, rather than before the newly cloned instruction in the
predecessor block.
This was exposed by GlobalISel on arm64.
Differential Revision: https://reviews.llvm.org/D64049
llvm-svn: 364888
Craig Topper [Tue, 2 Jul 2019 05:53:37 +0000 (05:53 +0000)]
[X86] Add PreprocessISelDAG support for turning ISD::FP_TO_SINT/UINT into X86ISD::CVTTP2SI/CVTTP2UI and to reduce the number of isel patterns.
llvm-svn: 364887
QingShan Zhang [Tue, 2 Jul 2019 03:28:52 +0000 (03:28 +0000)]
[PowerPC] Implement the areMemAccessesTriviallyDisjoint hook
After implemented this hook, we will model the memory dependency in the scheduling dependency graph more precise,
and will have more opportunity to reorder the load/stores, as they didn't have the dependency at some condition
Differential Revision: https://reviews.llvm.org/D63804
llvm-svn: 364886
Marshall Clow [Tue, 2 Jul 2019 03:23:06 +0000 (03:23 +0000)]
Update status of papers for upcoming WG21 meeting. NFC
llvm-svn: 364885
Marshall Clow [Tue, 2 Jul 2019 03:21:16 +0000 (03:21 +0000)]
Use new '__libcpp_is_constant_evaluated' call to remove an '#ifdef' from the bit code. NFC
llvm-svn: 364884
Zi Xuan Wu [Tue, 2 Jul 2019 02:54:52 +0000 (02:54 +0000)]
[DAGCombiner] Exploiting more about the transformation of TransformFPLoadStorePair function
For a given floating point load / store pair, if the load value isn't used by any other operations,
then consider transforming the pair to integer load / store operations if the target deems the transformation profitable.
And we can exploiting much more when there are other operation nodes with chain operand between the load/store pair
so long as we keep the chain ordering original. We only replace the register used to load/store from float to integer.
I only add testcase in ARM because the TLI.isDesirableToTransformToIntegerOp hook is only enabled in ARM target.
Differential Revision: https://reviews.llvm.org/D60601
llvm-svn: 364883
Artem Dergachev [Tue, 2 Jul 2019 02:17:56 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Implement a dark color scheme.
Addresses a popular request. Activated via --dark.
Differential Revision: https://reviews.llvm.org/D64056
llvm-svn: 364882
Artem Dergachev [Tue, 2 Jul 2019 02:17:53 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Improve program point dumps.
- Take advantage of the stmt_point_kind.
- Dump block IDs for BlockEntrance nodes.
- Don't dump huge compound statements on PurgeDeadSymbols nodes.
- Rename Edge to BlockEdge for consistency.
- Tweak colors.
Differential Revision: https://reviews.llvm.org/D64051
llvm-svn: 364881
Artem Dergachev [Tue, 2 Jul 2019 02:17:50 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Add support for objects under construction.
This trait is Environment-like, so there was a chance to re-use a lot of code.
Differential Revision: https://reviews.llvm.org/D64047
llvm-svn: 364880
Marshall Clow [Tue, 2 Jul 2019 00:20:06 +0000 (00:20 +0000)]
Mark the newly added '__libcpp_is_constant_evaluated' as 'inline', since it can be included multiple times by multiple headers, and we don't want 'duplicate definition' errors.
llvm-svn: 364879
Reid Kleckner [Mon, 1 Jul 2019 23:53:16 +0000 (23:53 +0000)]
Revert Remove scudo standalone tests from check-all
This reverts r364877 (git commit
dfae3705b75e6b5e1e163c78ab2df705a3388d89)
This didn't solve my problem so I've reverted it.
llvm-svn: 364878
Reid Kleckner [Mon, 1 Jul 2019 23:29:59 +0000 (23:29 +0000)]
Remove scudo standalone tests from check-all
They appear to fail to link in various 32-bit configurations for unknown
reasons. This change was already reverted, and it seems preferable to me
to make forward progress and remove this once the problems are fully
understood.
llvm-svn: 364877
Jordan Rupprecht [Mon, 1 Jul 2019 23:29:46 +0000 (23:29 +0000)]
Revert Recommit [PowerPC] Update P9 vector costs for insert/extract element
This reverts r364557 (git commit
9f7f5858fe46b8e706e87a83e2fd0a2678be619e)
This crashes as reported on the commit thread. Repro instructions TBD.
llvm-svn: 364876
Nathan Huckleberry [Mon, 1 Jul 2019 23:29:10 +0000 (23:29 +0000)]
[analyzer] Support kfree in MallocChecker
Summary:
kmalloc is freed with kfree in the linux kernel. kmalloc support was
added in r204832, but kfree was not. Adding kfree fixes incorrectly
detected memory leaks.
Reviewers: NoQ, nickdesaulniers, dcoughlin, Szelethus
Reviewed By: NoQ, Szelethus
Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64030
llvm-svn: 364875
Julian Lettner [Mon, 1 Jul 2019 23:23:18 +0000 (23:23 +0000)]
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.3
Remove unnecessary computation of mangled SP for x86_64 architecture.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D63944
llvm-svn: 364874
Marshall Clow [Mon, 1 Jul 2019 23:16:46 +0000 (23:16 +0000)]
Add a private call '__libcpp_is_constant_evaluated' which 'works' for old language versions and w/o any compiler support. 'Working', in this case, means that it returns false in those cases.
llvm-svn: 364873
Keno Fischer [Mon, 1 Jul 2019 23:15:07 +0000 (23:15 +0000)]
[cmake] With utils disabled, don't build tblgen in cross mode
Summary:
In cross mode, we build a separate NATIVE tblgen that runs on the
host and is used during the build. Separately, we have a flag that
disables building all executables in utils/. Of course generally,
this doesn't turn off tblgen, since we need that during the build.
In cross mode, however, that tblegen is useless since we never
actually use it. Furthermore, it can be actively problematic if the
cross toolchain doesn't like building executables for whatever reason.
And even if building executables works fine, we can at least save
compile time by omitting it from the target build. There's two changes
needed to make this happen:
- Stop creating a dependency from the native tool to the target tool.
No such dependency is required for a correct build, so I'm not entirely
sure why it was there in the first place.
- If utils were disabled on the CMake command line and we're in cross mode,
respect that by excluding it from the install target (using EXCLUDE_FROM_ALL).
Reviewers: smeenai
Differential Revision: https://reviews.llvm.org/D64032
llvm-svn: 364872
Artem Dergachev [Mon, 1 Jul 2019 23:06:08 +0000 (23:06 +0000)]
[analyzer] exploded-graph-rewriter: NFC: Add a forgotten test file.
This fell off of r364865.
llvm-svn: 364871