Zoe Carver [Mon, 19 Aug 2019 15:47:16 +0000 (15:47 +0000)]
[libc++] reverts commit
a5f5aad568bb7a91ceee47641f3076ac339ef8c7.
The commit being reverted caused segfaults when building
with libc++ and GCC (and possibly other configurations).
Differential Revision: https://reviews.llvm.org/D62868
llvm-svn: 369270
Pavel Labath [Mon, 19 Aug 2019 15:40:49 +0000 (15:40 +0000)]
Filesystem/Windows: fix inconsistency in readNativeFileSlice API
Summary:
The windows version implementation of readNativeFileSlice, was trying to
match the POSIX behavior of not treating EOF as an error, but it was
only handling the case of reading from a pipe. Attempting to read past
the end of a regular file returns a slightly different error code, which
needs to be handled too. This patch adds ERROR_HANDLE_EOF to the list of
error codes to be treated as an end of file, and adds some unit tests
for the API.
This issue was found while attempting to land D66224, which caused a bunch of
lldb tests to start failing on windows.
Reviewers: rnk, aganea
Subscribers: kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66344
llvm-svn: 369269
Roman Lebedev [Mon, 19 Aug 2019 15:01:42 +0000 (15:01 +0000)]
[TargetLowering] x s% C == 0 fold: vector divisor with INT_MIN handling
Summary:
The general fold is only valid for positive divisors.
Which effectively means, it is invalid for `INT_MIN` divisors,
and we currently bailout if we see them.
But that is too strict, we can just fix-up the results.
For that, let's do a second computation 'in parallel':
```
Name: srem -> and
Pre: isPowerOf2(C)
%o = srem i8 %X, C
%r = icmp eq %o, 0
=>
%n = and i8 %X, C-1
%r = icmp eq %n, 0
```
https://rise4fun.com/Alive/Sup
And then just blend results: if the divisor was `INT_MIN`,
pick the value we got via bit-test,
else pick the value from general fold.
There's interesting observation - `ISD::ROTR` is set to
`LegalizeAction::Expand` before AVX512, so we should not
treat `INT_MIN` divisor as even; and as it can be seen
while `@test_srem_odd_even_one` improves on all run-lines,
`@test_srem_odd_even_INT_MIN` only improves for AVX512.
Reviewers: RKSimon, craig.topper, spatel
Reviewed By: RKSimon
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66300
llvm-svn: 369268
Raphael Isemann [Mon, 19 Aug 2019 14:52:48 +0000 (14:52 +0000)]
[lldb][NFC] Stop using GetNumberOfMatches in CompletionRequest test
This function is just a wrapper for GetNumberOfResults and will
be removed soon. This patch just changes all calls to GetNumberOfResults
where possible (which is currently just the unit test).
llvm-svn: 369267
Serge Guelton [Mon, 19 Aug 2019 14:40:33 +0000 (14:40 +0000)]
[nfc] Silent gcc warning
llvm-svn: 369266
George Rimar [Mon, 19 Aug 2019 14:35:08 +0000 (14:35 +0000)]
[llvm-objdump] - Restore lost comment.
It was removed by mistake in r369263 (D66417).
llvm-svn: 369265
Amaury Sechet [Mon, 19 Aug 2019 14:34:08 +0000 (14:34 +0000)]
Automatically generate AVX512 test cases. NFC
llvm-svn: 369264
George Rimar [Mon, 19 Aug 2019 14:32:23 +0000 (14:32 +0000)]
[Object/COFF.h] - Stop returning std::error_code in a few methods. NFCI.
There are 4 methods that return std::error_code now,
though they do not have to because they are always succeed.
I refactored them.
This allows to simplify the code in tools a bit.
llvm-svn: 369263
Fangrui Song [Mon, 19 Aug 2019 14:30:12 +0000 (14:30 +0000)]
[ELF] Move (copy relocation/canonical PLT) before error checking
In processRelocAux(), we handle errors before copy relocation/canonical PLT.
This makes error checking a bit complex because we have to check for
conditions that will be allowed by copy relocation/canonical PLT.
Instead, move copy relocation/canonical PLT before error checking. This
simplifies the previous clumsy error checking code
`config->shared || (config->pie && expr == R_ABS && type != target->symbolicRel)`
to the simple `config->isPic`. Some diagnostics can be reported in
different ways. The code motion changes diagnostics for some contrived
test cases:
* copy-rel-pie-error.s -> copy-rel-pie2.s:
It was rejected before but accepted now. ld.bfd also accepts the case.
* copy-errors.s: "cannot preempt symbol" changes to "symbol 'bar' has no type"
* got32{,x}-i386.s: the suggestion changes from "-fPIC or -Wl,-z,notext" to "-fPIE"
* x86-64-dyn-rel-error5.s: one diagnostic changes for -pie case
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D66007
llvm-svn: 369262
Jinsong Ji [Mon, 19 Aug 2019 14:19:04 +0000 (14:19 +0000)]
[PeepholeOptimizer] Don't assume bitcast def always has input
Summary:
If we have a MI marked with bitcast bits, but without input operands,
PeepholeOptimizer might crash with assert.
eg:
If we apply the changes in PPCInstrVSX.td as in this patch:
[(set v4i32:$XT, (bitconvert (v16i8 immAllOnesV)))]>;
We will get assert in PeepholeOptimizer.
```
llvm-lit llvm-project/llvm/test/CodeGen/PowerPC/build-vector-tests.ll -v
llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:417: const
llvm::MachineOperand &llvm::MachineInstr::getOperand(unsigned int)
const: Assertion `i < getNumOperands() && "getOperand() out of range!"'
failed.
```
The fix is to abort if we found out of bound access.
Reviewers: qcolombet, MatzeB, hfinkel, arsenm
Reviewed By: qcolombet
Subscribers: wdng, arsenm, steven.zhang, wuzish, nemanjai, hiraditya, kbarton, MaskRay, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65542
llvm-svn: 369261
Fangrui Song [Mon, 19 Aug 2019 14:07:14 +0000 (14:07 +0000)]
[ELF][Hexagon] Improve error message for unknown relocations
Like rLLD354040
Previously, for unknown relocation types, in -no-pie/-pie mode, we got something like:
foo.o: unrecognized relocation ...
In -shared mode:
error: can't create dynamic relocation ... against symbol: yyy in readonly segment
Delete the default case from Hexagon::getRelExpr and add the error there. We will get consistent error message like `error: unknown relocation (1024) against symbol foo`
Reviewed By: sidneym
Differential Revision: https://reviews.llvm.org/D66275
llvm-svn: 369260
Aaron Ballman [Mon, 19 Aug 2019 13:37:41 +0000 (13:37 +0000)]
Don't keep stale pointers to LoopInfos.
CGLoopInfo was keeping pointers to parent loop LoopInfos, but when the loop info vector grew, it reallocated the storage and invalidated all of the parent pointers, causing use-after-free. Manage the lifetimes of the LoopInfos separately so that the pointers aren't stale.
Patch by Bevin Hansson.
llvm-svn: 369259
Sid Manning [Mon, 19 Aug 2019 13:32:32 +0000 (13:32 +0000)]
[lld][Hexagon] Add GOTREL relocations.
Add GOTREL relocation support. (S + A - GOT)
Differential Revision: https://reviews.llvm.org/D66260
llvm-svn: 369258
Alex Bradbury [Mon, 19 Aug 2019 13:23:02 +0000 (13:23 +0000)]
[RISCV] Don't force absolute FK_Data_X fixups to relocs
The current behavior of shouldForceRelocation forces relocations for the
majority of fixups when relaxation is enabled. This makes sense for
fixups which incorporate symbols but is unnecessary for simple data
fixups where the fixup target is already resolved to an absolute value.
Differential Revision: https://reviews.llvm.org/D63404
Patch by Edward Jones.
llvm-svn: 369257
David Stenberg [Mon, 19 Aug 2019 12:41:22 +0000 (12:41 +0000)]
[DebugInfo] Allow bundled calls in the MIR's call site info
Summary:
Extend the MIR parser and writer so that the call site information can
refer to calls that are bundled.
Reviewers: aprantl, asowda, NikolaPrica, djtodoro, ivanbaev, vsk
Reviewed By: aprantl
Subscribers: arsenm, hiraditya, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D66145
llvm-svn: 369256
Sanjay Patel [Mon, 19 Aug 2019 12:41:09 +0000 (12:41 +0000)]
[SLP] add test that requires shuffle of scalars; NFC
llvm-svn: 369255
Fangrui Song [Mon, 19 Aug 2019 12:18:18 +0000 (12:18 +0000)]
[llvm-readobj] unwrapOrError: remove unnecessary llvm_unreachable after r369194
llvm-svn: 369254
Sven van Haastregt [Mon, 19 Aug 2019 11:56:03 +0000 (11:56 +0000)]
[OpenCL] Add generic type handling for builtin functions
Generic types are an abstraction of type sets. It mimics the way
functions are defined in the OpenCL specification. For example,
floatN can abstract all the vector sizes of the float type.
This allows to
* stick more closely to the specification, which uses generic types;
* factorize definitions of functions with numerous prototypes in the
tablegen file; and
* reduce the memory impact of functions with many overloads.
Patch by Pierre Gondois and Sven van Haastregt.
Differential Revision: https://reviews.llvm.org/D65456
llvm-svn: 369253
Raphael Isemann [Mon, 19 Aug 2019 11:49:43 +0000 (11:49 +0000)]
[lldb][NFC] Use CompletionRequest in Variable::AutoComplete
llvm-svn: 369252
Anastasia Stulova [Mon, 19 Aug 2019 11:43:16 +0000 (11:43 +0000)]
[OpenCL] Fix addr space deduction for pointers/references to arrays.
Rewrite the logic for detecting if we are deducing addr space of
a pointee type to take into account special logic for arrays. For
pointers/references to arrays we can have any number of parentheses
expressions as well as nested pointers.
Differential Revision: https://reviews.llvm.org/D66137
llvm-svn: 369251
Sanjay Patel [Mon, 19 Aug 2019 11:39:56 +0000 (11:39 +0000)]
[SLP] reduce duplicated code; NFC
llvm-svn: 369250
Raphael Isemann [Mon, 19 Aug 2019 10:46:38 +0000 (10:46 +0000)]
[lldb][NFC] Add a few more completion tests to increase test coverage
These tests are mostly trying to reach the different completion functions
in CommandCompletions.cpp (::ArchitectureNames, ::DiskFiles, ::Modules).
llvm-svn: 369249
Fangrui Song [Mon, 19 Aug 2019 10:05:59 +0000 (10:05 +0000)]
[MC] Simplify ELFObjectWriter::recordRelocation. NFC
llvm-svn: 369248
Jeremy Morse [Mon, 19 Aug 2019 09:53:07 +0000 (09:53 +0000)]
[DebugInfo] Make postra sinking of DBG_VALUEs subregister-safe
Currently the machine instruction sinker identifies DBG_VALUE insts that
also need to sink by comparing register numbers. Unfortunately this isn't
safe, because (after register allocation) a DBG_VALUE may read a register
that aliases what's being sunk. To fix this, identify the DBG_VALUEs that
need to sink by recording & examining their register units. Register units
gives us the following guarantee:
"Two registers overlap if and only if they have a common register unit"
[MCRegisterInfo.h]
Thus we can always identify aliasing DBG_VALUEs if the set of register
units read by the DBG_VALUE, and the register units of the instruction
being sunk, intersect. (MachineSink already uses classes like
"LiveRegUnits" for determining sinking validity anyway).
The test added checks for super and subregister DBG_VALUE reads of a sunk
copy being sunk as well.
Differential Revision: https://reviews.llvm.org/D58191
llvm-svn: 369247
Peter Smith [Mon, 19 Aug 2019 09:46:52 +0000 (09:46 +0000)]
[ELF][ARM] Add a test that maxes out the thunk convergence limit
Add a test that takes the maximum amount of passes permitted to converge.
This will make sure that any symbol defined in a linker script gets the
correct value and that any other convergence limit involving symbol address
doesn't restrict Thunk convergence.
Differential Revision: https://reviews.llvm.org/D66346
llvm-svn: 369246
Sam Tebbs [Mon, 19 Aug 2019 09:38:28 +0000 (09:38 +0000)]
[ARM] Add support for MVE vaddv
This patch adds vecreduce_add and the relevant instruction selection for
vaddv.
Differential revision: https://reviews.llvm.org/D66085
llvm-svn: 369245
David Green [Mon, 19 Aug 2019 09:13:22 +0000 (09:13 +0000)]
[ARM] MVE sext costs
This adds some sext costs for MVE, taken from the length of assembly sequences
that we currently generate.
Differential Revision: https://reviews.llvm.org/D66010
llvm-svn: 369244
Jeremy Morse [Mon, 19 Aug 2019 09:02:18 +0000 (09:02 +0000)]
[DebugInfo] Test for variable range un-coalescing
LiveDebugVariables can coalesce ranges of variable locations across
multiple basic blocks. However when it recreates DBG_VALUE instructions,
it has to recreate one DBG_VALUE per block, otherwise it doesn't
represent the pre-regalloc layout and variable assignments can go missing.
This feature works -- however while mucking around with LiveDebugVariables,
I commented the relevant code it out and no tests failed. Thus, here's a
test that checks LiveDebugVariables preserves DBG_VALUEs across block
boundaries.
Differential Revision: https://reviews.llvm.org/D66347
llvm-svn: 369243
Raphael Isemann [Mon, 19 Aug 2019 08:15:46 +0000 (08:15 +0000)]
[lldb][NFC] Remove StringList::AutoComplete
We don't need this very specific function in StringList that
we only call once in LLDB.
llvm-svn: 369242
David L. Jones [Mon, 19 Aug 2019 08:00:08 +0000 (08:00 +0000)]
Revert [Attributor] Fix: Make sure we set the changed flag
This reverts r369159 (git commit
cbaf1fdea2de891bdbc49cdec89ae2077e6b9ed0)
r369160 caused a test to fail under UBSAN. See thread on llvm-commits.
llvm-svn: 369241
Raphael Isemann [Mon, 19 Aug 2019 07:59:44 +0000 (07:59 +0000)]
[lldb][NFC] Use GetMaxStringLength in CommandObjectApropos::DoExecute
llvm-svn: 369240
Fangrui Song [Mon, 19 Aug 2019 07:59:35 +0000 (07:59 +0000)]
[MC] Delete unnecessary diagnostic: "No relocation available to represent this relative expression"
Replace
- error: No relocation available to represent this relative expression
with
+ error: symbol 'undef' can not be undefined in a subtraction expression
or
+ error: Cannot represent a difference across sections
Keep !IsPcRel as an assertion after the two diagnostic checks are done.
llvm-svn: 369239
Johan Vikstrom [Mon, 19 Aug 2019 07:51:39 +0000 (07:51 +0000)]
[clangd] Added special HighlightingKind for function parameters.
Summary: This means that function parameters are no longer highlighted as variable.other.cpp but instead as variable.parameter.cpp which is the more "correct" TextMate scope for them.
Reviewers: hokein, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66335
llvm-svn: 369238
Raphael Isemann [Mon, 19 Aug 2019 07:22:19 +0000 (07:22 +0000)]
[lldb][NFC] Address review comments to StringList for-loop support
llvm-svn: 369237
David L. Jones [Mon, 19 Aug 2019 07:16:24 +0000 (07:16 +0000)]
Revert [Attributor] Fix: Do not partially resolve returned calls.
This reverts r369160 (git commit
f72d9b1c97b41fff48ad1eecbba59a29c171bff4)
r369160 caused some tests to fail under UBSAN. See thread on llvm-commits.
llvm-svn: 369236
Jan Kratochvil [Mon, 19 Aug 2019 07:06:56 +0000 (07:06 +0000)]
[lldb] Remove unused inheritance in RegularExpression
D66174 left inherited llvm::Regex which is now a member variable there.
Approved as a part of: https://reviews.llvm.org/D66392#1634575
llvm-svn: 369235
Seiya Nuta [Mon, 19 Aug 2019 06:45:48 +0000 (06:45 +0000)]
Revert r369230 and r369231
Looks these commits break CI builds:
- http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-gn/builds/4159
This commit reverts r369230 and r369231 (git coommit: 4a198a7 and dee9546).
llvm-svn: 369234
Fangrui Song [Mon, 19 Aug 2019 06:17:30 +0000 (06:17 +0000)]
[MC] Don't emit .symver redirected symbols to the symbol table
GNU as keeps the original symbol in the symbol table for defined @ and
@@, but suppresses it in other cases (@@@ or undefined). The original
symbol is usually undesired:
In a shared object, the original symbol can be localized with a version
script, but it is hard to remove/localize in an archive:
1) a post-processing step removes the undesired original symbol
2) consumers (executable) of the archive are built with the
version script
Moreover, it can cause linker issues like binutils PR/18703 if the
original symbol name and the base name of the versioned symbol is the
same (both ld.bfd and gold have some code to work around defined @ and
@@). In lld, if it sees f and f@v1:
--version-script =(printf 'v1 {};') => f and f@v1
--version-script =(printf 'v1 { f; };') => f@v1 and f@@v1
It can be argued that @@@ added on 2000-11-13 corrected the @ and @@ mistake.
This patch catches some more multiple version errors (defined @ and @@),
and consistently suppress the original symbol. This addresses all the
problems listed above.
If the user wants other aliases to the versioned symbol, they can copy
the original symbol to other symbol names with .set directive, e.g.
.symver f, f@v1 # emit f@v1 but not f into .symtab
.set f_impl, f # emit f_impl into .symtab
llvm-svn: 369233
Craig Topper [Mon, 19 Aug 2019 05:45:39 +0000 (05:45 +0000)]
[X86] Teach lower1BitShuffle to match right shifts with upper zero elements on types that don't natively support KSHIFT.
We can support these by widening to a supported type,
then shifting all the way to the left and then
back to the right to ensure that we shift in zeroes.
llvm-svn: 369232
Seiya Nuta [Mon, 19 Aug 2019 05:41:33 +0000 (05:41 +0000)]
[llvm-objcopy][MachO] Implement a layout algorithm for executables
Summary: The layout algorithm for relocatable objects and for executable are somewhat different. This patch implements the latter one based on the algorithm in LLD (MachOFileLayout).
Reviewers: alexshap, rupprecht, jhenderson
Reviewed By: alexshap
Subscribers: jakehehrlich, abrachet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65539
llvm-svn: 369231
Seiya Nuta [Mon, 19 Aug 2019 05:37:38 +0000 (05:37 +0000)]
[llvm-objcopy][MachO] Support load commands used in executables/shared libraries
Summary:
This patch implements copying some load commands that appear in executables/shared libraries such as the indirect symbol table.
I don't add tests intentionally because this patch is incomplete: we need a layout algorithm for executables/shared libraries. I'll submit it as a separate patch with tests.
Reviewers: alexshap, rupprecht, jhenderson, compnerd
Reviewed By: alexshap
Subscribers: abrachet, mgorny, mgrang, MaskRay, mtrent, jakehehrlich, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63395
llvm-svn: 369230
Nathan Ridge [Mon, 19 Aug 2019 05:11:15 +0000 (05:11 +0000)]
[clangd] Update features table in the docs with links to LSP extension proposals
Also update the semantic coloring entry to reflect it being supported in
clangd now.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65373
llvm-svn: 369229
Craig Topper [Mon, 19 Aug 2019 04:08:44 +0000 (04:08 +0000)]
[X86] Fix the lower1BitShuffle code added in r369215 to correctly pass the widened vector to the KSHIFT node.
Not sure how to test this as we have tests that exercise this code,
but nothing failed for the types not matching. Since all the k-registers
use equivalent register classes everything just ends up working.
llvm-svn: 369228
Craig Topper [Mon, 19 Aug 2019 04:08:40 +0000 (04:08 +0000)]
[X86] Teach lower1BitShuffle to match KSHIFTR that doesn't use Zeroable and only relies on undef.
This allows us to widen the type when the KSHIFTR instruction
doesn't exist for the type. If we need to shift in zeroes into
the upper elements we would need more work to guarantee zeroes
when widening.
llvm-svn: 369227
Craig Topper [Mon, 19 Aug 2019 00:39:22 +0000 (00:39 +0000)]
[X86] Teach lower1BitShuffle to recognize padding a subvector with zeros with V2 as the source and V1 as the zero vector.
Shuffle canonicalization can swap the sources so the zero vector
might be V1 and the subvector that's being padded can be V2.
llvm-svn: 369226
Craig Topper [Mon, 19 Aug 2019 00:39:18 +0000 (00:39 +0000)]
[X86] Add test case for missed opportunity to recognize a vXi1 shuffle as an insert into a zero vector.
We are currently missing this because shuffle canonicalization
puts the zero vector as V1 and the subvector as V2. Our current
code doesn't recognize this case.
llvm-svn: 369225
Craig Topper [Sun, 18 Aug 2019 23:30:11 +0000 (23:30 +0000)]
[X86] Add a special case to LowerCONCAT_VECTORSvXi1 to handle concatenating zero vectors followed by one non-zero vector followed by undef vectors.
For such a case we should only need a KSHIFTL, but we were
previously generating a KSHIFTL followed by a KSHIFTR because
we mistakenly believed we need to zero the undef elements.
llvm-svn: 369224
Craig Topper [Sun, 18 Aug 2019 23:30:07 +0000 (23:30 +0000)]
[X86] Add test cases for suboptimal insertion of a vXi1 vector into a larger vector with zeros in the lower elements and undef upper elements.
Currently we generate kshifts to clear both the upper and lower
elements, but we only need one kshift.
llvm-svn: 369223
Craig Topper [Sun, 18 Aug 2019 23:30:03 +0000 (23:30 +0000)]
[X86] Replace uses of getZeroVector for vXi1 vectors with DAG.getConstant.
vXi1 vectors don't need special handling.
llvm-svn: 369222
Hubert Tong [Sun, 18 Aug 2019 22:02:24 +0000 (22:02 +0000)]
[cmake] Move blocks out of redundant else( MSVC ); NFC
Address post-commit comment on D66256 regarding the `else( MSVC )` block
containing only blocks guarded with `LLVM_COMPILER_IS_GCC_COMPATIBLE`,
which would imply `NOT MSVC`.
llvm-svn: 369221
Jonas Devlieghere [Sun, 18 Aug 2019 21:54:26 +0000 (21:54 +0000)]
[CMake] Update CMAKE_OSX_DEPLOYMENT_TARGET to 10.12.
After LLVM moved to C++14, the RWMutex implementation was removed in
favor of std::shared_timed_mutex, which is only available on macOS
10.12 and later. As a workaround for older deployment targets, I added
the original RWMutexImpl again, guarded by the deployment target.
When doing a standalone build of LLDB using the Xcode generator, the
CMake cache specifies a minimum deployment target. However, LLVM and
Clang might have been built with a different minimum deployment target.
This is exactly what happened for the Xcode build. LLVM was built with a
minimum deployment target newer than 10.12, using
std::shared_timed_mutex. LLDB on the other hand was built with a minimum
deployment target of 10.11, using the old RWMutexImpl, resulting in
undefined symbols at link-time.
This patch changes the minimum deployment target for the Xcode build to
10.12 to work around this problem. A better solution would involve
synchronizing the minimum deployment or even not setting one at all.
llvm-svn: 369220
Lang Hames [Sun, 18 Aug 2019 21:29:57 +0000 (21:29 +0000)]
[ORC] Make sure we linker-mangle symbol names in the SpeculationLayer.
If mangling is not performed then speculative lookups will fail.
llvm-svn: 369219
Lang Hames [Sun, 18 Aug 2019 21:22:14 +0000 (21:22 +0000)]
[ORC] Remove some dead code.
llvm-svn: 369218
David Bolvansky [Sun, 18 Aug 2019 19:14:14 +0000 (19:14 +0000)]
[Diagnostics] Diagnose misused xor as pow
Summary:
Motivation:
https://twitter.com/jfbastien/status/
1139298419988549632
https://twitter.com/mikemx7f/status/
1139335901790625793
https://codesearch.isocpp.org/cgi-bin/cgi_ppsearch?q=10+%5E&search=Search
Reviewers: jfb, rsmith, regehr, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: lebedev.ri, Quuxplusone, erik.pilkington, riccibruno, dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63423
llvm-svn: 369217
DeForest Richards [Sun, 18 Aug 2019 19:07:10 +0000 (19:07 +0000)]
[Docs] Test commit
Fixes typo - Removes extra space between last word of sentence and period.
llvm-svn: 369216
Craig Topper [Sun, 18 Aug 2019 18:52:46 +0000 (18:52 +0000)]
[X86] Improve lower1BitShuffle handling for KSHIFTL on narrow vectors.
We can insert the value into a larger legal type and shift that
by the desired amount.
llvm-svn: 369215
Owen Pan [Sun, 18 Aug 2019 18:51:39 +0000 (18:51 +0000)]
[clang-format] Fix a bug that joins template closer and =
Also fixes the documentation for SpaceBeforeAssignmentOperators.
See discussions at https://reviews.llvm.org/D66332
Differential Revision: https://reviews.llvm.org/D66384
llvm-svn: 369214
Simon Pilgrim [Sun, 18 Aug 2019 17:26:30 +0000 (17:26 +0000)]
Fix signed/unsigned comparison warning. NFCI.
llvm-svn: 369213
Simon Pilgrim [Sun, 18 Aug 2019 17:15:26 +0000 (17:15 +0000)]
[X86] isTargetShuffleEquivalent - add BUILD_VECTOR matching
Add similar functionality to isShuffleEquivalent - if the mask elements don't match, try matching the BUILD_VECTOR scalars instead.
As target shuffles need to handle SM_Sentinel values, this can get a bit tricky, so commit just adds actual mask element index handling - full SM_SentinelZero support will be added when the need arises.
Also, enables support in matchVectorShuffleWithPACK
llvm-svn: 369212
Simon Pilgrim [Sun, 18 Aug 2019 16:37:58 +0000 (16:37 +0000)]
[X86] isTargetShuffleEquivalent - early out on illegal shuffle masks. NFCI.
Simplifies shuffle mask comparisons by just bailing out if the shuffle mask has any out of range values - will make an upcoming patch much simpler.
llvm-svn: 369211
Simon Pilgrim [Sun, 18 Aug 2019 15:39:04 +0000 (15:39 +0000)]
[X86][SSE] Improve PACKSS shuffle tests to better match codegen from D61129
D61129 creates 'concat + trunc' style patterns (at the 128-bit subvector level)
llvm-svn: 369209
Simon Pilgrim [Sun, 18 Aug 2019 13:29:12 +0000 (13:29 +0000)]
[MC] MCFixup - Fix cppcheck + MSVC analyzer uninitialized member variable warnings. NFCI.
llvm-svn: 369208
Roman Lebedev [Sun, 18 Aug 2019 12:26:33 +0000 (12:26 +0000)]
[InstCombine] Cherry-pick NFC cleanups of foldShiftIntoShiftInAnotherHandOfAndInICmp() from D66383
llvm-svn: 369207
David Bolvansky [Sun, 18 Aug 2019 10:10:09 +0000 (10:10 +0000)]
[Diagnostics] Improve -Wsizeof-pointer-div
Emit diag note with a location of pointer declaration.
Revisited/added tests.
llvm-svn: 369206
Craig Topper [Sun, 18 Aug 2019 06:28:06 +0000 (06:28 +0000)]
[TargetLowering] Teach computeRegisterProperties to only widen v3i16/v3f16 vectors to the next power of 2 type if that's legal.
These were recently made simple types. This restores their
behavior back to something like their EVT legalization.
We might be able to fix the code in type legalization where the
assert was failing, but I didn't investigate too much as I had
already looked at the computeRegisterProperties code during the
review for v3i16/v3f16.
Most of the test changes restore the X86 codegen back to what
it looked like before the recent change. The test case in
vec_setcc.ll and is a reduced version of the reproducer from
the fuzzer.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16490
llvm-svn: 369205
Craig Topper [Sun, 18 Aug 2019 06:28:00 +0000 (06:28 +0000)]
[SelectionDAG] Add a node creation debug message to getMachineNode.
llvm-svn: 369204
Matt Arsenault [Sun, 18 Aug 2019 00:20:44 +0000 (00:20 +0000)]
AMDGPU: Fix iterator error when lowering SI_END_CF
If the instruction is the last in the block, there is no next
instruction but the iteration still needs to look at the new block.
llvm-svn: 369203
Matt Arsenault [Sun, 18 Aug 2019 00:20:43 +0000 (00:20 +0000)]
AMDGPU: Disambiguate v3f16 format in load/store tables
Currently the searchable tables report the number of dwords. These
round to the same number for 3 and 4 component d16
instructions. Change this to report the number of elements so this
isn't ambiguous.
llvm-svn: 369202
Matt Arsenault [Sun, 18 Aug 2019 00:20:42 +0000 (00:20 +0000)]
TableGen: Revert changes from r369038
These aren't needed for a specific use yet, and I meant to not commit
these.
llvm-svn: 369201
Craig Topper [Sat, 17 Aug 2019 22:46:15 +0000 (22:46 +0000)]
[X86] Add a one use check to the combineStore code that handles v16i16->v16i8 truncate+store by extending to v16i32 and then emitting a v16i32->v16i8 truncstore.
This prevent us from emitting a separate truncate and a truncating
store instruction.
llvm-svn: 369200
Yonghong Song [Sat, 17 Aug 2019 22:12:00 +0000 (22:12 +0000)]
[BPF] Fix bpf llvm-objdump issues.
Commit https://reviews.llvm.org/D57939 ("[DWARF] Refactor
RelocVisitor and fix computation of SHT_RELA-typed relocation entries)
made a change for relocation resolution when operating
on an object file.
The change unfortunately broke BPF as given SymbolValue (S) and
Addent (A), previously relocation is resolved to
S + A
and after the change, it is resolved to
S
This patch fixed the issue by resolving relocation correctly.
It looks not all relocation resolution reaches here and I did not
trace down exactly when. But I do find if the object file includes
codes in two different ELF sections than default ".text",
the above bug will be triggered.
This patch included a trivial two function source code to
demonstrate this issue. The relocation for .debug_loc is resolved
incorrectly due to this and llvm-objdump cannot display source
annotated assembly.
Differential Revision: https://reviews.llvm.org/D66372
llvm-svn: 369199
Raphael Isemann [Sat, 17 Aug 2019 21:57:51 +0000 (21:57 +0000)]
[lldb][NFC] Remove unused MaterializeInitializer and MaterializeInternalVariable
llvm-svn: 369198
Roman Lebedev [Sat, 17 Aug 2019 21:35:33 +0000 (21:35 +0000)]
[NFC][InstCombine] Some tests for 'shift amount reassoc in bit test - trunc-of-lshr' (PR42399)
Finally, the fold i was looking forward to :)
The legality check is muddy, i doubt i've groked the full generalization,
but it handles all the cases i care about, and can come up with:
https://rise4fun.com/Alive/26j
https://bugs.llvm.org/show_bug.cgi?id=42399
llvm-svn: 369197
Tan S. B. [Sat, 17 Aug 2019 20:57:52 +0000 (20:57 +0000)]
[SemaDeclCXX] Allow inheriting constructor declaration to specify a cv-qualified type
Differential Revision: https://reviews.llvm.org/D47419
llvm-svn: 369196
Kristof Umann [Sat, 17 Aug 2019 16:49:54 +0000 (16:49 +0000)]
[analyzer] Turn an assert into an if condition
Shocker, turns out that terminator conditions that are binary operators
aren't always logical operators.
llvm-svn: 369195
George Rimar [Sat, 17 Aug 2019 16:07:18 +0000 (16:07 +0000)]
Recommit r369190 "[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API."
Fix: Add a `consumeError` call removed by mistake to 'printStackSize',
this should fix the "Expected<T> must be checked before access or destruction." reported by following bot:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9743/steps/stage%201%20check/logs/stdio
Original commit message:
Currently we have the following functions for error reporting:
LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
void reportError(Error Err, StringRef Input);
void reportWarning(Twine Msg);
void reportWarning(StringRef Input, Error Err);
void warn(llvm::Error Err);
void error(std::error_code EC);
Problems are: naming is inconsistent, arguments order is inconsistent,
some of the functions looks excessive.
After applying this patch we have:
void reportError(Error Err, StringRef Input);
void reportError(std::error_code EC, StringRef Input);
void reportWarning(Error Err, StringRef Input);
I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it
is used by COFF heavily.
Test cases were updated, they show an improvement introduced.
Differential revision: https://reviews.llvm.org/D66286
llvm-svn: 369194
George Rimar [Sat, 17 Aug 2019 15:36:06 +0000 (15:36 +0000)]
Revert r369190, r369192 ([llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.)
It caused multiple BB failtures:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9743/steps/stage%201%20check/logs/stdio
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/26042/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Astack-sizes.test
llvm-svn: 369193
George Rimar [Sat, 17 Aug 2019 15:24:16 +0000 (15:24 +0000)]
[llvm-readobj] - An attemp to fix BB after r369191.
Few BB failed with the following error:
Command Output (stderr):
--
/home/buildbots/ppc64be-clang-lnt-test/clang-ppc64be-lnt/llvm/test/tools/llvm-readobj/stack-sizes.test:263:19: error: BADSECTION-OUT: expected string not found in input
# BADSECTION-OUT: 8 ?
^
<stdin>:4:1: note: scanning from here
^
It doesn't reproduce on ubuntu/windows I have. Also, seems many of the bots
are happy too.
This slightly reorders the code to make fouts().flush() call earlier,
like it was before the r369191.
llvm-svn: 369192
Kang Zhang [Sat, 17 Aug 2019 14:37:05 +0000 (14:37 +0000)]
[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks
Summary:
Fix a bug of preducessors.
In `block-placement` pass, it will create some patterns for unconditional we can do the simple early retrun.
But the `early-ret` pass is before `block-placement`, we don't want to run it again.
This patch is to do the simple early return to optimize the blocks at the last of `block-placement`.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D63972
llvm-svn: 369191
George Rimar [Sat, 17 Aug 2019 14:36:40 +0000 (14:36 +0000)]
[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.
urrently we have the following functions for error reporting:
--
LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
void reportError(Error Err, StringRef Input);
void reportWarning(Twine Msg);
void reportWarning(StringRef Input, Error Err);
void warn(llvm::Error Err);
void error(std::error_code EC);
---
Problems are: naming is inconsistent, arguments order is inconsistent,
some of the functions looks excessive.
After applying this patch we have:
---
LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input);
LLVM_ATTRIBUTE_NORETURN void reportError(std::error_code EC, StringRef Input);
void reportWarning(Error Err, StringRef Input);
---
I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it
is used by COFF heavily.
Test cases were updated, they show an improvement introduced.
Differential revision: https://reviews.llvm.org/D66286
llvm-svn: 369190
George Rimar [Sat, 17 Aug 2019 14:23:30 +0000 (14:23 +0000)]
[test] - Remove precomiled openbsd-phdrs.elf-x86-64 objects.
There are 2 similar openbsd-phdrs.elf-x86-64 objects committed and
used in test/Object and test/tools/llvm-objdump test cases.
There is no reason to have them, we can use YAML instead. Patch does that.
Differential revision: https://reviews.llvm.org/D66342
llvm-svn: 369189
Troy A. Johnson [Sat, 17 Aug 2019 14:20:41 +0000 (14:20 +0000)]
[circular_raw_ostream] Delegate is_displayed to contained stream
raw_ostream has an is_displayed() member function that determines if the stream
is connected to a console for display or is connected to a file/pipe. By
default, is_displayed() returns false, and derived classes like raw_fd_ostream
override it. Because circular_raw_ostream wraps another stream, its result for
is_displayed() should be the same as that stream.
Differential Revision: https://reviews.llvm.org/D66026
llvm-svn: 369188
Fangrui Song [Sat, 17 Aug 2019 10:04:18 +0000 (10:04 +0000)]
[ELF] Replace local variable hasExportDynamic with config->exportDynamic. NFC
llvm-svn: 369187
Paul Walker [Sat, 17 Aug 2019 09:22:36 +0000 (09:22 +0000)]
Revert Revert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.
This reverts r369132 (git commit
19301d75f086caae1a495d267f5d0264b225942d)
llvm-svn: 369186
Paul Walker [Sat, 17 Aug 2019 09:22:28 +0000 (09:22 +0000)]
Revert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.
This reverts r369133 (git commit
2632c677f85cba1ac2aef5d68aaf8af0f5b3c944)
llvm-svn: 369185
Fangrui Song [Sat, 17 Aug 2019 06:28:03 +0000 (06:28 +0000)]
[ELF][PPC] Fix getRelExpr for R_PPC64_REL16_HI
Fixes https://github.com/ClangBuiltLinux/linux/issues/640
R_PPC64_REL16_HI was incorrectly computed as an R_ABS relocation.
rLLD368964 made it a linker failure. Change it to use R_PC to fix the
failures.
Add ppc64-reloc-rel.s for these R_PPC64_REL* tests.
llvm-svn: 369184
Troy A. Johnson [Sat, 17 Aug 2019 04:20:24 +0000 (04:20 +0000)]
[X86] Support -mlong-double-80
Add an option group for all of the -mlong-double-* options and make
-mlong-double-80 restore the default long double behavior for X86. The
motivations are that GNU accepts the -mlong-double-80 option and that complex
Makefiles often need a way of undoing earlier options. Prior to this commit, if
one chooses 64-bit or 128-bit long double for X86, there is no way to undo that
choice and restore the 80-bit behavior.
Differential Revision: https://reviews.llvm.org/D66055
llvm-svn: 369183
Diego Astiazaran [Sat, 17 Aug 2019 01:45:03 +0000 (01:45 +0000)]
[clang-doc] Fix casting not working in gcc 5.4.0
An implicit cast of std::string to llvm::SmallString<> was breaking GCC 5.4.0 builder.
A pair using llvm::SmallString<> now uses std::string.
Differential Revision: https://reviews.llvm.org/D66378
llvm-svn: 369182
Alina Sbirlea [Sat, 17 Aug 2019 01:02:12 +0000 (01:02 +0000)]
[MemorySSA] Loop passes should mark MSSA preserved when available.
This patch applies only to the new pass manager.
Currently, when MSSA Analysis is available, and pass to each loop pass, it will be preserved by that loop pass.
Hence, mark the analysis preserved based on that condition, vs the current `EnableMSSALoopDependency`. This leaves the global flag to affect only the entry point in the loop pass manager (in FunctionToLoopPassAdaptor).
llvm-svn: 369181
Petr Hosek [Sat, 17 Aug 2019 00:54:22 +0000 (00:54 +0000)]
[Fuchsia] Create the VMO during initialization, not during exit
We want to avoid doing expensive work during atexit since the process
might be terminated before we can publish the VMO and write out the
symbolizer markup, so move the VMO creation to the initialization
phase and only write data during the atexit phase.
Differential Revision: https://reviews.llvm.org/D66323
llvm-svn: 369180
Adrian Prantl [Sat, 17 Aug 2019 00:38:58 +0000 (00:38 +0000)]
Simplify code (NFC).
llvm-svn: 369179
Petr Hosek [Sat, 17 Aug 2019 00:07:26 +0000 (00:07 +0000)]
[llvm-readobj] Unwrap the value first to avoid the error
This addresses the issue introduced in r369169, we need to unwrap
the value first before we can check whether it's empty. This also
swaps the two branches to put the common path first which should
be NFC.
llvm-svn: 369177
Adrian Prantl [Fri, 16 Aug 2019 23:47:57 +0000 (23:47 +0000)]
Add LLDB dataformatters for llvm::StringRef and lldb_private::ConstString
These data formatters make the string value appear in Xcode's
variables view (and on the command line) without having to expand the
data structure.
Differential Revision: https://reviews.llvm.org/D66354
llvm-svn: 369175
Sanjay Patel [Fri, 16 Aug 2019 23:36:28 +0000 (23:36 +0000)]
Revert r367891 - "[InstCombine] combine mul+shl separated by zext"
This reverts commit
5dbb90bfe14ace30224239cac7c61a1422fa5144.
As noted in the post-commit thread for r367891, this can create
a multiply that is lowered to a libcall that may not exist.
We need to improve the backend decomposition for integer multiply
before trying to re-land this (if it's still worthwhile after
doing the backend work).
llvm-svn: 369174
Jian Cai [Fri, 16 Aug 2019 23:30:16 +0000 (23:30 +0000)]
Reland "[ARM] push LR before __gnu_mcount_nc"
This relands r369147 with fixes to unit tests.
https://reviews.llvm.org/D65019
llvm-svn: 369173
Amara Emerson [Fri, 16 Aug 2019 23:23:40 +0000 (23:23 +0000)]
[AArch64][GlobalISel] Fix an assertion during G_UNMERGE selection for s128 types.
llvm-svn: 369172
Lang Hames [Fri, 16 Aug 2019 23:20:54 +0000 (23:20 +0000)]
[ORC] Re-introduce self-dependence accidentally dropped from a unit test.
llvm-svn: 369171
Troy A. Johnson [Fri, 16 Aug 2019 23:18:22 +0000 (23:18 +0000)]
Revert "[X86] Support -mlong-double-80"
This reverts commit
250aafa2c4a1bc2395edfe8d4365545bbe56fffe.
Caused buildbot failures -- still investigating.
llvm-svn: 369170
Petr Hosek [Fri, 16 Aug 2019 23:15:40 +0000 (23:15 +0000)]
[llvm-readobj] Fallback to PT_NOTE if file doesn't have sections
This is useful when trying to read notes from stripped files and matches
the behavior of GNU readelf and eu-readelf.
Differential Revision: https://reviews.llvm.org/D66358
llvm-svn: 369169
Sanjay Patel [Fri, 16 Aug 2019 23:10:34 +0000 (23:10 +0000)]
[CodeGenPrepare] Fix use-after-free
If OptimizeExtractBits() encountered a shift instruction with no operands at all,
it would erase the instruction, but still return false.
This previously didn’t matter because its caller would always return after
processing the instruction, but https://reviews.llvm.org/D63233 changed the
function’s caller to fall through if it returned false, which would then cause
a use-after-free detectable by ASAN.
This change makes OptimizeExtractBits return true if it removes a shift
instruction with no users, terminating processing of the instruction.
Patch by: @brentdax (Brent Royal-Gordon)
Differential Revision: https://reviews.llvm.org/D66330
llvm-svn: 369168