Commit Graph

365370 Commits

Author SHA1 Message Date
Vitaly Buka 298c9fae93 [NFC][compiler-rt] Refine .clang-tidy checks
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D87182
2020-09-05 15:42:15 -07:00
Krzysztof Parzyszek 1387f96ab3 [Hexagon] Handle widening of vector truncate 2020-09-05 15:07:38 -05:00
Nikita Popov 621b10ca18 [InstSimplify] Add tests for a peculiar abs of abs form (NFC)
This pattern shows up when canonicalizing to spf abs form to
intrinsic abs form.
2020-09-05 21:42:22 +02:00
Florian Hahn 1ddb3a369f [LangRef] Adjust guarantee for llvm.memcpy to also allow equal arguments.
This adjusts the description of `llvm.memcpy` to also allow operands
to be equal. This is in line with what Clang currently expects.

This change is intended to be temporary and followed by re-introduce
a variant with the non-overlapping guarantee for cases where we can
actually ensure that property in the front-end.

See the links below for more details:
http://lists.llvm.org/pipermail/cfe-dev/2020-August/066614.html
and PR11763.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D86815
2020-09-05 19:18:23 +01:00
Lawrence D'Anna 0c64282861 scan-build-py: fix multiprocessing error
Recent versions of python3's multiprocessing module will blow up with
a Runtime error from this code, saying:

  An attempt has been made to start a new process before the
  current process has finished its bootstrapping phase

This is becuae the wrappers in bin/ are not using the  `__name__ == "__main__"`   idiom correctly.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D87051
2020-09-05 11:10:14 -07:00
Jessica Clarke bef38e86b4 [ELF] Handle SHT_RISCV_ATTRIBUTES similarly to SHT_ARM_ATTRIBUTES
Currently we treat SHT_RISCV_ATTRIBUTES like a normal section and
concatenate all such input sections, yielding invalid output unless only
a single attributes section is present in the input. Instead, pick the
first as with SHT_ARM_ATTRIBUTES. We do not currently need to condition
our behaviour on the contents, unlike Arm. In future, we should both do
stricter validation of the input and merge all sections together to
ensure we have, for example, the full arch string requirement, but this
rudimentary implementation is good enough for most common cases.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D86309
2020-09-05 18:36:23 +01:00
Aaron Puchert da6b3aa4c6 Attempt to fix Sphinx build failure, NFC
A code block wasn't properly introduced.
2020-09-05 18:25:27 +02:00
Aaron Puchert d3a779fe21 Restore size of TemplateParameterList after D44352
After adding a field of one bit, the bitfield members would take
30+1+1+1 = 33 bits, causing the size of TemplateParameterList to
increase from 16 to 24 bytes on 64-bit systems.

With 29 bits for NumParams we can encode up to half a billion template
parameters, which is almost certainly still enough for anybody.
2020-09-05 18:01:33 +02:00
Nikita Popov 5ad6552a83 [InstCombine] Add tests for known negative abs intrinsic (NFC)
And duplicate tests for known non-negative from InstSimplify.
2020-09-05 17:31:04 +02:00
Aaron Puchert b2ce79ef66 Thread safety analysis: ValueDecl in Project is non-null
The constructor asserts that, use it in the ThreadSafetyAnalyzer.
Also note that the result of a cast<> cannot be null.
2020-09-05 17:26:12 +02:00
Aaron Puchert 9dcc82f34e Thread safety analysis: Consider global variables in scope
Instead of just mutex members we also consider mutex globals.
Unsurprisingly they are always in scope. Now the paper [1] says that

> The scope of a class member is assumed to be its enclosing class,
> while the scope of a global variable is the translation unit in
> which it is defined.

But I don't think we should limit this to TUs where a definition is
available - a declaration is enough to acquire the mutex, and if a mutex
is really limited in scope to a translation unit, it should probably be
only declared there.

[1] https://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/42958.pdf

Fixes PR46354.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D84604
2020-09-05 17:26:12 +02:00
Nikita Popov ac87480bd8 [SCEV] Recognize min/max intrinsics
Recognize umin/umax/smin/smax intrinsics and convert them to the
already existing SCEV nodes of the same name.

In the future we'll want SCEVExpander to also produce the intrinsics,
but we're not ready for that yet.

Differential Revision: https://reviews.llvm.org/D87160
2020-09-05 16:30:11 +02:00
Nikita Popov 4892d3a198 [InstCombine] Fold abs with dominating condition
Similar to D87168, but for abs. If we have a dominating x >= 0
condition, then we know that abs(x) is x. This fold is in
InstCombine, because we need to create a sub instruction for
the x < 0 case.

Differential Revision: https://reviews.llvm.org/D87184
2020-09-05 16:18:35 +02:00
Nikita Popov 73104b0751 [InstSimplify] Fold min/max based on dominating condition
If we have a dominating condition that x >= y, then umax(x, y) is x,
etc. I'm doing this in InstSimplify as the corresponding transform
for the select form is also done there.

