Matt Arsenault [Wed, 17 May 2017 21:02:58 +0000 (21:02 +0000)]
AMDGPU: Change mubuf soffset register when SP relative
Check the MachinePointerInfo for whether the access is
supposed to be relative to the stack pointer.
No tests because this is used in later commits implementing
calls.
llvm-svn: 303301
Simon Pilgrim [Wed, 17 May 2017 21:02:18 +0000 (21:02 +0000)]
[X86][AVX512] Add 512-bit vector ctlz costs + tests
llvm-svn: 303300
Bob Haarman [Wed, 17 May 2017 20:46:48 +0000 (20:46 +0000)]
[llvm-pdbdump] in yaml2pdb, generate default output filename if none given
Summary:
llvm-pdbdump yaml2pdb used to fail with a misleading error
message ("An I/O error occurred on the file system") if no output file
was specified. This change adds an assert to PDBFileBuilder to check
that an output file name is specified, and makes llvm-pdbdump generate
an output file name based on the input file name if no output file
name is explicitly specified.
Reviewers: amccarth, zturner
Reviewed By: zturner
Subscribers: fhahn, llvm-commits
Differential Revision: https://reviews.llvm.org/D33296
llvm-svn: 303299
Dehao Chen [Wed, 17 May 2017 20:44:08 +0000 (20:44 +0000)]
update the test that should have been updated in r303292. (NFC)
llvm-svn: 303298
Zachary Turner [Wed, 17 May 2017 20:42:52 +0000 (20:42 +0000)]
Add some helpers for manipulating BinaryStreamRefs.
llvm-svn: 303297
Matt Arsenault [Wed, 17 May 2017 20:30:58 +0000 (20:30 +0000)]
AMDGPU: Make better use of op_sel with high components
Handle more general swizzles.
llvm-svn: 303296
Sanjay Patel [Wed, 17 May 2017 20:27:55 +0000 (20:27 +0000)]
[InstSimplify] handle all icmp i1 X, C in one place; NFCI
We already handled all of the new tests identically, but several
of those went through a lot of unnecessary processing before
getting folded.
Another motivation for grouping these cases together is that
InstCombine needs a similar fold. Currently, it handles the
'not' cases inefficiently which can lead to bugs as described
in the post-commit comments of:
https://reviews.llvm.org/D32143
llvm-svn: 303295
Zachary Turner [Wed, 17 May 2017 20:23:31 +0000 (20:23 +0000)]
[BinaryStream] Reduce the amount of boiler plate needed to use.
Often you have an array and you just want to use it. With the current
design, you have to first construct a `BinaryByteStream`, and then create
a `BinaryStreamRef` from it. Worse, the `BinaryStreamRef` holds a pointer
to the `BinaryByteStream`, so you can't just create a temporary one to
appease the compiler, you have to actually hold onto both the `ArrayRef`
as well as the `BinaryByteStream` *AND* the `BinaryStreamReader` on top of
that. This makes for very cumbersome code, often requiring one to store a
`BinaryByteStream` in a class just to circumvent this.
At the cost of some added complexity (not exposed to users, but internal
to the library), we can do better than this. This patch allows us to
construct `BinaryStreamReaders` and `BinaryStreamWriters` directly from
source data (e.g. `StringRef`, `MutableArrayRef<uint8_t>`, etc). Not only
does this reduce the amount of code you have to type and make it more
obvious how to use it, but it solves real lifetime issues when it's
inconvenient to hold onto a `BinaryByteStream` for a long time.
The additional complexity is in the form of an added layer of indirection.
Whereas before we simply stored a `BinaryStream*` in the ref, we now store
both a `BinaryStream*` **and** a `std::shared_ptr<BinaryStream>`. When
the user wants to construct a `BinaryStreamRef` directly from an
`ArrayRef` etc, we allocate an internal object that holds ownership over a
`BinaryByteStream` and forwards all calls, and store this in the
`shared_ptr<>`. This also maintains the ref semantics, as you can copy it
by value and references refer to the same underlying stream -- the one
being held in the object stored in the `shared_ptr`.
Differential Revision: https://reviews.llvm.org/D33293
llvm-svn: 303294
Simon Pilgrim [Wed, 17 May 2017 20:22:54 +0000 (20:22 +0000)]
[X86][AVX512] Add 512-bit vector cttz costs + tests
llvm-svn: 303293
Dehao Chen [Wed, 17 May 2017 20:18:13 +0000 (20:18 +0000)]
Only enable LiveRangeShrink for x86.
Summary: Moving LiveRangeShrink to x86 as this pass is mostly useful for archtectures with great register pressure.
Reviewers: MatzeB, qcolombet
Reviewed By: qcolombet
Subscribers: jholewinski, jyknight, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D33294
llvm-svn: 303292
Matt Arsenault [Wed, 17 May 2017 20:00:00 +0000 (20:00 +0000)]
AMDGPU: Try to use op_sel when selecting packed instructions
Avoids instructions to pack a vector when the source is really
a scalar being broadcast.
Also be smarter and look for per-component fneg.
Doesn't yet handle scalar from upper half of register
or other swizzles.
llvm-svn: 303291
Simon Pilgrim [Wed, 17 May 2017 19:57:20 +0000 (19:57 +0000)]
[X86] Split ctpop/ctlz/cttz cost tests
This will make things a lot easier to test all the permutations of avx512
llvm-svn: 303290
Dimitry Andric [Wed, 17 May 2017 19:46:49 +0000 (19:46 +0000)]
Reapply part of rL303015, fixing just the DynamicLibaryTest. Add
retrieval of the original argv[0] from the GoogleTest framework, so it
is more likely the correct main executable path is found.
llvm-svn: 303289
Jacob Gravelle [Wed, 17 May 2017 19:45:22 +0000 (19:45 +0000)]
[WebAssembly][NFC] Update expected testsuite failures for newly passing tests
Summary: r303050 fixes crashes when calling scalarizeMaskedMemIntrin pass from WebAssembly backend. This updates expected test failures for that.
Reviewers: sbc100
Subscribers: jfb, llvm-commits, dschuff
Differential Revision: https://reviews.llvm.org/D33295
llvm-svn: 303288
Matt Arsenault [Wed, 17 May 2017 19:37:57 +0000 (19:37 +0000)]
AMDGPU: Use appropriate soffset for spilling
This needs to be the frame offset register, and not the global
scratch wave offset register. For kernels, these are the same.
llvm-svn: 303287
Leo Li [Wed, 17 May 2017 19:37:27 +0000 (19:37 +0000)]
[Ubsan]Remove unused link libraries.
Summary: Remove unused link libraries metioned in D33216.
Reviewers: llvm-commits, vsk
Reviewed By: vsk
Subscribers: vsk, kubamracek, mgorny, filcab
Differential Revision: https://reviews.llvm.org/D33292
llvm-svn: 303286
Dimitry Andric [Wed, 17 May 2017 19:33:10 +0000 (19:33 +0000)]
Revert r303015, because it has the unintended side effect of breaking
driver-mode recognition in clang (this is because the sysctl method
always returns one and only one executable path, even for an executable
with multiple links):
Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD
Summary:
After rL301562, on FreeBSD the DynamicLibrary unittests fail, because
the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since
the path does not contain any slashes, retrieving the main executable
will not work.
Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3),
which is more reliable than fiddling with relative or absolute paths.
Also add retrieval of the original argv[] from the GoogleTest framework,
to use as a fallback for other OSes.
Reviewers: emaste, marsupial, hans, krytarowski
Reviewed By: krytarowski
Subscribers: krytarowski, llvm-commits
Differential Revision: https://reviews.llvm.org/D33171
llvm-svn: 303285
Matt Arsenault [Wed, 17 May 2017 19:25:06 +0000 (19:25 +0000)]
AMDGPU: Fix min3/max3 combines for f16/i16
Fix missing instruction definitions for min3/max3.
llvm-svn: 303284
Simon Pilgrim [Wed, 17 May 2017 19:20:20 +0000 (19:20 +0000)]
[X86][AVX512] Add 512-bit vector bitreverse costs + tests
llvm-svn: 303283
Rafael Espindola [Wed, 17 May 2017 18:55:01 +0000 (18:55 +0000)]
Add back a dummy --use-processes.
Some bots are using it.
llvm-svn: 303282
Marshall Clow [Wed, 17 May 2017 18:51:36 +0000 (18:51 +0000)]
Make next/prev/advance/distance operations on iterators be constexpr. I missed this when I implemented the rest of P0031R0
llvm-svn: 303281
Rafael Espindola [Wed, 17 May 2017 18:20:01 +0000 (18:20 +0000)]
Always use the multiprocess module.
This seems to work on freebsd and openbsd these days.
llvm-svn: 303280
Reid Kleckner [Wed, 17 May 2017 18:16:17 +0000 (18:16 +0000)]
Re-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"
We have to check gCrashRecoveryEnabled before using __try.
In other words, SEH works too well and we ended up recovering from
crashes in implicit module builds that we weren't supposed to. Only
libclang is supposed to enable CrashRecoveryContext to allow implicit
module builds to crash.
llvm-svn: 303279
Ted Woodward [Wed, 17 May 2017 17:48:55 +0000 (17:48 +0000)]
Fix error string set in AddName to take a StringRef.
llvm-svn: 303278
Aditya Nandakumar [Wed, 17 May 2017 17:41:55 +0000 (17:41 +0000)]
[GISel]: Fix undefined behavior in IRTranslator
Make sure IRTranslator->MachineIRBuilder->DebugLoc doesn't
outlive the DILocation. Clear it at the end of
IRTranslator::runOnMachineFunction
llvm-svn: 303277
Leo Li [Wed, 17 May 2017 17:17:41 +0000 (17:17 +0000)]
Generate ubsan shared libraries.
Summary: Those libraries are required by aosp (https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/Android.mk). Currenly the shared libraries are generated by aosp Makefile system. We are looking forward to using cmake to generate them.
Reviewers: llvm-commits, vsk
Reviewed By: vsk
Subscribers: filcab, vsk, srhines, kubamracek, mgorny, krytarowski
Differential Revision: https://reviews.llvm.org/D33216
llvm-svn: 303276
Reid Kleckner [Wed, 17 May 2017 17:15:00 +0000 (17:15 +0000)]
Revert "[CrashRecovery] Use SEH __try instead of VEH when available"
This reverts commit r303274, it appears to break some clang tests.
llvm-svn: 303275
Reid Kleckner [Wed, 17 May 2017 17:02:16 +0000 (17:02 +0000)]
[CrashRecovery] Use SEH __try instead of VEH when available
Summary:
It avoids problems when other libraries raise exceptions. In particular,
OutputDebugString raises an exception that the debugger is supposed to
catch and suppress. VEH kicks in first right now, and that is entirely
incorrect.
Unfortunately, GCC does not support SEH, so I've kept the old buggy VEH
codepath around. We could fix it with SetUnhandledExceptionFilter, but
that is not per-thread, so a well-behaved library shouldn't set it.
Reviewers: zturner
Subscribers: llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33261
llvm-svn: 303274
Hans Wennborg [Wed, 17 May 2017 16:44:08 +0000 (16:44 +0000)]
Include setjmp.h unconditionally in asan_test_utils.h
It's used in asan_test.cc also on Windows, and my build was failing
with:
C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:549:28: error: unknown type name 'jmp_buf'
NOINLINE void LongJmpFunc1(jmp_buf buf) {
^
C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:569:10: error: unknown type name 'jmp_buf'
static jmp_buf buf;
^
I couldn't find what changed to make this not work anymore, but this should fix
it.
llvm-svn: 303273
Zachary Turner [Wed, 17 May 2017 16:39:33 +0000 (16:39 +0000)]
Workaround for incorrect Win32 header on GCC.
llvm-svn: 303272
Zachary Turner [Wed, 17 May 2017 16:39:06 +0000 (16:39 +0000)]
[CodeView] Simplify the use of visiting type records & streams.
There is often a lot of boilerplate code required to visit a type
record or type stream. The #1 use case is that you have a sequence
of bytes that represent one or more records, and you want to
deserialize each one, switch on it, and call a callback with the
deserialized record that the user can examine. Currently this
requires at least 6 lines of code:
codeview::TypeVisitorCallbackPipeline Pipeline;
Pipeline.addCallbackToPipeline(Deserializer);
Pipeline.addCallbackToPipeline(MyCallbacks);
codeview::CVTypeVisitor Visitor(Pipeline);
consumeError(Visitor.visitTypeRecord(Record));
With this patch, it becomes one line of code:
consumeError(codeview::visitTypeRecord(Record, MyCallbacks));
This is done by having the deserialization happen internally inside
of the visitTypeRecord function. Since this is occasionally not
desirable, the function provides a 3rd parameter that can be used
to change this behavior.
Hopefully this can significantly reduce the barrier to entry
to using the visitation infrastructure.
Differential Revision: https://reviews.llvm.org/D33245
llvm-svn: 303271
Hans Wennborg [Wed, 17 May 2017 16:22:03 +0000 (16:22 +0000)]
Revert r303225 "Garbage collect dllimported symbols."
and follow-up r303226 "Fix Windows buildbots."
This broke the sanitizer-windows buildbot.
> Previously, the garbage collector (enabled by default or by explicitly
> passing /opt:ref) did not kill dllimported symbols. As a result,
> dllimported symbols could be added to resulting executables' dllimport
> list even if no one was actually using them.
>
> This patch implements dllexported symbol garbage collection. Just like
> COMDAT sections, dllimported symbols now have Live bits to manage their
> liveness, and MarkLive marks reachable dllimported symbols.
>
> Fixes https://bugs.llvm.org/show_bug.cgi?id=32950
>
> Reviewers: pcc
>
> Subscribers: llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D33264
llvm-svn: 303270
Zachary Turner [Wed, 17 May 2017 15:49:45 +0000 (15:49 +0000)]
[BitVector] Add find_[first,last]_[set,unset]_in.
A lot of code is duplicated between the first_last and the
next / prev methods. All of this code can be shared if they
are implemented in terms of find_first_in(Begin, End) etc,
in which case find_first = find_first_in(0, Size) and find_next
is find_first_in(Prev+1, Size), with similar reductions for
the other methods.
Differential Revision: https://reviews.llvm.org/D33104
llvm-svn: 303269
Marshall Clow [Wed, 17 May 2017 15:30:01 +0000 (15:30 +0000)]
Mark the copy constructor and move
constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor.
llvm-svn: 303268
Hans Wennborg [Wed, 17 May 2017 15:27:44 +0000 (15:27 +0000)]
clang-cl: Fix path-based MSVC version detection
The code wasn't taking the architecture-specific subdirectory into
account.
Differential Revision: https://reviews.llvm.org/D33258
llvm-svn: 303267
Francis Ricci [Wed, 17 May 2017 15:25:41 +0000 (15:25 +0000)]
Revert "Implement tls scanning for darwin LSan"
This reverts r303262, due to TSan buildbot breakages.
llvm-svn: 303266
Krasimir Georgiev [Wed, 17 May 2017 14:51:44 +0000 (14:51 +0000)]
[Frontend] Remove unused TemporaryFiles
Summary:
OnDiskData.TemporaryFiles is filled only by ASTUnit::addTemporaryFile, which is
dead. Also these files are used nowhere in the frontend nor in libclang.
Reviewers: bkramer, ilya-biryukov
Reviewed By: bkramer, ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D33270
llvm-svn: 303265
Alexander Kornienko [Wed, 17 May 2017 14:39:47 +0000 (14:39 +0000)]
Change getChecksFilter() interface to hide implementation details.
llvm-svn: 303264
Alexander Kornienko [Wed, 17 May 2017 14:39:39 +0000 (14:39 +0000)]
[clang-tidy] Replace matchesName with hasName where no regex is needed
llvm-svn: 303263
Francis Ricci [Wed, 17 May 2017 14:35:17 +0000 (14:35 +0000)]
Implement tls scanning for darwin LSan
Summary:
This required for any users who call exit() after creating
thread-specific data, as tls destructors are only called when
pthread_exit() or pthread_cancel() are used. This should also
match tls behavior on linux.
Getting the base address of the tls section is straightforward,
as it's stored as a section offset in %gs. The size is a bit trickier
to work out, as there doesn't appear to be any official documentation
or source code referring to it. The size used in this patch was determined
by taking the difference between the base address and the address of the
subsequent memory region returned by vm_region_recurse_64, which was
1024 * sizeof(uptr) on all threads except the main thread, where it was
larger. Since the section must be the same size on all of the threads,
1024 * sizeof(uptr) seemed to be a reasonable size to use, barring
a more programtic way to get the size.
1024 seems like a reasonable number, given that PTHREAD_KEYS_MAX
is 512 on darwin, so pthread keys will fit inside the region while
leaving space for other tls data. A larger size would overflow the
memory region returned by vm_region_recurse_64, and a smaller size
wouldn't leave room for all the pthread keys. In addition, the
stress test added here passes, which means that we are scanning at
least the full set of possible pthread keys, and probably
the full tls section.
Reviewers: alekseyshl, kubamracek
Subscribers: krytarowski, llvm-commits
Differential Revision: https://reviews.llvm.org/D33215
llvm-svn: 303262
Sanjay Patel [Wed, 17 May 2017 14:21:19 +0000 (14:21 +0000)]
[InstCombine] add isCanonicalPredicate() helper function and use it; NFCI
There should be a slight efficiency improvement from handling icmp/fcmp with one matcher and reducing duplicated code.
The larger motivation is that there are questions about how predicate canonicalization is handled, and the refactoring
should make it easier if we want to change any of that behavior.
1. As noted in the code comment, we've chosen 3 of the 16 FCMP preds as not canonical. Why those 3? It goes back to
rL32751 from what I can tell, but I'm not sure if there's a justification for that rule.
2. We currently do not canonicalize integer select conditions. Should we use the same rule that applies to branches
for selects?
3. We currently do canonicalize some FP select conditions, and those rules would conflict with the rule shown here.
Should one or both be changed?
No-functional-change-intended, but adding tests anyway because there's no coverage for most of the predicates.
Differential Revision: https://reviews.llvm.org/D33247
llvm-svn: 303261
Haojian Wu [Wed, 17 May 2017 14:13:59 +0000 (14:13 +0000)]
Recommit "[include-fixer] Don't throw exception when parsing unknown ar… …guments in vim script."
Summary: To make it work in neovim.
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D33273
llvm-svn: 303260
Daniel Sanders [Wed, 17 May 2017 13:39:49 +0000 (13:39 +0000)]
[globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Summary:
As of this patch, 1018 out of 3938 rules are currently imported.
Depends on D32275
Reviewers: qcolombet, kristof.beyls, rovka, t.p.northover, ab, aditya_nandakumar
Reviewed By: qcolombet
Subscribers: dberris, igorb, llvm-commits
Differential Revision: https://reviews.llvm.org/D32278
llvm-svn: 303259
Sanjay Patel [Wed, 17 May 2017 13:39:16 +0000 (13:39 +0000)]
[x86] Update tests in psubus.ll; NFC
Remove unnecessary memops to minimize tests.
Patch by Yulia Koval!
Differential Revision: https://reviews.llvm.org/D32643
llvm-svn: 303258
Krzysztof Parzyszek [Wed, 17 May 2017 13:25:09 +0000 (13:25 +0000)]
[PPC] Properly update register save area offsets
The variables MinGPR/MinG8R were not updated properly when resetting the
offsets, which in the included testcase lead to saving the CR register
in the same location as R30.
This fixes another issue reported in PR26519.
Differential Revision: https://reviews.llvm.org/D33017
llvm-svn: 303257
Alexander Kornienko [Wed, 17 May 2017 12:57:06 +0000 (12:57 +0000)]
[clang-tidy] A bit of refactoring of modernize-replace-auto-ptr. NFC
llvm-svn: 303256
Igor Breger [Wed, 17 May 2017 12:48:08 +0000 (12:48 +0000)]
[GlobalISel][X86] Support add i64 in IA32.
Summary: support G_UADDE instruction selection.
Reviewers: zvi, guyblank
Reviewed By: guyblank
Subscribers: rovka, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D33096
llvm-svn: 303255
Jonas Paulsson [Wed, 17 May 2017 12:46:26 +0000 (12:46 +0000)]
[SystemZ] Modelling of costs of divisions with a constant power of 2.
Such divisions will eventually be implemented with shifts which should
be reflected in the cost function.
Review: Ulrich Weigand
llvm-svn: 303254
Daniel Sanders [Wed, 17 May 2017 12:43:30 +0000 (12:43 +0000)]
[globalisel][tablegen] Require that all registers between instructions of a match are virtual.
Summary:
Without this, it's possible to encounter multiple defs for a register.
This is triggered by the current version of D32868 when applied to trunk.
Reviewers: qcolombet, ab, t.p.northover, rovka, kristof.beyls
Reviewed By: qcolombet
Subscribers: llvm-commits, igorb
Differential Revision: https://reviews.llvm.org/D32869
llvm-svn: 303253
Diana Picus [Wed, 17 May 2017 12:42:52 +0000 (12:42 +0000)]
Reland r303247: [ARM] GlobalISel: Remove dead instruction selection code
It only failed on llvm-clang-x86_64-expensive-checks-win, probably
because the TableGen stuff hasn't been regenerated.
Requires a clean build.
llvm-svn: 303252
George Rimar [Wed, 17 May 2017 12:10:51 +0000 (12:10 +0000)]
[DWARF] - Cleanup relocations proccessing.
RelocAddrMap was a pair of <width, address>, where width is relocation size (4/8/x, x < 8),
and width field was never used in code.
Relocations proccessing loop had checks for width field. Does not look like DWARF parser
should do that. There is probably no much sense to validate relocations during proccessing
them in parser.
Patch removes relocation's width relative code from DWARFContext.
Differential revision: https://reviews.llvm.org/D33194
llvm-svn: 303251
Vassil Vassilev [Wed, 17 May 2017 12:09:11 +0000 (12:09 +0000)]
Constify.
llvm-svn: 303250
Diana Picus [Wed, 17 May 2017 11:56:07 +0000 (11:56 +0000)]
Revert "[ARM] GlobalISel: Remove dead instruction selection code"
This reverts commit r303247 because the tests are failing on some bots.
Sorry!
llvm-svn: 303249
Pavel Labath [Wed, 17 May 2017 11:47:44 +0000 (11:47 +0000)]
Make TestConflictingSymbol run on non-darwin targets
For remote targets we need to call registerSharedLibrariesWithTarget to
make sure they are installed alongside main executable. This also
required a small fixup in the the mentioned function as in this case
"One" was both a directory name and a library name template. I fixed it
to make sure it checks that the string refers to a file before it
assumed it was a full library path.
llvm-svn: 303248
Diana Picus [Wed, 17 May 2017 11:39:26 +0000 (11:39 +0000)]
[ARM] GlobalISel: Remove dead instruction selection code
We can now generate code for selecting G_ADD, G_SUB and G_MUL. Remove
the hand-written versions.
llvm-svn: 303247
Alex Lorenz [Wed, 17 May 2017 11:08:36 +0000 (11:08 +0000)]
[Lexer] Ensure that the token is not an annotation token when
retrieving the identifer info for an Objective-C keyword
This commit fixes an assertion that's triggered in getIdentifier when the token
is an annotation token.
rdar://
32225463
llvm-svn: 303246
Daniel Cederman [Wed, 17 May 2017 11:05:20 +0000 (11:05 +0000)]
[Sparc] Remove execute permissions from non-executable text files
Reviewers: jyknight, lero_chris, venkatra
Reviewed By: jyknight
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27127
llvm-svn: 303245
Diana Picus [Wed, 17 May 2017 09:25:08 +0000 (09:25 +0000)]
Fixup r303240: Use llvm::to_string instead of std::to_string
It turns out some of the buildbots don't have std::to_string around,
even in this day and age...
llvm-svn: 303243
Benjamin Kramer [Wed, 17 May 2017 09:24:28 +0000 (09:24 +0000)]
Revert "[include-fixer] Don't throw exception when parsing unknown arguments in vim script."
This reverts commit r302934. It's wrong, edits the wrong file and was
committed without review.
llvm-svn: 303242
George Rimar [Wed, 17 May 2017 09:00:10 +0000 (09:00 +0000)]
[DebugInfo/DWARF] - Make comments to be in doxygen style. NFCi.
This changes "//" to "///" in llvm/DebugInfo/DWARF folder where appropriate
and also removes few trailing whitespaces.
llvm-svn: 303241
Diana Picus [Wed, 17 May 2017 08:57:28 +0000 (08:57 +0000)]
[GlobalISel][TableGen] Fix handling of default operands
When looping through a destination pattern's operands to decide how many
default operands we need to introduce, we used to count the "expanded"
number of operands. So if one default operand would be rendered as 2
values, we'd count it as 2 operands, when in fact it needs to count as
only 1 operand regardless of how many values it expands to.
This turns out to be a problem only in some very specific cases, e.g.
when we have one operand with multiple default values followed by more
operands with default values (see the new test). In such a situation
we'd stop looping before looking at all the operands, and then error out
assuming that we don't have enough default operands to make up the
shortfall.
At the moment this only affects ARM.
The patch removes the loop counting default operands entirely and
assumes that we'll have to introduce values for any default operand that
we find (i.e. we're assuming it cannot be given as a child at all). It
also extracts the code for adding renderers for default operands into a
helper method.
Differential Revision: https://reviews.llvm.org/D33031
llvm-svn: 303240
Pavel Labath [Wed, 17 May 2017 08:47:28 +0000 (08:47 +0000)]
[RuntimeDyld] Fix debug section relocation (pr20457)
Summary:
Debug info sections, (or non-SHF_ALLOC sections in general) should be
linked as if their load address was zero to emulate the behavior of the
static linker.
This bug was discovered because it was breaking lldb expression evaluation on
linux.
Reviewers: lhames
Subscribers: aprantl, eugene, clayborg, lldb-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D32899
llvm-svn: 303239
Jonas Paulsson [Wed, 17 May 2017 07:36:03 +0000 (07:36 +0000)]
Make sure -optimize-regalloc=false is used correctly by user.
Don't allow -optimize-regalloc=false with -regalloc given for anything other
than 'fast'. The other register allocators depend on the supporting passes
added by addOptimizedRegAlloc().
Reviewers: Quentin Colombet, Matthias Braun
https://reviews.llvm.org/D33181
llvm-svn: 303238
George Rimar [Wed, 17 May 2017 07:10:59 +0000 (07:10 +0000)]
[ELF] - Detemplate Thunk creation.
Nothing special here, just detemplates code that became possible
to detemplate after recent commits in a straghtforward way.
Differential revision: https://reviews.llvm.org/D33234
llvm-svn: 303237
Craig Topper [Wed, 17 May 2017 06:45:30 +0000 (06:45 +0000)]
[APInt] Use getWord to shorten some code. NFC
llvm-svn: 303236
Max Kazantsev [Wed, 17 May 2017 04:09:14 +0000 (04:09 +0000)]
[SCEV] Always sort AddRecExprs from different loops by dominance
Sorting of AddRecExprs by loop nesting does not make sense since we only invoke
the CompareSCEVComplexity for AddRecExprs that are used by one SCEV. This
guarantees that there is always a dominance relationship between them. This
patch removes the sorting by nesting which is a dead code in current usage of
this function.
Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D33228
llvm-svn: 303235
Max Kazantsev [Wed, 17 May 2017 03:58:42 +0000 (03:58 +0000)]
[SCEV][NFC] Replace redundant dyn_cast with cast in getAddExpr
Replace dyn_cast which is ensured by isa just one line above with cast.
Differential Revision: https://reviews.llvm.org/D33231
llvm-svn: 303234
Richard Trieu [Wed, 17 May 2017 03:23:35 +0000 (03:23 +0000)]
[ODRHash] Support NestedNameSpecifier
llvm-svn: 303233
Gor Nishanov [Wed, 17 May 2017 03:09:22 +0000 (03:09 +0000)]
[coroutines] Handle spills before catchswitch
If we need to spill the result of the PHI instruction, we insert the spill after
all of the PHIs and EHPads, however, in a catchswitch block there is no
room to insert the spill. Make room by splitting away catchswitch into a separate
block.
Before the fix:
catch.dispatch:
%val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
%switch = catchswitch within none [label %catch] unwind label %cleanuppad
After:
catch.dispatch:
%val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
%tok = cleanuppad within none []
; spill goes here
cleanupret from %tok unwind label %catch.dispatch.switch
catch.dispatch.switch:
%switch = catchswitch within none [label %catch] unwind label %cleanuppad
https://reviews.llvm.org/D31846
llvm-svn: 303232
Richard Trieu [Wed, 17 May 2017 02:29:02 +0000 (02:29 +0000)]
[ODRHash] Support more types in the ODR checker.
Added support for TagType, TypeWithKeyword, and all children types.
llvm-svn: 303231
Alexander Kornienko [Wed, 17 May 2017 02:25:11 +0000 (02:25 +0000)]
[clang-tidy] Optimize misc-unused-parameters. NFCI
Don't traverse AST each time we need to find references to a certain function.
Traverse the AST once using RAV and cache the index of function references.
The speed up on a particular large file was about 1000x.
llvm-svn: 303230
Galina Kistanova [Wed, 17 May 2017 02:20:05 +0000 (02:20 +0000)]
Added LLVM_DUMP_METHOD attributes for MatchableInfo::dump(). Defined it only if dump is enabled.
llvm-svn: 303229
Ekaterina Romanova [Wed, 17 May 2017 01:46:11 +0000 (01:46 +0000)]
(1) Fixed mismatch in intrinsics names in declarations and in doxygen comments.
(2) Removed uncessary anymore \c commands, since the same effect will be achived by <c> ... </c> sequence.
I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.
llvm-svn: 303228
Francis Visoiu Mistrih [Wed, 17 May 2017 01:07:53 +0000 (01:07 +0000)]
BitVector: add iterators for set bits
Differential revision: https://reviews.llvm.org/D32060
llvm-svn: 303227
Rui Ueyama [Wed, 17 May 2017 01:05:56 +0000 (01:05 +0000)]
Fix Windows buildbots.
llvm-svn: 303226
Rui Ueyama [Wed, 17 May 2017 00:35:50 +0000 (00:35 +0000)]
Garbage collect dllimported symbols.
Summary:
Previously, the garbage collector (enabled by default or by explicitly
passing /opt:ref) did not kill dllimported symbols. As a result,
dllimported symbols could be added to resulting executables' dllimport
list even if no one was actually using them.
This patch implements dllexported symbol garbage collection. Just like
COMDAT sections, dllimported symbols now have Live bits to manage their
liveness, and MarkLive marks reachable dllimported symbols.
Fixes https://bugs.llvm.org/show_bug.cgi?id=32950
Reviewers: pcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33264
llvm-svn: 303225
Richard Smith [Wed, 17 May 2017 00:24:14 +0000 (00:24 +0000)]
[modules] When creating a declaration, cache its owning module immediately
rather than waiting until it's queried.
Currently this is only applied to local submodule visibility mode, as we don't
yet allocate storage for the owning module in non-local-visibility modules
compilations.
This reinstates r302965, reverted in r303037, with a fix for the reported
crash, which occurred when reparenting a local declaration to be a child of
a hidden imported declaration (specifically during template instantiation).
llvm-svn: 303224
Sean Callanan [Tue, 16 May 2017 23:46:13 +0000 (23:46 +0000)]
[Expression parser] Look up module symbols before hunting globally
When it resolves symbol-only variables, the expression parser
currently looks only in the global module list. It should prefer
the current module.
I've fixed that behavior by making it search the current module
first, and only search globally if it finds nothing. I've also
added a test case.
After review, I moved the core of the lookup algorithm into
SymbolContext for use by other code that needs it.
Thanks to Greg Clayton and Pavel Labath for their help.
Differential Revision: https://reviews.llvm.org/D33083
llvm-svn: 303223
Adrian Prantl [Tue, 16 May 2017 23:46:10 +0000 (23:46 +0000)]
Fix scope of namespaced DISubprograms when the function definition is out-of-line.
This fixes a regression introduced in r302915.
Using the lexical decl context is not necessary here for what r302915
wast trying to achieve. Not canonicalizing the NamespaceDecl in
getOrCreateNamespace is suficient.
rdar://problem/
29339538
llvm-svn: 303222
Eugene Zelenko [Tue, 16 May 2017 23:10:25 +0000 (23:10 +0000)]
[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
llvm-svn: 303221
Zachary Turner [Tue, 16 May 2017 22:59:34 +0000 (22:59 +0000)]
Fix for compilers with older CRT header libraries.
llvm-svn: 303220
Zachary Turner [Tue, 16 May 2017 22:50:32 +0000 (22:50 +0000)]
[Support] Ignore OutputDebugString exceptions in our crash recovery.
Since we use AddVectoredExceptionHandler, we get notified of
every exception that gets raised by a program. Sometimes these
are not necessarily errors though, and this can be especially
true when linking against a library that we have no control
over, and may raise an exception internally which it intends
to catch.
In particular, the Windows API OutputDebugString does exactly
this. It raises an exception inside of a __try / __except,
giving the debugger a chance to handle the exception to print
the message to the debug console.
But this doesn't interoperate nicely with our vectored exception
handler, which just sees another exception and decides that we
need to terminate the program.
Add a special case for this so that we ignore ODS exceptions
and continue normally.
Note that a better fix is to simply not use vectored exception
handlers and use SEH instead, but given that MinGW doesn't support
SEH, this is the only solution for MinGW.
Differential Revision: https://reviews.llvm.org/D33260
llvm-svn: 303219
Davide Italiano [Tue, 16 May 2017 22:38:40 +0000 (22:38 +0000)]
[IR] Prefer use_empty() to !hasNUsesOrMore(1) for clarity.
llvm-svn: 303218
Davide Italiano [Tue, 16 May 2017 22:27:06 +0000 (22:27 +0000)]
[NewGVN] Re-enable test now that the nondeterminism has been fixed.
llvm-svn: 303217
NAKAMURA Takumi [Tue, 16 May 2017 22:19:56 +0000 (22:19 +0000)]
llvm/test/Transforms/InstCombine/debuginfo-skip.ll REQUIRES +asserts.
llvm-svn: 303216
Adrian McCarthy [Tue, 16 May 2017 22:11:25 +0000 (22:11 +0000)]
Add test for FixedStreamArrayIterator::operator->
The operator-> implementation comes from iterator_facade_base, so it should
just work given that the iterator has a tested operator*. But r302257 showed
that required careful handling of for the const qualifier. This patch ensures
the fix in r302257 doesn't regress.
Differential Revision: https://reviews.llvm.org/D33249
llvm-svn: 303215
Paul Robinson [Tue, 16 May 2017 21:53:30 +0000 (21:53 +0000)]
Update doxygen description of a method. NFC
llvm-svn: 303214
Sanjay Patel [Tue, 16 May 2017 21:51:04 +0000 (21:51 +0000)]
[InstSimplify] add folds for constant mask of value shifted by constant
We would eventually catch these via demanded bits and computing known bits in InstCombine,
but I think it's better to handle the simple cases as soon as possible as a matter of efficiency.
This fold allows further simplifications based on distributed ops transforms. eg:
%a = lshr i8 %x, 7
%b = or i8 %a, 2
%c = and i8 %b, 1
InstSimplify can directly fold this now:
%a = lshr i8 %x, 7
Differential Revision: https://reviews.llvm.org/D33221
llvm-svn: 303213
Evgeny Stupachenko [Tue, 16 May 2017 21:44:59 +0000 (21:44 +0000)]
The patch exclude a case from zero check skip in
CTLZ idiom recognition (r303102).
Summary:
The following case:
i = 1;
if(n)
while (n >>= 1)
i++;
use(i);
Was converted to:
i = 1;
if(n)
i += builtin_ctlz(n >> 1, false);
use(i);
Which is not correct. The patch make it:
i = 1;
if(n)
i += builtin_ctlz(n >> 1, true);
use(i);
From: Evgeny Stupachenko <evstupac@gmail.com>
llvm-svn: 303212
Amara Emerson [Tue, 16 May 2017 21:29:22 +0000 (21:29 +0000)]
Re-commit r302678, fixing PR33053.
The issue was that the AArch64 TTI hook allowed unpacked integer cmp reductions
which didn't have a lowering.
llvm-svn: 303211
Easwaran Raman [Tue, 16 May 2017 21:18:09 +0000 (21:18 +0000)]
[Inliner] Do not mix callsite and callee hotness based updates.
Update threshold based on callee's hotness only when BFI is not available.
Otherwise use only callsite's hotness. This makes it easier to reason about
hotness related threshold updates.
Differential revision: https://reviews.llvm.org/D33157
llvm-svn: 303210
Tim Shen [Tue, 16 May 2017 20:58:55 +0000 (20:58 +0000)]
[PPC] Add -ppc-asm-full-reg-names to atomic-2.ll. NFC.
Differential Revisions: https://reviews.llvm.org/D32763
llvm-svn: 303209
Matthias Braun [Tue, 16 May 2017 20:53:27 +0000 (20:53 +0000)]
Test for r303197
llvm-svn: 303208
Saleem Abdulrasool [Tue, 16 May 2017 20:25:07 +0000 (20:25 +0000)]
builtins: fix guard __AEABI__ -> __ARM_EABI__
llvm-svn: 303207
Manoj Gupta [Tue, 16 May 2017 20:18:57 +0000 (20:18 +0000)]
[libunwind] Fix executable stack directive on Linux.
Summary:
Disable executable stack on Linux. Also remove redundant Android check
as it is covered by Android.
Reviewers: phosek, compnerd, rs, rmaprath, EricWF, krytarowski
Reviewed By: krytarowski
Subscribers: srhines, llvm-commits, krytarowski
Differential Revision: https://reviews.llvm.org/D33217
llvm-svn: 303206
Tim Shen [Tue, 16 May 2017 20:18:06 +0000 (20:18 +0000)]
[PPC] Lower load acquire/seq_cst trailing fence to cmp + bne + isync.
Summary:
This fixes pr32392.
The lowering pipeline is:
llvm.ppc.cfence in IR -> PPC::CFENCE8 in isel -> Actual instructions in
expandPostRAPseudo.
The reason why expandPostRAPseudo is chosen is because previous passes
are likely eliminating instructions like cmpw 3, 3 (early CSE) and bne-
7, .+4 (some branch pass(s)).
Differential Revision: https://reviews.llvm.org/D32763
llvm-svn: 303205
Easwaran Raman [Tue, 16 May 2017 20:14:39 +0000 (20:14 +0000)]
Add hasProfileSummary and has{Sample|Instrumentation}Profile methods
ProfileSummaryInfo already checks whether the module has sample profile
in determining profile counts. This will also be useful in inliner to
clean up threshold updates.
llvm-svn: 303204
Sanjay Patel [Tue, 16 May 2017 20:09:32 +0000 (20:09 +0000)]
[InstCombine] auto-generate better checks; NFC
llvm-svn: 303203
Dmitry Mikulin [Tue, 16 May 2017 20:08:49 +0000 (20:08 +0000)]
In debug builds non-trivial amount of time is spent in InstCombine processing
@llvm.dbg.* calls in visitCallInst(). They can be safely ignored.
llvm-svn: 303202
Daniel Berlin [Tue, 16 May 2017 20:02:45 +0000 (20:02 +0000)]
NewGVN: Only do something in verifyStoreExpressions if assertions are enabled, to avoid unused code warnings.
llvm-svn: 303201