Anastasia Stulova [Thu, 7 Mar 2019 17:06:30 +0000 (17:06 +0000)]
[Sema] Change addr space diagnostics in casts to follow C++ style.
This change adds a new diagnostic for mismatching address spaces
to be used for C++ casts (only enabled in C style cast for now,
the rest will follow!).
The change extends C-style cast rules to account for address spaces.
It also adds a separate function for address space cast checking that
can be used to map from a separate address space cast operator
addrspace_cast (to be added as a follow up patch).
Note, that after this change clang will no longer allows arbitrary
address space conversions in reinterpret_casts because they can lead
to accidental errors. The implicit safe conversions would still be
allowed.
Differential Revision: https://reviews.llvm.org/D58346
llvm-svn: 355609
Anastasia Stulova [Thu, 7 Mar 2019 16:43:41 +0000 (16:43 +0000)]
[PR40778][Sema] Adjust addr space of operands in builtin operators.
Adjust address space for references and pointer operands of builtin operators.
Currently this change only fixes addr space in assignment (= and |=) operator,
that is needed for the test case reported in the bug. Wider support for all
other operations will follow.
Differential Revision: https://reviews.llvm.org/D58719
llvm-svn: 355608
Petar Jovanovic [Thu, 7 Mar 2019 16:31:08 +0000 (16:31 +0000)]
[DebugInfo] Fix the type of the formated variable
Change the format type of *Personality and *LSDAAddress to PRIx64 since
they are of type uint64_t.
The problem was detected on mips builds, where it was printing junk values
and causing test failure.
Patch by Milos Stojanovic.
Differential Revision: https://reviews.llvm.org/D58451
llvm-svn: 355607
Anastasia Stulova [Thu, 7 Mar 2019 16:23:15 +0000 (16:23 +0000)]
[PR40778] Preserve addr space in Derived to Base cast.
The address space for the Base class pointer when up-casting
from Derived should be taken from the Derived class pointer.
Differential Revision: https://reviews.llvm.org/D53818
llvm-svn: 355606
Petar Jovanovic [Thu, 7 Mar 2019 15:50:52 +0000 (15:50 +0000)]
[analyzer] handle modification of vars inside an expr with comma operator
We should track mutation of a variable within a comma operator expression.
Current code in ExprMutationAnalyzer does not handle it.
This will handle cases like:
(a, b) ++ < == b is modified
(a, b) = c < == b is modifed
Patch by Djordje Todorovic.
Differential Revision: https://reviews.llvm.org/D58894
llvm-svn: 355605
Nico Weber [Thu, 7 Mar 2019 15:44:59 +0000 (15:44 +0000)]
gn build: Port r342002
I had hoped we could remove the dependency on shell32.lib from lib/Support
(there isn't much depending on it), but looks like this will take a while. So
for now, port this over.
Differential Revision: https://reviews.llvm.org/D58925
llvm-svn: 355604
Nico Weber [Thu, 7 Mar 2019 15:43:14 +0000 (15:43 +0000)]
gn build: Merge r355522
llvm-svn: 355603
Alexandre Ganea [Thu, 7 Mar 2019 15:07:55 +0000 (15:07 +0000)]
[LLD][COFF] Restrict the failifmismatch test to x86_64-windows-msvc because the ELF container doesn't support llvm.linker.options meta-data with only one operand.
llvm-svn: 355602
Aaron Ballman [Thu, 7 Mar 2019 15:03:06 +0000 (15:03 +0000)]
expected-no-diagnostics@ does not make sense, switching to a more idiomatic form; NFC.
llvm-svn: 355601
Xing GUO [Thu, 7 Mar 2019 14:53:10 +0000 (14:53 +0000)]
[llvm-readobj] Dump DT_USED value as string like GNU readelf does
Reviewers: jhenderson
Reviewed By: jhenderson
Subscribers: rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59089
llvm-svn: 355600
Haojian Wu [Thu, 7 Mar 2019 14:47:17 +0000 (14:47 +0000)]
[clangd] Strip plugin arguments in clangd-indexer.
Summary: This would allow clangd-indexer runs on chromium repo.
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59022
llvm-svn: 355599
Balazs Keri [Thu, 7 Mar 2019 14:09:18 +0000 (14:09 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTImporter.
Reviewers: a.sidorin, shafik, a_sidorin, martong
Reviewed By: a_sidorin
Subscribers: rnkovacs, jdoerfert, davide, aprantl, llvm-commits, gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D53818
llvm-svn: 355598
David Green [Thu, 7 Mar 2019 13:44:40 +0000 (13:44 +0000)]
[LSR] Attempt to increase the accuracy of LSR's setup cost
In some loops, we end up generating loop induction variables that look like:
{(-1 * (zext i16 (%i0 * %i1) to i32))<nsw>,+,1}
As opposed to the simpler:
{(zext i16 (%i0 * %i1) to i32),+,-1}
i.e we count up from -limit to 0, not the simpler counting down from limit to
0. This is because the scores, as LSR calculates them, are the same and the
second is filtered in place of the first. We end up with a redundant SUB from 0
in the code.
This patch tries to make the calculation of the setup cost a little more
thoroughly, recursing into the scev members to better approximate the setup
required. The cost function for comparing LSR costs is:
return std::tie(C1.NumRegs, C1.AddRecCost, C1.NumIVMuls, C1.NumBaseAdds,
C1.ScaleCost, C1.ImmCost, C1.SetupCost) <
std::tie(C2.NumRegs, C2.AddRecCost, C2.NumIVMuls, C2.NumBaseAdds,
C2.ScaleCost, C2.ImmCost, C2.SetupCost);
So this will only alter results if none of the other variables turn out to be
different.
Differential Revision: https://reviews.llvm.org/D58770
llvm-svn: 355597
Gabor Marton [Thu, 7 Mar 2019 13:38:20 +0000 (13:38 +0000)]
[ASTImporter] Import member expr with explicit template args
Summary:
Member expressions with explicit template arguments were not imported
correctly: the DeclRefExpr was missing. This patch fixes.
Reviewers: a_sidorin, shafik, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58830
llvm-svn: 355596
Alexandre Ganea [Thu, 7 Mar 2019 13:32:29 +0000 (13:32 +0000)]
[LLD][COFF] Attempt fix for failifmismatch test on aarch64-only builder.
Shall fix: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/6150
llvm-svn: 355595
Petar Avramovic [Thu, 7 Mar 2019 13:28:29 +0000 (13:28 +0000)]
[MIPS GlobalISel] Fix mul operands
Unsigned mul high for MIPS32 is selected into two PseudoInstructions:
PseudoMULTu and PseudoMFHI that use accumulator register class ACC64 for
some of its operands. Registers in this class have appropriate hi and lo
register as subregisters: $lo0 and $hi0 are subregisters of $ac0 etc.
mul instruction implicit-defs $lo0 and $hi0 according to MipsInstrInfo.td.
In functions where mul and PseudoMULTu are present fastRegisterAllocator
will "run out of registers during register allocation" because
'calcSpillCost' for $ac0 will return spillImpossible because subregisters
$lo0 and $hi0 of $ac0 are reserved by mul instruction above. A solution is
to mark implicit-defs of $lo0 and $hi0 as dead in mul instruction.
Differential Revision: https://reviews.llvm.org/D58715
llvm-svn: 355594
Gabor Marton [Thu, 7 Mar 2019 13:01:51 +0000 (13:01 +0000)]
[ASTImporter] Handle redecl chain of FunctionTemplateDecls
Summary:
Redecl chains of function templates are not handled well currently. We
want to handle them similarly to functions, i.e. try to keep the
structure of the original AST as much as possible. The aim is to not
squash a prototype with a definition, rather we create both and put them
in a redecl chain.
Reviewers: a_sidorin, shafik, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58494
llvm-svn: 355593
David Stenberg [Thu, 7 Mar 2019 13:01:17 +0000 (13:01 +0000)]
[analyzer] Handle comparison between non-default AS symbol and constant
Summary:
When comparing a symbolic region and a constant, the constant would be
widened or truncated to the width of a void pointer, meaning that the
constant could be incorrectly truncated when handling symbols for
non-default address spaces. In the attached test case this resulted in a
false positive since the constant was truncated to zero. To fix this,
widen/truncate the constant to the width of the symbol expression's
type.
This commit does not consider non-symbolic regions as I'm not sure how
to generalize getting the type there.
This fixes PR40814.
Reviewers: NoQ, zaks.anna, george.karpenkov
Reviewed By: NoQ
Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, jdoerfert, Charusso, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58665
llvm-svn: 355592
George Rimar [Thu, 7 Mar 2019 12:09:19 +0000 (12:09 +0000)]
[yaml2obj] - Allow producing ELFDATANONE ELFs
I need this to remove a binary from LLD test suite.
The patch also simplifies the code a bit.
Differential revision: https://reviews.llvm.org/D59082
llvm-svn: 355591
Michael Platings [Thu, 7 Mar 2019 11:55:26 +0000 (11:55 +0000)]
Fix & re-enable test that intermittently failed in debug mode.
The Value class and derivates will have uninitialized member variables if not created via operator new.
llvm-svn: 355590
Fangrui Song [Thu, 7 Mar 2019 11:42:59 +0000 (11:42 +0000)]
[IDF] Delete a redundant J-edge test
In the DJ-graph based computation of iterated dominance frontiers,
SuccNode->getIDom() == Node is one of the tests to check if (Node,Succ)
is a J-edge. If it is true, since Node is dominated by Root,
SuccLevel = level(Node)+1 > RootLevel
which means the next test SuccLevel > RootLevel will also be true. test
the check is redundant and can be deleted as it also involves one
indirection and provides no speed-up.
llvm-svn: 355589
Michael Platings [Thu, 7 Mar 2019 10:27:10 +0000 (10:27 +0000)]
Temporarily disable newly added test that fails in debug mode.
llvm-svn: 355588
Kristof Beyls [Thu, 7 Mar 2019 10:14:38 +0000 (10:14 +0000)]
Add newline to interpreter debugging output
When running lli --debug --force-interpreter=true the executed instructions are
printed but are missing newlines. This commit adds the missing newlines.
Patch by Andrew Brown.
Differential Revision: https://reviews.llvm.org/D57806
llvm-svn: 355587
Ivan Donchevskii [Thu, 7 Mar 2019 10:13:50 +0000 (10:13 +0000)]
[libclang] Fix CXTranslationUnit_KeepGoing
Since
commit
56f548bbbb7e4387a69708f70724d00e9e076153
[modules] Round-trip -Werror flag through explicit module build.
the behavior of CXTranslationUnit_KeepGoing changed:
Unresolved #includes are fatal errors again. As a consequence, some
templates are not instantiated and lead to confusing errors.
Revert to the old behavior: With CXTranslationUnit_KeepGoing fatal
errors are mapped to errors.
Patch by Nikolai Kosjar.
Differential Revision: https://reviews.llvm.org/D58501
llvm-svn: 355586
Michael Platings [Thu, 7 Mar 2019 09:15:23 +0000 (09:15 +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: 355585
Fangrui Song [Thu, 7 Mar 2019 06:38:03 +0000 (06:38 +0000)]
[BDCE] Optimize find+insert with early insert
llvm-svn: 355583
Craig Topper [Thu, 7 Mar 2019 06:30:19 +0000 (06:30 +0000)]
[X86] Enable combineFMinNumFMaxNum for 512 bit vectors when AVX512 is enabled.
Simplified by just checking if the vector type is legal rather than listing all combinations of types and features.
Fixes PR40984.
llvm-svn: 355582
Craig Topper [Thu, 7 Mar 2019 05:56:52 +0000 (05:56 +0000)]
[X86] Add 512-bit fminnum/maxnum test cases for PR40984. Also add v8f32 minnum/maxnum tests. NFC
llvm-svn: 355581
Sam Clegg [Thu, 7 Mar 2019 04:20:04 +0000 (04:20 +0000)]
[WebAssembly] Fix build after rL355577
Turns own that IsUsedInRegularObject is set for lazy (archive) symbols.
Differential Revision: https://reviews.llvm.org/D59074
llvm-svn: 355580
Jan Kratochvil [Thu, 7 Mar 2019 03:41:00 +0000 (03:41 +0000)]
Skip TestGdbserverPort.test on Windows
lldb/cmake/modules/LLDBConfig.cmake does not build lldb-server on Windows:
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
set(LLDB_CAN_USE_LLDB_SERVER 1)
Also do not append 'platform' parameter twice - although that was quietly
ignored.
llvm-svn: 355579
Jason Molenda [Thu, 7 Mar 2019 03:16:45 +0000 (03:16 +0000)]
When disassembling Aarch64 target and vendor Apple, set the cpu to
"apple-latest" which llvm uses to indicate the newest supported ISA.
Add a unit test; I'm only testing an armv8.1 instruction in this
unit test which would already be disassembled correctly because we
set the disassembler to ARM v8.2 mode, but it ensures that nothing
has been broken by adding this cpu spec.
<rdar://problem/
38714781>
llvm-svn: 355578
Sam Clegg [Thu, 7 Mar 2019 02:43:19 +0000 (02:43 +0000)]
[WebAssembly] LTO: Don't include bitcode-only symbols in the symtab
Fixes https://bugs.llvm.org/show_bug.cgi?id=40654
Differential Revision: https://reviews.llvm.org/D59012
llvm-svn: 355577
Florian Hahn [Thu, 7 Mar 2019 02:19:11 +0000 (02:19 +0000)]
[InterleavedAccessAnalysis] Use fixed size integers for InterleaveGroup.
Reviewers: Ayal, hsaito, anna, efriedma, dorit
Reviewed By: efriedma
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58889
llvm-svn: 355576
Alex Langford [Thu, 7 Mar 2019 01:02:55 +0000 (01:02 +0000)]
Repair the build when LLDB_DISABLE_PYTHON is set
Summary:
If LLDB_DISABLE_PYTHON is set, some functions are unavailable but
SBReproducer assumes they are. Let's conditionally register those functions
since they are conditionally declared.
Differential Revision: https://reviews.llvm.org/D59056
llvm-svn: 355575
Aakanksha Patil [Thu, 7 Mar 2019 00:54:04 +0000 (00:54 +0000)]
AMDGPU: Handle "uniform-work-group-size" attribute (fix for RADV)
A previous patch for "uniform-work-group-size" attribute was found to break
some RADV and possibly radeon SI tests and had to be retracted.
This patch fixes that.
Differential Revision: http://reviews.llvm.org/D58993
llvm-svn: 355574
Adrian Prantl [Thu, 7 Mar 2019 00:46:56 +0000 (00:46 +0000)]
Avoid using -S in combination with "script"; it's unreliable.
llvm-svn: 355573
Adrian Prantl [Thu, 7 Mar 2019 00:41:51 +0000 (00:41 +0000)]
crashlog.py: Catch exception from subprocess.
llvm-svn: 355572
Adrian Prantl [Thu, 7 Mar 2019 00:34:13 +0000 (00:34 +0000)]
Relax testcase.
Recent versions of llvm monorepo builds build libc++abi.dylib as libc++abi.1.dylib.
This accespts both variants.
llvm-svn: 355571
Jonas Devlieghere [Thu, 7 Mar 2019 00:24:44 +0000 (00:24 +0000)]
[Reproducers] Add tests for different types of functionality
This patch adds test that check that functionality in lldb continues to
work when replaying a reproducer.
- Entries in image list are identical.
- That stepping behaves the same.
- That the data formatters behave the same.
Differential revision: https://reviews.llvm.org/D55626
llvm-svn: 355570
Adrian Prantl [Thu, 7 Mar 2019 00:14:20 +0000 (00:14 +0000)]
Promote more debug-only assertions to regular assertions.
llvm-svn: 355569
Adrian Prantl [Thu, 7 Mar 2019 00:10:11 +0000 (00:10 +0000)]
Promote more debug-only assertions to regular assertions.
llvm-svn: 355568
Davide Italiano [Wed, 6 Mar 2019 23:50:36 +0000 (23:50 +0000)]
[Python] Unbreak the recently modified tests for python 2.
llvm-svn: 355566
Jason Molenda [Wed, 6 Mar 2019 23:47:52 +0000 (23:47 +0000)]
Remove the warning in
DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule
which would list every kext that failed to load when doing kernel
debugging. Instead, in DynamicLoaderDarwinKernel::ParseKextSummaries,
print a summary of how many kexts lldb was unable to load at the end.
I want to reduce the amount of output at the start of kernel debug
sessions a bit; we'll see if anyone really wanted to see the list of
which kexts specifically were unable to be loaded.
No functional change, only changing lldb's output at the start of
a kernel debug session.
<rdar://problem/
48654569>
llvm-svn: 355565
Nick Desaulniers [Wed, 6 Mar 2019 23:04:40 +0000 (23:04 +0000)]
[LoopRotate] fix crash encountered with callbr
Summary:
While implementing inlining support for callbr
(https://bugs.llvm.org/show_bug.cgi?id=40722), I hit a crash in Loop
Rotation when trying to build the entire x86 Linux kernel
(drivers/char/random.c). This is a small fix up to r353563.
Test case is drivers/char/random.c (with callbr's inlined), then ran
through creduce, then `opt -opt-bisect-limit=<limit>`, then bugpoint.
Thanks to Craig Topper for immediately spotting the fix, and teaching me
how to fish.
Reviewers: craig.topper, jyknight
Reviewed By: craig.topper
Subscribers: hiraditya, llvm-commits, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58929
llvm-svn: 355564
Rong Xu [Wed, 6 Mar 2019 23:00:38 +0000 (23:00 +0000)]
[PGO] Re-submit: Clang part of change for context-sensitive PGO (part2)
Part 2 of CSPGO change in Clang: Add test cases.
Differential Revision: https://reviews.llvm.org/D54176
llvm-svn: 355563
Davide Italiano [Wed, 6 Mar 2019 22:54:11 +0000 (22:54 +0000)]
[testsuite] Port crashlog to python 3, second attempt.
llvm-svn: 355562
Jim Ingham [Wed, 6 Mar 2019 22:53:38 +0000 (22:53 +0000)]
Fix Cmake files for ExpressionSourceCode.cpp -> ClangExpressionSourceCode.cpp.
llvm-svn: 355561
Jim Ingham [Wed, 6 Mar 2019 22:43:25 +0000 (22:43 +0000)]
Factor the clang specific parts of ExpressionSourceCode.{h,cpp} into the clang plugin.
NFC
Differential Revision: https://reviews.llvm.org/D59040
llvm-svn: 355560
Zachary Turner [Wed, 6 Mar 2019 22:42:34 +0000 (22:42 +0000)]
Pass /bigobj for SBReproducer.cpp with MSVC
/BIGOBJ is used to bypass certain COFF file format
limitations and is used with, unsurprisingly, very big
object files. This file has grown large enough that it
needs this flag in order to compile successfully.
llvm-svn: 355559
Simon Atanasyan [Wed, 6 Mar 2019 22:40:28 +0000 (22:40 +0000)]
[mips] Replace assertion by error message while lowering `RETURNADDR` and `FRAMEADDR`
MIPS target supports lowering `RETURNADDR` and `FRAMEADDR` for a current
frame only. It's better to show an error message then crash on assertion
if `__builtin_return_address` is invoked with non-zero argument.
llvm-svn: 355558
Zachary Turner [Wed, 6 Mar 2019 22:30:06 +0000 (22:30 +0000)]
[lldb-vscode] Correctly propagate errors back to VS Code.
llvm-svn: 355557
Rong Xu [Wed, 6 Mar 2019 22:16:47 +0000 (22:16 +0000)]
[PGO] Fix hexagon buildbot errors in r355541
Add "REQUIRES: x86-registered-target" to thinlto test cases.
llvm-svn: 355556
Frederic Riss [Wed, 6 Mar 2019 21:56:14 +0000 (21:56 +0000)]
[debugserver] Fix IsUserReady thread filtering
Summary:
In 2010 (r118866), filtering code was added to debugserver to avoid reporting threads
that were "not ready to be displayed to the user". This code inspects the thread's
state and discards threads marked 'uninterruptible'. Turns out, this state is pretty
common and not only a characterisitic of 'user-readiness'. This filtering was tracked
down as the source of the flakiness of TestQueues and TestConcurrent* with the symptom
of missing threads.
We discussed with the kernel team and there should be no need for us to filter the
restult of task_threads(). Everything that is returned from there can be examined.
So I went on and tried to remove the filtering completely. This produces other test
failures, where we were reporting more theads than expected. Always threads that had
been terminated, but weren't removed from the task bookkeeping structures yet. Those
threads always had a PC of 0.
This patch changes the heuristic to make the filtering a little less strict and only
rejects threads that are 'uninteruptible' *and* have a PC of 0. This has proven to be
solid in my testing.
Reviewers: jasonmolenda, clayborg, jingham
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58912
llvm-svn: 355555
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