Differential Revision: https://reviews.llvm.org/D87168
2020-09-05 16:16:40 +02:00
Nikita Popov ada8a17d94 [InstCombine] Fold abs intrinsic eq zero
Following the same transform for the select version of abs.
2020-09-05 15:11:38 +02:00
Nikita Popov 94c71d6aa1 [InstCombine] Add tests for abs intrinsic eq zero (NFC) 2020-09-05 15:11:38 +02:00
Uday Bondhugula 430b47a17d [MLIR] Remove unused arg from affine tiling validity check
Drop unused function arg from affine loop tiling validity check.
2020-09-05 18:04:20 +05:30
Aaron Puchert 16975a638d Set InvalidDecl directly when deserializing a Decl
When parsing a C++17 binding declaration, we first create the
BindingDecls in Sema::ActOnDecompositionDeclarator, and then build the
DecompositionDecl in Sema::ActOnVariableDeclarator, so the contained
BindingDecls are never null. But when deserializing, we read the
DecompositionDecl with all properties before filling in the Bindings.
Among other things, reading a declaration reads whether it's invalid,
then calling setInvalidDecl which assumes that all bindings of the
DecompositionDecl are available, but that isn't the case.

Deserialization should just set all properties directly without invoking
subsequent functions, so we just set the flag without using the setter.

Fixes PR34960.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D86207
2020-09-05 14:26:43 +02:00
Aaron Puchert 8544defdcb Thread safety analysis: Document how try-acquire is handled
I don't think this is obvious, since try-acquire seemingly contradicts
our usual requirements of "no conditional locking".

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D87065
2020-09-05 14:26:43 +02:00
Nikita Popov 58b28fa7a2 [InstCombine] Fold mul of abs intrinsic
Same as the existing SPF_ABS fold. We don't need to explicitly
handle NABS, as the negs will get folded away first.
2020-09-05 12:37:45 +02:00
Nikita Popov 3ab13348ba [InstCombine] Add tests for mul of abs intrinsic (NFC) 2020-09-05 12:36:27 +02:00
Nikita Popov 10cb23c6ca [InstCombine] Fold cttz of abs intrinsic
Same as the existing fold for SPF_ABS. We don't need to explicitly
handle the NABS variant, as we'll first fold away the neg in that
case.
2020-09-05 12:25:41 +02:00
Nikita Popov 1903a1afd9 [InstCombine] Add tests for cttz of abs intrinsic (NFC) 2020-09-05 12:22:42 +02:00
Nikita Popov d401e376e4 [InstCombine] Test abs with dominating condition (NFC) 2020-09-05 11:10:01 +02:00
Jonas Paulsson 714ceefad9 [SelectionDAG] Always intersect SDNode flags during getNode() node memoization.
Previously SDNodeFlags::instersectWith(Flags) would do nothing if Flags was
in an undefined state, which is very bad given that this is the default when
getNode() is called without passing an explicit SDNodeFlags argument.

This meant that if an already existing and reused node had a flag which the
second caller to getNode() did not set, that flag would remain uncleared.

This was exposed by https://bugs.llvm.org/show_bug.cgi?id=47092, where an NSW
flag was incorrectly set on an add instruction (which did in fact overflow in
one of the two original contexts), so when SystemZElimCompare removed the
compare with 0 trusting that flag, wrong-code resulted.

There is more that needs to be done in this area as discussed here:

Differential Revision: https://reviews.llvm.org/D86871

Review: Ulrich Weigand, Sanjay Patel
2020-09-05 10:30:38 +02:00
Nikita Popov 39caf9e940 [SCCP] Add tests for intrinsic ranges (NFC) 2020-09-05 10:28:13 +02:00
serge-sans-paille 3a6f3fc160 Fix return status of SimplifyCFG
When a switch case is folded into default's case, that's an IR change that
should be reported, update ConstantFoldTerminator accordingly.

Differential Revision: https://reviews.llvm.org/D87142
2020-09-05 07:54:15 +02:00
Qiu Chaofan 705271d9cd [PowerPC] Expand constrained ppc_fp128 to i32 conversion
Libcall __gcc_qtou is not available, which breaks some tests needing
it. On PowerPC, we have code to manually expand the operation, this
patch applies it to constrained conversion. To keep it strict-safe,
it's using the algorithm similar to expandFP_TO_UINT.

For constrained operations marking FP exception behavior as 'ignore',
we should set the NoFPExcept flag. However, in some custom lowering
the flag is missed. This should be fixed by future patches.

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D86605
2020-09-05 13:16:20 +08:00
Nemanja Ivanovic 2d652949be [PowerPC] Provide vec_cmpne on pre-Power9 architectures in altivec.h
These overloads are listed in appendix A of the ELFv2 ABI specification
without a requirement for ISA 3.0. So these need to be available on
all Altivec-capable architectures. The implementation in altivec.h
erroneously had them guarded for Power9 due to the availability of
the VCMPNE[BHW] instructions. However these need to be implemented
in terms of the VCMPEQ[BHW] instructions on older architectures.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=47423
2020-09-04 21:48:38 -04:00
Fangrui Song a5d6af421d [compiler-rt] Add .clang-tidy with customization to disable readability-identifier-naming
Copied from lldb/.clang-tidy (D75810).

