Jan Kratochvil [Wed, 6 Mar 2019 21:52:19 +0000 (21:52 +0000)]
Sanity check --max-gdbserver-port
In mail
[lldb-dev] Remote debugging a docker process
https://lists.llvm.org/pipermail/lldb-dev/2019-March/014795.html
user was confused by --min-gdbserver-port and --max-gdbserver-port options
being ignored. I think there is even a bug that --max-gdbserver-port is upper
exclusive limit (and not upper inclusive limit appropriate for max).
At least this patch should catch such mistake by an error message. The question
is whether --max-gdbserver-port should not be changed to really be max and not
max+1 but that would break backward compatibility.
Now the mail example does produce:
error: --min-gdbserver-port (5001) is not lower than --max-gdbserver-port (5001)
Differential Revision: https://reviews.llvm.org/D58962
llvm-svn: 355554
Adrian Prantl [Wed, 6 Mar 2019 21:22:25 +0000 (21:22 +0000)]
Pass ConstString by value (NFC)
My apologies for the large patch. With the exception of ConstString.h
itself it was entirely produced by sed.
ConstString has exactly one const char * data member, so passing a
ConstString by reference is not any more efficient than copying it by
value. In both cases a single pointer is passed. But passing it by
value makes it harder to accidentally return the address of a local
object.
(This fixes rdar://problem/
48640859 for the Apple folks)
Differential Revision: https://reviews.llvm.org/D59030
llvm-svn: 355553
Peter Collingbourne [Wed, 6 Mar 2019 21:21:45 +0000 (21:21 +0000)]
gn build: Merge r355514.
llvm-svn: 355552
Michael Liao [Wed, 6 Mar 2019 21:16:27 +0000 (21:16 +0000)]
[CUDA][HIP][DebugInfo] Skip reference device function
Summary:
- A device functions could be used as a non-type template parameter in a
global/host function template. However, we should not try to retrieve that
device function and reference it in the host-side debug info as it's
only valid at device side.
Subscribers: aprantl, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58992
llvm-svn: 355551
Thomas Anderson [Wed, 6 Mar 2019 21:10:08 +0000 (21:10 +0000)]
[libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1
The issue is the following code:
__cn1->__add(*__ip);
(*__ip)->__c_ = __cn1;
`__ip` points into the array of iterators for container `__cn2`. This code adds
the iterator to the array of iterators for `__cn1`, and updates the iterator to
point to the new container.
This code works fine, except when `__cn1` and `__cn2` are the same container.
`__cn1->__add()` might need to grow the array of iterators, and when it does,
`__ip` becomes invalid, so the second line becomes a use-after-free error.
Simply swapping the order of the above two lines is not sufficient, because of
the memmove() below. The easiest and most performant solution is just to skip
touching any iterators if the containers are the same.
Differential Revision: https://reviews.llvm.org/D58926
llvm-svn: 355550
Konstantin Zhuravlyov [Wed, 6 Mar 2019 20:54:48 +0000 (20:54 +0000)]
AMDGPU: Fix the mapping of sub group sync scope
Map memory_scope_sub_group to "wavefront" sync scope
Differential Revision: https://reviews.llvm.org/D58847
llvm-svn: 355549
Raphael Isemann [Wed, 6 Mar 2019 20:51:28 +0000 (20:51 +0000)]
Remove redundant second os.path.join call [NFC]
llvm-svn: 355548
JF Bastien [Wed, 6 Mar 2019 20:36:00 +0000 (20:36 +0000)]
Passthrough compiler launcher
Summary: Not having this seems like an oversight, and makes stage2 builds odd.
Reviewers: ddunbar, dexonsmith
Subscribers: mgorny, jkorous, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59032
llvm-svn: 355547
Eric Fiselier [Wed, 6 Mar 2019 20:31:57 +0000 (20:31 +0000)]
Fix ABI compatibility of `<stdexcept>` with VCRuntime.
Summary:
Currently, libc++'s `<stdexcept>` doesn't play nice with `vcruntime`. Specifically:
* `logic_error` and `runtime_error` have a different layout.
* libc++'s `logic_error` and `runtime_error` override `what()` but `vcruntime` does not.
* `vcruntime` uses weak vtables for `<stdexcept>` types.
* libc++'s `<stdexcept>` constructors and assignment operators may have different manglings than `vcruntimes`.
This patch makes libc++'s declarations in `<stdexcept>` match those provided by MSVC's STL as closely as possible.
If MSVC doesn't declare a special member, then neither do we. This ensures that the implicit definitions have the same linkage, visibility, triviality, and noexcept-ness.
Reviewers: thomasanderson, ldionne, smeenai
Reviewed By: thomasanderson
Subscribers: jdoerfert, libcxx-commits
Differential Revision: https://reviews.llvm.org/D58945
llvm-svn: 355546
Abderrazek Zaafrani [Wed, 6 Mar 2019 20:30:06 +0000 (20:30 +0000)]
[AArch64] Improve FP16 instruction selection for vector round and vector conver from half instructions
https://reviews.llvm.org/D58855
llvm-svn: 355545
Nikita Popov [Wed, 6 Mar 2019 20:25:49 +0000 (20:25 +0000)]
[X86] Add vector mulo with power of two operand tests; NFC
llvm-svn: 355544
Alexandre Ganea [Wed, 6 Mar 2019 20:18:38 +0000 (20:18 +0000)]
[LLD][COFF] More detailed information for /failifmismatch
When mismatched #pragma detect_mismatch declarations occur, now print the conflicting OBJs.
lld-link: error: /failifmismatch: mismatch detected for 'TEST':
>>> test.obj has value 1
>>> test2.obj has value 2
Fixes PR38579
Differential Revision: https://reviews.llvm.org/D58910
llvm-svn: 355543
Paul Robinson [Wed, 6 Mar 2019 19:57:43 +0000 (19:57 +0000)]
[PS4] Emit a trap after a stack-protector fail call.
llvm-svn: 355542
Rong Xu [Wed, 6 Mar 2019 19:31:37 +0000 (19:31 +0000)]
[PGO] Context sensitive PGO (part 4)
Part 4 of CSPGO changes:
(1) add support in cmake for cspgo build.
(2) fix an issue in big endian.
(3) test cases.
Differential Revision: https://reviews.llvm.org/D54175
llvm-svn: 355541
Philip Reames [Wed, 6 Mar 2019 19:27:13 +0000 (19:27 +0000)]
[AtomicExpand] Allow libcall expansion for non-zero address spaces (try 2)
Restore a reverted commit, with the silly mistake fixed. Sorry for the previous breakage.
Be consistent about how we treat atomics in non-zero address spaces. If we get to the backend, we tend to lower them as if in address space 0. Do the same if we need to insert a libcall instead.
Differential Revision: https://reviews.llvm.org/D58760
llvm-svn: 355540
Julian Lettner [Wed, 6 Mar 2019 19:27:10 +0000 (19:27 +0000)]
[NFC][TSan][libdispatch] Rename tsan_block_context_t -> block_context_t
'tsan_' part of the struct name is redundant since we are already inside
the __tsan namespace.
llvm-svn: 355539
Julian Lettner [Wed, 6 Mar 2019 19:25:09 +0000 (19:25 +0000)]
[tsan] Support interception of libdispatch on Linux
This is a new attempt for bringing TSan libdispatch support to Linux.
The main issue with the last patch (https://reviews.llvm.org/D53171) was
that we want to avoid building a separate library.
The updated plan is as follows:
1) Hide libdispatch support behind a flag: true on Darwin, false
elsewhere. If flag is specified, assume that libdispatch header and
-flbocks is available for building. This way we can directly include
the libdispatch header and rely on blocks runtime for our
implementation.
2) Optionally/weakly intercept libdispatch API functions.
This patch accomplishes 1). It compiles (without the flag enabled) on
Linux. Follow-up patches will provide 2) and enabling of tests on Linux.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D58935
llvm-svn: 355538
Mitch Phillips [Wed, 6 Mar 2019 19:17:18 +0000 (19:17 +0000)]
Revert "[IR][ARM] Add function pointer alignment to datalayout"
This reverts commit
2391bfca97290181ae65796ea6da135d1b6d037b.
This reverts rL355522 (https://reviews.llvm.org/D57335).
Kills buildbots that use '-Werror' with the following error:
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm/lib/IR/Value.cpp:657:7: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
See buildbots http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/30200/steps/check-llvm%20asan/logs/stdio for more information.
llvm-svn: 355537
Zachary Turner [Wed, 6 Mar 2019 19:14:41 +0000 (19:14 +0000)]
Try again to fix OSX compilation failure.
llvm-svn: 355536
Sanjay Patel [Wed, 6 Mar 2019 19:02:01 +0000 (19:02 +0000)]
[AArch64] add tests for uaddsat/usubsat; NFC
The tests are copied from the sibling x86 test files.
llvm-svn: 355535
Amara Emerson [Wed, 6 Mar 2019 18:54:07 +0000 (18:54 +0000)]
[AArch64] Remove a stray test from the AArch64 directory.
llvm-svn: 355534
Simon Pilgrim [Wed, 6 Mar 2019 18:52:52 +0000 (18:52 +0000)]
[DAGCombine] Improve select (not Cond), N1, N2 -> select Cond, N2, N1 fold
Move the x86 combine from D58974 into the DAGCombine VSELECT code and update the SELECT version to use the isBooleanFlip helper as well.
Requested by @spatel on D59006
llvm-svn: 355533
Simon Pilgrim [Wed, 6 Mar 2019 18:49:39 +0000 (18:49 +0000)]
[PowerPC] Use real pointers instead of undef
The reduced test removed the pointer arguments, but to better survive D58017 and D58070 we need them back.
llvm-svn: 355532
Zachary Turner [Wed, 6 Mar 2019 18:44:27 +0000 (18:44 +0000)]
Try to fix OSX compilation failure.
llvm-svn: 355531
Nikita Popov [Wed, 6 Mar 2019 18:30:00 +0000 (18:30 +0000)]
[InstCombine] Fold add nsw + sadd.with.overflow
Fold `add nsw` and `sadd.with.overflow` with constants if the addition
does not overflow.
Part of https://bugs.llvm.org/show_bug.cgi?id=38146.
Patch by Dan Robertson.
Differential Revision: https://reviews.llvm.org/D58881
llvm-svn: 355530
Guozhi Wei [Wed, 6 Mar 2019 18:22:22 +0000 (18:22 +0000)]
[PPC] Adjust the computed branch offset for the possible shorter distance
In file PPCBranchSelector.cpp we tend to over estimate code size due to large
alignment and inline assembly. Usually it causes larger computed branch offset,
it is not big problem. But sometimes it may also causes smaller computed branch
offset than actual branch offset. If the offset is close to the limit of
encoding, it may cause problem at run time.
Following is a simplified example.
actual estimated
address address
...
bne Far 100 10c
.p2align 4
Near: 110 110
...
Far: 8108 8108
Actual offset: 0x8108 - 0x100 = 0x8008
Computed offset: 0x8108 - 0x10c = 0x7ffc
The computed offset is at most ((1 << alignment) - 4) bytes smaller than actual
offset. So we add this number to the offset for safety.
Differential Revision: https://reviews.llvm.org/D57718
llvm-svn: 355529
Zachary Turner [Wed, 6 Mar 2019 18:20:23 +0000 (18:20 +0000)]
Resubmit "Don't include UnixSignals.h from Host."
This was reverted because it breaks the GreenDragon bot, but
the reason for the breakage is lost, so I'm resubmitting this
now so we can find out what the problem is.
llvm-svn: 355528
Francis Visoiu Mistrih [Wed, 6 Mar 2019 18:10:41 +0000 (18:10 +0000)]
[MC][MachO] Emit an error for emitting relocations of the form -SYM + cst
Emit an error for an unsupported relocation. mach-o relocations can't
encode the form -SYM + cst.
Differential Revision: https://reviews.llvm.org/D58944
llvm-svn: 355527
Greg Clayton [Wed, 6 Mar 2019 18:04:10 +0000 (18:04 +0000)]
Fix core files for 32 bit architectures that are supported in ProcessELFCore.cpp
Core files need to know the size of the PRSTATUS header so that we can grab the register values that follow it. The code that figure out this size was using a hard coded list of architecture cores instead of relying on 32 or 64 bit for most cores.
The fix here fixes core files for 32 bit ARM. Prior to this the PRSTATUS header size was being returned as zero and the register values were being taken from the first bytes of the PRSTATUS struct (signo, etc).
Differential Revision: https://reviews.llvm.org/D58985
llvm-svn: 355526
Shafik Yaghmour [Wed, 6 Mar 2019 18:03:54 +0000 (18:03 +0000)]
Adding test to cover the correct import of SourceLocation pertaining to a built-in during expression parsing
Summary: This tests a fix in the ASTImpoter.cpp to ensure that we import built-in correctly,
see differential: https://reviews.llvm.org/D58743
Once this change is merged this test should pass and should catch regressions in this feature.
Differential Revision: https://reviews.llvm.org/D58790
llvm-svn: 355525
Krzysztof Parzyszek [Wed, 6 Mar 2019 17:43:50 +0000 (17:43 +0000)]
[Hexagon] Avoid creating 5-instruction packets with vgather pseudos
Change the resource usage of the vgather pseudos from SLOT0+LD to
SLOT0+SLOT1.
llvm-svn: 355524
Tatyana Krasnukha [Wed, 6 Mar 2019 17:27:40 +0000 (17:27 +0000)]
Re-apply "Fix embedded Python initialization according to changes in version 3.7"
llvm-svn: 355523
Michael Platings [Wed, 6 Mar 2019 17:24:11 +0000 (17:24 +0000)]
[IR][ARM] Add function pointer alignment to datalayout
Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.
Differential Revision: https://reviews.llvm.org/D57335
llvm-svn: 355522
Louis Dionne [Wed, 6 Mar 2019 17:07:24 +0000 (17:07 +0000)]
[libc++] Do not specify the underlying type of memory_order
Summary:
This breaks ABI for folks using -fshort-enums, and does not really buy
us anything.
http://llvm.org/PR40977
Reviewers: mclow.lists, EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver
Differential Revision: https://reviews.llvm.org/D59029
llvm-svn: 355521
Ryan Taylor [Wed, 6 Mar 2019 17:02:06 +0000 (17:02 +0000)]
[AMDGPU] Add support for 64 bit buffer atomic artihmetic instructions
Summary:
This adds support for 64 bit buffer atomic arithmetic instructions but does not include
cmpswap as that depends on a fix to the way the register pairs are handled
Change-Id: Ib207ea65fb69487ccad5066ea647ae8ddfe2ce61
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58918
llvm-svn: 355520
Jonas Devlieghere [Wed, 6 Mar 2019 16:42:33 +0000 (16:42 +0000)]
[Reproducers] Guard register macros that take lldb::thread_t on Windows
On Windows, lldb::thread_t is just a void*, so the we will try to
allocate an object of type void when deserializing. Undef this for now
until we support void* arguments.
llvm-svn: 355519
Jonas Devlieghere [Wed, 6 Mar 2019 16:33:48 +0000 (16:33 +0000)]
[Reproducers] Don't use VLA in SBReproducer redirect
This should unbreak the Windows bot.
llvm-svn: 355518
Simon Pilgrim [Wed, 6 Mar 2019 16:11:03 +0000 (16:11 +0000)]
[DAGCombiner] Enable UADDO/USUBO vector combine support
Differential Revision: https://reviews.llvm.org/D58965
llvm-svn: 355517
Sanjay Patel [Wed, 6 Mar 2019 16:06:27 +0000 (16:06 +0000)]
[TargetLowering] simplify code for uaddsat/usubsat expansion; NFC
We had 2 local variable names for the same type.
llvm-svn: 355516
Alexander Kornienko [Wed, 6 Mar 2019 15:23:50 +0000 (15:23 +0000)]
Revert "[CodeGen] Omit range checks from jump tables when lowering switches with unreachable default"
This reverts commit
2a0f2c5ef3330846149598220467d9f3c6e8b99c (r355490).
The commit causes an assertion failure when compiling LLVM code:
$ cat repro.cpp
class QQQ {
public:
bool x() const;
bool y() const;
unsigned getSizeInBits() const {
if (y() || x())
return getScalarSizeInBits();
return getScalarSizeInBits() * 2;
}
unsigned getScalarSizeInBits() const;
};
int f(const QQQ &Ty) {
switch (Ty.getSizeInBits()) {
case 1:
case 8:
return 0;
case 16:
return 1;
case 32:
return 2;
case 64:
return 3;
default:
__builtin_unreachable();
}
}
$ clang -O2 -o repro.o repro.cpp
assert.h assertion failed at llvm/include/llvm/ADT/ilist_iterator.h:139 in llvm::ilist_iterator::reference llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, true, false>::operator*() const [OptionsT = llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, IsReverse = true, IsConst = false]: !NodePtr->isKnownSentinel()
*** Check failure stack trace: ***
@ 0x558aab4afc10 __assert_fail
@ 0x558aa885479b llvm::ilist_iterator<>::operator*()
@ 0x558aa8854715 llvm::MachineInstrBundleIterator<>::operator*()
@ 0x558aa92c33c3 llvm::X86InstrInfo::optimizeCompareInstr()
@ 0x558aa9a9c251 (anonymous namespace)::PeepholeOptimizer::optimizeCmpInstr()
@ 0x558aa9a9b371 (anonymous namespace)::PeepholeOptimizer::runOnMachineFunction()
@ 0x558aa99a4fc8 llvm::MachineFunctionPass::runOnFunction()
@ 0x558aab019fc4 llvm::FPPassManager::runOnFunction()
@ 0x558aab01a3a5 llvm::FPPassManager::runOnModule()
@ 0x558aab01aa9b (anonymous namespace)::MPPassManager::runOnModule()
@ 0x558aab01a635 llvm::legacy::PassManagerImpl::run()
@ 0x558aab01afe1 llvm::legacy::PassManager::run()
@ 0x558aa5914769 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly()
@ 0x558aa5910f44 clang::EmitBackendOutput()
@ 0x558aa5906135 clang::BackendConsumer::HandleTranslationUnit()
@ 0x558aa6d165ad clang::ParseAST()
@ 0x558aa6a94e22 clang::ASTFrontendAction::ExecuteAction()
@ 0x558aa590255d clang::CodeGenAction::ExecuteAction()
@ 0x558aa6a94840 clang::FrontendAction::Execute()
@ 0x558aa6a38cca clang::CompilerInstance::ExecuteAction()
@ 0x558aa4e2294b clang::ExecuteCompilerInvocation()
@ 0x558aa4df6200 cc1_main()
@ 0x558aa4e1b37f ExecuteCC1Tool()
@ 0x558aa4e1a725 main
@ 0x7ff20d56abbd __libc_start_main
@ 0x558aa4df51c9 _start
llvm-svn: 355515
Francis Visoiu Mistrih [Wed, 6 Mar 2019 15:20:13 +0000 (15:20 +0000)]
Reland "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"
This allows us to store more info about where we're emitting the remarks
without cluttering LLVMContext. This is needed for future support for
the remark section.
Differential Revision: https://reviews.llvm.org/D58996
Original llvm-svn: 355507
llvm-svn: 355514
Strahinja Petrovic [Wed, 6 Mar 2019 15:00:10 +0000 (15:00 +0000)]
[PowerPC] Add secure plt support for TLS symbols
This patch supports secure plt mode for TLS symbols.
Differential Revision: https://reviews.llvm.org/D45520
llvm-svn: 355513
Teresa Johnson [Wed, 6 Mar 2019 14:57:40 +0000 (14:57 +0000)]
[CGP] Avoid repeatedly building DominatorTree causing long compile-time (NFC)
Summary:
In r354298 a DominatorTree construction was added via new function
combineToUSubWithOverflow, which was subsequently restructured into
replaceMathCmpWithIntrinsic in r354689. We are hitting a very long
compile time due to this repeated construction, once per math cmp in
the function.
We shouldn't need to build the DominatorTree more than once per
function, except when a transformation invalidates it. There is already
a boolean flag that is returned from these methods indicating whether
the DT has been modified. We can simply build the DT once per
Function walk in CodeGenPrepare::runOnFunction, since any time a change
is made we break out of the Function walk and restart it.
I modified the code so that both replaceMathCmpWithIntrinsic as well as
mergeSExts (which was also building a DT) use the DT constructed by the
run method.
From -mllvm -time-passes:
Before this patch: CodeGen Prepare user time is 328s
With this patch: CodeGen Prepare user time is 21s
Reviewers: spatel
Subscribers: jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58995
llvm-svn: 355512
Francis Visoiu Mistrih [Wed, 6 Mar 2019 14:52:37 +0000 (14:52 +0000)]
Revert "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"
This reverts commit
2e8c4997a2089f8228c843fd81b148d903472e02.
Breaks bots.
llvm-svn: 355511
Michal Gorny [Wed, 6 Mar 2019 14:49:48 +0000 (14:49 +0000)]
[lldb] [lit] Attempt to fix regex in toolchain-clang.test
llvm-svn: 355510
Pavel Labath [Wed, 6 Mar 2019 14:41:43 +0000 (14:41 +0000)]
Move RangeMap.h into Utility
Summary:
This file implements some general purpose data structures, and so it
belongs to the Utility module.
Reviewers: zturner, jingham, JDevlieghere, clayborg, espindola
Subscribers: emaste, mgorny, javed.absar, arichardson, MaskRay, lldb-commits
Differential Revision: https://reviews.llvm.org/D58970
llvm-svn: 355509
Sanjay Patel [Wed, 6 Mar 2019 14:34:59 +0000 (14:34 +0000)]
[TargetLowering] simplify code for uaddsat/usubsat expansion; NFC
llvm-svn: 355508
Francis Visoiu Mistrih [Wed, 6 Mar 2019 14:32:08 +0000 (14:32 +0000)]
[Remarks] Refactor remark diagnostic emission in a RemarkStreamer
This allows us to store more info about where we're emitting the remarks
without cluttering LLVMContext. This is needed for future support for
the remark section.
Differential Revision: https://reviews.llvm.org/D58996
llvm-svn: 355507
Simon Pilgrim [Wed, 6 Mar 2019 14:22:21 +0000 (14:22 +0000)]
[DAGCombiner] Add SADDO/SSUBO combine support
Basic constant handling folds, for both scalars and vectors
Differential Revision: https://reviews.llvm.org/D58967
llvm-svn: 355506
George Rimar [Wed, 6 Mar 2019 14:12:18 +0000 (14:12 +0000)]
[llvm-objcopy] - Remove dead code. NFCI.
DecompressedSection can only be created if --decompress-debug-sections is specified.
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/ELFObjcopy.cpp#L492
If it is specified when !zlib::isAvailable(), we error out early when parsing the options:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/CopyConfig.cpp#L657
What means the code I am removing in this patch is dead.
Differential revision: https://reviews.llvm.org/D59017
llvm-svn: 355505
Pavel Labath [Wed, 6 Mar 2019 14:09:02 +0000 (14:09 +0000)]
Expose template parameters of endian specific types as class members
Summary:
This allows generic code to query these parameters, and is a common
practice in a lot of other template classes.
Reviewers: zturner, Bigcheese
Subscribers: kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58969
llvm-svn: 355504
George Rimar [Wed, 6 Mar 2019 14:08:27 +0000 (14:08 +0000)]
[llvm-objcopy] - Remove an excessive zlib::isAvailable() check and dead code.
There are 2 places where llvm-objcopy creates CompressedSection:
For --compress-debug-sections. It might create the compressed section from
regular here:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/ELFObjcopy.cpp#L486
All initially compressed sections are created as CompressedSection during reading the sections
from an object:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/Object.cpp#L1118
Those have DebugCompressionType::None type and a different constructor.
Case 1 has the following code in its constructor:
if (!zlib::isAvailable()) {
CompressionType = DebugCompressionType::None;
return;
}
(https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/ELF/Object.cpp#L267)
We can never reach that code with because would report an error much earlier:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-objcopy/CopyConfig.cpp#L480
So the code I am removing is dead. Landing this will address the issue mentioned in https://bugs.llvm.org/show_bug.cgi?id=40886.
Differential revision: https://reviews.llvm.org/D59019
llvm-svn: 355503
Michal Gorny [Wed, 6 Mar 2019 14:03:18 +0000 (14:03 +0000)]
[lldb] [test] Pass appropriate -L&-Wl,-rpath for libc++ on NetBSD
Pass appropriate -L and -Wl,-rpath flags pointing out to the LLVM
library directory on NetBSD. This is necessary since clang on NetBSD
requires libc++ but it is not installed as part of the system
by default. For the purpose of running buildbot, we want LLDB to use
just-built libc++.
Differential Revision: https://reviews.llvm.org/D58630
llvm-svn: 355502
George Rimar [Wed, 6 Mar 2019 14:01:54 +0000 (14:01 +0000)]
[llvm-objcopy] - Fix incorrect CompressedSection creation.
We should create CompressedSection only if the section has SHF_COMPRESSED flag
or it's name starts from '.zdebug'.
Currently, we create it if section's data starts from ZLIB signature.
Differential revision: https://reviews.llvm.org/D59018
llvm-svn: 355501
George Rimar [Wed, 6 Mar 2019 13:49:41 +0000 (13:49 +0000)]
[LLD][ELF] - Convert common-symbol-alignment.s test to yaml.
This removes 2 precompiled binaries from the inputs.
llvm-svn: 355500
Anastasia Stulova [Wed, 6 Mar 2019 13:02:41 +0000 (13:02 +0000)]
[PR40778] Add addr space conversion when binding reference to a temporary.
This change fixes temporary materialization to happen in the right
(default) address space when binding to it a reference of different type.
It adds address space conversion afterwards to match the addr space
of a reference.
Differential Revision: https://reviews.llvm.org/D58634
llvm-svn: 355499
Simon Pilgrim [Wed, 6 Mar 2019 12:51:16 +0000 (12:51 +0000)]
[llvm-mca][X86] Add ADC/SBB with zero test cases
Some targets have fast-path handling for these patterns that we should model.
llvm-svn: 355498
George Rimar [Wed, 6 Mar 2019 12:37:46 +0000 (12:37 +0000)]
[LLD][ELF] - Remove unused invalid input object. NFC.
It was introduced by me in 2016: r290335,
but the test did contain the YAML from start,
I think it was committed by mistake.
llvm-svn: 355497
Roman Lebedev [Wed, 6 Mar 2019 11:47:43 +0000 (11:47 +0000)]
[X86][NFC] Autogenerate check lines in cmovcmov.ll test
Investigating 8-bit cmov promotion, this test comes up.
llvm-svn: 355496
Simon Pilgrim [Wed, 6 Mar 2019 11:04:21 +0000 (11:04 +0000)]
[DAGCombiner] Enable SMULO/UMULO vector combine support (PR40442)
Differential Revision: https://reviews.llvm.org/D58968
llvm-svn: 355495
Simon Pilgrim [Wed, 6 Mar 2019 10:54:43 +0000 (10:54 +0000)]
[X86][SSE] VSELECT(XOR(Cond,-1), LHS, RHS) --> VSELECT(Cond, RHS, LHS)
As noticed on D58965
DAGCombiner::visitSELECT has something similar, so we should be able to move this to DAGCombiner and support VSELECT as well at some point.
Differential Revision: https://reviews.llvm.org/D58974
llvm-svn: 355494
Haojian Wu [Wed, 6 Mar 2019 10:51:38 +0000 (10:51 +0000)]
[clangd] Add Source to clangd::Diagnostic.
Summary:
clangd embedder can distinguish diagnostics from clang or clang-tidy.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58600
llvm-svn: 355493
Hans Wennborg [Wed, 6 Mar 2019 10:26:19 +0000 (10:26 +0000)]
Inline asm constraints: allow ICE-like pointers for the "n" constraint (PR40890)
Apparently GCC allows this, and there's code relying on it (see bug).
The idea is to allow expression that would have been allowed if they
were cast to int. So I based the code on how such a cast would be done
(the CK_PointerToIntegral case in IntExprEvaluator::VisitCastExpr()).
Differential Revision: https://reviews.llvm.org/D58821
llvm-svn: 355491
Ayonam Ray [Wed, 6 Mar 2019 10:01:02 +0000 (10:01 +0000)]
[CodeGen] Omit range checks from jump tables when lowering switches with unreachable default
During the lowering of a switch that would result in the generation of a
jump table, a range check is performed before indexing into the jump
table, for the switch value being outside the jump table range and a
conditional branch is inserted to jump to the default block. In case the
default block is unreachable, this conditional jump can be omitted. This
patch implements omitting this conditional branch for unreachable
defaults.
Differential Revision: https://reviews.llvm.org/D52002
Reviewers: Hans Wennborg, Eli Freidman, Roman Lebedev
llvm-svn: 355490
Hans Wennborg [Wed, 6 Mar 2019 09:38:04 +0000 (09:38 +0000)]
clang-cl: Parse /Qspectre and a few other missing options (PR40964)
llvm-svn: 355489
Martin Liska [Wed, 6 Mar 2019 08:36:50 +0000 (08:36 +0000)]
Always compare C++ typeinfo (based on libstdc++ implementation).
Differential Revision: https://reviews.llvm.org/D58028
llvm-svn: 355488
Ayonam Ray [Wed, 6 Mar 2019 07:51:28 +0000 (07:51 +0000)]
Reversing the commit of revision 355483 since it is giving a regression on a newly added test.
llvm-svn: 355487
Roman Lebedev [Wed, 6 Mar 2019 07:45:10 +0000 (07:45 +0000)]
[clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists"
Summary:
This reverts rL352390 / D57280.
As discussed in https://reviews.llvm.org/D57112#inline-506781,
'flush' clause does not exist in the OpenMP spec, it can not be
specified, and `OMPFlushClause` class is just a helper class.
Now, here's the caveat. I have read @ABataev's
> Well, I think it would be good to filter out OMPC_flush somehow
> because there is no such clause actually, it is a pseudo clause
> for better handling of the flush directive.
as if that clause is pseudo clause that only exists for the sole
purpose of simplifying the parser. As in, it never reaches AST.
I did not however try to verify that. Too bad, i was wrong.
It absolutely *does* reach AST. Therefore my understanding/justification
for the change was flawed, which makes the patch a regression which **must** be reverted.
@gribozavr has brought that up again in https://reviews.llvm.org/D57112#inline-521238
> > ...
> Sorry to be late for this discussion, but I don't think this conclusion
> follows. ASTMatchers are supposed to match the AST as it is.
> Even if OMPC_flush is synthetic, it exists in the AST, and users might
> want to match it. I think users would find anything else (trying to filter
> out AST nodes that are not in the source code) to be surprising. For example,
> there's a matcher materializeTemporaryExpr even though this AST node is a
> Clang invention and is not a part of the C++ spec.
>
> Matching only constructs that appear in the source code is not feasible with
> ASTMatchers, because they are based on Clang's AST that exposes tons of semantic
> information, and its design is dictated by the structure of the semantic information.
> See "RFC: Tree-based refactorings with Clang" in cfe-dev for a library that will
> focus on representing source code as faithfully as possible.
>
> Not to even mention that this code is in ASTTypeTraits, a general library for
> handling AST nodes, not specifically for AST Matchers...
Reviewers: gribozavr, ABataev, rjmccall, aaron.ballman
Reviewed By: gribozavr, ABataev
Subscribers: dylanmckay, guansong, arphaman, jdoerfert, cfe-commits, gribozavr, ABataev
Tags: #clang, #openmp
Differential Revision: https://reviews.llvm.org/D58979
llvm-svn: 355486
Craig Topper [Wed, 6 Mar 2019 07:36:38 +0000 (07:36 +0000)]
[X86] Enable the add with 128 -> sub with -128 encoding trick with X86ISD::ADD when the carry flag isn't used.
This allows us to use an 8-bit sign extended immediate instead of a 16 or 32 bit immediate.
Also do similar for 0x80000000 with 64-bit adds to avoid having to use a movabsq.
llvm-svn: 355485
Craig Topper [Wed, 6 Mar 2019 07:36:36 +0000 (07:36 +0000)]
[X86] Suppress load folding for add/sub with 128 immediate.
128 won't fit in a sign extended 8-bit immediate, but we can negate it to -128 and use the other operation. This results in a shorter encoding since the move would have used 16 or 32 bits for the immediate.
llvm-svn: 355484
Ayonam Ray [Wed, 6 Mar 2019 07:27:45 +0000 (07:27 +0000)]
[CodeGen] Omit range checks from jump tables when lowering switches with unreachable default
During the lowering of a switch that would result in the generation of a
jump table, a range check is performed before indexing into the jump
table, for the switch value being outside the jump table range and a
conditional branch is inserted to jump to the default block. In case the
default block is unreachable, this conditional jump can be omitted. This
patch implements omitting this conditional branch for unreachable
defaults.
Differential Revision: https://reviews.llvm.org/D52002
Reviewers: Hans Wennborg, Eli Freidman, Roman Lebedev
llvm-svn: 355483
Duncan P. N. Exon Smith [Wed, 6 Mar 2019 05:42:56 +0000 (05:42 +0000)]
Fix slashes in path references in -Rmodule-import test from r355477
Fixup for r355477 to fix the Windows bot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/16217
llvm-svn: 355482
Marshall Clow [Wed, 6 Mar 2019 03:59:44 +0000 (03:59 +0000)]
Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple of other minor cleanups. NFC
llvm-svn: 355481
Peter Collingbourne [Wed, 6 Mar 2019 03:08:06 +0000 (03:08 +0000)]
gn build: Merge r355439.
llvm-svn: 355480
Peter Collingbourne [Wed, 6 Mar 2019 03:07:57 +0000 (03:07 +0000)]
ELF: De-template OutputSection::finalize() and MipsGotSection::build(). NFCI.
Differential Revision: https://reviews.llvm.org/D58810
llvm-svn: 355479
Peter Collingbourne [Wed, 6 Mar 2019 03:07:48 +0000 (03:07 +0000)]
ELF: Extract a non-ELFT base class for VersionNeedSection.
We're going to need a separate VersionNeedSection for each partition, and
the partition data structure won't be templated.
With this the VersionTableSection class no longer needs ELFT, so detemplate it.
Differential Revision: https://reviews.llvm.org/D58808
llvm-svn: 355478
Duncan P. N. Exon Smith [Wed, 6 Mar 2019 02:50:46 +0000 (02:50 +0000)]
Modules: Add -Rmodule-import
Add a remark for importing modules. Depending on whether this is a
direct import (into the TU being built by this compiler instance) or
transitive import (into an already-imported module), the diagnostic has
two forms:
importing module 'Foo' from 'path/to/Foo.pcm'
importing module 'Foo' into 'Bar' from 'path/to/Foo.pcm'
Also drop a redundant FileCheck invocation in Rmodule-build.m that was
using -Reverything, since the notes from -Rmodule-import were confusing
it.
https://reviews.llvm.org/D58891
llvm-svn: 355477
Jason Molenda [Wed, 6 Mar 2019 02:45:27 +0000 (02:45 +0000)]
Change the scanning algorithm in DynamicLoaderDarwinKernel::SearchForKernelNearPC.
Currently when lldb might be doing a kernel debug session, it scans through
memory by taking the current pc value and looking for a kernel at megabyte
boundaries, up to 32MB behind $pc. This adjusts the algorithm to
scan back at every 16k page boundary and to stop scanning as soon
as we hit a memory read error. The addition of stopping at a memory read
error saves us from tons of unnecessary packet traffic on generic
targets where lldb might look for a kernel binary.
I've been trying to think of how to construct a test for this; it's a bit
tricky. A gdb-remote protocol test with the contents of a fake tiny kernel
mach-o binary would satisify part of it, but this kernel path also directly
calls over to dsymForUUID or DebugSymbols framework lookups to find the
kernel binary as well. I'll keep thinking about this one, but it's so
intertangled with these two external systems that it may be hard to do.
<rdar://problem/
48578197>
llvm-svn: 355476
QingShan Zhang [Wed, 6 Mar 2019 02:39:18 +0000 (02:39 +0000)]
[NFC] Declare the member data of class PostGenericScheduler as "protected" instead of "private"
Some target might try to subclass the PostGenericScheduler to custom the scheduling strategy.
We need to declare the member data of PostGenericScheduler as "protected", which acts the same as "GenericScheduler".
Differential Revision: https://reviews.llvm.org/D58949
llvm-svn: 355475
Craig Topper [Wed, 6 Mar 2019 02:36:48 +0000 (02:36 +0000)]
[X86] Remove periods from the end of SubtargetFeature descriptions since the help printer adds a period.
Most features don't have periods already, but some did. When there is a period it causes llc -mattr=+help to print 2 periods.
llvm-svn: 355474
Jason Molenda [Wed, 6 Mar 2019 02:32:45 +0000 (02:32 +0000)]
Re-commit logging for SBCompileUnit::GetNumLineEntries.
llvm-svn: 355473
Heejin Ahn [Wed, 6 Mar 2019 02:00:22 +0000 (02:00 +0000)]
[WebAssembly] Remove trailing whitespaces in tests (NFC)
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58955
llvm-svn: 355472
Alex Langford [Wed, 6 Mar 2019 01:57:04 +0000 (01:57 +0000)]
[ExpressionParser] Fix ComputeClangResourceDirectory for windows
The function signature of ComputeClangResourceDirectory for windows
wasn't updated when the others changed, causing the windows build to
fail. This should fix that.
llvm-svn: 355471
Jonas Devlieghere [Wed, 6 Mar 2019 01:49:57 +0000 (01:49 +0000)]
[Reproducers] Enable replay from SBRepro.
Now that the LLDB instrumentation macros are in place, we should use
that to test reproducer replay.
Differential revision: https://reviews.llvm.org/D58565
llvm-svn: 355470
Jonas Devlieghere [Wed, 6 Mar 2019 01:49:54 +0000 (01:49 +0000)]
[Reproducers] Don't intercept SBDebugger::SetInputFileHandle
With the reproducer logic in place for the command interpreter we no
longer need to make SBDebugger::SetInputFileHandle a no-op.
llvm-svn: 355469
Xing GUO [Wed, 6 Mar 2019 01:28:40 +0000 (01:28 +0000)]
[BinaryFormat] Add DT_USED tag into dynamic section.
Summary:
This tag is documented in https://docs.oracle.com/cd/E19253-01/817-1984/chapter6-42444/index.html
Though I could not find some docs that describe it in detail, I found some code snippets.
1.
```
/*
* Look up the string in the string table and get its offset. If
* this succeeds, then it is possible that there is a DT_NEEDED
* dynamic entry that references it.
*/
have_string = elfedit_sec_findstr(argstate->str.sec,
strpad_elt.dn_dyn.d_un.d_val, arg, &str_offset) != 0;
if (have_string) {
dyn = argstate->dynamic.data;
for (ndx = 0; ndx < numdyn; dyn++, ndx++) {
if (((dyn->d_tag == DT_NEEDED) ||
(dyn->d_tag == DT_USED)) &&
(dyn->d_un.d_val == str_offset))
goto done;
}
}
```
https://github.com/kofemann/opensolaris/blob/
80192cd83bf665e708269dae856f9145f7190f74/usr/src/cmd/sgs/elfedit/modules/common/syminfo.c#L512
2.
```
case DT_USED:
case DT_INIT_ARRAY:
case DT_FINI_ARRAY:
if (do_dynamic)
{
if (entry->d_tag == DT_USED
&& VALID_DYNAMIC_NAME (entry->d_un.d_val))
{
char *name = GET_DYNAMIC_NAME (entry->d_un.d_val);
if (*name)
{
printf (_("Not needed object: [%s]\n"), name);
break;
}
}
print_vma (entry->d_un.d_val, PREFIX_HEX);
putchar ('\n');
}
break;
```
http://web.mit.edu/freebsd/head/contrib/binutils/binutils/readelf.c
3.
```
#define DT_USED 0x7ffffffe /* ignored - same as needed */
```
https://github.com/switchbrew/switch-tools/blob/master/src/elf_common.h
Reviewers: jhenderson, grimar
Reviewed By: jhenderson, grimar
Subscribers: emaste, krytarowski, fedor.sergeev, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58762
llvm-svn: 355468
Peter Collingbourne [Wed, 6 Mar 2019 01:28:32 +0000 (01:28 +0000)]
gn build: Add 32-bit Linux support.
Differential Revision: https://reviews.llvm.org/D58839
llvm-svn: 355467
Adrian Prantl [Wed, 6 Mar 2019 01:07:45 +0000 (01:07 +0000)]
Replace debug-only assert with a plain old assert.
llvm-svn: 355466
Jonas Devlieghere [Wed, 6 Mar 2019 01:00:36 +0000 (01:00 +0000)]
[Reproducers] Undef LLDB_REPRO_INSTR_TRACE
Forgot to undef this before landing.
llvm-svn: 355465
Jonas Devlieghere [Wed, 6 Mar 2019 00:52:48 +0000 (00:52 +0000)]
[Reproducers] Fix warnings without asserts
Make sure the variable is used when asserts are compiled out.
llvm-svn: 355464
Alex Langford [Wed, 6 Mar 2019 00:45:16 +0000 (00:45 +0000)]
[ExpressionParser] Test GetClangResourceDir
Summary:
I'm doing this because I plan on implementing `ComputeClangResourceDirectory`
on windows so that `GetClangResourceDir` will work. Additionally, I made
test_paths make sure that the directory member of the returned FileSpec is not
none. This will fail on windows since `ComputeClangResourceDirectory` isn't
implemented yet.
Differential Revision: https://reviews.llvm.org/D58748
llvm-svn: 355463
Leonard Chan [Wed, 6 Mar 2019 00:28:43 +0000 (00:28 +0000)]
[Fixed Point Arithmetic] Fixed Point and Integer Conversions
This patch includes the necessary code for converting between a fixed point type and integer.
This also includes constant expression evaluation for conversions with these types.
Differential Revision: https://reviews.llvm.org/D56900
llvm-svn: 355462
Mitch Phillips [Wed, 6 Mar 2019 00:25:40 +0000 (00:25 +0000)]
Revert "[AtomicExpand] Allow libcall expansion for non-zero address spaces" for buildbot failures.
llvm-svn: 355461
Florian Hahn [Wed, 6 Mar 2019 00:10:03 +0000 (00:10 +0000)]
[ARM] Sink zext/sext operands for add and sub to enable vsubl generation.
This uses the infrastructure added in rL353152 to sink zext and sexts to
sub/add users, to enable vsubl/vaddl generation when NEON is available.
See https://bugs.llvm.org/show_bug.cgi?id=40025.
Reviewers: SjoerdMeijer, t.p.northover, samparker, efriedma
Reviewed By: samparker
Differential Revision: https://reviews.llvm.org/D58063
llvm-svn: 355460
Jonas Devlieghere [Wed, 6 Mar 2019 00:06:00 +0000 (00:06 +0000)]
[Reproducers] Add SBReproducer macros
This patch adds the SBReproducer macros needed to capture and reply the
corresponding calls. This patch was generated by running the lldb-instr
tool on the API source files.
Differential revision: https://reviews.llvm.org/D57475
llvm-svn: 355459
Jonas Devlieghere [Wed, 6 Mar 2019 00:05:55 +0000 (00:05 +0000)]
[SBAPI] Don't check IsValid in constructor
When running the test suite with the instrumentation macros, I noticed
two lldb-mi tests regressed. The issue was the copy constructor of
SBLineEntry. Without the macros the returned value would be elided, but
with the macros the copy constructor was called. The latter using ::IsValid
to determine whether the underlying opaque pointer should be set. This
is likely a remnant of when ::IsValid would only check the validity of the
smart pointer. In SBLineEntry however, it actually forwards to
LineEntry::IsValid().
So what happened here was that because of the macros the copy
constructor was called. The opaque pointer was valid but the LineEntry
didn't consider itself valid. So the copied-to object ended up default
initialized.
This patch replaces all checks for IsValid in copy (assignment)
constructors with checks for the opaque pointer itself.
Differential revision: https://reviews.llvm.org/D58946
llvm-svn: 355458
Adrian Prantl [Tue, 5 Mar 2019 23:51:25 +0000 (23:51 +0000)]
Remove tautological #ifdefs (NFC)
Differential Revision: https://reviews.llvm.org/D58838
llvm-svn: 355457
Jonas Devlieghere [Tue, 5 Mar 2019 23:47:22 +0000 (23:47 +0000)]
[DWARFFormValue] Don't consider DW_FORM_data4/8 to be section offsets.
When dumping ToT clan's debug info with dwarfdump, we were seeing an
error saying that that the location list overflows the debug_loc
section. After reducing the testcase we figured out that we were
interpreting the DW_FORM_data4 as a section offset.
In DWARF3 DW_FORM_data4 and DW_FORM_data8 served also as a section
offset. Until now we didn't check check for the DWARF version, because
some producers (read old versions of clang) were still emitting this.
The relevant code/comment was added in 2013, and I believe it's now
reasonable to start checking the version.
The FormValue class is a little bit of a mess because it cashes the
DWARF unit and context when it extracted the value itself. Several
methods of the class rely on it being present, or return an Optional for
the code path that needs it. At the same time the FormValue class also
used in places where there's no DWARF unit.
For this patch I went with the least invasive change: checking the
version from the CU when it's available. If it's not (because the form
value was created from a value directly) we default to the old behavior.
Differential revision: https://reviews.llvm.org/D58698
llvm-svn: 355456
Florian Hahn [Tue, 5 Mar 2019 23:10:28 +0000 (23:10 +0000)]
[opt] Report if the provided architecture is invalid.
Partly addresses PR15026.
There are a few tests that passed in invalid architectures, which are fixed in: rL355349 and D58931
Reviewers: echristo, efriedma, rengolin, atrick
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D58933
llvm-svn: 355455
Rong Xu [Tue, 5 Mar 2019 23:02:06 +0000 (23:02 +0000)]
Revert r355432 for buildbot failures in ppc64be-linux and s390x-linux
llvm-svn: 355454