Jan Vesely [Wed, 16 Aug 2017 17:09:00 +0000 (17:09 +0000)]
amdgcn: rewrite barrier() using fence and clang __builtin_amdgcn_s_barrier
Specs require using fences when barrier() is invoked:
"The barrier function will either flush any variables stored in local memory
or queue a memory fence to ensure correct ordering of memory operations to local memory."
and
"The barrier function will queue a memory fence to ensure correct ordering
of memory operations to global memory."
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 311022
Jan Vesely [Wed, 16 Aug 2017 17:08:56 +0000 (17:08 +0000)]
amdgcn: Implement {read_,write_,}mem_fence builtin
v2: add more detailed comment about waitcnt instruction
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 311021
Chih-Hung Hsieh [Wed, 16 Aug 2017 16:59:26 +0000 (16:59 +0000)]
[clang-tidy] Use CloexecCheck as base class.
Summary:
Simplify registerMatchers and check functions in CloexecCreatCheck,
CloexecSocketCheck, CloexecFopenCheck, and CloexecOpenCheck.
Differential Revision: https://reviews.llvm.org/D36761
llvm-svn: 311020
Evgeny Mankov [Wed, 16 Aug 2017 16:47:29 +0000 (16:47 +0000)]
[AMDGPU] NFC: test commit
llvm-svn: 311019
Kostya Kortchinsky [Wed, 16 Aug 2017 16:40:48 +0000 (16:40 +0000)]
[scudo] Application & platform compatibility changes
Summary:
This patch changes a few (small) things around for compatibility purposes for
the current Android & Fuchsia work:
- `realloc`'ing some memory that was not allocated with `malloc`, `calloc` or
`realloc`, while UB according to http://pubs.opengroup.org/onlinepubs/
009695399/functions/realloc.html
is more common that one would think. We now only check this if
`DeallocationTypeMismatch` is set; change the "mismatch" error
messages to be more homogeneous;
- some sketchily written but widely used libraries expect a call to `realloc`
to copy the usable size of the old chunk to the new one instead of the
requested size. We have to begrundingly abide by this de-facto standard.
This doesn't seem to impact security either way, unless someone comes up with
something we didn't think about;
- the CRC32 intrinsics for 64-bit take a 64-bit first argument. This is
misleading as the upper 32 bits end up being ignored. This was also raising
`-Wconversion` errors. Change things to take a `u32` as first argument.
This also means we were (and are) only using 32 bits of the Cookie - not a
big thing, but worth mentioning.
- Includes-wise: prefer `stddef.h` to `cstddef`, move `scudo_flags.h` where it
is actually needed.
- Add tests for the memalign-realloc case, and the realloc-usable-size one.
(Edited typos)
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36754
llvm-svn: 311018
Konstantin Zhuravlyov [Wed, 16 Aug 2017 16:23:32 +0000 (16:23 +0000)]
AMDGPU/NFC: Sort files in CMakeLists.txt alphabetically
llvm-svn: 311017
Simon Pilgrim [Wed, 16 Aug 2017 16:22:19 +0000 (16:22 +0000)]
[X86] Regenerate immediate store merging tests
llvm-svn: 311016
Jakub Kuderski [Wed, 16 Aug 2017 16:12:52 +0000 (16:12 +0000)]
[Dominators] Introduce batch updates
Summary:
This patch introduces a way of informing the (Post)DominatorTree about multiple CFG updates that happened since the last tree update. This makes performing tree updates much easier, as it internally takes care of applying the updates in lockstep with the (virtual) updates to the CFG, which is done by reverse-applying future CFG updates.
The batch updater is able to remove redundant updates that cancel each other out. In the future, it should be also possible to reorder updates to reduce the amount of work needed to perform the updates.
Reviewers: dberlin, sanjoy, grosser, davide, brzycki
Reviewed By: brzycki
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D36167
llvm-svn: 311015
Hal Finkel [Wed, 16 Aug 2017 16:09:22 +0000 (16:09 +0000)]
[BDCE] Don't check demanded bits on unsized types
To clear assumptions that are potentially invalid after trivialization, we need
to walk the use/def chain. Normally, the only way to reach an instruction with
an unsized type is via an instruction that has side effects (or otherwise will
demand its input bits). That would stop the walk. However, if we have a
readnone function that returns an unsized type (e.g., void), we must avoid
asking for the demanded bits of the function call's return value. A
void-returning readnone function is always dead (and so we can stop walking the
use/def chain here), but the check is necessary to avoid asserting.
Fixes PR34211.
llvm-svn: 311014
Alexey Bataev [Wed, 16 Aug 2017 15:58:46 +0000 (15:58 +0000)]
[OPENMP] Fix for PR28581: OpenMP linear clause - wrong results.
If worksharing construct has at least one linear item, an implicit
synchronization point must be emitted to avoid possible conflict with
the loading/storing values to the original variables. Added implicit
barrier if the linear item is found before actual start of the
worksharing construct.
llvm-svn: 311013
Davide Italiano [Wed, 16 Aug 2017 15:16:33 +0000 (15:16 +0000)]
[Verifier] Reject globals without a type associated.
llvm-svn: 311012
Dmitry Preobrazhensky [Wed, 16 Aug 2017 15:16:32 +0000 (15:16 +0000)]
[AMDGPU][MC][GFX9] Added op_sel support for v_mad_*16, v_fma_f16, v_div_fixup_f16
This change implements features postponed in https://reviews.llvm.org/D35424 because of a dependency on https://reviews.llvm.org/D36322
Reviewers: SamWot, artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D36694
llvm-svn: 311011
Sanjay Patel [Wed, 16 Aug 2017 14:28:23 +0000 (14:28 +0000)]
[DemandedBits] simplify call; NFC
llvm-svn: 311009
Balaram Makam [Wed, 16 Aug 2017 14:17:43 +0000 (14:17 +0000)]
Revert "MachineInstr: Reason locally about some memory objects before going to AA."
r310825 caused the clang-ppc64le-linux-lnt bot to go red
(http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/5712)
because of a test-suite failure of
SingleSource/UnitTests/2003-07-09-SignedArgs
This reverts commit
0028f6a87224fb595a1c19c544cde9b003035996.
llvm-svn: 311008
Alexey Bataev [Wed, 16 Aug 2017 14:01:00 +0000 (14:01 +0000)]
[OPRNMP] Fix for PR33445: ICE: OpenMP target containing ordered for.
If exceptions are enabled, there may be a problem with the codegen of
the finalization functions from OpenMP runtime. It happens because of
the problem with the getting of thread identifier value. Patch tries to
fix it by using the result of the call of function
__kmpc_global_thread_num() rather than loading of value of outlined
function parameter.
llvm-svn: 311007
Dmitry Preobrazhensky [Wed, 16 Aug 2017 13:51:56 +0000 (13:51 +0000)]
[AMDGPU][MC][GFX9] Added integer clamping support for VOP3 opcodes
See Bug 34152: https://bugs.llvm.org//show_bug.cgi?id=34152
Reviewers: SamWot, artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D36674
llvm-svn: 311006
Simon Pilgrim [Wed, 16 Aug 2017 13:50:20 +0000 (13:50 +0000)]
[CostModel][X86][XOP] Improve costs for XOP shuffles
VPPERM/VPERMIL2PD/VPERMIL2PS all provide more effective 2-input shuffles than regular AVX instructions
llvm-svn: 311005
Davide Italiano [Wed, 16 Aug 2017 13:39:07 +0000 (13:39 +0000)]
[DI] Every DIGlobalVariable should have a type.
I'll make this a verifier check to catch other violations. This
commit fixes the tests already in tree.
llvm-svn: 311004
Ed Maste [Wed, 16 Aug 2017 13:10:07 +0000 (13:10 +0000)]
convert hard tabs to spaces in PlatformOpenBSD.cpp
Another case of this was responsible for the whitespace conflict
in D34776.
llvm-svn: 311003
Ed Maste [Wed, 16 Aug 2017 12:55:02 +0000 (12:55 +0000)]
Make i386-*-freebsd expression work on JIT path
* Enable i386 ABI creation for freebsd
* Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap
syscall
* Unlike linux, the last argument of mmap is actually 64-bit(off_t).
This requires us to push an additional word for the higher order bits.
* Prior to this change, ktrace dump will show mmap failures due to
invalid argument coming from the 6th mmap argument.
Patch by Karnajit Wangkhem
Differential Revision: https://reviews.llvm.org/D34776
llvm-svn: 311002
Simon Dardis [Wed, 16 Aug 2017 12:18:04 +0000 (12:18 +0000)]
[mips] Handle variables with an explicit section and interactions with .sdata, .sbss
If a variable has an explicit section such as .sdata or .sbss, it is placed
in that section and accessed in a gp relative manner. This overrides the global
-G setting.
Otherwise if a variable has a explicit section attached to it, such as '.rodata'
or '.mysection', it is not placed in the small data section. This also overrides
the global -G setting.
Reviewers: atanasyan, nitesh.jain
Differential Revision: https://reviews.llvm.org/D36616
llvm-svn: 311001
Tamas Berghammer [Wed, 16 Aug 2017 11:45:10 +0000 (11:45 +0000)]
Remove the DWARFExpression -> Clang ExpressionParser dependency
It was completly unused and broke the part of the encapsulation that
common code shouldn't depend on specific plugins or language specific
features.
llvm-svn: 311000
Michael Kruse [Wed, 16 Aug 2017 09:28:02 +0000 (09:28 +0000)]
[ScopInfo] Clarify comment. NFC.
Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D36760
llvm-svn: 310999
Davide Italiano [Wed, 16 Aug 2017 08:21:04 +0000 (08:21 +0000)]
[ELF/LTO] -function-sections/-data-sections are exact options.
Also add a test. This fixes r310995 and PR34200.
llvm-svn: 310998
Sam Parker [Wed, 16 Aug 2017 07:42:44 +0000 (07:42 +0000)]
[ARM] Improve loop unrolling for Cortex-M
- Set the default runtime unroll count to 4 and use the newly added
UnrollRemainder option.
- Create loop cost and force unroll for a cost less than 12.
- Disable unrolling on Thumb1 only targets.
Differential Revision: https://reviews.llvm.org/D36134
llvm-svn: 310997
Igor Breger [Wed, 16 Aug 2017 07:25:51 +0000 (07:25 +0000)]
[GlobalISel][X86] Fix mir tests, use correct physical register.NFC.
llvm-svn: 310996
George Rimar [Wed, 16 Aug 2017 07:25:09 +0000 (07:25 +0000)]
[ELF] - Ignore -plugin-opt=-function-sections/-plugin-opt=-data-sections. NFC.
Clang passes this options to linker. We should ignore them,
anyways they are always enabled by default atm.
Fixes https://bugs.llvm.org/show_bug.cgi?id=34200.
llvm-svn: 310995
Chandler Carruth [Wed, 16 Aug 2017 07:22:49 +0000 (07:22 +0000)]
Fix a UBSan failure where this boolean was copied when uninitialized.
When r310905 moved the pointer and bool out of a PointerIntPair, it made
them end up uninitialized and caused UBSan failures when copying the
uninitialized boolean. However, making the pointer be null should avoid
the reference to the boolean entirely.
llvm-svn: 310994
Martin Storsjo [Wed, 16 Aug 2017 05:23:00 +0000 (05:23 +0000)]
[COFF] Don't produce weak aliases in import libraries
When creating an import library from lld, the cases with
Name != ExtName shouldn't end up as a weak alias, but as a real
export of the new name, which is what actually is exported from
the DLL.
This restores the behaviour of renamed exports to what it was in
4.0.
Differential Revision: https://reviews.llvm.org/D36634
llvm-svn: 310992
Martin Storsjo [Wed, 16 Aug 2017 05:22:49 +0000 (05:22 +0000)]
[COFF] Make the weak aliases optional
When creating an import library from lld, the cases with
Name != ExtName shouldn't end up as a weak alias, but as a real
export of the new name, which is what actually is exported from
the DLL.
This restores the behaviour of renamed exports to what it was in
4.0.
The other half of this commit, including test, goes into lld.
Differential Revision: https://reviews.llvm.org/D36633
llvm-svn: 310991
Martin Storsjo [Wed, 16 Aug 2017 05:18:36 +0000 (05:18 +0000)]
[llvm-dlltool] Fix creating stdcall/fastcall import libraries for i386
Hook up the -k option (that in the original GNU dlltool removes the
@n suffix from the symbol that the final executable ends up linked to).
In llvm-dlltool, make sure that functions end up with the undecorate
name type if this option is set and they are decorated. In mingw, when
creating import libraries from def files instead of creating an import
library as a side effect of linking a DLL, the symbol names in the def
contain the stdcall/fastcall decoration (but no leading underscore).
By setting the undecorate name type, a linker linking to the import
library will omit the decoration from the DLL import entry.
With this in place, mingw-w64 for i386 built with llvm-dlltool/clang
produces import libraries that actually work.
Differential Revision: https://reviews.llvm.org/D36548
llvm-svn: 310990
Martin Storsjo [Wed, 16 Aug 2017 05:13:25 +0000 (05:13 +0000)]
[COFF] Fix the name type for stdcall functions in import libraries
Since SVN r303491 and r304573, LLD used the COFFImportLibrary
functions from LLVM. These only had two names, Name and ExtName,
which wasn't enough to convey all the details of stdcall functions.
Stdcall functions got the wrong symbol name in the import library
itself in r303491, which is why it was reverted in r304561. When
re-landed and fixed in r304573 (after adding a test in r304572),
the symbol name itself in the import library ended up right, but the
name type of the import library entry was wrong.
This had the effect that linking to the import library succeeded
(contrary to in r303491, where linking to such an import library
failed), but at runtime, the symbol wouldn't be found in the DLL
(since the caller linked to the stdcall decorated name).
Differential Revision: https://reviews.llvm.org/D36545
llvm-svn: 310989
Martin Storsjo [Wed, 16 Aug 2017 05:13:16 +0000 (05:13 +0000)]
[COFF] Add SymbolName as a distinct field in COFFImportFile
The previous Name and ExtName aren't enough to convey all the nuances
between weak aliases and stdcall decorated function names.
A test for this will be added in LLD.
Differential Revision: https://reviews.llvm.org/D36544
llvm-svn: 310988
Stanislav Mekhanoshin [Wed, 16 Aug 2017 04:43:49 +0000 (04:43 +0000)]
[AMDGPU] Eliminate no effect instructions before s_endpgm
Differential Revision: https://reviews.llvm.org/D36585
llvm-svn: 310987
Yaxun Liu [Wed, 16 Aug 2017 04:15:28 +0000 (04:15 +0000)]
Fix comments about __OPENCL_MEMORY_SCOPE_* macros
llvm-svn: 310986
Dehao Chen [Wed, 16 Aug 2017 01:55:26 +0000 (01:55 +0000)]
Merge debug info when hoist then-else code to if.
Summary: When we move then-else code to if, we need to merge its debug info, otherwise the hoisted instruction may have inaccurate debug info attached.
Reviewers: aprantl, probinson, dblaikie, echristo, loladiro
Reviewed By: aprantl
Subscribers: sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D36778
llvm-svn: 310985
Lang Hames [Wed, 16 Aug 2017 01:50:32 +0000 (01:50 +0000)]
Fix typo in variable name.
llvm-svn: 310984
Richard Smith [Wed, 16 Aug 2017 01:49:53 +0000 (01:49 +0000)]
PR19668, PR23034: Fix handling of move constructors and deleted copy
constructors when deciding whether classes should be passed indirectly.
This fixes ABI differences between Clang and GCC:
* Previously, Clang ignored the move constructor when making this
determination. It now takes the move constructor into account, per
https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may
seem recent, but the ABI change was agreed on the Itanium C++ ABI
list a long time ago).
* Previously, Clang's behavior when the copy constructor was deleted
was unstable -- depending on whether the lazy declaration of the
copy constructor had been triggered, you might get different behavior.
We now eagerly declare the copy constructor whenever its deletedness
is unclear, and ignore deleted copy/move constructors when looking for
a trivial such constructor.
This also fixes an ABI difference between Clang and MSVC:
* If the copy constructor would be implicitly deleted (but has not been
lazily declared yet), for instance because the class has an rvalue
reference member, we would pass it directly. We now pass such a class
indirectly, matching MSVC.
Based on a patch by Vassil Vassilev, which was based on a patch by Bernd
Schmidt, which was based on a patch by Reid Kleckner!
This is a re-commit of r310401, which was reverted in r310464 due to ARM
failures (which should now be fixed).
llvm-svn: 310983
Richard Smith [Wed, 16 Aug 2017 01:46:46 +0000 (01:46 +0000)]
Add test that we get the correct calling convention and mangling for va_list.
llvm-svn: 310982
Derek Schuff [Wed, 16 Aug 2017 00:49:44 +0000 (00:49 +0000)]
[WebAssembly] Remove infinite loop from reg-stackify test
r310940 exposed reverse-unreachable code to some optimizers,
which caused some of the code in this test to be sunk, changing
the input to the pass and breaking the exptectations.
Since that change is irrelevant to this particular test, this change
just adds an exit node to work around the problem; the
test should really be more robust (or be an MIR test?) but this preserves
the existing test intent.
llvm-svn: 310981
Jakub Kuderski [Wed, 16 Aug 2017 00:18:39 +0000 (00:18 +0000)]
[Polly] XFAIL ReportLoopHasNoExit tests after r310940
ReportLoopHasNoExit started failing after r310940 that added
infinite loops to postdominators. The change made regions not
contain infinite loops anymore.
This patch unbreaks the polly tree by XFAILING the
ReportLoopHasNoExit test. Full fix is under review in D36776.
llvm-svn: 310980
Quentin Colombet [Wed, 16 Aug 2017 00:17:05 +0000 (00:17 +0000)]
[VirtRegRewriter] Properly model the register liveness on undef subreg definition
Undef subreg definition means that the content of the super register
doesn't matter at this point. While that's true for virtual registers,
this may not hold when replacing them with actual physical registers.
Indeed, some part of the physical register may be coalesced with the
related virtual register and thus, the values for those parts matter and
must be live.
The fix consists in checking whether or not subregs of the physical register
being assigned to an undef subreg definition are live through that def and
insert an implicit use if they are. Doing so, will keep them alive until
that point like they should be.
E.g., let vreg14 being assigned to R0_R1 then
%vreg14:gsub_0<def,read-undef> = COPY %R0 ; <-- R1 is still live here
%vreg14:gsub_1<def> = COPY %R1
Before this changes, the rewriter would change the code into:
%R0<def> = KILL %R0, %R0_R1<imp-def> ; <-- this tells R1 is redefined
%R1<def> = KILL %R1, %R0_R1<imp-def>, %R0_R1<imp-use> ; this value of this R1
; is believed to come
; from the previous
; instruction
Because of this invalid liveness, later pass could make wrong choices and in
particular clobber live register as it happened with the register scavenger in
llvm.org/PR34107
Now we would generate:
%R0<def> = KILL %R0, %R0_R1<imp-def>, %R0_R1<imp-use> ; This tells R1 needs to
; reach this point
%R1<def> = KILL %R1, %R0_R1<imp-def>, %R0_R1<imp-use>
The bug has been here forever, it got exposed recently because the register
scavenger got smarter.
Fixes llvm.org/PR34107
llvm-svn: 310979
Richard Smith [Wed, 16 Aug 2017 00:06:07 +0000 (00:06 +0000)]
Add missing test for warning added in r310803.
llvm-svn: 310978
Dan Albert [Tue, 15 Aug 2017 23:57:34 +0000 (23:57 +0000)]
Revert "Revert "Revert "Fix LLVMgold plugin name/path for non-Linux."""
llvm-svn: 310977
Dan Albert [Tue, 15 Aug 2017 23:57:32 +0000 (23:57 +0000)]
Revert "Add a target for new LTO plugin name tests."
llvm-svn: 310976
Kuba Mracek [Tue, 15 Aug 2017 23:41:34 +0000 (23:41 +0000)]
Revert archive-* tests from r310953, there were test failures.
llvm-svn: 310974
George Karpenkov [Tue, 15 Aug 2017 23:22:52 +0000 (23:22 +0000)]
Quickfix to the refactoring commit: typo in the link flags variable
name.
llvm-svn: 310973
Richard Smith [Tue, 15 Aug 2017 22:58:45 +0000 (22:58 +0000)]
Do not look through pack expansions when looking for unexpanded parameter packs.
Fixes a selection of rejects-valids when pack-expanding a lambda that itself
contains a pack expansion.
llvm-svn: 310972
George Karpenkov [Tue, 15 Aug 2017 22:56:10 +0000 (22:56 +0000)]
[sanitizers CMake] NFC Refactor the logic for compiling and generating tests
into a function.
Most CMake configuration under compiler-rt/lib/*/tests have
almost-the-same-but-not-quite functions of the form add_X_[unit]tests
for compiling and running the tests.
Much of the logic is duplicated with minor variations across different
sub-folders.
This can harm productivity for multiple reasons:
For newcomers, resulting CMake files are very large, hard to understand,
and hide the intention of the code.
Changes for enabling certain architectures end up being unnecessarily
large, as they get duplicated across multiple folders.
Adding new sub-projects requires more effort than it should, as a
developer has to again copy-n-paste the configuration, and it's not even
clear from which sub-project it should be copy-n-pasted.
With this change the logic of compile-and-generate-a-set-of-tests is
extracted into a function, which hopefully makes writing and reading
CMake much easier.
Differential Revision: https://reviews.llvm.org/D36116
llvm-svn: 310971
Craig Topper [Tue, 15 Aug 2017 22:48:41 +0000 (22:48 +0000)]
[InstCombine] Teach canEvaluateZExtd and canEvaluateTruncated to handle vector shifts with splat shift amount
We were only allowing ConstantInt before. This patch allows splat of ConstantInt too.
Differential Revision: https://reviews.llvm.org/D36763
llvm-svn: 310970
Quentin Colombet [Tue, 15 Aug 2017 22:31:51 +0000 (22:31 +0000)]
Reapply "[GlobalISel] Remove the GISelAccessor API."
This reverts commit r310425, thus reapplying r310335 with a fix for link
issue of the AArch64 unittests on Linux bots when BUILD_SHARED_LIBS is ON.
Original commit message:
[GlobalISel] Remove the GISelAccessor API.
Its sole purpose was to avoid spreading around ifdefs related to
building global-isel. Since r309990, GlobalISel is not optional anymore,
thus, we can get rid of this mechanism all together.
NFC.
----
The fix for the link issue consists in adding the GlobalISel library in
the list of dependencies for the AArch64 unittests. This dependency
comes from the use of AArch64Subtarget that needs to know how
to destruct the GISel related APIs when being detroyed.
Thanks to Bill Seurer and Ahmed Bougacha for helping me reproducing and
understand the problem.
llvm-svn: 310969
Jan Vesely [Tue, 15 Aug 2017 22:24:05 +0000 (22:24 +0000)]
configure.py: Drop explicit import of int builtin
I can't reproduce the error that made me add this.
Reported-by: Kim Gräsman <kim.grasman@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Kim Gräsman <kim.grasman@gmail.com>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 310968
Charles Saternos [Tue, 15 Aug 2017 22:23:44 +0000 (22:23 +0000)]
[ThinLTO] Fix ThinLTO crash while destroying context
Fix for PR32763
An assert that checks if a Ref was untracked fails during ThinLTO context cleanup. The issue is because lazy loading temporary nodes didn't properly track ValueAsMetadata nodes. This patch ensures that the temporary nodes are properly tracked when they're replaced with the value.
llvm-svn: 310967
Dan Albert [Tue, 15 Aug 2017 22:10:44 +0000 (22:10 +0000)]
Add a target for new LTO plugin name tests.
Not all targets will use -plugin with -flto. Pick a fixed target so
this works regardless of the default target (regardless of host OS,
the toolchain should be picking the correct LTO plugin for a target
that supports it).
llvm-svn: 310966
Zachary Turner [Tue, 15 Aug 2017 21:46:51 +0000 (21:46 +0000)]
Fix warning about unused variable.
I'm explicitly ignoring the warning by casting to void instead of
deleting the local assignment, because it's confusing to see a
function that fails when its return value evaluates to true.
But when you see that it's a std::error_code, it makes more sense.
llvm-svn: 310965
John McCall [Tue, 15 Aug 2017 21:42:52 +0000 (21:42 +0000)]
Extract IRGen's constant-emitter into its own helper class and clean up
the interface.
The ultimate goal here is to make it easier to do some more interesting
things in constant emission, like emit constant initializers that have
ignorable side-effects, or doing the majority of an initialization
in-place and then patching up the last few things with calls. But for
now this is mostly just a refactoring.
llvm-svn: 310964
John McCall [Tue, 15 Aug 2017 21:42:47 +0000 (21:42 +0000)]
Allow the target field of a CK_ToUnion to be more easily recovered.
llvm-svn: 310963
John McCall [Tue, 15 Aug 2017 21:42:42 +0000 (21:42 +0000)]
Allow StmtVisitor visitation to be parameterized. NFC.
llvm-svn: 310962
Zachary Turner [Tue, 15 Aug 2017 21:31:41 +0000 (21:31 +0000)]
[LLD COFF/PDB] Incrementally update the build id.
Previously, our algorithm to compute a build id involved hashing the
executable and storing that as the GUID in the CV Debug Record chunk,
and setting the age to 1.
This breaks down in one very obvious case: a user adds some newlines to
a file, rebuilds, but changes nothing else. This causes new line
information and new file checksums to get written to the PDB, meaning
that the debug info is different, but the generated code would be the
same, so we would write the same build over again with an age of 1.
Anyone using a symbol cache would have a problem now, because the
debugger would open the executable, look at the age and guid, find a
matching PDB in the symbol cache and then load it. It would never copy
the new PDB to the symbol cache.
This patch implements the canonical Windows algorithm for updating
a build id, which is to check the existing executable first, and
re-use an existing GUID while bumping the age if it already
exists.
Differential Revision: https://reviews.llvm.org/D36758
llvm-svn: 310961
Dan Albert [Tue, 15 Aug 2017 21:31:17 +0000 (21:31 +0000)]
Revert "Revert "Fix LLVMgold plugin name/path for non-Linux.""
Summary:
Relanding https://reviews.llvm.org/D35739 which was reverted because
it broke the tests on non-Linux. The tests have been fixed to be
platform agnostic, and additional tests have been added to make sure
that the plugin has the correct extension on each platform
(%pluginext doesn't work in CHECK lines).
Reviewers: srhines, pirama
Reviewed By: srhines
Subscribers: emaste, mehdi_amini, eraman, cfe-commits
Differential Revision: https://reviews.llvm.org/D36769
llvm-svn: 310960
Jason Molenda [Tue, 15 Aug 2017 21:23:14 +0000 (21:23 +0000)]
Update NSArray/NSDictionary/NSSet formatters to handle new
macOS 10.13 - High Sierra - internal layouts. Patch by
Sean Callanan.
<rdar://problem/
33282015>
llvm-svn: 310959
Stephen Hines [Tue, 15 Aug 2017 21:20:41 +0000 (21:20 +0000)]
Switch to consumeError(), since this can crash otherwise.
Summary:
If assertions are disabled, but LLVM_ABI_BREAKING_CHANGES is enabled,
this will cause an issue with an unchecked Success. Switching to
consumeError() is the correct way to bypass the check.
Reviewers: llvm-commits, cfe-commits, arphaman
Reviewed By: arphaman
Subscribers: arphaman, klimek, pirama
Differential Revision: https://reviews.llvm.org/D36728
llvm-svn: 310958
Kuba Mracek [Tue, 15 Aug 2017 21:02:17 +0000 (21:02 +0000)]
Revert changes in r310953 for llvm-symbolizer.test. The change causes a test failure.
llvm-svn: 310956
Chris Bieneman [Tue, 15 Aug 2017 20:56:04 +0000 (20:56 +0000)]
[CMake] Fixing an error in STREQUAL usage.
llvm-svn: 310955
Tony Tye [Tue, 15 Aug 2017 20:47:41 +0000 (20:47 +0000)]
Update AMDGPUUsage.rst documentation:
1. Correct description of the kernel initial state for FLAT_SCRATCH_INIT.
2. Add link to GFX9 architecture documentation.
3. Update product names.
4. Rename note record from NT_AMD_AMDGPU_METADATA to NT_AMD_AMDGPU_HSA_METADATA and move description to the AMDHSA coding convention section.
5. Minor typo corrections.
Differential Revision: https://reviews.llvm.org/D36549
llvm-svn: 310954
Kuba Mracek [Tue, 15 Aug 2017 20:29:24 +0000 (20:29 +0000)]
[llvm] Get rid of "%T" expansions
The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t.
This patch removes %T in llvm.
Differential Revision: https://reviews.llvm.org/D36495
llvm-svn: 310953
Kuba Mracek [Tue, 15 Aug 2017 19:54:04 +0000 (19:54 +0000)]
Fixup for r310950: Also remove the new instance of %T from html-diags.c
llvm-svn: 310952
Kuba Mracek [Tue, 15 Aug 2017 19:47:06 +0000 (19:47 +0000)]
[clang] Get rid of "%T" expansions
The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t.
This patch removes %T in clang.
Differential Revision: https://reviews.llvm.org/D36437
llvm-svn: 310950
Amjad Aboud [Tue, 15 Aug 2017 19:33:14 +0000 (19:33 +0000)]
[InstCombine] Added support for (X >>s C) << C --> X & (-1 << C)
Differential Revision: https://reviews.llvm.org/D36743
llvm-svn: 310949
Alexander Shaposhnikov [Tue, 15 Aug 2017 19:23:54 +0000 (19:23 +0000)]
[clang] Code cleanup in clang/tooling
1. Add missing explicit for SymbolName constructor.
2. Add missing std::move in createRenameReplacements.
Differential revision: https://reviews.llvm.org/D36715
llvm-svn: 310948
Lang Hames [Tue, 15 Aug 2017 19:20:10 +0000 (19:20 +0000)]
[ORC][Kaleidoscope] Update Chapter 1 of BuildingAJIT to incorporate recent ORC
API changes.
llvm-svn: 310947
Richard Smith [Tue, 15 Aug 2017 19:11:21 +0000 (19:11 +0000)]
PR33082: Improve tracking of unexpanded parameter packs within variadic generic lambdas.
llvm-svn: 310946
George Karpenkov [Tue, 15 Aug 2017 18:38:14 +0000 (18:38 +0000)]
[CMake compiler-rt] NFC: Minor CMake refactoring.
Detect ObjC files in `clang_compile` and pass an appropriate flag to a
compiler, also change `clang_compile` to a function.
Differential Revision: https://reviews.llvm.org/D36727
llvm-svn: 310945
George Karpenkov [Tue, 15 Aug 2017 18:35:02 +0000 (18:35 +0000)]
[compiler-rt CMake] NFC: Minor CMake refactoring.
Change macro to a function, and use a generic variable instead of
branching for handling multi-output build with
CMAKE_CONFIGURATION_TYPES.
Differential Revision: https://reviews.llvm.org/D36725
llvm-svn: 310944
George Karpenkov [Tue, 15 Aug 2017 18:32:28 +0000 (18:32 +0000)]
[compiler-rt CMake] CMake refactoring: create directories in helper func.
Change macro to a function, move creating test directory into
`add_compiler_rt_test`.
Differential Revision: https://reviews.llvm.org/D36724
llvm-svn: 310943
Sanjay Patel [Tue, 15 Aug 2017 18:25:52 +0000 (18:25 +0000)]
[InstCombine] sink sext after ashr
Narrow ops are better for bit-tracking, and in the case of vectors,
may enable better codegen.
As the trunc test shows, this can allow follow-on simplifications.
There's a block of code in visitTrunc that deals with shifted ops
with FIXME comments. It may be possible to remove some of that now,
but I want to make sure there are no problems with this step first.
http://rise4fun.com/Alive/Y3a
Name: hoist_ashr_ahead_of_sext_1
%s = sext i8 %x to i32
%r = ashr i32 %s, 3 ; shift value is < than source bit width
=>
%a = ashr i8 %x, 3
%r = sext i8 %a to i32
Name: hoist_ashr_ahead_of_sext_2
%s = sext i8 %x to i32
%r = ashr i32 %s, 8 ; shift value is >= than source bit width
=>
%a = ashr i8 %x, 7 ; so clamp this shift value
%r = sext i8 %a to i32
Name: junc_the_trunc
%a = sext i16 %v to i32
%s = ashr i32 %a, 18
%t = trunc i32 %s to i16
=>
%t = ashr i16 %v, 15
llvm-svn: 310942
Siddharth Bhat [Tue, 15 Aug 2017 18:21:38 +0000 (18:21 +0000)]
[Polly] [GPUJIT] Set min size to 1 on CUDA allocation calls. [NFC]
Requesting size 0 allocations from `cuMalloc` / `cuMallocManaged` fails.
If there is a size 0 allocation that can be statically proved, the we
fail at PPCGCodeGeneration. This is because if size 0 allocation could
take place, we should not generate code that tries to use this array.
However, there are cases where we cannot statically prove this, and at
runtime we get a request for 0 bytes of memory. We choose to allocate
size 1 to allow the program to continue running.
Differential Revision: https://reviews.llvm.org/D36751
llvm-svn: 310941
Jakub Kuderski [Tue, 15 Aug 2017 18:14:57 +0000 (18:14 +0000)]
[Dominators] Include infinite loops in PostDominatorTree
Summary:
This patch teaches PostDominatorTree about infinite loops. It is built on top of D29705 by @dberlin which includes a very detailed motivation for this change.
What's new is that the patch also teaches the incremental updater how to deal with reverse-unreachable regions and how to properly maintain and verify tree roots. Before that, the incremental algorithm sometimes ended up preserving reverse-unreachable regions after updates that wouldn't appear in the tree if it was constructed from scratch on the same CFG.
This patch makes the following assumptions:
- A sequence of updates should produce the same tree as a recalculating it.
- Any sequence of the same updates should lead to the same tree.
- Siblings and roots are unordered.
The last two properties are essential to efficiently perform batch updates in the future.
When it comes to the first one, we can decide later that the consistency between freshly built tree and an updated one doesn't matter match, as there are many correct ways to pick roots in infinite loops, and to relax this assumption. That should enable us to recalculate postdominators less frequently.
This patch is pretty conservative when it comes to incremental updates on reverse-unreachable regions and ends up recalculating the whole tree in many cases. It should be possible to improve the performance in many cases, if we decide that it's important enough.
That being said, my experiments showed that reverse-unreachable are very rare in the IR emitted by clang when bootstrapping clang. Here are the statistics I collected by analyzing IR between passes and after each removePredecessor call:
```
# functions: 52283
# samples: 337609
# reverse unreachable BBs: 216022
# BBs:
247840796
Percent reverse-unreachable: 0.
08716159869015269 %
Max(PercRevUnreachable) in a function: 87.
58620689655172 %
# > 25 % samples: 471 ( 0.
1395104988314885 % samples )
... in 145 ( 0.
27733680163724345 % functions )
```
Most of the reverse-unreachable regions come from invalid IR where it wouldn't be possible to construct a PostDomTree anyway.
I would like to commit this patch in the next week in order to be able to complete the work that depends on it before the end of my internship, so please don't wait long to voice your concerns :).
Reviewers: dberlin, sanjoy, grosser, brzycki, davide, chandlerc, hfinkel
Reviewed By: dberlin
Subscribers: nhaehnle, javed.absar, kparzysz, uabelho, jlebar, hiraditya, llvm-commits, dberlin, david2050
Differential Revision: https://reviews.llvm.org/D35851
llvm-svn: 310940
Tom Stellard [Tue, 15 Aug 2017 18:11:56 +0000 (18:11 +0000)]
test-release.sh: Move test-suite setup to beginning of the script
Summary:
We want to catch failures early before do the full 3 stage build.
The goal here is to avoid running through the whole build process and have
it fail at the end (and not create the binary packages), just because
some prerequisites failed to install.
Reviewers: rovka, hans
Reviewed By: hans
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36422
llvm-svn: 310939
Lang Hames [Tue, 15 Aug 2017 18:10:19 +0000 (18:10 +0000)]
[ORC] Add case statements for AArch64 to the local stub and callback manager
creation functions.
This should allow lli to lazily execute code using OrcLazyJIT on AArch64.
llvm-svn: 310938
Yaxun Liu [Tue, 15 Aug 2017 17:59:26 +0000 (17:59 +0000)]
Attempt to fix failure in CodeGenOpenCL/atomic-ops.cl again
llvm-svn: 310937
Chris Bieneman [Tue, 15 Aug 2017 17:42:20 +0000 (17:42 +0000)]
[CMake] Disable code sign entitlements when using lldb_codesign
Turns out self-signed certificates and entitlements don't always play well together...
llvm-svn: 310936
Sanjay Patel [Tue, 15 Aug 2017 17:41:31 +0000 (17:41 +0000)]
[InstCombine] add tests for sext+ashr; NFC
llvm-svn: 310935
Rui Ueyama [Tue, 15 Aug 2017 17:39:35 +0000 (17:39 +0000)]
Fix -Wunused-lambda-capture for Release build.
`I` and `this` are used only in assert or DEBUG, so they are unused
in Release build.
llvm-svn: 310934
Argyrios Kyrtzidis [Tue, 15 Aug 2017 17:20:37 +0000 (17:20 +0000)]
[index] Update indexing to handle CXXDeductionGuideDecls properly
CXXDeductionGuideDecls can't be referenced so there's no need to output a symbol occurrence for them.
Also handle DeducedTemplateSpecializationTypeLocs in the TypeIndexer so we don't miss the symbol occurrences of the corresponding template decls.
Patch by Nathan Hawes!
Differential Revision: https://reviews.llvm.org/D36641
llvm-svn: 310933
Yaxun Liu [Tue, 15 Aug 2017 17:16:44 +0000 (17:16 +0000)]
Attempt to fix failure in CodeGenOpenCL/atomic-ops.cl
llvm-svn: 310932
Rui Ueyama [Tue, 15 Aug 2017 17:01:39 +0000 (17:01 +0000)]
Remove GdbIndexSection::finalizeContents.
GdbIndexSection doesn't need lazy finalization because when an instance
of the class is created, we already know all debug info sections.
We can initialize the instnace in the ctor.
llvm-svn: 310931
Rui Ueyama [Tue, 15 Aug 2017 17:01:28 +0000 (17:01 +0000)]
Use ArrayRef instead of std::vector&.
llvm-svn: 310930
Rui Ueyama [Tue, 15 Aug 2017 17:01:17 +0000 (17:01 +0000)]
Update a comment and rename a function.
llvm-svn: 310929
George Rimar [Tue, 15 Aug 2017 16:42:21 +0000 (16:42 +0000)]
[llvm-dwarfdump] - Attemp to fix BB after r310915.
Now MIPS one is unhappy:
http://lab.llvm.org:8011/builders/llvm-mips-linux/builds/2221
llvm-svn: 310928
Yaxun Liu [Tue, 15 Aug 2017 16:30:31 +0000 (16:30 +0000)]
Remove -finclude-default-header in OpenCL atomic tests
Differential Revision: https://reviews.llvm.org/D36676
llvm-svn: 310927
Steven Wu [Tue, 15 Aug 2017 16:16:33 +0000 (16:16 +0000)]
[Doc] Update LangRef for new Module Flag Behavior
Summary:
Add the documentation for the new module flag behavior. The new
ModFlagBehavior is added in r303590.
Reviewers: tejohnson
Reviewed By: tejohnson
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36557
llvm-svn: 310926
Rui Ueyama [Tue, 15 Aug 2017 16:03:11 +0000 (16:03 +0000)]
Remove SymbolTable::findInCurrentDSO.
This function doesn't seem to add value to the symbol table as
it is easy to write code without it.
llvm-svn: 310925
Yaxun Liu [Tue, 15 Aug 2017 16:02:49 +0000 (16:02 +0000)]
[OpenCL] Support variable memory scope in atomic builtins
Differential Revision: https://reviews.llvm.org/D36580
llvm-svn: 310924
George Rimar [Tue, 15 Aug 2017 15:54:43 +0000 (15:54 +0000)]
[llvm-dwarfdump] - Refactor section name/uniqueness gathering.
As was requested in D36313 thread,
with this patch section names and uniqueness calculated once,
and not every time when a range is dumped.
Differential revision: https://reviews.llvm.org/D36740
llvm-svn: 310923
Daniel Sanders [Tue, 15 Aug 2017 15:10:31 +0000 (15:10 +0000)]
Revert r310919 - [globalisel][tablegen] Support zero-instruction emission.
As expected, this failed on the windows bots but the instrumentation showed
something interesting. The ADD8ri and INC8r rules are never directly compared
on the windows machines. That implies that the issue lies in transitivity of
the Compare predicate. I believe I've already verified that but maybe I missed
something.
llvm-svn: 310922
Alex Lorenz [Tue, 15 Aug 2017 14:42:01 +0000 (14:42 +0000)]
Allow pretty platform names in availability attributes
rdar://
32076651
llvm-svn: 310921
Alexey Bataev [Tue, 15 Aug 2017 14:34:04 +0000 (14:34 +0000)]
[OPENMP] Fix compiler crash on argument translate for NVPTX.
When translating arguments for NVPTX target it is not taken into account
that function may have variable number of arguments. Patch fixes this
problem.
llvm-svn: 310920
Daniel Sanders [Tue, 15 Aug 2017 13:50:09 +0000 (13:50 +0000)]
Re-commit with some instrumentation: [globalisel][tablegen] Support zero-instruction emission.
Summary:
Support the case where an operand of a pattern is also the whole of the
result pattern. In this case the original result and all its uses must be
replaced by the operand. However, register class restrictions can require
a COPY. This patch handles both cases by always emitting the copy and
leaving it for the register allocator to optimize.
The previous commit failed on the windows bots and this one is likely to fail
on those same bots. However, the added instrumentation should reveal a particular
isHigherPriorityThan() evaluation which I'm expecting to expose that
these machines are weighing priority of two rules differently from the
non-windows machines.
Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar
Subscribers: javed.absar, kristof.beyls, igorb, llvm-commits
Differential Revision: https://reviews.llvm.org/D36084
llvm-svn: 310919
George Rimar [Tue, 15 Aug 2017 13:26:12 +0000 (13:26 +0000)]
[DebugInfo] - Attemp to fix BB after r310915.
Not sure what BB does not like.
While building module 'LLVM_DebugInfo_DWARF' imported from /home/buildbot/modules-slave-2/clang-x86_64-linux-selfhost-modules-2/llvm.src/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp:10:
In file included from <module-includes>:7:
In file included from /home/buildbot/modules-slave-2/clang-x86_64-linux-selfhost-modules-2/llvm.src/include/llvm/DebugInfo/DWARF/DWARFContext.h:29:
/home/buildbot/modules-slave-2/clang-x86_64-linux-selfhost-modules-2/llvm.src/include/llvm/DebugInfo/DWARF/DWARFObject.h:30:17: error: declaration of 'object' must be imported from module 'LLVM_Object.Decompressor' before it is required
virtual const object::ObjectFile *getFile() const { return nullptr; }
^
/home/buildbot/modules-slave-2/clang-x86_64-linux-selfhost-modules-2/llvm.src/include/llvm/Object/Decompressor.h:18:11: note: previous declaration is here
namespace object {
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/10766
llvm-svn: 310918