Matt Arsenault [Sun, 9 Aug 2020 18:37:45 +0000 (14:37 -0400)]
PeepholeOptimizer: Use Register
Matt Arsenault [Sun, 9 Aug 2020 21:28:15 +0000 (17:28 -0400)]
GlobalISel: Remove redundant check for empty blocks
Matt Arsenault [Sun, 9 Aug 2020 19:26:30 +0000 (15:26 -0400)]
AMDGPU/GlobalISel: Merge load/store select cases
Matt Arsenault [Sun, 9 Aug 2020 16:10:49 +0000 (12:10 -0400)]
AMDGPU/GlobalISel: Fix typo
Matt Arsenault [Sun, 9 Aug 2020 16:01:47 +0000 (12:01 -0400)]
AMDGPU/GlobalISel: Use nicer form of buildInstr
Sanjay Patel [Mon, 10 Aug 2020 12:27:19 +0000 (08:27 -0400)]
[InstCombine] auto-generate test checks; NFC
Nico Weber [Mon, 10 Aug 2020 12:20:35 +0000 (08:20 -0400)]
Revert "[DebugInfo] Don't error for zero-length arange entries"
This reverts commit
cb3a598c87db2db997401b82dfb3f7f80707194e.
Breaks build of check-llvm dep obj2yaml everywhere.
Aleksandr Platonov [Mon, 10 Aug 2020 12:11:25 +0000 (15:11 +0300)]
[clang-tidy] Fix a crash in bugprone-not-null-terminated-result check when `__STDC_WANT_LIB_EXT1__` is not a literal.
If `__STDC_WANT_LIB_EXT1__` is not a literal (e.g. `#define __STDC_WANT_LIB_EXT1__ ((unsigned)1)`) bugprone-not-null-terminated-result check crashes.
Stack dump:
```
#0 0x0000000002185e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x2185e6a)
#1 0x0000000002183e8c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x2183e8c)
#2 0x0000000002183ff3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x2183ff3)
#3 0x00007f08d91b1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00000000021338bb llvm::StringRef::getAsInteger(unsigned int, llvm::APInt&) const (/llvm-project/build/bin/clang-tidy+0x21338bb)
#5 0x000000000052051c clang::tidy::bugprone::NotNullTerminatedResultCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x52051c)
```
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D85525
Sanjay Patel [Mon, 10 Aug 2020 12:05:26 +0000 (08:05 -0400)]
[InstCombine] rearrange code for readability; NFC
The code comment refers to the path where we change the
size of the integer type, so handle that first, otherwise
deal with the general case.
Haojian Wu [Mon, 10 Aug 2020 12:02:22 +0000 (14:02 +0200)]
[clangd] Fix the background index is not disabled when using remote-index.
Differential Revision: https://reviews.llvm.org/D85637
James Henderson [Wed, 5 Aug 2020 14:39:57 +0000 (15:39 +0100)]
[DebugInfo] Don't error for zero-length arange entries
Although the DWARF specification states that .debug_aranges entries
can't have length zero, these can occur in the wild. There's no
particular reason to enforce this part of the spec, since functionally
they have no impact. The patch removes the error and introduces a new
warning for premature terminator entries which does not stop parsing.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46805. See also
https://reviews.llvm.org/D71932 which originally introduced the error.
Reviewed by: ikudrin, dblaikie
Differential Revision: https://reviews.llvm.org/D85313
Florian Hahn [Mon, 10 Aug 2020 09:52:33 +0000 (10:52 +0100)]
[LoopInterchange] Move instructions from preheader to outer loop header.
Instructions defined in the original inner loop preheader may depend on
values defined in the outer loop header, but the inner loop header will
become the entry block in the loop nest. Move the instructions from the
preheader to the outer loop header, so we do not break dominance. We
also have to check for unsafe instructions in the preheader. If there
are no unsafe instructions, all instructions should be movable.
Currently we move all instructions except the terminator and rely on
LICM to hoist out invariant instructions later.
Fixes PR45743
Florian Hahn [Mon, 10 Aug 2020 09:51:36 +0000 (10:51 +0100)]
[LoopInterchange] Form LCSSA phis for values in orig outer loop header.
Values defined in the outer loop header could be used in the inner loop
latch. In that case, we need to create LCSSA phis for them, because after
interchanging they will be defined in the new inner loop and used in the
new outer loop.
Eduardo Caldas [Tue, 4 Aug 2020 17:33:36 +0000 (17:33 +0000)]
[SyntaxTree] Implement the List construct.
We defined a List construct to help with the implementation of list-like
grammar rules. This is a first implementation of this API.
Differential Revision: https://reviews.llvm.org/D85295
Qiu Chaofan [Mon, 10 Aug 2020 10:25:01 +0000 (18:25 +0800)]
[PowerPC] Add intrinsic to read or set FPSCR register
This patch introduces two intrinsics: llvm.ppc.setflm and
llvm.ppc.readflm. They read from or write to FPSCR register
(floating-point status & control) which contains rounding mode and
exception status.
To ensure correctness of program, we need to prevent FP operations from
being moved across these intrinsics (mffs/mtfsf instruction), so here I
set them as scheduling boundaries. We can relax such restriction if
FPSCR is modeled well in the future.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D84914
Simon Pilgrim [Mon, 10 Aug 2020 10:14:01 +0000 (11:14 +0100)]
[ScalarizeMaskedMemIntrin][X86] Refresh missed transform test cases from rGc0c3b9a25fee
Differential Revision: https://reviews.llvm.org/D85416
Simon Pilgrim [Mon, 10 Aug 2020 10:05:43 +0000 (11:05 +0100)]
[ScalarizeMaskedMemIntrin] Scalarize constant mask expandload as shuffle(build_vector,pass_through)
As noticed on D66004, scalarization of an expandload with a constant mask as a chain of irregular loads+inserts makes it tricky to optimize before lowering, resulting in difficulties in merging loads etc.
This patch instead scalarizes the expansion to a build_vector(load0, load1, undef, load2,....) style pattern and then performs a blend shuffle with the pass through vector. This allows us to more easily make use of all the build_vector combines, merging of consecutive loads etc.
Differential Revision: https://reviews.llvm.org/D85416
Raphael Isemann [Mon, 10 Aug 2020 09:29:40 +0000 (11:29 +0200)]
[lldb][NFC] Remove dead code in BreakpointResolverAddress
Igor Kudrin [Mon, 10 Aug 2020 08:56:30 +0000 (15:56 +0700)]
[DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.
This also fixes the condition in the assertion in
DwarfCompileUnit::getLabelBegin() because it checked something unrelated
to the returned value.
Differential Revision: https://reviews.llvm.org/D85437
Jing Pu [Mon, 10 Aug 2020 08:32:24 +0000 (10:32 +0200)]
Free the memory allocated by mlirOperationStateAddXXX methods in mlirOperationCreate.
Previously, the memory leaks on heap. Since the MlirOperationState is not intended to be used again after mlirOperationCreate, the patch simplify frees the memory in mlirOperationCreate instead of creating any new API.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D85629
Petar Avramovic [Mon, 10 Aug 2020 08:10:46 +0000 (10:10 +0200)]
AMDGPU/GlobalISel: Lower G_FREM
Add custom lower for G_FREM.
Differential Revision: https://reviews.llvm.org/D84324
Aleksandr Platonov [Mon, 10 Aug 2020 07:23:08 +0000 (10:23 +0300)]
[clang-tidy] Fix a crash in bugprone-not-null-terminated-result check when `__STDC_WANT_LIB_EXT1__` was undefined after definition.
PP->getMacroInfo() returns nullptr for undefined macro, so we need to check this return value before dereference.
Stack dump:
```
#0 0x0000000002185e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x2185e6a)
#1 0x0000000002183e8c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x2183e8c)
#2 0x0000000002183ff3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x2183ff3)
#3 0x00007f37df9b1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x000000000052054e clang::tidy::bugprone::NotNullTerminatedResultCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x52054e)
```
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D85523
Haojian Wu [Mon, 10 Aug 2020 07:11:08 +0000 (09:11 +0200)]
[Concepts] Dump template arguments for immediately declared constraint.
The template arguments were dumped as part of the TemplateTypeParmDecl, which
was incorrect.
Differential Revision: https://reviews.llvm.org/D85282
Nathan Ridge [Mon, 10 Aug 2020 00:37:18 +0000 (20:37 -0400)]
[clang] Allow DynTypedNode to store a TemplateArgumentLoc
The patch also adds a templateArgumentLoc() AST matcher.
Differential Revision: https://reviews.llvm.org/D85621
Vitaly Buka [Sat, 8 Aug 2020 09:10:10 +0000 (02:10 -0700)]
[NFC][StackSafety] Add a couple of early returns
Richard Smith [Mon, 10 Aug 2020 06:30:30 +0000 (23:30 -0700)]
More cleanup after removing the ability to reference a dependent
VarTemplateSpecializationDecl.
Vitaly Buka [Sat, 8 Aug 2020 21:00:42 +0000 (14:00 -0700)]
[NFC][StackSafety] Count dataflow inputs
Vitaly Buka [Mon, 10 Aug 2020 06:30:27 +0000 (23:30 -0700)]
[NFC][Attributor] Add missing override
Richard Smith [Thu, 16 Jul 2020 02:37:15 +0000 (19:37 -0700)]
Improve modeling of variable template specializations with dependent
arguments.
Don't build a variable template specialization declaration until its
scope and template arguments are non-dependent.
No functionality change intended, but the AST representation is now more
consistent with how we model other templates.
Vitaly Buka [Sat, 8 Aug 2020 09:05:04 +0000 (02:05 -0700)]
[StackSafety] Fix union which produces wrapped sets
Vitaly Buka [Sat, 8 Aug 2020 00:28:05 +0000 (17:28 -0700)]
[NFC][StackSafety] Avoid assert in getBaseObjec
Eric Christopher [Mon, 10 Aug 2020 05:12:10 +0000 (22:12 -0700)]
Add override to fix -Winconsistent-missing-override warning.
Craig Topper [Mon, 10 Aug 2020 03:24:54 +0000 (20:24 -0700)]
[TableGen] Pull the increment of a variable out of an assert.
The variable is only used by the assert so the code was fine
before, but it was flagged in PR47072.
Kazu Hirata [Mon, 10 Aug 2020 02:29:38 +0000 (19:29 -0700)]
[docs] Fix typos
Juneyoung Lee [Mon, 10 Aug 2020 01:57:18 +0000 (10:57 +0900)]
[BuildLibCalls] Add noundef to standard I/O functions
This patch adds noundef to return value and arguments of standard I/O functions.
With this patch, passing undef or poison to the functions becomes undefined
behavior in LLVM IR. Since undef/poison is lowered from operations having UB in C/C++,
passing undef to them was already UB in source.
With this patch, the functions cannot return undef or poison anymore as well.
According to C17 standard, ungetc/ungetwc/fgetpos/ftell can generate unspecified
value; 3.19.3 says unspecified value is a valid value of the relevant type,
and using unspecified value is unspecified behavior, which is not UB, so it
cannot be undef (using undef is UB when e.g. it is used at branch condition).
— The value of the file position indicator after a successful call to the ungetc function for a text stream, or the ungetwc function for any stream, until all pushed-back characters are read or discarded (7.21.7.10, 7.29.3.10).
— The details of the value stored by the fgetpos function (7.21.9.1).
— The details of the value returned by the ftell function for a text stream (7.21.9.4).
In the long run, most of the functions listed in BuildLibCalls should have noundefs; to remove redundant diffs which will anyway disappear in the future, I added noundef to a few more non-I/O functions as well.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D85345
Jacques Pienaar [Mon, 10 Aug 2020 01:02:08 +0000 (18:02 -0700)]
[mlir][drr] Make error easier to understand
Changes error from
error: referencing unbound symbol ''
to
error: raw string not supported as argument
Brad Smith [Mon, 10 Aug 2020 00:52:43 +0000 (20:52 -0400)]
Re-enable OpenBSD PowerPC64 tests.
Shinji Okumura [Mon, 10 Aug 2020 00:18:10 +0000 (09:18 +0900)]
[Attributor][NFC][AAPotentialValues] Change interface of PotentialValuesState
Previously `PotentialValuesState` inherited `BooleanState`.
We have to add `getAssumed` to the state in order to use `clampStateAndIndicateChange` (which will be used in `AAPotentialValuesArgument`).
However `BooleanState::getAssumed` is not a virtual function and we cannot override it.
Therefore, I changed the state not to inherit `BooleanState` and add `getAssumed` to it.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D85610
Brad Smith [Sun, 9 Aug 2020 23:43:16 +0000 (19:43 -0400)]
int64_t and intmax_t are always (signed) long long on OpenBSD.
Vitaly Buka [Sat, 8 Aug 2020 00:25:50 +0000 (17:25 -0700)]
[StackSafety] Don't keep FullSet in index
Optimization. Missing record is enterpreted as FullSet anyway.
Vitaly Buka [Sun, 9 Aug 2020 21:28:17 +0000 (14:28 -0700)]
[StackSafety] Use getSignedMin() to serialize ranges
Almost NFC as it's important only for full sets which should not
be serialized at all.
Vitaly Buka [Sun, 9 Aug 2020 02:09:34 +0000 (19:09 -0700)]
[NFC][StackSafety] Add index test
This directly covers generateParamAccessSummary
Vitaly Buka [Sun, 9 Aug 2020 21:31:06 +0000 (14:31 -0700)]
[NFC][StackSafety] Add shell test requirement
Dávid Bolvanský [Sun, 9 Aug 2020 21:17:48 +0000 (23:17 +0200)]
[AST] Fixed string list in test
Dávid Bolvanský [Sun, 9 Aug 2020 21:09:19 +0000 (23:09 +0200)]
[AST] Fixed string concatenation warnings
Kirill Bobyrev [Sun, 9 Aug 2020 20:07:26 +0000 (22:07 +0200)]
[clangd] Add more error details on the remote index server side
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D85502
Dávid Bolvanský [Sun, 9 Aug 2020 20:04:53 +0000 (22:04 +0200)]
[X86] Added testcases for PR47024 and PR46315
Vitaly Buka [Sun, 9 Aug 2020 19:38:53 +0000 (12:38 -0700)]
[NFC][StackSafety] Avoid some duplications in tests
Gousemoodhin Nadaf [Sun, 9 Aug 2020 19:01:36 +0000 (21:01 +0200)]
[clang] Fix typo in comment
In the handleIntToFloatConversion() function, 6th parameter is ConvertFloat, 7th parameter is ConvertInt.
Reviewed By: njames93, xbolva00
Differential Revision: https://reviews.llvm.org/D85568
Craig Topper [Sun, 9 Aug 2020 07:37:18 +0000 (00:37 -0700)]
[X86][GlobalISel] Enable a test case for sext i32->i64 that was commented out.
Test case seems to work so I guess whatever lead to it being
commented out with a FIXME has been fixed.
Piotr Sobczak [Thu, 30 Jul 2020 11:56:06 +0000 (13:56 +0200)]
Fix 64-bit copy to SCC
Fix 64-bit copy to SCC by restricting the pattern resulting
in such a copy to subtargets supporting 64-bit scalar compare,
and mapping the copy to S_CMP_LG_U64.
Before introducing the S_CSELECT pattern with explicit SCC
(
0045786f146e78afee49eee053dc29ebc842fee1), there was no need
for handling 64-bit copy to SCC ($scc = COPY sreg_64).
The proposed handling to read only the low bits was however
based on a false premise that it is only one bit that matters,
while in fact the copy source might be a vector of booleans and
all bits need to be considered.
The practical problem of mapping the 64-bit copy to SCC is that
the natural instruction to use (S_CMP_LG_U64) is not available
on old hardware. Fix it by restricting the problematic pattern
to subtargets supporting the instruction (hasScalarCompareEq64).
Differential Revision: https://reviews.llvm.org/D85207
Florian Hahn [Sun, 9 Aug 2020 18:47:16 +0000 (19:47 +0100)]
[InstSimplify] Make sure CanUseUndef is initialized in all cases.
This should fix a bunch of buildbot failures.
Florian Hahn [Sun, 9 Aug 2020 18:16:56 +0000 (19:16 +0100)]
[InstSimplify/NewGVN] Add option to control the use of undef.
Making use of undef is not safe if the simplification result is not used
to replace all uses of the result. This leads to problems in NewGVN,
which does not replace all uses in the IR directly. See PR33165 for more
details.
This patch adds an option to SimplifyQuery to disable the use of undef.
Note that I've only guarded uses if isa<UndefValue>/m_Undef where
SimplifyQuery is currently available. If we agree on the general
direction, I'll update the remaining uses.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84792
Florian Hahn [Sun, 9 Aug 2020 15:48:44 +0000 (16:48 +0100)]
[SCEVExpander] Make sure cast properly dominates Builder's IP.
The selected cast must properly dominate the Builder's IP, so we cannot
re-use the cast, if it matches the builder's IP.
Aditya Kumar [Sun, 9 Aug 2020 15:45:36 +0000 (08:45 -0700)]
[HotColdSplit] Add options for splitting cold functions in separate section
Add support for (if enabled) splitting cold functions into a separate section
in order to further boost locality of hot code.
Authored by: rjf (Ruijie Fang)
Reviewed by: hiraditya,rcorcs,vsk
Differential Revision: https://reviews.llvm.org/D85331
Dávid Bolvanský [Sun, 9 Aug 2020 14:07:36 +0000 (16:07 +0200)]
[Tests] Precommit tests for D85593
Dávid Bolvanský [Sun, 9 Aug 2020 14:00:01 +0000 (16:00 +0200)]
[Diagnostics] Handle string concat pattern and avoid false positives
Sanjay Patel [Sun, 9 Aug 2020 12:59:54 +0000 (08:59 -0400)]
[VectorCombine] try to create vector loads from scalar loads
This patch was adjusted to match the most basic pattern that starts with an insertelement
(so there's no extract created here). Hopefully, that removes any concern about
interfering with other passes. Ie, the transform should almost always be profitable.
We could make an argument that this could be part of canonicalization, but we
conservatively try not to create vector ops from scalar ops in passes like instcombine.
If the transform is not profitable, the backend should be able to re-scalarize the load.
Differential Revision: https://reviews.llvm.org/D81766
Florian Hahn [Sun, 9 Aug 2020 12:16:59 +0000 (13:16 +0100)]
[SCEVExpander] Avoid re-using existing casts if it means updating users.
Currently the SCEVExpander tries to re-use existing casts, even if they
are not exactly at the insertion point it was asked to create the cast.
To do so in some case, it creates a new cast at the insertion point and
updates all users to use the new cast.
This behavior is problematic, because it changes the IR outside of the
instructions created during the expansion. Therefore we cannot
completely undo all changes made during expansion.
This re-use should be only an extra optimization, so only using the new
cast in the expanded instructions should not be a correctness issue.
There are many cases equivalent instructions are created during
expansion.
This patch also adjusts findInsertPointAfter to skip instructions
inserted during expansion. This enables re-using existing casts without
the renaming any uses, by picking a better insertion point.
Reviewed By: efriedma, lebedev.ri
Differential Revision: https://reviews.llvm.org/D84399
Michał Górny [Wed, 5 Aug 2020 08:15:41 +0000 (10:15 +0200)]
[Polly] Reuse LLVM's build rules for gtest/gmock
Reuse LLVM's CMakeLists.txt for gtest/gmock instead of reinventing
them in Polly. This fixes a lot of linking errors due to not linking
LLVMSupport in for me.
Differential Revision: https://reviews.llvm.org/D85280
Dávid Bolvanský [Sun, 9 Aug 2020 10:22:29 +0000 (12:22 +0200)]
[Diagnostics] Turn string concat warning to avoid false positives
David Green [Sun, 9 Aug 2020 10:09:49 +0000 (11:09 +0100)]
[ARM] Add VADDV and VMLAV patterns for v16i16
This adds patterns for v16i16's vecreduce, using all the existing code
to go via an i32 VADDV/VMLAV and truncating the result.
Differential Revision: https://reviews.llvm.org/D85452
David Green [Sun, 9 Aug 2020 09:57:17 +0000 (10:57 +0100)]
[ARM] Allow vecreduce_add in tail predicated loops
This allows vecreduce_add in loops so that we can tailpredicate them.
Differential Revision: https://reviews.llvm.org/D85454
David Green [Sat, 8 Aug 2020 13:43:09 +0000 (14:43 +0100)]
[ARM] Some formatting and predicate VRHADD patterns. NFC
This formats some of the MVE patterns, and adds a missing
Predicates = [HasMVEInt] to some VRHADD patterns I noticed
as going through. Although I don't believe NEON would ever
use the patterns (as it would use ADDL and VSHRN instead)
they should ideally be predicated on having MVE instructions.
Georgii Rymar [Fri, 7 Aug 2020 09:41:20 +0000 (12:41 +0300)]
[llvm-readelf/obj] - Refine the implementation of printMipsReginfo().
It adds the proper warnings reporting and updates the mips-reginfo.test to
remove using of the precompiled binary.
Differential revision: https://reviews.llvm.org/D85511
Georgii Rymar [Fri, 7 Aug 2020 10:38:16 +0000 (13:38 +0300)]
[llvm-readobj] - Remove 3 excessive test cases.
This patch does the following:
1) Removes mips-options.test and the corresponding Inputs/mips-options.elf-mips64el binary:
This is a test that checks that --dynamic-table is able to print the DT_MIPS_OPTIONS tag.
We are testing it in dynamic-tags-machine-specific.test already.
(https://github.com/llvm/llvm-project/blob/master/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test#L235)
2) Removes mips-rld-map-rel.test and the corresponding Inputs/mips-rld-map-rel.elf-mipsel binary.
This is a test that checks that --dynamic-table is able to print the DT_MIPS_RLD_MAP_REL tag.
We are testing it in dynamic-tags-machine-specific.test already.
(https://github.com/llvm/llvm-project/blob/master/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test#L257)
3) Removes ppc64-glink.test test and the corresponding Inputs/ppc64.exe binary.
This is a test that checks that --dynamic-table is able to print the DT_PPC64_GLINK tag.
We are testing it in dynamic-tags-machine-specific.test already.
(https://github.com/llvm/llvm-project/blob/master/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test#L337)
Differential revision: https://reviews.llvm.org/D85515
Craig Topper [Sun, 9 Aug 2020 07:24:53 +0000 (00:24 -0700)]
[X86][GlobalISel] Remove unneeded code for handling zext i8->16, i8->i64, i16->i64, i32->i64.
These all seem to be handled by tablegen pattern imports.
Uday Bondhugula [Sat, 8 Aug 2020 21:48:04 +0000 (03:18 +0530)]
[MLIR][NFC] Fix misleading diagnostic error + clang-tidy fix
Fix misleading diagnostic error in affine.yield verifier + a clang-tidy fix.
Differential Revision: https://reviews.llvm.org/D85587
Craig Topper [Sun, 9 Aug 2020 05:09:21 +0000 (22:09 -0700)]
[DAGCombiner] Teach SimplifySetCC SETUGE X, SINTMIN -> SETLT X, 0 and SETULE X, SINTMAX -> SETGT X, -1.
These aren't the canonical forms we'd get from InstCombine, but
we do have X86 tests for them. Recognizing them is pretty cheap.
While there make use of APInt:isSignedMinValue/isSignedMaxValue
instead of creating a new APInt to compare with. Also use
SelectionDAG::getAllOnesConstant helper to hide the all ones
APInt creation.
Craig Topper [Sun, 9 Aug 2020 00:12:20 +0000 (17:12 -0700)]
[X86] Autogenerate complete checks. NFC
Vitaly Buka [Sun, 9 Aug 2020 04:26:35 +0000 (21:26 -0700)]
Revert "[NFC][StackSafety] Add index test"
This reverts commit
5fd49911db546cda6b35dffb6be440385e8d96d5.
GUIDs don't match.
Vitaly Buka [Sun, 9 Aug 2020 02:09:34 +0000 (19:09 -0700)]
[NFC][StackSafety] Add index test
This directly covers generateParamAccessSummary
Vitaly Buka [Sat, 8 Aug 2020 00:22:08 +0000 (17:22 -0700)]
[NFC][StackSafety] noinline in alias tests
Fangrui Song [Sun, 9 Aug 2020 01:17:38 +0000 (18:17 -0700)]
[ELF] --wrap: don't leave the original symbol as SHN_UNDEF in .symtab or .dynsym
weihe [Sun, 9 Aug 2020 00:49:33 +0000 (17:49 -0700)]
[llvm-profdata] Implement llvm-profdata overlap for sample profiles
Implemented the `llvm-profdata overlap` feature for sample profiles. It reports weighted //similarity// and unweighted //overlap// metrics at program and function level for two input profiles. Similarity metrics are symmetric with regards to the order of two input profiles. By default, the tool only reports program-level summary. Users can look into function-level details via additional options `--function`, `--similarity-cutoff`, and `--value-cutoff`.
The similarity metrics are designed as follows:
* Program-level summary
* Whole program profile similarity is an aggregate over function-level similarity `FS`: `PS = sum(FS(A) * avg_weight(A))` for all function `A`.
* Whole program sample overlap: `PSO = common_samples / total_samples`.
* Function overlap: `FO = #common_function / #total_function`.
* Hot-function overlap: `HFO = #common_hot_function / #total_hot_function`.
* Hot-block overlap: `HBO = #common_hot_block / #total_hot_block`.
* Function-level details
* Function-level similarity is an aggregate over line/block-level similarities `BS` of all sample lines/blocks in the function, weighted by the closeness of the function's weights in two profiles: `FS = sum(BS(i)) * (1 - weight_distance(A))`.
* Function-level sample overlap: `FSO = common_samples / total_samples` for samples in the function.
Reviewed By: wenlei, hoyFB, wmi
Differential Revision: https://reviews.llvm.org/D83852
Petr Hosek [Sun, 9 Aug 2020 00:08:23 +0000 (17:08 -0700)]
Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit
ccbc1485b55ff4acd21bcfafbf7aec4ed0fd818d which
is still failing on the Windows MLIR bots.
Petr Hosek [Thu, 30 Apr 2020 20:07:13 +0000 (13:07 -0700)]
[CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.
This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.
Differential Revision: https://reviews.llvm.org/D79219
Brad Smith [Sat, 8 Aug 2020 22:39:43 +0000 (18:39 -0400)]
Backout a test that is dependent on an uncommited diff. Fix another.
Thomas Lively [Sat, 8 Aug 2020 22:23:11 +0000 (15:23 -0700)]
[WebAssembly] Fix FastISel address calculation bug
Fixes PR47040, in which an assertion was improperly triggered during
FastISel's address computation. The issue was that an `Address` set to
be relative to the FrameIndex with offset zero was incorrectly
considered to have an unset base. When the left hand side of an add
set the Address to be 0 off the FrameIndex, the right side would not
detect that the Address base had already been set and could try to set
the Address to be relative to a register instead, triggering an
assertion.
This patch fixes the issue by explicitly tracking whether an `Address`
has been set rather than interpreting an offset of zero to mean the
`Address` has not been set.
Differential Revision: https://reviews.llvm.org/D85581
Brad Smith [Sat, 8 Aug 2020 21:58:13 +0000 (17:58 -0400)]
fix typo
Brad Smith [Sat, 8 Aug 2020 21:51:19 +0000 (17:51 -0400)]
Hook up OpenBSD 64-bit PowerPC support
Vincent Zhao [Sat, 8 Aug 2020 21:41:44 +0000 (03:11 +0530)]
[MLIR] Consider AffineIfOp when getting the index set of an Op wrapped in nested loops
This diff attempts to resolve the TODO in `getOpIndexSet` (formerly
known as `getInstIndexSet`), which states "Add support to handle IfInsts
surronding `op`".
Major changes in this diff:
1. Overload `getIndexSet`. The overloaded version considers both
`AffineForOp` and `AffineIfOp`.
2. The `getInstIndexSet` is updated accordingly: its name is changed to
`getOpIndexSet` and its implementation is based on a new API `getIVs`
instead of `getLoopIVs`.
3. Add `addAffineIfOpDomain` to `FlatAffineConstraints`, which extracts
new constraints from the integer set of `AffineIfOp` and merges it to
the current constraint system.
4. Update how a `Value` is determined as dim or symbol for
`ValuePositionMap` in `buildDimAndSymbolPositionMaps`.
Differential Revision: https://reviews.llvm.org/D84698
Craig Topper [Sat, 8 Aug 2020 21:05:51 +0000 (14:05 -0700)]
[X86] Remove a DCI.isBeforeLegalize() call from combineVSelectWithAllOnesOrZeros.
This was blocking isTypeLegal call so that we could do a particular
transform on illegal types before type legalization. But the we
create a target specific node using that type. We shouldn't do
that if the type isn't legal. So I think we should just always
make sure the type is legal.
I suspect that in order to get the condition VT to not be a vector
of i1 we already completed type legalization anyway so this probably
doesn't matter much in practice.
Roman Lebedev [Sat, 8 Aug 2020 20:21:08 +0000 (23:21 +0300)]
[Reduce] Rewrite function body delta pass again
It is not enough to replace all uses of users of the function with undef,
the users, we only drop instruction users, so they may stick around.
Let's try different approach - first drop bodies for all the functions
we will drop, which should take care of blockaddress issue the previous
rewrite was dealing with; then, after dropping *all* such bodies,
replace remaining uses with undef (thus all the uses are either
outside of functions, or are in kept functions)
and then finally drop functions.
This seems to work, and passes the *existing* test coverage,
but it is possible that a new issue will be discovered later :)
A new (previously crashing) test added.
Dávid Bolvanský [Sat, 8 Aug 2020 20:44:14 +0000 (22:44 +0200)]
[libcxx-fuzzing] Fixed bug found by -Wstring-concatenation
Craig Topper [Sat, 8 Aug 2020 19:58:49 +0000 (12:58 -0700)]
[X86] Support matching VPTERNLOG when the root node is X86ISD::ANDNP.
Craig Topper [Sat, 8 Aug 2020 19:50:33 +0000 (12:50 -0700)]
[X86] Add VPTERNLOG test cases where the root node will be X86ISD::ANDNP. NFC
We currently fail to match this.
Dávid Bolvanský [Sat, 8 Aug 2020 19:47:01 +0000 (21:47 +0200)]
[AArch64RegisterInfo] Supress new warning
Craig Topper [Sat, 8 Aug 2020 19:00:15 +0000 (12:00 -0700)]
[X86] Remove isSafeToClobberEFLAGS helper and just inline it into the call sites.
This is just a thin wrapper around computeRegisterLivness which
we can just call directly. The only real difference is that
isSafeToClobberEFLAGS returns a bool and computeRegisterLivness
returns an enum. So we need to check for the specific enum value
that isSafeToClobberEFLAGS was hiding.
I've also adjusted which sites pass an explicit value for
Neighborhood since the default for computeRegisterLivness is 10.
Muhammad Omair Javaid [Fri, 7 Aug 2020 22:35:15 +0000 (03:35 +0500)]
[LLDB] Fix timeout value on expect_gdbremote_sequence
D83904 seems to have changed timeout value on expect_gdbremote_sequence which
was 120 previously. This seems to be causing intermittent failures on
lldb-aarch64-ubuntu buildbot.
This patch fixes the timeout value to see the impact on test suite.
Example:
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/7401/steps/test/logs/stdio
Differential Revision: https://reviews.llvm.org/D85514
Craig Topper [Sat, 8 Aug 2020 18:38:50 +0000 (11:38 -0700)]
Recommit "[X86] Increase the number of instructions searched for isSafeToClobberEFLAGS in a couple places"
I messed up the bug numbers in the commit message before
Previously this function searched 4 instructions forwards or
backwards to determine if it was ok to clobber eflags.
This is called in 3 places: rematerialization, turning 2 operand
leas into adds or splitting 3 ops leas into an lea and add on some
CPU targets.
This patch increases the search limit to 10 instructions for
rematerialization and 2 operand lea to add. I've left the old
treshold for 3 ops lea spliting as that increases code size.
Fixes PR47024 and PR46315.
Craig Topper [Sat, 8 Aug 2020 18:38:26 +0000 (11:38 -0700)]
Revert "[X86] Increase the number of instructions searched for isSafeToClobberEFLAGS in a couple places"
This reverts commit
44b260cb0aab387d85e4d59c16fc7b8866264f5e.
I messed up the bug number in the commit message so I'm reverting
to fix it.
Dávid Bolvanský [Sat, 8 Aug 2020 18:45:24 +0000 (20:45 +0200)]
[FileCheckTest] Supress new warning
Simon Pilgrim [Sat, 8 Aug 2020 18:35:57 +0000 (19:35 +0100)]
[X86][SSE] combineTargetShuffle - use scaleShuffleMask helper to widen shuffle mask. NFCI.
Use scaleShuffleMask helper for the shuffle(hadd,hadd) canonicalization.
Craig Topper [Sat, 8 Aug 2020 18:03:16 +0000 (11:03 -0700)]
[X86] Increase the number of instructions searched for isSafeToClobberEFLAGS in a couple places
Previously this function searched 4 instructions forwards or
backwards to determine if it was ok to clobber eflags.
This is called in 3 places: rematerialization, turning 2 operand
leas into adds or splitting 3 ops leas into an lea and add on some
CPU targets.
This patch increases the search limit to 10 instructions for
rematerialization and 2 operand lea to add. I've left the old
treshold for 3 ops lea spliting as that increases code size.
Fixes PR47024 and PR43014
Simon Pilgrim [Sat, 8 Aug 2020 18:26:02 +0000 (19:26 +0100)]
[InstCombine] Use CreateVectorSplat(ElementCount) variant directly
This was introduced at rGe20223672100, and the CreateVectorSplat(unsigned NumElements) variant calls it internally
Simon Pilgrim [Sat, 8 Aug 2020 18:12:11 +0000 (19:12 +0100)]
Fix MSVC "not all control paths return a value" warning. NFC.
Brad Smith [Sat, 8 Aug 2020 17:49:45 +0000 (13:49 -0400)]
Change the default target CPU for OpenBSD/i386 to i586
Dávid Bolvanský [Sat, 8 Aug 2020 17:37:50 +0000 (19:37 +0200)]
[Clang] Fixed buildboit failure; bot defaults to older C++ standard
Dávid Bolvanský [Sat, 8 Aug 2020 17:34:07 +0000 (19:34 +0200)]
[Clang] Avoid whitespace in fixit note