Dmitri Gribenko [Mon, 26 Aug 2019 15:44:32 +0000 (15:44 +0000)]
Moved GlobList into a separate header file
Summary:
It is a separate abstraction that is used in more contexts than just
a helper for ClangTidyDiagnosticConsumer.
Subscribers: mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66747
llvm-svn: 369918
Kadir Cetinkaya [Mon, 26 Aug 2019 15:42:16 +0000 (15:42 +0000)]
[clangd] Add docs for configuration knobs in clangd
Summary:
This is a first step in documenting different configuration knobs we
have in clangd.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66740
llvm-svn: 369917
Martin Probst [Mon, 26 Aug 2019 15:37:05 +0000 (15:37 +0000)]
clang-format: [JS] handle `as const`.
Summary:
TypeScript 3.4 supports casting into a const type using `as const`:
const x = {x: 1} as const;
Previously, clang-format would insert a space after the `const`. With
this patch, no space is inserted after the sequence `as const`.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66736
llvm-svn: 369916
Yitzhak Mandelbaum [Mon, 26 Aug 2019 15:27:05 +0000 (15:27 +0000)]
[clang-tidy][NFC] Qualify `makeRule` call in test, for consistency with other calls.
One call `makeRule` is unqualified (and unintentionally relying on ADL to
resolve correctly). This revision qualifies that call for consistency and to
drop use of ADL.
llvm-svn: 369915
Yitzhak Mandelbaum [Mon, 26 Aug 2019 15:17:29 +0000 (15:17 +0000)]
[clang-tidy] TransformerClangTidyCheck: change choice of location for diagnostic message.
Summary:
This patch changes the location specified to the
`ClangTidyCheck::diag()`. Currently, the beginning of the matched range is
used. This patch uses the beginning of the first fix's range. This change both
simplifies the code and (hopefully) gives a more intuitive result: the reported
location aligns with the fix(es) provided, rather than the (arbitrary) range of
the rule's match.
N.B. this patch will break the line offset numbers in lit tests if the first fix
is not at the beginning of the match.
Reviewers: gribozavr
Subscribers: xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66676
llvm-svn: 369914
Johan Vikstrom [Mon, 26 Aug 2019 13:56:45 +0000 (13:56 +0000)]
[clangd] Handling text editor/document lifetimes in vscode extension.
Summary:
Just reapplies highlightings for all files when visible text editors change. Could find the correct text editor that should be reapplied but going for a simple implementation instead.
Removes the associated highlighting entry from the Colorizer when a text document is closed.
Reviewers: hokein, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66735
llvm-svn: 369911
Pavel Labath [Mon, 26 Aug 2019 13:56:33 +0000 (13:56 +0000)]
Really fix the type mismatch error in GDBRemoteCommunicationServerCommon
My previous attempt in attempt in r369904 actually broke the 32bit build
because File::Read expects to take a reference to size_t. Fix the
warning by using SIZE_MAX to denote failure instead.
llvm-svn: 369910
Amaury Sechet [Mon, 26 Aug 2019 13:53:29 +0000 (13:53 +0000)]
[X86] Automatically generate various tests. NFC
llvm-svn: 369909
Tatyana Krasnukha [Mon, 26 Aug 2019 13:35:59 +0000 (13:35 +0000)]
[ProcessWindows] Remove equivalent macros
llvm-svn: 369908
Pavel Labath [Mon, 26 Aug 2019 13:07:02 +0000 (13:07 +0000)]
Move ProcessInstanceInfoTest to Utility
The class under test was moved in r355342. This moves the test code too.
llvm-svn: 369907
Pavel Labath [Mon, 26 Aug 2019 13:03:21 +0000 (13:03 +0000)]
ProcessInstanceInfo: Fix dumping of invalid user ids
Don't attempt to print invalid user ids. Previously, these would come
out as UINT32_MAX, or as an assertion failure.
llvm-svn: 369906
Pavel Labath [Mon, 26 Aug 2019 12:42:32 +0000 (12:42 +0000)]
Fix windows build after r369894
Constructing a std::vector from a llvm::map_range fails on windows,
apparently because std::vector expects the input iterator to have a
const operator* (map_range iterator has a non-const one).
This avoids the cleverness and unrolls the map-loop manually (which is
also slightly shorter).
llvm-svn: 369905
Pavel Labath [Mon, 26 Aug 2019 12:42:28 +0000 (12:42 +0000)]
Fix a type mismatch error in GDBRemoteCommunicationServerCommon
GetU64 returns a uint64_t. Don't store it in size_t as that is only
32-bit on 32-bit platforms.
llvm-svn: 369904
Pavel Labath [Mon, 26 Aug 2019 11:44:14 +0000 (11:44 +0000)]
Postfix: move more code out of the PDB plugin
Summary:
Previously we moved the code which parses a single expression out of the PDB
plugin, because that was useful for DWARF expressions in breakpad. However, FPO
programs are used in breakpad files too (when unwinding on windows), so this
completes the job, and moves the rest of the FPO parser too.
Reviewers: amccarth, aleksandr.urakov
Subscribers: aprantl, markmentovai, rnk, lldb-commits
Differential Revision: https://reviews.llvm.org/D66634
llvm-svn: 369894
Johan Vikstrom [Mon, 26 Aug 2019 11:36:11 +0000 (11:36 +0000)]
[clangd] Added a colorizer to the vscode extension.
Summary:
Adds the main colorizer component. It colorizes every time clangd sends a publishSemanticHighlighting notification.
Every time it colorizes it does a full recolorization (removes all decorations from the editor and applies new ones). The reason for this is that all ranges for the same scope share a TextEditorDecorationType. This is due to TextEditorDecorationTypes being very expensive to create. The prototype used one DecorationType per range but that ran into very big performance problems (it took >100 ms to apply 600 lines of highlightings which froze the editor).
This version does not share the problem of being extremly slow, but there is probably potential to optimize it even more.
No document/texteditor lifecycle management code in this CL, that will come in the next one.
Reviewers: hokein, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66219
llvm-svn: 369893
Pavel Labath [Mon, 26 Aug 2019 11:25:28 +0000 (11:25 +0000)]
Breakpad: Add support for parsing STACK WIN records
Summary: The fields that aren't useful for us right now are simply ignored.
Reviewers: amccarth, markmentovai
Subscribers: rnk, lldb-commits
Differential Revision: https://reviews.llvm.org/D66633
llvm-svn: 369892
Bjorn Pettersson [Mon, 26 Aug 2019 11:02:36 +0000 (11:02 +0000)]
[GWP_ASAN] Avoid using VERSION_GREATER_EQUAL in cmake files
This is a fixup for r369823 which introduced the use of
VERSION_GREATER_EQUAL in the cmake config for gwp_asan.
Minimum supported version of cmake in LLVM is 3.4.3 and
VERSION_GREATER_EQUAL was not introduced until later
versions of cmake.
llvm-svn: 369891
Fangrui Song [Mon, 26 Aug 2019 10:32:12 +0000 (10:32 +0000)]
[ELF] EhFrameSection: postpone FDE liveness check to finalizeSections
EhFrameSection::addSection checks liveness of FDE early. This makes it
infeasible to move combineEhSections() before ICF.
Postpone the check to EhFrameSection::finalizeContents(). This is what
ARMExidxSyntheticSection does and it will make a subsequent patch D66717
simpler.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D66727
llvm-svn: 369890
Fangrui Song [Mon, 26 Aug 2019 10:23:31 +0000 (10:23 +0000)]
[ELF] Make LinkerScript::assignAddresses iterative
PR42990. For `SECTIONS { b = a; . = 0xff00 + (a >> 8); a = .; }`,
we currently set st_value(a)=0xff00 while st_value(b)=0xffff.
The following call tree demonstrates the problem:
```
link<ELF64LE>(Args);
Script->declareSymbols(); // insert a and b as absolute Defined
Writer<ELFT>().run();
Script->processSectionCommands();
addSymbol(cmd); // a and b are re-inserted. LinkerScript::getSymbolValue
// is lazily called by subsequent evaluation
finalizeSections();
forEachRelSec(scanRelocations<ELFT>);
processRelocAux // another problem PR42506, not affected by this patch
finalizeAddressDependentContent(); // loop executed once
script->assignAddresses(); // a = 0, b = 0xff00
script->assignAddresses(); // a = 0xff00, _end = 0xffff
```
We need another assignAddresses() to finalize the value of `a`.
This patch
1) modifies assignAddress() to track the original section/value of each
symbol and return a symbol whose section/value has changed.
2) moves the post-finalizeSections assignAddress() inside the loop
of finalizeAddressDependentContent() and makes it iterative.
Symbol assignment may not converge so we make a few attempts before
bailing out.
Note, assignAddresses() must be called at least twice. The penultimate
call finalized section addresses while the last finalized symbol values.
It is somewhat obscure and there was no comment.
linkerscript/addr-zero.test tests this.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D66279
llvm-svn: 369889
Gabor Buella [Mon, 26 Aug 2019 09:42:30 +0000 (09:42 +0000)]
[NFC][cmake] Build fix in tools/llvm-config/CMakeLists.txt
To avoid the following error message (using cmake version 3.13.4) :
```
CMake Error at tools/llvm-config/CMakeLists.txt:37 (string):
Syntax error in cmake code when parsing string-std=[^ ]\+Invalid escape sequence \+
```
Reviewed By: mgorny
Differential Revision: https://reviews.llvm.org/D58619
llvm-svn: 369887
Bjorn Pettersson [Mon, 26 Aug 2019 09:29:53 +0000 (09:29 +0000)]
[LoopUnroll] Handle certain PHIs in full unrolling properly
Summary:
When reconstructing the CFG of the loop after unrolling,
LoopUnroll could in some cases remove the phi operands of
loop-carried values instead of preserving them, resulting
in undef phi values after loop unrolling.
When doing this reconstruction, avoid removing incoming
phi values for phis in the successor blocks if the successor
is the block we are jumping to anyway.
Patch-by: ebevhan
Reviewers: fhahn, efriedma
Reviewed By: fhahn
Subscribers: bjope, lebedev.ri, zzheng, dmgreen, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66334
llvm-svn: 369886
Raphael Isemann [Mon, 26 Aug 2019 09:20:59 +0000 (09:20 +0000)]
[lldb] Construct the dummy target when the first Debugger object is constructed
Summary:
We should always have a dummy target, so we might as well construct it directly when we create a Debugger object.
The idea is that if this patch doesn't cause any problems that we can get rid of all the logic
that handles situations where we don't have a dummy target (as all that code is currently
untested as there seems to be no way to have no dummy target in LLDB).
Reviewers: labath, jingham
Reviewed By: labath, jingham
Subscribers: jingham, abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66581
llvm-svn: 369885
Haojian Wu [Mon, 26 Aug 2019 08:38:45 +0000 (08:38 +0000)]
[clangd] Send highlighting diff beyond the end of the file.
Summary: This would make the client life (tracking the changes) easier.
Reviewers: jvikstrom
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66541
llvm-svn: 369884
Raphael Isemann [Mon, 26 Aug 2019 08:22:52 +0000 (08:22 +0000)]
[lldb][NFC] Add ProcessInfo::GetNameAsStringRef to simplify some code
llvm-svn: 369880
Fangrui Song [Mon, 26 Aug 2019 06:23:53 +0000 (06:23 +0000)]
[ELF] Error if --strip-all and --emit-relocs are used together
--strip-all suppresses the creation of in.symtab
This can cause a null pointer dereference in OutputSection::finalize()
// --emit-relocs => copyRelocs is true
if (!config->copyRelocs || (type != SHT_RELA && type != SHT_REL))
return;
...
link = in.symTab->getParent()->sectionIndex; // in.symTab is null
Let's just disallow the combination. In some cases the combination can
cause GNU linkers to fail:
* ld.bfd: final link failed: invalid operation
* gold: internal error in set_no_output_symtab_entry, at ../../gold/object.h:1814
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D66704
llvm-svn: 369878
Zi Xuan Wu [Mon, 26 Aug 2019 05:06:30 +0000 (05:06 +0000)]
[NFC][Regalloc] Add testcases for D66576
llvm-svn: 369877
Amaury Sechet [Sun, 25 Aug 2019 20:48:14 +0000 (20:48 +0000)]
[X86] Automatically generate stack folding tests. NFC
llvm-svn: 369876
Sanjay Patel [Sun, 25 Aug 2019 18:34:07 +0000 (18:34 +0000)]
[Hexagon] remove noise from tests; NFC
llvm-svn: 369875
Sanjay Patel [Sun, 25 Aug 2019 18:25:22 +0000 (18:25 +0000)]
[Hexagon][x86] add tests for bit-test; NFC
More coverage for D66687
(assuming we make this a generic combine with TLI hook).
llvm-svn: 369874
Dmitri Gribenko [Sun, 25 Aug 2019 18:20:18 +0000 (18:20 +0000)]
[Wdocumentation] improve wording of a warning message
Based on @davezarzycki remarks in D64696 improved the wording of the warning
message.
Differential Revision: https://reviews.llvm.org/D66700
Patch by Mark de Wever.
llvm-svn: 369873
Craig Topper [Sun, 25 Aug 2019 17:59:49 +0000 (17:59 +0000)]
[X86][DAGCombiner] Teach narrowShuffle to use concat_vectors instead of inserting into undef
Summary:
Concat_vectors is more canonical during early DAG combine. For example, its what's used by SelectionDAGBuilder when converting IR shuffles into SelectionDAG shuffles when element counts between inputs and mask don't match. We also have combines in DAGCombiner than can pull concat_vectors through a shuffle. See partitionShuffleOfConcats. So it seems like concat_vectors is a better operation to use here. I had to teach DAGCombiner's SimplifyVBinOp to also handle concat_vectors with undef. I haven't checked yet if we can remove the INSERT_SUBVECTOR version in there or not.
I didn't want to mess with the other caller of getShuffleHalfVectors that's used during shuffle lowering where insert_subvector probably is what we want to produce so I've enabled this via a boolean passed to the function.
Reviewers: spatel, RKSimon
Reviewed By: RKSimon
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66504
llvm-svn: 369872
Amaury Sechet [Sun, 25 Aug 2019 15:49:29 +0000 (15:49 +0000)]
[X86] Add test case for inserting/extracting from two shuffled vectors. NFC
llvm-svn: 369871
Amaury Sechet [Sun, 25 Aug 2019 15:19:20 +0000 (15:19 +0000)]
[X86] Add test case for inserting/extracting from shuffled vectors. NFC
llvm-svn: 369870
Xing Xue [Sun, 25 Aug 2019 15:17:25 +0000 (15:17 +0000)]
[PowerPC][AIX] Adds support for writing the .data section in assembly files
Summary:
Adds support for generating the .data section in assembly files for global variables with a non-zero initialization. The support for writing the .data section in XCOFF object files will be added in a follow-on patch. Any relocations are not included in this patch.
Reviewers: hubert.reinterpretcast, sfertile, jasonliu, daltenty, Xiangling_L
Reviewed by: hubert.reinterpretcast
Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, wuzish, shchenz, DiggerLin, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66154
llvm-svn: 369869
Fangrui Song [Sun, 25 Aug 2019 14:41:18 +0000 (14:41 +0000)]
[ELF] Delete a redundant dyn_cast<InputSection>. NFC
llvm-svn: 369868
Benjamin Kramer [Sun, 25 Aug 2019 12:47:31 +0000 (12:47 +0000)]
[AMDGPU] Downgrade from StringLiteral to const char* in an attempt to make GCC 5 happy
llvm-svn: 369867
Bjorn Pettersson [Sun, 25 Aug 2019 10:54:44 +0000 (10:54 +0000)]
Fixup in test/DebugInfo/X86/live-debug-vars-discard-invalid.mir
The test case used invalid source operands as input
to BTS64rr instructions (feeding register operands with
immediates). This patch changes those instruction into
using BTS64ri8 instead, which seems to better match the
operand types.
Fixes problems seen in https://reviews.llvm.org/D63973.
llvm-svn: 369866
Bjorn Pettersson [Sun, 25 Aug 2019 10:47:30 +0000 (10:47 +0000)]
[TableGen] Correct comments for end of namespace. NFC
Summary:
Update end-of-namespace comments generated by
tablegen emitters to fulfill the rules setup by
clang-tidy's llvm-namespace-comment checker.
Fixed a few end-of-namespace comments in the
tablegen source code as well.
Reviewers: craig.topper
Reviewed By: craig.topper
Subscribers: craig.topper, stoklund, dschuff, sbc100, jgravelle-google, aheejin, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66396
llvm-svn: 369865
Nikita Popov [Sun, 25 Aug 2019 08:04:22 +0000 (08:04 +0000)]
[SDAG] Fold umul_lohi with 0 or 1 multiplicand
These can turn up during multiplication legalization. In principle
these should also apply to smul_lohi, but I wasn't able to figure
out how to produce those with the necessary operands.
Differential Revision: https://reviews.llvm.org/D66380
llvm-svn: 369864
Craig Topper [Sun, 25 Aug 2019 05:22:40 +0000 (05:22 +0000)]
[X86] Teach -Os immediate sharing code to not count constant uses that will become INC/DEC.
INC/DEC don't use an immediate so we don't need to count it. We
also shouldn't use the custom isel for it.
Fixes PR42998.
llvm-svn: 369863
Craig Topper [Sun, 25 Aug 2019 05:22:36 +0000 (05:22 +0000)]
[X86] Add test cases for PR42998. NFC
llvm-svn: 369862
Duncan P. N. Exon Smith [Sun, 25 Aug 2019 01:18:35 +0000 (01:18 +0000)]
FileManager: Factor duplicated code in getBufferForFile, NFC
Incidentally, this also unifies the two versions (removing an
unnecessary call to `SmallString::c_str`).
llvm-svn: 369861
Nilanjana Basu [Sun, 25 Aug 2019 01:09:11 +0000 (01:09 +0000)]
Removing block comments from CodeView records in assembly files & related code cleanup
llvm-svn: 369860
Craig Topper [Sat, 24 Aug 2019 23:14:57 +0000 (23:14 +0000)]
[X86] Add isel patterns to match vpdpwssd avx512vnni instruction from add+pmaddwd nodes.
llvm-svn: 369859
Matt Arsenault [Sat, 24 Aug 2019 22:22:38 +0000 (22:22 +0000)]
AMDGPU: Add baseline test for mul24 ordering issues
llvm-svn: 369858
Matt Arsenault [Sat, 24 Aug 2019 22:17:10 +0000 (22:17 +0000)]
AMDGPU: Preserve value name when inserting mul24 intrinsic
llvm-svn: 369857
Matt Arsenault [Sat, 24 Aug 2019 22:14:41 +0000 (22:14 +0000)]
AMDGPU: Introduce a flag to disable mul24 intrinsic formation
llvm-svn: 369856
Matt Arsenault [Sat, 24 Aug 2019 22:14:37 +0000 (22:14 +0000)]
AMDGPU: Generate check lines
Checking all the instructions will help catch LICM changes when passes
are reordered. Also switch to using gfx9 since global stores make the
relevant instructions more obvious.
llvm-svn: 369855
Benjamin Kramer [Sat, 24 Aug 2019 17:30:12 +0000 (17:30 +0000)]
[TLI] Simplify code. NFCI.
llvm-svn: 369854
Benjamin Kramer [Sat, 24 Aug 2019 17:19:06 +0000 (17:19 +0000)]
[clang-tidy] Manually enable exceptions in tesst that uses them
llvm-svn: 369853
Benjamin Kramer [Sat, 24 Aug 2019 16:19:32 +0000 (16:19 +0000)]
Hack around a GCC ICE that was fixed in GCC 6.2
lib/Target/X86/AsmParser/X86AsmParser.cpp: In member function ‘void {anonymous}::X86AsmParser::SwitchMode(unsigned int)’:
lib/Target/X86/AsmParser/X86AsmParser.cpp:927:76: in constexpr expansion of ‘AllModes.llvm::FeatureBitset::FeatureBitset(std::initializer_list<unsigned int>{((const unsigned int*)(& ._157)), 3u})’
include/llvm/MC/SubtargetFeature.h:56:12: in constexpr expansion of ‘llvm::FeatureBitset::set(I)’
lib/Target/X86/AsmParser/X86AsmParser.cpp:927:76: internal compiler error: in fold_binary_loc, at fold-const.c:9921
FeatureBitset AllModes({X86::Mode64Bit, X86::Mode32Bit, X86::Mode16Bit});
^
llvm-svn: 369852
Benjamin Kramer [Sat, 24 Aug 2019 15:46:49 +0000 (15:46 +0000)]
Try to make MSVC 2017 happy.
AArch64BaseInfo.h(316): error C3615: constexpr function 'llvm::SysAlias::SysAlias' cannot result in a constant expression
AArch64BaseInfo.h(316): note: failure was caused by call of undefined function or one not declared 'constexpr'
AArch64BaseInfo.h(316): note: see usage of 'llvm::FeatureBitset::FeatureBitset'
llvm-svn: 369851
Benjamin Kramer [Sat, 24 Aug 2019 15:24:25 +0000 (15:24 +0000)]
Fix some accidental global initializers by using StringLiteral instead of StringRef
llvm-svn: 369850
Benjamin Kramer [Sat, 24 Aug 2019 15:11:41 +0000 (15:11 +0000)]
Update tablegen test after r369847.
llvm-svn: 369849
Benjamin Kramer [Sat, 24 Aug 2019 15:04:33 +0000 (15:04 +0000)]
[llvm-reduce] Silence -Wdocumentation
ReduceGlobalVars.cpp:17:6: warning: '@returns' command used in a comment that is attached to a function returning void
llvm-svn: 369848
Benjamin Kramer [Sat, 24 Aug 2019 15:02:44 +0000 (15:02 +0000)]
Use a bit of relaxed constexpr to make FeatureBitset costant intializable
This requires std::intializer_list to be a literal type, which it is
starting with C++14. The downside is that std::bitset is still not
constexpr-friendly so this change contains a re-implementation of most
of it.
Shrinks clang by ~60k.
llvm-svn: 369847
Benjamin Kramer [Sat, 24 Aug 2019 13:04:34 +0000 (13:04 +0000)]
[OpenCL] Microoptimize OCL2Qual a bit
Still not optimal, but makes clang 25k smaller.
llvm-svn: 369846
Csaba Dabis [Sat, 24 Aug 2019 12:17:49 +0000 (12:17 +0000)]
[analyzer] Analysis: Fix checker silencing
llvm-svn: 369845
Fangrui Song [Sat, 24 Aug 2019 08:40:20 +0000 (08:40 +0000)]
[ELF] Simplify with less_second. NFC
llvm-svn: 369844
David Zarzycki [Sat, 24 Aug 2019 08:12:51 +0000 (08:12 +0000)]
[Testing] Unbreak r369830
llvm-svn: 369843
Roman Lebedev [Sat, 24 Aug 2019 06:49:51 +0000 (06:49 +0000)]
[Constant] Add 'isElementWiseEqual()' method
Promoting it from InstCombine's tryToReuseConstantFromSelectInComparison().
Return true if this constant and a constant 'Y' are element-wise equal.
This is identical to just comparing the pointers, with the exception that
for vectors, if only one of the constants has an `undef` element in some
lane, the constants still match.
llvm-svn: 369842
Roman Lebedev [Sat, 24 Aug 2019 06:49:36 +0000 (06:49 +0000)]
[InstCombine] matchThreeWayIntCompare(): commutativity awareness
Summary:
`matchThreeWayIntCompare()` looks for
```
select i1 (a == b),
i32 Equal,
i32 (select i1 (a < b), i32 Less, i32 Greater)
```
but both of these selects/compares can be in it's commuted form,
so out of 8 variants, only the two most basic ones is handled.
This fixes regression being introduced in D66232.
Reviewers: spatel, nikic, efriedma, xbolva00
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66607
llvm-svn: 369841
Roman Lebedev [Sat, 24 Aug 2019 06:49:25 +0000 (06:49 +0000)]
[InstCombine] Try to reuse constant from select in leading comparison
Summary:
If we have e.g.:
```
%t = icmp ult i32 %x, 65536
%r = select i1 %t, i32 %y, i32 65535
```
the constants `65535` and `65536` are suspiciously close.
We could perform a transformation to deduplicate them:
```
Name: ult
%t = icmp ult i32 %x, 65536
%r = select i1 %t, i32 %y, i32 65535
=>
%t.inv = icmp ugt i32 %x, 65535
%r = select i1 %t.inv, i32 65535, i32 %y
```
https://rise4fun.com/Alive/avb
While this may seem esoteric, this should certainly be good for vectors
(less constant pool usage) and for opt-for-size - need to have only one constant.
But the real fun part here is that it allows further transformation,
in particular it finishes cleaning up the `clamp` folding,
see e.g. `canonicalize-clamp-with-select-of-constant-threshold-pattern.ll`.
We start with e.g.
```
%dont_need_to_clamp_positive = icmp sle i32 %X, 32767
%dont_need_to_clamp_negative = icmp sge i32 %X, -32768
%clamp_limit = select i1 %dont_need_to_clamp_positive, i32 -32768, i32 32767
%dont_need_to_clamp = and i1 %dont_need_to_clamp_positive, %dont_need_to_clamp_negative
%R = select i1 %dont_need_to_clamp, i32 %X, i32 %clamp_limit
```
without this patch we currently produce
```
%1 = icmp slt i32 %X, 32768
%2 = icmp sgt i32 %X, -32768
%3 = select i1 %2, i32 %X, i32 -32768
%R = select i1 %1, i32 %3, i32 32767
```
which isn't really a `clamp` - both comparisons are performed on the original value,
this patch changes it into
```
%1.inv = icmp sgt i32 %X, 32767
%2 = icmp sgt i32 %X, -32768
%3 = select i1 %2, i32 %X, i32 -32768
%R = select i1 %1.inv, i32 32767, i32 %3
```
and then the magic happens! Some further transform finishes polishing it and we finally get:
```
%t1 = icmp sgt i32 %X, -32768
%t2 = select i1 %t1, i32 %X, i32 -32768
%t3 = icmp slt i32 %t2, 32767
%R = select i1 %t3, i32 %t2, i32 32767
```
which is beautiful and just what we want.
Proofs for `getFlippedStrictnessPredicateAndConstant()` for de-canonicalization:
https://rise4fun.com/Alive/THl
Proofs for the fold itself: https://rise4fun.com/Alive/THl
Reviewers: spatel, dmgreen, nikic, xbolva00
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66232
llvm-svn: 369840
Roman Lebedev [Sat, 24 Aug 2019 06:49:11 +0000 (06:49 +0000)]
[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests
llvm-svn: 369839
Fangrui Song [Sat, 24 Aug 2019 06:31:34 +0000 (06:31 +0000)]
[ELF] Make member function Writer<ELFT>::removeEmptyPTLoad non-member. NFC
llvm-svn: 369838
Craig Topper [Sat, 24 Aug 2019 05:59:46 +0000 (05:59 +0000)]
[X86] Add an assert to mark more code that needs to be removed when the vector widening legalization switch is removed again.
llvm-svn: 369837
Fangrui Song [Sat, 24 Aug 2019 02:50:42 +0000 (02:50 +0000)]
[LoopFusion] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off build
llvm-svn: 369836
Amara Emerson [Sat, 24 Aug 2019 02:39:51 +0000 (02:39 +0000)]
Remove unnecessary REQUIRES from a test.
llvm-svn: 369835
Richard Smith [Sat, 24 Aug 2019 02:30:00 +0000 (02:30 +0000)]
PR42513: Enter the proper DeclContext before substituting into an
default template argument expression.
We already did this for type template parameters and template template
parameters, but apparently forgot to do so for non-type template
parameters. This causes the substituted default argument expression to
be substituted in the proper context, and in particular to properly mark
its subexpressions as odr-used.
llvm-svn: 369834
Amara Emerson [Sat, 24 Aug 2019 02:25:56 +0000 (02:25 +0000)]
[GlobalISel] Introduce a G_DYN_STACKALLOC opcode to represent dynamic allocas.
This just adds the opcode and verifier, it will be used to replace existing
dynamic alloca handling in a subsequent patch.
Differential Revision: https://reviews.llvm.org/D66677
llvm-svn: 369833
Alex Lorenz [Sat, 24 Aug 2019 01:53:40 +0000 (01:53 +0000)]
Re-enable DependencyScannerTest on windows with the right fixes
It should now pass.
llvm-svn: 369832
Vitaly Buka [Sat, 24 Aug 2019 01:44:39 +0000 (01:44 +0000)]
NFC: Rename lifetime-asan.ll -> lifetime-sanitizer.ll
llvm-svn: 369831
Vitaly Buka [Sat, 24 Aug 2019 01:31:38 +0000 (01:31 +0000)]
NFC: Rename some sanitizer related lifetime checks
llvm-svn: 369830
Richard Smith [Sat, 24 Aug 2019 01:23:57 +0000 (01:23 +0000)]
PR40674: fix assertion failure if a structured binding declaration has a
tuple-like decomposition that produces value-dependent reference
bindings.
llvm-svn: 369829
Fangrui Song [Sat, 24 Aug 2019 00:41:15 +0000 (00:41 +0000)]
[ELF] Align the first section of a PT_LOAD even if its type is SHT_NOBITS
Reported at https://reviews.llvm.org/D64930#
1642223
If the only section of a PT_LOAD is a SHT_NOBITS section (e.g. .bss), we
may not align its sh_offset. p_offset of the PT_LOAD will be set to
sh_offset, and we will get p_offset!=p_vaddr (mod p_align). If such
executable is mapped by the Linux kernel, it will segfault.
After D64906, this may happen the non-linker script case.
The linker script case has had this issue for a long time.
This was fixed by rL321657 (but the test linkerscript/nobits-offset.s
failed to test a SHT_NOBITS section), but broken by rL345154.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D66658
llvm-svn: 369828
Jonas Devlieghere [Fri, 23 Aug 2019 23:56:19 +0000 (23:56 +0000)]
[NFC] Fix comments and formatting.
llvm-svn: 369827
Peter Collingbourne [Fri, 23 Aug 2019 23:33:26 +0000 (23:33 +0000)]
hwasan: Align n_namesz and n_descsz to 4 when reading notes.
There is no requirement for the producer of a note to include the note
alignment in these fields. As a result we can end up missing the HWASAN note
if one of the other notes in the binary has the alignment missing.
Differential Revision: https://reviews.llvm.org/D66692
llvm-svn: 369826
Mitch Phillips [Fri, 23 Aug 2019 23:23:48 +0000 (23:23 +0000)]
[GWP-ASan] Split options_parser and backtrace_sanitizer_common.
Summary:
optional/options_parser and optional/backtrace_sanitizer_common are logically
separate components. They both use sanitizer-common to power their
functionality, but there was an unstated implicit dependency that in order for
backtrace_sanitizer_common to function correctly, one had to also use
options_parser.
This was because options_parser called __sanitizer::InitialiseCommonFlags. This
is a requirement for backtrace_sanitizer_common to work, as the sanitizer
unwinder uses the sanitizer_common flags and will SEGV on a null page if
they're not initialised correctly.
This patch removes this hidden dependency. You can now use
backtrace_sanitizer_common without the requirements of options_parser.
This patch also makes the GWP-ASan unit tests only have a soft dependency on
sanitizer-common. The unit tests previously explicitly used
__sanitizer::Printf, which is now provided under
tests/optional/printf_sanitizer_common. This allows Android to build the unit
tests using their own signal-safe printf().
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: srhines, mgorny, #sanitizers, llvm-commits, vlad.tsyrklevich, morehouse
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D66684
llvm-svn: 369825
Guillaume Chatelet [Fri, 23 Aug 2019 23:19:25 +0000 (23:19 +0000)]
[LLVM][NFC] Removing unused functions
Summary: Removes a not so useful function from DataLayout and cleans up Support/MathExtras.h
Reviewers: courbet
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66691
llvm-svn: 369824
Mitch Phillips [Fri, 23 Aug 2019 23:13:18 +0000 (23:13 +0000)]
Fix stack_trace_compressor builds for Clang < 6.0
Summary:
Clang 4.* doesn't supply -fsanitize=fuzzer, and Clang 5.* doesn't supply
-fsanitize=fuzzer-no-link. Generally, in LLVM, fuzz targets are added through
the add_llvm_fuzzer build rule, which can't be used in compiler-rt (as it has
to be able to be standalone built).
Instead of adding tooling to add a dummy main (which kind of defeats the
purpose of these fuzz targets), we instead build the fuzz target only when the
Clang version is >= 6.*.
Reviewers: tejohnson
Subscribers: mgorny, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D66682
llvm-svn: 369823
Jan Korous [Fri, 23 Aug 2019 22:51:23 +0000 (22:51 +0000)]
[libclang][index][NFC] Fix test for skipping already parsed function bodies
llvm-svn: 369822
Vedant Kumar [Fri, 23 Aug 2019 22:28:46 +0000 (22:28 +0000)]
Skip tail call frame tests when dwarf_version < 4
rdar://problem/
54656572
llvm-svn: 369821
Gabor Horvath [Fri, 23 Aug 2019 22:26:49 +0000 (22:26 +0000)]
Fix a test to test what the name suggest.
llvm-svn: 369820
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:22:49 +0000 (22:22 +0000)]
[AMDGPU] Check for immediate SrcC in mfma in AsmParser
Differential Revision: https://reviews.llvm.org/D66674
llvm-svn: 369819
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:22:29 +0000 (22:22 +0000)]
[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug
gfx908 ignores an mfma if SrcC is a literal.
Differential Revision: https://reviews.llvm.org/D66670
llvm-svn: 369818
Gabor Horvath [Fri, 23 Aug 2019 22:21:33 +0000 (22:21 +0000)]
[LifetimeAnalysis] Make it possible to disable the new warnings
llvm-svn: 369817
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:09:58 +0000 (22:09 +0000)]
[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug
gfx908 ignores an mfma if SrcC is a literal.
Differential Revision: https://reviews.llvm.org/D66670
llvm-svn: 369816
Peter Collingbourne [Fri, 23 Aug 2019 21:37:20 +0000 (21:37 +0000)]
hwasan: Fix use of uninitialized memory.
Reported by e.g.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/23071/steps/build%20with%20ninja/logs/stdio
llvm-svn: 369815
Adrian Prantl [Fri, 23 Aug 2019 21:28:14 +0000 (21:28 +0000)]
Upstream support for macCatalyst Mach-O binaries.
On macOS one Mach-O slice can contain multiple load commands: One load
command for being loaded into a macOS process and one load command for
being loaded into a macCatalyst process. This patch adds support for
the new load command and makes sure ObjectFileMachO returns the
Architecture that matches the Module.
Differential Revision: https://reviews.llvm.org/D66626
llvm-svn: 369814
Peter Collingbourne [Fri, 23 Aug 2019 21:27:56 +0000 (21:27 +0000)]
Move a break into the correct place. NFCI.
Should silence new C fallthrough warning.
llvm-svn: 369813
Sanjay Patel [Fri, 23 Aug 2019 21:15:27 +0000 (21:15 +0000)]
[x86] add tests for bt/test; NFC
llvm-svn: 369812
Julie Hockett [Fri, 23 Aug 2019 21:14:05 +0000 (21:14 +0000)]
[clang-doc] Bump BitcodeWriter max line number to 32U
PR43039 reports hitting the assert on a very large file, so bumping this
to allow for larger files.
Differential Revision: https://reviews.llvm.org/D66681
llvm-svn: 369811
Guillaume Chatelet [Fri, 23 Aug 2019 20:49:06 +0000 (20:49 +0000)]
[LLVM][NFC] remove unused fields
Summary:
Here is the commit introducing the fields
https://github.com/llvm/llvm-project/commit/
cf6749e4c091
It dates back from 2006 and was used by AArch64 backend.
There is no more reference to these fields in the whole codebase so I think it's fine.
Reviewers: courbet
Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66683
llvm-svn: 369810
Lang Hames [Fri, 23 Aug 2019 20:37:32 +0000 (20:37 +0000)]
[ORC] Remove query dependencies when symbols are resolved.
If the dependencies are not removed then a late failure (one symbol covered by
the query failing after others have already been resolved) can result in an
attempt to detach the query from already finalized symbol, resulting in an
assert/crash. This patch fixes the issue by removing query dependencies in
JITDylib::resolve for symbols that meet the required state.
llvm-svn: 369809
Lang Hames [Fri, 23 Aug 2019 20:37:31 +0000 (20:37 +0000)]
[ORC] Fix a FIXME: Propagate errors to dependencies.
When symbols are failed (via MaterializationResponsibility::failMaterialization)
any symbols depending on them will now be moved to an error state. Attempting
to resolve or emit a symbol in the error state (via the notifyResolved or
notifyEmitted methods on MaterializationResponsibility) will result in an error.
If notifyResolved or notifyEmitted return an error due to failure of a
dependence then the caller should log or discard the error and call
failMaterialization to propagate the failure to any queries waiting on the
symbols being resolved/emitted (plus their dependencies).
llvm-svn: 369808
Lang Hames [Fri, 23 Aug 2019 20:37:26 +0000 (20:37 +0000)]
[ORC] Fix an incorrect comment.
llvm-svn: 369807
Jessica Paquette [Fri, 23 Aug 2019 20:31:34 +0000 (20:31 +0000)]
[AArch64][GlobalISel] Import XRO load/store patterns instead of custom selection
Instead of using custom C++ in `earlySelect` for loads and stores, just import
the patterns.
Remove `earlySelectLoad`, since we can just import the work it's doing.
Some minor changes to how `ComplexRendererFns` are returned for the XRO
addressing modes. If you add immediates in two steps, sometimes they are not
imported properly and you only end up with one immediate. I'm not sure if this
is intentional.
- Update load-addressing-modes.mir to include the instructions we can now
import.
- Add a similar test, store-addressing-modes.mir to show which store opcodes we
currently import, and show that we can pull in shifts etc.
- Update arm64-fastisel-gep-promote-before-add.ll to use FastISel instead of
GISel. This test failed with GISel because GISel folds the gep into the load.
The test checks that FastISel doesn't fold non-pointer-width adds into loads.
GISel on the other hand, produces a G_CONSTANT of -128 for the add, and then
a G_GEP, which must be pointer-width.
Note that we don't get STRBRoX right now. It seems like the importer can't
handle `FPR8Op:{ *:[Untyped] }:$Rt` source operands. So, those are not currently
supported.
Differential Revision: https://reviews.llvm.org/D66679
llvm-svn: 369806
Volkan Keles [Fri, 23 Aug 2019 20:30:35 +0000 (20:30 +0000)]
[GlobalISel] Legalizer: Retry combining illegal artifacts as long as there new artifacts
Summary:
Currently, Legalizer aborts if it’s unable to legalize artifacts. However, it’s
possible to combine them after processing the rest of the instruction because
the legalization is likely to generate more artifacts that allow ArtifactCombiner
to combine away them.
Instead, move illegal artifacts to another list called RetryList and wait until all of the
instruction in InstList are legalized. After that, check if there is any new artifacts and
try to combine them again if that’s the case. If not, abort. The idea is similar to D59339,
but the approach is a bit different.
This patch fixes the issue described above, but the legalizer still may be unable to handle
some cases depending on when to legalize artifacts. So, in the long run, we probably need
a different legalization strategy that handles this dependency in a better way.
Reviewers: dsanders, aditya_nandakumar, qcolombet, arsenm, aemerson, paquette
Reviewed By: dsanders
Subscribers: jvesely, wdng, nhaehnle, rovka, javed.absar, hiraditya, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65894
llvm-svn: 369805
Johannes Doerfert [Fri, 23 Aug 2019 20:20:10 +0000 (20:20 +0000)]
[Attributor] Manifest alignment in load and store instructions
Summary:
We can now manifest alignment information in load/store instructions if
the pointer is known to have a better alignment.
Reviewers: uenoku, sstefan1, lebedev.ri
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66567
llvm-svn: 369804
Benjamin Kramer [Fri, 23 Aug 2019 19:59:23 +0000 (19:59 +0000)]
Do a sweep of symbol internalization. NFC.
llvm-svn: 369803