Most compiler-rt code actually uses variableName or variable_name but not VariableName.
Lots of functions use `__function_name` and FunctionName instead of functionName.
Just exclude readability-identifier-naming.
2020-09-04 16:05:20 -07:00
Daniel Sanders 5e04b539c8 [compiler-rt] Try again to correct test after 3f1a9b7eca added segment names to objdump output
One check was missed on the previous attempt
2020-09-04 15:49:11 -07:00
Krzysztof Parzyszek 89a4fe79d4 [Hexagon] Unindent everything in HexagonISelLowering.h, NFC
Just a shift, no other formatting changes.
2020-09-04 17:25:29 -05:00
Pengxuan Zheng 2bccd2b435 [Driver] Allow -specs and -nostartfiles to be forwarded to GCC
With 6a75496836, these two options are no longer
forwarded to GCC. This patch restores the original behavior.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D87162
2020-09-04 15:09:33 -07:00
Jan Korous 7cfc8f0c7c [libclang] Add missing dependency on clangRewrite lib
Differential Revision: https://reviews.llvm.org/D86992
2020-09-04 14:59:53 -07:00
Nikita Popov 781a438408 [InstSimplify] Add tests for min/max with dominating condition (NFC) 2020-09-04 23:45:54 +02:00
LLVM GN Syncbot b07cbccf28 [gn build] Port 69e5abb57b 2020-09-04 21:18:33 +00:00
Jan Korous 69e5abb57b [libclang] Add CXRewriter to libclang API
Differential Revision: https://reviews.llvm.org/D86992
2020-09-04 14:17:03 -07:00
Craig Topper 35b35a373d [X86] Prevent shuffle combining from creating an identical X86ISD::SHUF128.
This can cause an infinite loop if SimplifiedDemandedElts asks
for the node to replace itself.

A similar protection exists in other places in shuffle combining.

Fixes ISPC https://github.com/ispc/ispc/issues/1864
2020-09-04 14:12:49 -07:00
Sanjay Patel 35c6d56c04 [InstCombine] rename tmp values to avoid scripted FileCheck conflicts; NFC 2020-09-04 17:02:18 -04:00
Sanjay Patel c5d6b2b7e5 [InstCombine] add test for assume in block with unreachable (PR47416); NFC 2020-09-04 16:57:35 -04:00
Nikita Popov b3e139444f [BDCE] Add tests for min/max intrinsincs (NFC) 2020-09-04 22:41:52 +02:00
Jan Korous 052f838903 [libclang] Expose couple more AST details via cursors
Differential Revision: https://reviews.llvm.org/D86991
2020-09-04 13:38:47 -07:00
Fangrui Song 398ba37230 [LiveDebugVariables] Delete unneeded doInitialization 2020-09-04 13:27:42 -07:00
Lang Hames 3b64052a25 [ORC] Fix some bugs in TPCDynamicLibrarySearchGenerator, use in llvm-jitlink.
TPCDynamicLibrarySearchGenerator was generating errors on missing
symbols, but that doesn't fit the DefinitionGenerator contract: A symbol
that isn't generated by a particular generator should not cause an
error.

This commit fixes the error by using SymbolLookupFlags::WeaklyReferencedSymbol
for all elements of the lookup, and switches llvm-jitlink to use
TPCDynamicLibrarySearchGenerator.
2020-09-04 13:23:52 -07:00
Nikita Popov 6b50ce3ac9 [SCEV] Add tests for min/max intrinsics (NFC) 2020-09-04 22:08:01 +02:00
Steven Wu 97866b8de8 [ThinLTO][Legacy] Fix StringRef assertion from ThinLTO bots
This is a presumed fix for FireFox thinLTO bot fix which hits assertion
failure for invalid index when access StringRef. Techinically, `IRName`
in the symtab should not be empty string for the entries we cared about
but this will help to fix the bot before more information can be
provided. Otherwise, NFCI.
2020-09-04 12:30:09 -07:00
Daniel Sanders 1eae19a87f [compiler-rt] Try to correct test after 3f1a9b7eca added segment names to objdump output 2020-09-04 12:24:46 -07:00
Nemanja Ivanovic 54205f0bd2 [PowerPC] Allow const pointers for load builtins in altivec.h
The load builtins in altivec.h do not have const in the signature
for the pointer parameter. This prevents using them for loading
from constant pointers. A notable case for such a use is Eigen.

This patch simply adds the missing const.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=47408
2020-09-04 13:56:39 -04:00
Florian Hahn 00eb6fef08 [DSE,MemorySSA] Check for throwing instrs between killing/killed def.
We also have to check all uses between the killing & killed def and
check if any of them is throwing.
2020-09-04 18:54:59 +01:00
Akira Hatanaka 64bb582f4a Fix the type of the invoke function in the block ABI documentation
rdar://problem/67892794
2020-09-04 10:29:09 -07:00