Pavel Labath [Tue, 11 Dec 2018 15:21:15 +0000 (15:21 +0000)]
Rename ObjectFile::GetHeaderAddress to GetBaseAddress
Summary:
This function was named such because in the case of MachO files, the
mach header is located at this address. However all (most?) usages of
this function were not interested in that fact, but the fact that this
address is used as the base address for expressing various relative
addresses in the object file.
For other object file formats, this name is not appropriate (and it's
probably the reason why this function was not implemented in these
classes). In the ELF case the ELF header will usually end up at this
address, but this is a result of the linker optimizing the file layout
and not a requirement of the spec. For COFF files, I believe the is no
header located at this address either.
Reviewers: clayborg, jasonmolenda, amccarth, lemo, stella.stamenova
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D55422
llvm-svn: 348849
Gabor Horvath [Tue, 11 Dec 2018 14:40:48 +0000 (14:40 +0000)]
[analyzer] Fix a minor typo.
llvm-svn: 348848
Louis Dionne [Tue, 11 Dec 2018 14:22:28 +0000 (14:22 +0000)]
[pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.
This is a re-application of r348824, which broke the build in C++03 mode
because a test was marked as supported in C++03 when it shouldn't be.
Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).
<rdar://problem/
29537079>
Reviewers: mclow.lists, EricWF
Subscribers: christof, llvm-commits
Differential Revision: https://reviews.llvm.org/D48669
llvm-svn: 348847
Louis Dionne [Tue, 11 Dec 2018 14:15:54 +0000 (14:15 +0000)]
[libcxx] Fix test on compilers that do not support char8_t yet
llvm-svn: 348846
Sanjay Patel [Tue, 11 Dec 2018 14:05:03 +0000 (14:05 +0000)]
[x86] remove dead code for 16-bit LEA formation; NFC
As discussed in:
D55494
...this code has been disabled/dead for a long time (the code references
Athlon and Pentium 4), and there's almost no chance that it will be used
given the last decade of uarch evolution. Also, in SDAG we promote 16-bit
ops to 32-bit, so there's almost no way to test this code any more.
llvm-svn: 348845
Clement Courbet [Tue, 11 Dec 2018 13:38:43 +0000 (13:38 +0000)]
Revert r348843 "[CodeGen] Allow mempcy/memset to generate small overlapping stores."
Breaks ARM/memcpy-inline.ll
llvm-svn: 348844
Clement Courbet [Tue, 11 Dec 2018 13:15:56 +0000 (13:15 +0000)]
[CodeGen] Allow mempcy/memset to generate small overlapping stores.
Summary:
All targets either just return false here or properly model `Fast`, so I
don't think there is any reason to prevent CodeGen from doing the right
thing here.
Subscribers: nemanjai, javed.absar, eraman, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D55365
llvm-svn: 348843
Jonas Toth [Tue, 11 Dec 2018 12:45:51 +0000 (12:45 +0000)]
Use the standard Duration factory matcher
Summary: A new check came in over the weekend; it should use our existing infrastructure for matching `absl::Duration` factories.
Patch by hwright.
Reviewers: JonasToth
Reviewed By: JonasToth
Subscribers: astrelni
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D55541
llvm-svn: 348842
Dan Liew [Tue, 11 Dec 2018 12:43:44 +0000 (12:43 +0000)]
Fix bug where we'd try symbolize a second time with the same arguments.
Summary:
Fix bug where we'd try symbolize a second time with the same arguments even though symbolization failed the first time.
This looks like a long standing typo given that the guard for trying
symbolization again is to only try it if symbolization failed using
`binary` and `original_binary != binary`.
Reviewers: kubamracek, glider, samsonov
Subscribers: #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D55504
llvm-svn: 348841
Jonas Toth [Tue, 11 Dec 2018 12:42:17 +0000 (12:42 +0000)]
[clang-tidy] NFC Consolidate test absl::Time implementation
Summary: Several tests re-implement these same prototypes (differently), so we can put them in a common location.
Patch by hwright.
Reviewers: JonasToth
Reviewed By: JonasToth
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D55540
llvm-svn: 348840
Simon Pilgrim [Tue, 11 Dec 2018 11:08:40 +0000 (11:08 +0000)]
[TargetLowering] Add ISD::EXTRACT_VECTOR_ELT support to SimplifyDemandedBits
Let SimplifyDemandedBits attempt to simplify all elements of a vector extraction.
Part of PR39689.
llvm-svn: 348839
Simon Pilgrim [Tue, 11 Dec 2018 10:44:54 +0000 (10:44 +0000)]
Fix "not all control paths return a value" MSVC warnings. NFCI.
llvm-svn: 348838
David Stenberg [Tue, 11 Dec 2018 10:33:38 +0000 (10:33 +0000)]
[DeadArgElim] Fixes for dbg.values using dead arg/return values
Summary:
When eliminating a dead argument or return value in a function with
local linkage, all uses, including in dbg.value intrinsics, would be
replaced with null constants. This would mean that, for example for an
integer argument, the debug info would incorrectly express that the
value is 0. Instead, replace all uses with undef to indicate that the
argument/return value is optimized out.
Also, make sure that metadata uses of return values are rewritten even
if there are no non-metadata uses of the value.
As a bit of historical curiosity, the code that emitted null constants
was introduced in the initial check-in of the pass in 2003, before
'undef' values even existed in LLVM.
This fixes PR23260.
Reviewers: dblaikie, aprantl, vsk, djtodoro
Reviewed By: aprantl
Subscribers: llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D55513
llvm-svn: 348837
Martin Storsjo [Tue, 11 Dec 2018 09:53:11 +0000 (09:53 +0000)]
[SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before calling RtlUnwindEx
This fixes PR39935.
llvm-svn: 348836
Ranjeet Singh [Tue, 11 Dec 2018 09:32:49 +0000 (09:32 +0000)]
Cleanup test case by removing unused attribute dso_local
Attribute 'dso_local' generated in bitcode from compiling
original C file but isn't needed.
Differential Revision: https://reviews.llvm.org/D55521
llvm-svn: 348835
Clement Courbet [Tue, 11 Dec 2018 08:39:11 +0000 (08:39 +0000)]
Reland r348741 "[Sema] Further improvements to to static_assert diagnostics."
Fix a dangling reference to temporary, never return nullptr.
llvm-svn: 348834
Craig Topper [Tue, 11 Dec 2018 07:41:06 +0000 (07:41 +0000)]
[X86] Switch the 64-bit mulx schedule test to use inline assembly.
I'm not sure we should always prefer MULX over MUL. So making the MULX guaranteed with inline assembly.
llvm-svn: 348833
Martin Storsjo [Tue, 11 Dec 2018 07:34:14 +0000 (07:34 +0000)]
Don't export assembly functions when function visibility annotations are disabled
Patch by Peiyuan Song!
Differential Revision: https://reviews.llvm.org/D55537
llvm-svn: 348832
Clement Courbet [Tue, 11 Dec 2018 07:28:00 +0000 (07:28 +0000)]
Revert r348830 "[Sema]improve static_assert(!expr)"
Submitted the wrong change.
llvm-svn: 348831
Clement Courbet [Tue, 11 Dec 2018 07:04:49 +0000 (07:04 +0000)]
[Sema]improve static_assert(!expr)
llvm-svn: 348830
Marshall Clow [Tue, 11 Dec 2018 06:06:49 +0000 (06:06 +0000)]
Fix problems with char8_t stuff on compilers that don't support char8_t yet
llvm-svn: 348829
Marshall Clow [Tue, 11 Dec 2018 04:35:44 +0000 (04:35 +0000)]
Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308
llvm-svn: 348828
Richard Trieu [Tue, 11 Dec 2018 03:18:39 +0000 (03:18 +0000)]
Move CodeGenOptions from Frontend to Basic
Basic uses CodeGenOptions and should not depend on Frontend.
llvm-svn: 348827
Martell Malone [Tue, 11 Dec 2018 03:14:56 +0000 (03:14 +0000)]
[PPC][NFC] store operands are dst not src
Differential Revision: https://reviews.llvm.org/D55502
llvm-svn: 348826
Louis Dionne [Tue, 11 Dec 2018 02:32:46 +0000 (02:32 +0000)]
Revert "[pair] Mark constructors as conditionally noexcept"
This broke the tests on Linux. Reverting until I find out why the tests
are broken (tomorrow).
llvm-svn: 348825
Louis Dionne [Tue, 11 Dec 2018 02:17:23 +0000 (02:17 +0000)]
[pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.
Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).
<rdar://problem/
29537079>
Reviewers: mclow.lists, EricWF
Subscribers: christof, llvm-commits
Differential Revision: https://reviews.llvm.org/D48669
llvm-svn: 348824
Nico Weber [Tue, 11 Dec 2018 02:09:32 +0000 (02:09 +0000)]
[gn build] Add build files for AsmParser, MIRParser, IRReader, MCDisassembler, Vectorize
These are all remaining build dependencies of llc, except for Target/X86 which
is in a separate patch at https://reviews.llvm.org/D55524
Differential Revision: https://reviews.llvm.org/D55518
llvm-svn: 348823
George Karpenkov [Tue, 11 Dec 2018 01:14:17 +0000 (01:14 +0000)]
[analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker
Memoization dose not seem to be necessary, as other statement visitors
run just fine without it,
and in fact seems to be causing memory corruptions.
Just removing it instead of investigating the root cause.
rdar://
45945002
Differential Revision: https://reviews.llvm.org/D54921
llvm-svn: 348822
George Karpenkov [Tue, 11 Dec 2018 01:13:58 +0000 (01:13 +0000)]
[analyzer] Hack for backwards compatibility for options for RetainCountChecker.
To be removed once the clients update.
llvm-svn: 348821
George Karpenkov [Tue, 11 Dec 2018 01:13:40 +0000 (01:13 +0000)]
[analyzer] Display a diagnostics when an inlined function violates its os_consumed summary
This is currently a diagnostics, but might be upgraded to an error in the future,
especially if we introduce os_return_on_success attributes.
rdar://
46359592
Differential Revision: https://reviews.llvm.org/D55530
llvm-svn: 348820
George Karpenkov [Tue, 11 Dec 2018 01:13:20 +0000 (01:13 +0000)]
[analyzer] Resolve another bug where the name of the leaked object was not printed properly
Differential Revision: https://reviews.llvm.org/D55528
llvm-svn: 348819
Heejin Ahn [Tue, 11 Dec 2018 01:11:04 +0000 (01:11 +0000)]
[WebAssembly] Add '.eventtype' directive support
Summary:
This patch supports `.eventtype` directive printing and parsing in the
same syntax with `.functype`.
Reviewers: aardappel, sbc100
Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D55353
llvm-svn: 348818
Armando Montanez [Tue, 11 Dec 2018 01:00:16 +0000 (01:00 +0000)]
[TextAPI][elfabi] Make SoName optional
This change makes DT_SONAME treated as an optional trait for ELF TextAPI
stubs. This change accounts for the fact that shared objects aren't
guaranteed to have a DT_SONAME entry. Tests have been updated to check
for correct behavior of an optional soname.
Differential Revision: https://reviews.llvm.org/D55533
llvm-svn: 348817
Heejin Ahn [Tue, 11 Dec 2018 00:53:59 +0000 (00:53 +0000)]
[WebAssembly] TargetStreamer cleanup (NFC)
Summary:
- Unify mixed argument names (`Symbol` and `Sym`) to `Sym`
- Changed `MCSymbolWasm*` argument of `emit***` functions to `const
MCSymbolWasm*`. It seems not very intuitive that emit function in the
streamer modifies symbol contents.
- Moved empty function bodies to the header
- clang-format
Reviewers: aardappel, dschuff, sbc100
Subscribers: jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D55347
llvm-svn: 348816
Aditya Nandakumar [Tue, 11 Dec 2018 00:48:50 +0000 (00:48 +0000)]
[GISel]: Refactor MachineIRBuilder to allow passing additional parameters to build Instrs
https://reviews.llvm.org/D55294
Previously MachineIRBuilder::buildInstr used to accept variadic
arguments for sources (which were either unsigned or
MachineInstrBuilder). While this worked well in common cases, it doesn't
allow us to build instructions that have multiple destinations.
Additionally passing in other optional parameters in the end (such as
flags) is not possible trivially. Also a trivial call such as
B.buildInstr(Opc, Reg1, Reg2, Reg3)
can be interpreted differently based on the opcode (2defs + 1 src for
unmerge vs 1 def + 2srcs).
This patch refactors the buildInstr to
buildInstr(Opc, ArrayRef<DstOps>, ArrayRef<SrcOps>)
where DstOps and SrcOps are typed unions that know how to add itself to
MachineInstrBuilder.
After this patch, most invocations would look like
B.buildInstr(Opc, {s32, DstReg}, {SrcRegs..., SrcMIBs..});
Now all the other calls (such as buildAdd, buildSub etc) forward to
buildInstr. It also makes it possible to build instructions with
multiple defs.
Additionally in a subsequent patch, we should make it possible to add
flags directly while building instructions.
Additionally, the main buildInstr method is now virtual and other
builders now only have to override buildInstr (for say constant
folding/cseing) is straightforward.
Also attached here (https://reviews.llvm.org/
F7675680) is a clang-tidy
patch that should upgrade the API calls if necessary.
llvm-svn: 348815
David Blaikie [Tue, 11 Dec 2018 00:17:36 +0000 (00:17 +0000)]
Follow-up fix to r348811 for null Errors (which is the case for end iterators)
Not sure how I missed that in my testing, but obvious enough - this
causes segfaults when attempting to dereference the Error in end
iterators.
llvm-svn: 348814
Zachary Turner [Tue, 11 Dec 2018 00:15:03 +0000 (00:15 +0000)]
Fix undefined behavior in Variable.h
m_loc_is_constant_data was uninitialized, so unless someone
explicitly called SetLocIsConstantData(), this would be UB.
I think every existing call-site would always call the proper
function to initialize the value, so there were no existing
bugs, but I encountered this when I tried to use it without
calling this function and encountered this.
llvm-svn: 348813
Eric Fiselier [Tue, 11 Dec 2018 00:14:34 +0000 (00:14 +0000)]
Add a version of std::function that includes a few optimizations in ABI V2.
Patch by Jordan Soyke (jsoyke@google.com)
Reviewed as D55045
The result of running the benchmarks and comparing them can be found
here: https://gist.github.com/EricWF/
a77fd42ec87fc98da8039e26d0349498
llvm-svn: 348812
David Blaikie [Tue, 11 Dec 2018 00:09:06 +0000 (00:09 +0000)]
llvm-objcopy: Improve/simplify llvm::Error handling during notes iteration
Using an Error as an out parameter from an indirect operation like
iteration as described in the documentation (
http://llvm.org/docs/ProgrammersManual.html#building-fallible-iterators-and-iterator-ranges
) seems to be a little fussy - so here's /one/ possible solution, though
I'm not sure it's the right one.
Alternatively such APIs may be better off being switched to a standard
algorithm style, where they take a lambda to do the iteration work that
is then called back into (eg: "Error e = obj.for_each_note([](const
Note& N) { ... });"). This would be safer than having an unwritten
assumption that the user of such an iteration cannot return early from
the inside of the function - and must always exit through the gift
shop... I mean error checking. (even though it's guaranteed that if
you're mid-way through processing an iteration, it's not in an error
state).
Alternatively we'd need some other (the super untrustworthy/thing we've
generally tried to avoid) error handling primitive that actually clears
the error state entirely so it's safe to ignore.
Fleshed this solution out a bit further during review - it now relies on
op==/op!= comparison as the equivalent to "if (Err)" testing the Error.
So just like an Error must be checked (even if it's in a success state),
the Error hiding in the iterator must be checked after each increment
(including by comparison with another iterator - perhaps this could be
constrained to only checking if the iterator is compared to the end
iterator? Not sure it's too important).
So now even just creating the iterator and not incrementing it at all
should still assert because the Error has not been checked.
Reviewers: lhames, jakehehrlich
Differential Revision: https://reviews.llvm.org/D55235
llvm-svn: 348811
Shafik Yaghmour [Mon, 10 Dec 2018 23:26:38 +0000 (23:26 +0000)]
[DataFormatters] Fixes to libc++ std::function formatter to deal with ABI change see
https://reviews.llvm.org/D55045
llvm-svn: 348810
Matt Arsenault [Mon, 10 Dec 2018 23:02:40 +0000 (23:02 +0000)]
Update test for instcombine change
llvm-svn: 348809
Adrian Prantl [Mon, 10 Dec 2018 22:57:47 +0000 (22:57 +0000)]
Rewrite pexpect-based test in LIT/FileCheck.
pexecpt-based tests are flakey because they involve timeouts and this
test is eprfectly serializable.
llvm-svn: 348808
Yi Kong [Mon, 10 Dec 2018 22:52:59 +0000 (22:52 +0000)]
[builtins] Remove trailing whitespaces, NFC
Remove trailing whitespaces so that it is easier to diff the code between
div{s,d,t}f3.c
llvm-svn: 348807
David Blaikie [Mon, 10 Dec 2018 22:44:48 +0000 (22:44 +0000)]
debuginfo: Use symbol difference for CU length to simplify assembly reading/editing
Mucking about simplifying a test case ( https://reviews.llvm.org/D55261 ) I stumbled across something I've hit before - that LLVM's (GCC's does too, FWIW) assembly output includes a hardcode length for a DWARF unit in its header. Instead we could emit a label difference - making the assembly easier to read/edit (though potentially at a slight (I haven't tried to observe it) performance cost of delaying/sinking the length computation into the MC layer).
Reviewers: JDevlieghere, probinson, ABataev
Differential Revision: https://reviews.llvm.org/D55281
llvm-svn: 348806
Frederic Riss [Mon, 10 Dec 2018 22:30:19 +0000 (22:30 +0000)]
Reflow a multi-line string and add a newline
llvm-svn: 348805
Davide Italiano [Mon, 10 Dec 2018 22:17:04 +0000 (22:17 +0000)]
[Local] Promote an utility that could be used elsewhere. NFCI.
llvm-svn: 348804
Sam Clegg [Mon, 10 Dec 2018 22:01:33 +0000 (22:01 +0000)]
Fix LLVM_LINK_LLVM_DYLIB build of TapiTests
A dependency on TestingSupport was introduced in rL348735 but
library was not incldued in the LLVM_LINK_LLVM_DYLIB build.
Differential Revision: https://reviews.llvm.org/D55526
llvm-svn: 348803
Krzysztof Parzyszek [Mon, 10 Dec 2018 21:56:04 +0000 (21:56 +0000)]
[Hexagon] Couple of fixes in optimize addressing mode
- Check if an operand is an immediate before calling getImm. Some operands
that take constant values can actually have global symbols or other
constant expressions.
- When a load-constant instruction can be folded into users, make sure to
only delete it when all users have been successfully converted.
llvm-svn: 348802
Matt Arsenault [Mon, 10 Dec 2018 21:50:54 +0000 (21:50 +0000)]
InstCombine: Scalarize single use icmp/fcmp
llvm-svn: 348801
Sanjay Patel [Mon, 10 Dec 2018 21:44:20 +0000 (21:44 +0000)]
[InstCombine] add tests for movmsk (PR39927) NFC
llvm-svn: 348800
Stephen Kelly [Mon, 10 Dec 2018 21:20:05 +0000 (21:20 +0000)]
Revert "Change InitListExpr dump to label and pointer"
This reverts commit r348794.
llvm-svn: 348799
Stephen Kelly [Mon, 10 Dec 2018 21:04:04 +0000 (21:04 +0000)]
Fix nits
llvm-svn: 348798
Stephen Kelly [Mon, 10 Dec 2018 21:03:00 +0000 (21:03 +0000)]
Re-order content of template parameter dumps
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55393
llvm-svn: 348797
David Green [Mon, 10 Dec 2018 20:55:34 +0000 (20:55 +0000)]
[Targets] Fixup incorrect targets in codemodel tests
llvm-svn: 348796
Stephen Kelly [Mon, 10 Dec 2018 20:53:39 +0000 (20:53 +0000)]
Re-order content in OMPDeclareReductionDecl dump
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55395
llvm-svn: 348795
Stephen Kelly [Mon, 10 Dec 2018 20:53:32 +0000 (20:53 +0000)]
Change InitListExpr dump to label and pointer
Summary: Don't add a child just for the label.
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55495
llvm-svn: 348794
Jonas Toth [Mon, 10 Dec 2018 19:41:53 +0000 (19:41 +0000)]
[clang-tidy] insert release notes for new checkers alphabetically
Summary:
Almost all code review comments on new checkers {D55433} {D48866} {D54349} seem to ask for the release notes to be added alphabetically, plus I've seen commits by @Eugene.Zelenko reordering the lists
Make add_new_check.py add those release notes alphabetically based on checker name
If include-fixer section is seen add it at the end
Minor change in the message format to prevent double newlines added before the checker.
Do the tools themselves have unit tests? (sorry new to this game)
- Tested adding new checker at the beginning
- Tested on adding new checker in the middle
- Tested on empty ReleasesNotes.rst (as we would see after RC)
Patch by MyDeveloperDay.
Reviewers: alexfh, JonasToth, curdeius, aaron.ballman, benhamilton, hokein
Reviewed By: JonasToth
Subscribers: cfe-commits, xazax.hun, Eugene.Zelenko
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D55508
llvm-svn: 348793
Krzysztof Parzyszek [Mon, 10 Dec 2018 19:30:08 +0000 (19:30 +0000)]
Revert "[Hexagon] Check if operand is an immediate before getImm"
This reverts r348787. The patch wasn't quite correct.
llvm-svn: 348792
JF Bastien [Mon, 10 Dec 2018 19:27:38 +0000 (19:27 +0000)]
APFloat: allow 64-bit of payload
Summary: The APFloat and Constant APIs taking an APInt allow arbitrary payloads,
and that's great. There's a convenience API which takes an unsigned, and that's
silly because it then directly creates a 64-bit APInt. Just change it to 64-bits
directly.
At the same time, add ConstantFP NaN getters which match the APFloat ones (with
getQNaN / getSNaN and APInt parameters).
Improve the APFloat testing to set more payload bits.
Reviewers: scanon, rjmccall
Subscribers: jkorous, dexonsmith, kristina, llvm-commits
Differential Revision: https://reviews.llvm.org/D55460
llvm-svn: 348791
Aaron Ballman [Mon, 10 Dec 2018 19:18:11 +0000 (19:18 +0000)]
Add an explicit triple to this test to fix failing test bots.
llvm-svn: 348790
Bruno Cardoso Lopes [Mon, 10 Dec 2018 19:03:12 +0000 (19:03 +0000)]
[constexpr][c++2a] Try-catch blocks in constexpr functions
Implement support for try-catch blocks in constexpr functions, as
proposed in http://wg21.link/P1002 and voted in San Diego for c++20.
The idea is that we can still never throw inside constexpr, so the catch
block is never entered. A try-catch block like this:
try { f(); } catch (...) { }
is then morally equivalent to just
{ f(); }
Same idea should apply for function/constructor try blocks.
rdar://problem/
45530773
Differential Revision: https://reviews.llvm.org/D55097
llvm-svn: 348789
Amara Emerson [Mon, 10 Dec 2018 18:44:58 +0000 (18:44 +0000)]
[GlobalISel] Restrict G_MERGE_VALUES capability and replace with new opcodes.
This patch restricts the capability of G_MERGE_VALUES, and uses the new
G_BUILD_VECTOR and G_CONCAT_VECTORS opcodes instead in the appropriate places.
This patch also includes AArch64 support for selecting G_BUILD_VECTOR of <4 x s32>
and <2 x s64> vectors.
Differential Revisions: https://reviews.llvm.org/D53629
llvm-svn: 348788
Krzysztof Parzyszek [Mon, 10 Dec 2018 18:39:47 +0000 (18:39 +0000)]
[Hexagon] Check if operand is an immediate before getImm
llvm-svn: 348787
Aaron Ballman [Mon, 10 Dec 2018 18:37:47 +0000 (18:37 +0000)]
Adding tests for -ast-dump; NFC.
This adds tests for expressions in C.
llvm-svn: 348786
Krzysztof Parzyszek [Mon, 10 Dec 2018 18:36:06 +0000 (18:36 +0000)]
[Hexagon] Add patterns for any_extend from i1 and short vectors of i1
llvm-svn: 348785
Simon Pilgrim [Mon, 10 Dec 2018 18:29:46 +0000 (18:29 +0000)]
[TargetLowering] Add UNDEF folding to SimplifyDemandedVectorElts
If all the demanded elements of the SimplifyDemandedVectorElts are known to be UNDEF, we can simplify to an ISD::UNDEF node.
Zero constant folding will be handled in a future patch - its a little trickier as we often have bitcasted zero values.
Differential Revision: https://reviews.llvm.org/D55511
llvm-svn: 348784
Jonathan Peyton [Mon, 10 Dec 2018 18:26:50 +0000 (18:26 +0000)]
[OpenMP] Fix a few build issues
Fix two build issues:
1) Recent commit 348756 accidentally included Unix clang compilers
to use immintrin.h when only clang-cl should be using it leading
to the following error:
openmp-llvm/runtime/src/kmp_lock.cpp:2035:25: error: always_
inline function '_xbegin' requires target feature 'rtm', but would be inlined into function
'__kmp_test_adaptive_lock_only' that is compiled without support for 'rtm'
kmp_uint32 status = _xbegin();
This patch changes the guard to use immintrin.h to only use clang-cl instead of all clang
2) gcc-8 gives a warning about multiline comment in kmp_runtime.cpp:
This patch just changes it to a two line comment
openmp-llvm/runtime/src/kmp_runtime.cpp:7697:8: warning: multi-line comment [-Wcomment]
#endif // KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD \
llvm-svn: 348783
Erik Pilkington [Mon, 10 Dec 2018 18:19:43 +0000 (18:19 +0000)]
[docs] Add the new Objective-C ARC intrinsics to the LangRef.
These were added in r348441. This mostly just points to the clang documentation
to describe the intended semantics of each intrinsic.
llvm-svn: 348782
Simon Pilgrim [Mon, 10 Dec 2018 18:18:50 +0000 (18:18 +0000)]
[DAGCombiner] Remove unnecessary recursive DAGCombiner::visitINSERT_SUBVECTOR call.
As discussed on D55511, this caused an issue if the inner node deletes a node that the outer node depends upon. As it doesn't affect any lit-tests and I've only been able to expose this with the D55511 change I'm committing this now.
llvm-svn: 348781
Pavel Labath [Mon, 10 Dec 2018 18:17:53 +0000 (18:17 +0000)]
Fix r348773
It's not sufficient to implement the CreateMemoryInstance function, one
has to use it too.
llvm-svn: 348780
Jonas Devlieghere [Mon, 10 Dec 2018 18:17:39 +0000 (18:17 +0000)]
[Host] Use FileSystem wrapper
Fixes Host.mm to use the FileSystem class instead of making native calls
to check if a file exists.
llvm-svn: 348779
Eric Fiselier [Mon, 10 Dec 2018 18:14:09 +0000 (18:14 +0000)]
Refactor std::function to more easily support alternative implementations.
Patch from Jordan Soyke (jsoyke@google.com)
Reviewed as D55520
This change adds a new internal class, called __value_func, that adds
a minimal subset of value-type semantics to the internal __func interface.
The change is NFC, and is cleanup for the upcoming ABI v2 function implementation (D55045).
llvm-svn: 348778
Fangrui Song [Mon, 10 Dec 2018 18:10:35 +0000 (18:10 +0000)]
ComputeLineNumbers: delete SSE2 vectorization
Summary:
SSE2 vectorization was added in 2012, but it is 2018 now and I can't
observe any performance boost (testing clang -E [all Sema/* CodeGen/* with proper -I options]) with the existing _mm_movemask_epi8+countTrailingZeros or the following SSE4.2 (compiling with -msse4.2):
__m128i C = _mm_setr_epi8('\r','\n',0,0,0,0,0,0,0,0,0,0,0,0,0,0);
_mm_cmpestri(C, 2, Chunk, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_POSITIVE_POLARITY | _SIDD_LEAST_SIGNIFICANT)
Delete the vectorization to simplify the code.
Also simplify the code a bit and don't check the line ending sequence \n\r
Reviewers: bkramer, #clang
Reviewed By: bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55484
llvm-svn: 348777
Sanjay Patel [Mon, 10 Dec 2018 17:23:44 +0000 (17:23 +0000)]
[x86] fix formatting; NFC
This should really be generalized to allow increment and/or
we should replace it by using ISD::matchUnaryPredicate().
See D55515 for context.
llvm-svn: 348776
Stella Stamenova [Mon, 10 Dec 2018 17:23:28 +0000 (17:23 +0000)]
Do not use PATH_MAX with SmallString
Summary: Instead use a more reasonable value to start and rely on the fact that SmallString will resize if necessary.
Reviewers: labath, asmith
Reviewed By: labath
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D55457
llvm-svn: 348775
Evandro Menezes [Mon, 10 Dec 2018 17:17:26 +0000 (17:17 +0000)]
[AArch64] Refactor the Exynos scheduling predicates
Refactor the scheduling predicates based on `MCInstPredicate`. In this
case, for the Exynos processors.
Differential revision: https://reviews.llvm.org/D55345
llvm-svn: 348774
Pavel Labath [Mon, 10 Dec 2018 17:16:38 +0000 (17:16 +0000)]
Re-commit "Introduce ObjectFileBreakpad"
This re-commits r348592, which was reverted due to a failing test on
macos.
The issue was that I was passing a null pointer for the
"CreateMemoryInstance" callback when registering ObjectFileBreakpad,
which caused crashes when attemping to load modules from memory. The
correct thing to do is to pass a callback which always returns a null
pointer (as breakpad files are never loaded in inferior memory).
It turns out that there is only one test which exercises this code path,
and it's mac-only, so I've create a new test which should run everywhere
(except windows, as one cannot delete an executable which is being run).
Unfortunately, this test still fails on linux for other reasons, but at
least it gives us something to aim for.
The original commit message was:
This patch adds the scaffolding necessary for lldb to recognise symbol
files generated by breakpad. These (textual) files contain just enough
information to be able to produce a backtrace from a crash
dump. This information includes:
- UUID, architecture and name of the module
- line tables
- list of symbols
- unwind information
A minimal breakpad file could look like this:
MODULE Linux x86_64
0000000024B5D199F0F766FFFFFF5DC30 a.out
INFO CODE_ID
00000000B52499D1F0F766FFFFFF5DC3
FILE 0 /tmp/a.c
FUNC 1010 10 0 _start
1010 4 4 0
1014 5 5 0
1019 5 6 0
101e 2 7 0
PUBLIC 1010 0 _start
STACK CFI INIT 1010 10 .cfa: $rsp 8 + .ra: .cfa -8 + ^
STACK CFI 1011 $rbp: .cfa -16 + ^ .cfa: $rsp 16 +
STACK CFI 1014 .cfa: $rbp 16 +
Even though this data would normally be considered "symbol" information,
in the current lldb infrastructure it is assumed every SymbolFile object
is backed by an ObjectFile instance. So, in order to better interoperate
with the rest of the code (particularly symbol vendors).
In this patch I just parse the breakpad header, which is enough to
populate the UUID and architecture fields of the ObjectFile interface.
The rough plan for followup patches is to expose the individual parts of
the breakpad file as ObjectFile "sections", which can then be used by
other parts of the codebase (SymbolFileBreakpad ?) to vend the necessary
information.
Reviewers: clayborg, zturner, lemo, amccarth
Subscribers: mgorny, fedor.sergeev, markmentovai, lldb-commits
Differential Revision: https://reviews.llvm.org/D55214
llvm-svn: 348773
Alexey Bataev [Mon, 10 Dec 2018 16:50:36 +0000 (16:50 +0000)]
[OPENMP][NVPTX]Revert __kmpc_shuffle_int64 to its original form.
Summary:
Use the original shuffle implementation for __kmpc_shuffle_int64 since
default implementation uses the same implementation.
Reviewers: gtbercea
Subscribers: guansong, caomhin, openmp-commits
Differential Revision: https://reviews.llvm.org/D55514
llvm-svn: 348772
Neil Henning [Mon, 10 Dec 2018 16:35:53 +0000 (16:35 +0000)]
[AMDGPU] Change the l1 flush instruction for AMDPAL/MESA3D.
This commit changes which l1 flush instruction is used for AMDPAL and
MESA3d workloads to flush the entire l1 cache instead of just the
volatile lines.
Differential Revision: https://reviews.llvm.org/D55367
llvm-svn: 348771
David Carlier [Mon, 10 Dec 2018 16:29:30 +0000 (16:29 +0000)]
[Sanitizer] expand sysctl/getmntinfo/nl_langinfo to Darwin
Reviewers: vitalybuka, krytarowski, kubamracek
Reviewed By: vitalybuka, krytarowski
Differential Revision: https://reviews.llvm.org/D55473
llvm-svn: 348770
Sanjay Patel [Mon, 10 Dec 2018 16:28:30 +0000 (16:28 +0000)]
[x86] add tests for LowerVSETCC with min/max; NFC
llvm-svn: 348769
Evandro Menezes [Mon, 10 Dec 2018 16:24:30 +0000 (16:24 +0000)]
[AArch64] Refactor the scheduling predicates
Refactor the scheduling predicates based on `MCInstPredicate`. Augment the
number of helper predicates used by processor specific predicates.
Differential revision: https://reviews.llvm.org/D55375
llvm-svn: 348768
Tim Corringham [Mon, 10 Dec 2018 16:23:30 +0000 (16:23 +0000)]
[AMDGPU] Add new Mode Register pass - minor fix
Trivial change to add parentheses to an expression to avoid a
sanitizer error in SIModeRegister.cpp, which was committed earlier.
llvm-svn: 348767
Evandro Menezes [Mon, 10 Dec 2018 16:22:29 +0000 (16:22 +0000)]
[llvm-mca] Add new tests for Exynos (NFC)
llvm-svn: 348766
Francis Visoiu Mistrih [Mon, 10 Dec 2018 16:04:56 +0000 (16:04 +0000)]
[DAGCombiner] Simplify test case from r348759
Thanks Simon for pointing that out.
llvm-svn: 348765
Ivan Donchevskii [Mon, 10 Dec 2018 15:58:50 +0000 (15:58 +0000)]
[libclang] Revert removal of tidy plugin support from libclang introduced in r347496
Differential Revision: https://reviews.llvm.org/D55415
llvm-svn: 348764
Cameron McInally [Mon, 10 Dec 2018 15:21:35 +0000 (15:21 +0000)]
[AVX512] Update typo in comment
Should be "Sae" for "Suppress All Exceptions".
NFC
llvm-svn: 348763
Michael Kruse [Mon, 10 Dec 2018 15:16:37 +0000 (15:16 +0000)]
Use zip_longest for iterator range comparisons. NFC.
Use zip_longest in two locations that compare iterator ranges.
zip_longest allows the iteration using a range-based for-loop and to be
symmetric over both ranges instead of prioritizing one over the other.
In that latter case code have to handle the case that the first is
longer than the second, the second is longer than the first, and both
are of the same length, which must partially be checked after the loop.
With zip_longest, this becomes an element comparison within the loop
like the comparison of the elements themselves. The symmetry makes it
clearer that neither the first and second iterators are handled
differently. The iterators are not event used directly anymore, just
the ranges.
Differential Revision: https://reviews.llvm.org/D55468
llvm-svn: 348762
Petr Pavlu [Mon, 10 Dec 2018 15:15:05 +0000 (15:15 +0000)]
[GlobalISel] Set stack protector index when translating Intrinsic::stackprotector
Record the stack protector index in MachineFrameInfo when translating
Intrinsic::stackprotector similarly as is done by SelectionDAG when
processing the same intrinsic.
Setting this index allows the Prologue/Epilogue Insertion to recognize
that the stack protection is enabled. The pass can then make sure that
the stack protector comes before local variables on the stack and
assigns potentially vulnerable objects first so they are close to the
stack protector slot.
Differential Revision: https://reviews.llvm.org/D55418
llvm-svn: 348761
Vladimir Stefanovic [Mon, 10 Dec 2018 15:07:36 +0000 (15:07 +0000)]
[mips][mc] Emit R_{MICRO}MIPS_JALR when expanding jal to jalr
When replacing jal with jalr, also emit '.reloc R_MIPS_JALR' (R_MICROMIPS_JALR
for micromips). The linker might then be able to turn jalr into a direct
call.
Add '-mips-jalr-reloc' to enable/disable this feature (default is true).
Differential revision: https://reviews.llvm.org/D55292
llvm-svn: 348760
Francis Visoiu Mistrih [Mon, 10 Dec 2018 14:31:34 +0000 (14:31 +0000)]
[DAGCombiner] Use the result value type in visitCONCAT_VECTORS
This triggers an assert when combining concat_vectors of a bitcast of
merge_values.
With asserts disabled, it fails to select:
fatal error: error in backend: Cannot select: 0x7ff19d000e90: i32 = any_extend 0x7ff19d000ae8
0x7ff19d000ae8: f64,ch = CopyFromReg 0x7ff19d000c20:1, Register:f64 %1
0x7ff19d000b50: f64 = Register %1
In function: d
Differential Revision: https://reviews.llvm.org/D55507
llvm-svn: 348759
Alexey Bataev [Mon, 10 Dec 2018 14:29:05 +0000 (14:29 +0000)]
[OPENMP][NVPTX]Enable fast shuffles on 64bit values only if CUDA >= 9.
Summary:
Shuffle on 64bit data is allowed only for CUDA >= 9.0. Also, fixed the
constant for the mask, need one extra L in the end.
Reviewers: gtbercea, kkwli0
Subscribers: guansong, caomhin, openmp-commits
Differential Revision: https://reviews.llvm.org/D55440
llvm-svn: 348758
David Spickett [Mon, 10 Dec 2018 14:26:06 +0000 (14:26 +0000)]
[NFC][AArch64] Remove duplicate Arch list in target parser tests
The list generated in the target parser tests is the
same as the one in the AArch64 target parser.
Use that one instead.
Differential Revision: https://reviews.llvm.org/D55509
llvm-svn: 348757
Andrey Churbanov [Mon, 10 Dec 2018 13:45:00 +0000 (13:45 +0000)]
Support clang compiling under windows-gnu and windows-msvc
Patch by Peiyuan Song <squallatf@gmail.com>
Differential Revision: https://reviews.llvm.org/D53422
llvm-svn: 348756
Raphael Isemann [Mon, 10 Dec 2018 12:37:46 +0000 (12:37 +0000)]
Misc typos fixes in ./lib folder
Summary: Found via `codespell -q 3 -I ../clang-whitelist.txt -L uint,importd,crasher,gonna,cant,ue,ons,orign,ned`
Reviewers: teemperor
Reviewed By: teemperor
Subscribers: teemperor, jholewinski, jvesely, nhaehnle, whisperity, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D55475
llvm-svn: 348755
Tim Corringham [Mon, 10 Dec 2018 12:06:10 +0000 (12:06 +0000)]
[AMDGPU] Add new Mode Register pass
A new pass to manage the Mode register.
Currently this just manages the floating point double precision
rounding requirements, but is intended to be easily extended to
encompass all Mode register settings.
The immediate motivation comes from the requirement to use the
round-to-zero rounding mode for the 16 bit interpolation
instructions, where the rounding mode setting is shared between
16 and 64 bit operations.
llvm-svn: 348754
Jeremy Morse [Mon, 10 Dec 2018 12:04:08 +0000 (12:04 +0000)]
[DebugInfo] Don't drop dbg.value's of nullptr
Currently, dbg.value's of "nullptr" are dropped when entering a SelectionDAG --
apparently just because of an oversight when recognising Values that are
constant (see PR39787). This patch adds ConstantPointerNull to the list of
constants that can be turned into DBG_VALUEs.
The matter of what bit-value a null pointer constant in LLVM has was raised
in this mailing list thread:
http://lists.llvm.org/pipermail/llvm-dev/2018-December/128234.html
Where it transpires LLVM relies on (IR) null pointers being zero valued,
thus I've baked this assumption into the patch.
Differential Revision: https://reviews.llvm.org/D55227
llvm-svn: 348753
Andrew Savonichev [Mon, 10 Dec 2018 12:03:00 +0000 (12:03 +0000)]
[OpenCL][CodeGen] Fix replacing memcpy with addrspacecast
Summary:
If a function argument is byval and RV is located in default or alloca address space
an optimization of creating addrspacecast instead of memcpy is performed. That is
not correct for OpenCL, where that can lead to a situation of address space casting
from __private * to __global *. See an example below:
```
typedef struct {
int x;
} MyStruct;
void foo(MyStruct val) {}
kernel void KernelOneMember(__global MyStruct* x) {
foo (*x);
}
```
for this code clang generated following IR:
...
%0 = load %struct.MyStruct addrspace(1)*, %struct.MyStruct addrspace(1)**
%x.addr, align 4
%1 = addrspacecast %struct.MyStruct addrspace(1)* %0 to %struct.MyStruct*
...
So the optimization was disallowed for OpenCL if RV is located in an address space
different than that of the argument (0).
Reviewers: yaxunl, Anastasia
Reviewed By: Anastasia
Subscribers: cfe-commits, asavonic
Differential Revision: https://reviews.llvm.org/D54947
llvm-svn: 348752
Jeremy Morse [Mon, 10 Dec 2018 11:20:47 +0000 (11:20 +0000)]
[DebugInfo] Emit undef DBG_VALUEs when SDNodes are optimised out
This is a fix for PR39896, where dbg.value's of SDNodes that have been
optimised out do not lead to "DBG_VALUE undef" instructions being created.
Such undef instructions are necessary to terminate earlier variable
ranges, otherwise variable values leak past the point where they're valid.
The "invalidated" flag of SDDbgValue is currently being abused to mean two
things:
* The corresponding SDNode is now invalid
* This SDDbgValue should not be emitted
Of which there are several legitimate combinations of meaning:
* The SDNode has been invalidated and we should emit "DBG_VALUE undef"
* The SDNode has been invalidated but the debug data was salvaged, don't
emit anything for this SDDbgValue
* This SDDbgValue has been emitted
This patch introduces distinct "Emitted" and "Invalidated" fields to the
SDDbgValue class, updates users accordingly, and generates "undef"
DBG_VALUEs for invalidated records. Awkwardly, there are circumstances
where we emit SDDbgValue's twice, specifically DebugInfo/X86/dbg-addr-dse.ll
which I've preserved.
Differential Revision: https://reviews.llvm.org/D55372
llvm-svn: 348751
Nikita Popov [Mon, 10 Dec 2018 10:16:50 +0000 (10:16 +0000)]
[X86] Fix AvoidStoreForwardingBlocks pass for negative displacements
Fixes https://bugs.llvm.org/show_bug.cgi?id=39926.
The size of the first copy was computed as
std::abs(std::abs(LdDisp2) - std::abs(LdDisp1)), which results in
skipped bytes if the signs of LdDisp2 and LdDisp1 differ. As far as
I can see, this should just be LdDisp2 - LdDisp1. The case where
LdDisp1 > LdDisp2 is already handled in the code above, in which case
LdDisp2 is set to LdDisp1 and this subtraction will evaluate to
Size1 = 0, which is the correct value to skip an overlapping copy.
Differential Revision: https://reviews.llvm.org/D55485
llvm-svn: 348750