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
Artem Dergachev [Mon, 1 Jul 2019 23:02:18 +0000 (23:02 +0000)]
[analyzer] Fix invalidation when returning into a ctor initializer.
Due to RVO the target region of a function that returns an object by
value isn't necessarily a temporary object region; it may be an
arbitrary memory region. In particular, it may be a field of a bigger
object.
Make sure we don't invalidate the bigger object when said function is
evaluated conservatively.
Differential Revision: https://reviews.llvm.org/D63968
llvm-svn: 364870
Artem Dergachev [Mon, 1 Jul 2019 23:02:14 +0000 (23:02 +0000)]
[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.
The NonnullGlobalConstants checker models the rule "it doesn't make sense
to make a constant global pointer and initialize it to null"; it makes sure
that whatever it's initialized with is known to be non-null.
Ironically, annotating the type of the pointer as _Nonnull breaks the checker.
Fix handling of the _Nonnull annotation so that it was instead one more reason
to believe that the value is non-null.
Differential Revision: https://reviews.llvm.org/D63956
llvm-svn: 364869
Artem Dergachev [Mon, 1 Jul 2019 23:02:10 +0000 (23:02 +0000)]
[analyzer] CStringChecker: Modernize to use CallDescriptions.
This patch uses the new CDF_MaybeBuiltin flag to handle C library functions.
It's mostly an NFC/refactoring pass, but it does fix a bug in handling memset()
when it expands to __builtin___memset_chk() because the latter has
one more argument and memset() handling code was trying to match
the exact number of arguments. Now the code is deduplicated and there's
less room for mistakes.
Differential Revision: https://reviews.llvm.org/D62557
llvm-svn: 364868
Artem Dergachev [Mon, 1 Jul 2019 23:02:07 +0000 (23:02 +0000)]
[analyzer] NFC: CallDescription: Implement describing C library functions.
When matching C standard library functions in the checker, it's easy to forget
that they are often implemented as macros that are expanded to builtins.
Such builtins would have a different name, so matching the callee identifier
would fail, or may sometimes have more arguments than expected, so matching
the exact number of arguments would fail, but this is fine as long as we have
all the arguments that we need in their respective places.
This patch adds a set of flags to the CallDescription class so that to handle
various special matching rules, and adds the first flag into this set,
which enables a more fuzzy matching for functions that
may be implemented as compiler builtins.
Differential Revision: https://reviews.llvm.org/D62556
llvm-svn: 364867
Artem Dergachev [Mon, 1 Jul 2019 23:02:03 +0000 (23:02 +0000)]
[analyzer] NFC: Add a convenient CallDescriptionMap class.
It encapsulates the procedure of figuring out whether a call event
corresponds to a function that's modeled by a checker.
Checker developers no longer need to worry about performance of
lookups into their own custom maps.
Add unittests - which finally test CallDescription itself as well.
Differential Revision: https://reviews.llvm.org/D62441
llvm-svn: 364866
Artem Dergachev [Mon, 1 Jul 2019 23:01:59 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Add support for dynamic types.
Slightly cleanup emission of horizontal lines and unhardcode the title
for generic maps.
Differential Revision: https://reviews.llvm.org/D64041
llvm-svn: 364865
Artem Dergachev [Mon, 1 Jul 2019 23:01:55 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Implement program point tags.
Keep them on a separate line for more visibility.
Differential Revision: https://reviews.llvm.org/D63965
llvm-svn: 364864
Marshall Clow [Mon, 1 Jul 2019 23:00:34 +0000 (23:00 +0000)]
Update status for bit operations
llvm-svn: 364863
Marshall Clow [Mon, 1 Jul 2019 23:00:32 +0000 (23:00 +0000)]
Bit Operations: P0556, P0553 and P1355. Reviewed as: https://reviews.llvm.org/D51262
llvm-svn: 364862
Reid Kleckner [Mon, 1 Jul 2019 22:43:39 +0000 (22:43 +0000)]
[PGO] Update ICP pass for recent byval type changes
Fixes verifier errors encountered in PR42413.
Reviewers: xur, t.p.northover, inglorion, gbiv, george.burgess.iv
Differential Revision: https://reviews.llvm.org/D63842
llvm-svn: 364861
Stella Stamenova [Mon, 1 Jul 2019 22:12:55 +0000 (22:12 +0000)]
[lldb] [lldbsuite] Use a unique class name for TestValueVarUpdate
It looks like when this test was added, it was based on TestHelloWorld and it ended up with the same class name. This is an issue because the logs associated with the tests use the class name as the identifier for the file and if two tests have the same name their logs overwrite each other. On non-windows, this just means we lose one of the logs, but on Windows this means that one of the tests will fail occasionally because the file are locked by the other test.
llvm-svn: 364860
Matt Arsenault [Mon, 1 Jul 2019 22:01:05 +0000 (22:01 +0000)]
AMDGPU: Correct properties for adjcallstack* pseudos
These should be SALU writes, and these are lowered to instructions
that def SCC.
llvm-svn: 364859
Matt Arsenault [Mon, 1 Jul 2019 22:00:59 +0000 (22:00 +0000)]
Fix broken C++ mode comment
llvm-svn: 364858
Huihui Zhang [Mon, 1 Jul 2019 22:00:32 +0000 (22:00 +0000)]
[InstCombine][NFCI] Update test cases in onehot_merge.ll
Use both one bit and signbit shifting to check for one bit merge.
Reviewers: lebedev.ri, spatel, efriedma, craig.topper
Reviewed By: lebedev.ri
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63903
llvm-svn: 364857
Sanjay Patel [Mon, 1 Jul 2019 22:00:00 +0000 (22:00 +0000)]
[InstCombine] reduce more checks for power-of-2-or-zero using ctpop
Extends the transform from:
rL364341
...to include another (more common?) pattern that tests whether a
value is a power-of-2 (including or excluding zero).
llvm-svn: 364856
JF Bastien [Mon, 1 Jul 2019 21:57:31 +0000 (21:57 +0000)]
Fix breakage introduced by D60974
D60974 added tests which incorrectly assume that llvm-readelf is available. This is a bad assumption, it should instead declare the dependency explicitly in the tests.
llvm-svn: 364855
Jonas Devlieghere [Mon, 1 Jul 2019 21:25:34 +0000 (21:25 +0000)]
[Reproducer] Assert on unexpected packet
I'm not able to reproduce the reproducer flakiness we're seeing on
GreenDragon. I want to add this assert to find out if the GDB remote
packets are somehow getting out of sync when this happens.
llvm-svn: 364852
Craig Topper [Mon, 1 Jul 2019 21:25:11 +0000 (21:25 +0000)]
[X86] Use v4i32 vzloads instead of v2i64 for vpmovzx/vpmovsx patterns where only 32-bits are loaded.
v2i64 vzload defines a 64-bit memory access. It doesn't look like
we have any coverage for this either way.
Also remove some vzload usages where the instruction loads only
16-bits.
llvm-svn: 364851
Simon Atanasyan [Mon, 1 Jul 2019 21:25:04 +0000 (21:25 +0000)]
[mips] Add missing schedinfo for MIPSeh_return[32|64] instructions
llvm-svn: 364850
Simon Atanasyan [Mon, 1 Jul 2019 21:24:58 +0000 (21:24 +0000)]
[mips] Add virtualization ASE to P5600 scheduling definitions
llvm-svn: 364849