Dean Michael Berris [Thu, 3 Aug 2017 00:58:45 +0000 (00:58 +0000)]
[XRay][compiler-rt] Allow for building the XRay runtime without PREINIT initialization.
Summary:
Define a build-time configuration option for the XRay runtime to
determine whether the archive will add an entry to the `.preinit_array`
section of the binary. We also allow for initializing the XRay data
structures with an explicit call to __xray_init(). This allows us to
give users the capability to initialize the XRay data structures on
demand.
This can allow us to start porting XRay to platforms where
`.preinit_array` isn't a supported section. It also allows us to limit
the effects of XRay in the initialization sequence for applications that
are sensitive to this kind of interference (i.e. large binaries) or
those that want to package XRay control in libraries.
Future changes should allow us to build two different library archives
for the XRay runtime, and allow clang users to determine which version
to link.
Reviewers: dblaikie, kpw, pelikan
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D36080
llvm-svn: 309909
Tim Shen [Thu, 3 Aug 2017 00:18:11 +0000 (00:18 +0000)]
[Sema] Add a comment on an identified bug on default arguments.
Summary:
The mis-compile is triggered by internal code, but I haven't reduced it to a small piece of code. Add a FIXME here, since a decent fix doesn't seem to be trivial.
The decent fix can be changing Decl::Init to PointerUnion<Stmt *, EvaluatedStmt *, ParamVarDecl *>, and make setUninstantiatedDefaultArg take a ParamVarDecl *, which contains the Expr * as the default argument. This way, getTemplateInstantiationArgs can take that ParamVarDecl and do the right thing.
Reviewers: rsmith
Subscribers: sanjoy, cfe-commits
Differential Revision: https://reviews.llvm.org/D36253
llvm-svn: 309908
Dehao Chen [Thu, 3 Aug 2017 00:09:18 +0000 (00:09 +0000)]
Fix the bug when SampleProfileWriter writes out number of callsites.
Summary: As we support multiple callsites for the same location, we need to traverse all locations to get the number of callsites.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D36246
llvm-svn: 309907
Vedant Kumar [Wed, 2 Aug 2017 23:35:27 +0000 (23:35 +0000)]
Move two functions to a nicer spot. NFC.
llvm-svn: 309906
Vedant Kumar [Wed, 2 Aug 2017 23:35:26 +0000 (23:35 +0000)]
Rely on autobrief, remove \briefs from a header. NFC.
llvm-svn: 309905
Vedant Kumar [Wed, 2 Aug 2017 23:35:25 +0000 (23:35 +0000)]
[Coverage] Add an API to retrive all instantiations of a function (NFC)
The CoverageMapping::getInstantiations() API retrieved all function
records corresponding to functions with more than one instantiation (e.g
template functions with multiple specializations). However, there was no
simple way to determine *which* function a given record was an
instantiation of. This was an oversight, since it's useful to aggregate
coverage information over all instantiations of a function.
llvm-cov works around this by building a mapping of source locations to
instantiation sets, but this duplicates logic that libCoverage already
has (see FunctionInstantiationSetCollector).
This change adds a new API, CoverageMapping::getInstantiationGroups(),
which returns a list of InstantiationGroups. A group contains records
for each instantiation of some particular function, and also provides
utilities to get the total execution count within the group, the source
location of the common definition, etc.
This lets removes some hacky logic in llvm-cov by reusing
FunctionInstantiationSetCollector and makes the CoverageMapping API
friendlier for other clients.
llvm-svn: 309904
Vedant Kumar [Wed, 2 Aug 2017 23:35:24 +0000 (23:35 +0000)]
[llvm-cov] Respect the value of the -show-instantiations option
Make `-show-instantiations=false` actually skip displaying instantiation
sub-views, instead of simply ignoring the option.
llvm-svn: 309903
Reid Kleckner [Wed, 2 Aug 2017 23:32:26 +0000 (23:32 +0000)]
[PDB] Improve rsds test to check that we fill in the file offset as well as the RVA
llvm-svn: 309902
Eli Friedman [Wed, 2 Aug 2017 23:22:50 +0000 (23:22 +0000)]
[coverage] Make smaller regions for the first case of a switch.
We never overwrite the end location of a region, so we would end up with
an overly large region when we reused the switch's region.
It's possible this code will be substantially rewritten in the near
future to deal with fallthrough more accurately, but this seems like
an improvement on its own for now.
Differential Revision: https://reviews.llvm.org/D34801
llvm-svn: 309901
Reid Kleckner [Wed, 2 Aug 2017 23:19:54 +0000 (23:19 +0000)]
[PDB] Improve our PDB OMF debug directory entry
In order to get dbghelp to load our pdb, we have to fill in the
PointerToRawData field as well as the AddressOfRawData field. One is the
file offset and the other is the RVA.
llvm-svn: 309900
George Karpenkov [Wed, 2 Aug 2017 23:09:57 +0000 (23:09 +0000)]
Revert "[libFuzzer tests] Use substring comparison in libFuzzer tests"
This reverts commit
3592d8049660dcdd07f7c2e797f2de9790f93111.
Breaks the bots, reverting for now.
llvm-svn: 309899
Tom Stellard [Wed, 2 Aug 2017 22:56:30 +0000 (22:56 +0000)]
AMDGPU/GlobalISel: Mark 32-bit G_FMUL as legal
Reviewers: arsenm
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D36218
llvm-svn: 309898
Kostya Kortchinsky [Wed, 2 Aug 2017 22:47:54 +0000 (22:47 +0000)]
[tsan] Check for pvalloc overlow
Summary:
`CheckForPvallocOverflow` was introduced with D35818 to detect when pvalloc
would wrap when rounding up to the next multiple of the page size.
Add this check to TSan's pvalloc implementation.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D36245
llvm-svn: 309897
Zachary Turner [Wed, 2 Aug 2017 22:31:39 +0000 (22:31 +0000)]
[pdb/lld] Write a valid FPM.
The PDB reserves certain blocks for the FPM that describe which
blocks in the file are allocated and which are free. We weren't
filling that out at all, and in some cases we were even stomping
it with incorrect data. This patch writes a correct FPM.
Differential Revision: https://reviews.llvm.org/D36235
llvm-svn: 309896
Zachary Turner [Wed, 2 Aug 2017 22:26:09 +0000 (22:26 +0000)]
[MSF] Move MSF unit tests to their own unittest target.
llvm-svn: 309895
Zachary Turner [Wed, 2 Aug 2017 22:25:52 +0000 (22:25 +0000)]
[pdbutil] Add a command to dump the FPM.
Recently problems have been discovered in the way we write the FPM
(free page map). In order to fix this, we first need to establish
a baseline about what a correct FPM looks like using an MSVC
generated PDB, so that we can then make our own generated PDBs
match. And in order to do this, the dumper needs a mode where it
can dump an FPM so that we can write tests for it.
This patch adds a command to dump the FPM, as well as a test against
a known-good PDB.
llvm-svn: 309894
Tom Stellard [Wed, 2 Aug 2017 22:19:45 +0000 (22:19 +0000)]
AMDGPU/R600: Initialize more passes
Reviewers: arsenm
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D36128
llvm-svn: 309893
Sterling Augustine [Wed, 2 Aug 2017 21:52:23 +0000 (21:52 +0000)]
Use a more standard method to mark these tests as unsupported on powerpc64.
llvm-svn: 309892
Keith Wyss [Wed, 2 Aug 2017 21:47:27 +0000 (21:47 +0000)]
Xray docs with description of Flight Data Recorder binary format.
Summary:
Adding a new restructuredText file to document the trace format produced with
an FDR mode handler and read by llvm-xray toolset.
Fixed two problems in the documentation from differential review. One bad table
and a missing link in the toc.
Original commit was
e97c5836a77db803fe53319c53f3bf8e8b26d2b7.
Reviewers: dberris, pelikan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36041
llvm-svn: 309891
Matt Arsenault [Wed, 2 Aug 2017 21:43:08 +0000 (21:43 +0000)]
LV: Don't insert runtime ptr checks on divergent targets
llvm-svn: 309890
George Karpenkov [Wed, 2 Aug 2017 21:38:50 +0000 (21:38 +0000)]
[libFuzzer tests] Use substring comparison in libFuzzer tests
LIT launches executables with absolute, and not relative, path.
strncmp would try to do exact comparison and fail.
Differential Revision: https://reviews.llvm.org/D36242
llvm-svn: 309889
Benjamin Kramer [Wed, 2 Aug 2017 21:16:50 +0000 (21:16 +0000)]
Remove unused diagnostic. NFC.
llvm-svn: 309888
Craig Topper [Wed, 2 Aug 2017 21:05:40 +0000 (21:05 +0000)]
[InstCombine] Remove unnecessary temporary APInt. NFCI
llvm-svn: 309887
Teresa Johnson [Wed, 2 Aug 2017 20:35:29 +0000 (20:35 +0000)]
[PM] Split LoopUnrollPass and make partial unroller a function pass
Summary:
This is largely NFC*, in preparation for utilizing ProfileSummaryInfo
and BranchFrequencyInfo analyses. In this patch I am only doing the
splitting for the New PM, but I can do the same for the legacy PM as
a follow-on if this looks good.
*Not NFC since for partial unrolling we lose the updates done to the
loop traversal (adding new sibling and child loops) - according to
Chandler this is not very useful for partial unrolling, but it also
means that the debugging flag -unroll-revisit-child-loops no longer
works for partial unrolling.
Reviewers: chandlerc
Subscribers: mehdi_amini, mzolotukhin, eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D36157
llvm-svn: 309886
Rafael Espindola [Wed, 2 Aug 2017 20:32:35 +0000 (20:32 +0000)]
Update for llvm change.
llvm-svn: 309885
Rafael Espindola [Wed, 2 Aug 2017 20:32:26 +0000 (20:32 +0000)]
Don't pass the code model to MC
I was surprised to see the code model being passed to MC. After all,
it assembles code, it doesn't create it.
The one place it is used is in the expansion of .cfi directives to
handle .eh_frame being more that 2gb away from the code.
As far as I can tell, gnu assembler doesn't even have an option to
enable this. Compiling a c file with gcc -mcmodel=large produces a
regular looking .eh_frame. This is probably because in practice linker
parse and recreate .eh_frames.
In llvm this is used because the JIT can place the code and .eh_frame
very far apart. Ideally we would fix the jit and delete this
option. This is hard.
Apart from confusion another problem with the current interface is
that most callers pass CodeModel::Default, which is bad since MC has
no way to map it to the target default if it actually needed to.
This patch then replaces the argument with a boolean with a default
value. The vast majority of users don't ever need to look at it. In
fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more
testing.
llvm-svn: 309884
Kostya Kortchinsky [Wed, 2 Aug 2017 20:32:12 +0000 (20:32 +0000)]
[msan] Check for pvalloc overflow
Summary:
CheckForPvallocOverflow was introduced with D35818 to detect when pvalloc
would wrap when rounding up to the next multiple of the page size.
Add this check to MSan's pvalloc implementation.
This time I made sure I was actually running (and writing) the correct tests,
and that they are passing...
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36164
llvm-svn: 309883
Craig Topper [Wed, 2 Aug 2017 20:30:27 +0000 (20:30 +0000)]
[InstCombine] Remove explicit code for folding (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).
As far as I can tell this should be handled by foldCastedBitwiseLogic which is called later in visitXor.
Differential Revision: https://reviews.llvm.org/D36214
llvm-svn: 309882
Marshall Clow [Wed, 2 Aug 2017 20:29:26 +0000 (20:29 +0000)]
Rename a couple variables to eliminate a shadow warning. No functionality change
llvm-svn: 309881
Craig Topper [Wed, 2 Aug 2017 20:25:56 +0000 (20:25 +0000)]
[InstCombine] Support sext in foldLogicCastConstant
This adds support for sext in foldLogicCastConstant. This is a prerequisite for D36214.
Differential Revision: https://reviews.llvm.org/D36234
llvm-svn: 309880
David Blaikie [Wed, 2 Aug 2017 20:16:22 +0000 (20:16 +0000)]
DebugInfo: Test & handle (differently) non-zero DW_AT_ranges_base
Followup to r309570, fixing it slightly differently (ranges_base and
addr_base should never be read from a DWO file - so there shouldn't be
any issue with 'overriding' the values - conditionalize the code and
assert that the values aren't being overriden).
llvm-svn: 309879
Tobias Grosser [Wed, 2 Aug 2017 20:12:27 +0000 (20:12 +0000)]
Enable simplify and forward-op-tree by default
These passes have been tested over the last month and should generally help
to remove scalar data dependences in Polly. We enable them to give them even
wider test coverage. Large performance regressions and any kind of correctness
regressions are not expected.
llvm-svn: 309878
Jonathan Peyton [Wed, 2 Aug 2017 20:10:00 +0000 (20:10 +0000)]
Exclude version symbols for static libomp
We use symbol versioning for GNU-compatibility but libgomp has versioned symbols
only in the shared library but not in the static.
Moreover, version symbols in the static library can cause an error at link time.
Patch by Olga Malysheva
Differential Revision: https://reviews.llvm.org/D36225
llvm-svn: 309877
Stefan Pintilie [Wed, 2 Aug 2017 20:07:21 +0000 (20:07 +0000)]
[Power9] Exploit vector absolute difference instructions on Power 9
Power 9 has instructions to do absolute difference (VABSDUB, VABSDUH, VABSDUW)
for byte, halfword and word. We should take advantage of these.
Differential Revision: https://reviews.llvm.org/D34684
llvm-svn: 309876
Jonathan Peyton [Wed, 2 Aug 2017 20:06:32 +0000 (20:06 +0000)]
Move lock acquire/release functions in task deque cleanup code
The original locations can be reached without initializing the lock variable
(td_deque_lock), so it is potentially unsafe. It is guaranteed that the lock
is initialized if the deque (td_deque) is not NULL, and lock functions can be
safely called.
Patch by Hansang Bae
Differential Revision: https://reviews.llvm.org/D36017
llvm-svn: 309875
Jonathan Peyton [Wed, 2 Aug 2017 20:04:45 +0000 (20:04 +0000)]
Add new envirable KMP_TEAMS_THREAD_LIMIT
This change adds a new environment variable, KMP_TEAMS_THREAD_LIMIT, which is
used to set a new global variable, __kmp_teams_max_nth, which is checked when
determining the size and quantity of teams that will be created in the teams
construct. Specifically, it is a limit on the total number of threads in a given
teams construct. It differentiates the limits for the teams construct from the
limits for regular parallel regions (KMP_DEVICE_THREAD_LIMIT/__kmp_max_nth and
OMP_THREAD_LIMIT/__kmp_cg_max_nth). When each individual team is formed, it is
still subject to those limits. After the clauses to the teams construct are
parsed and calculated, we check to make sure we are within this limit, and if
not, reduce num_threads per team and/or number of teams, accordingly. The
default value is set to the number of available processors on the system.
Patch by Terry Wilmarth
Differential Revision: https://reviews.llvm.org/D36009
llvm-svn: 309874
Han Shen [Wed, 2 Aug 2017 19:53:38 +0000 (19:53 +0000)]
[UBSan] Provide default blacklist filename for UBSan
Summary:
This is to provide a default blacklist filename for UBSan.
While UBSan is turned on, it's better that clang pick up a blacklist file (when exists), just as what ASan / MSan does, so we do not end up adding the "-fsanitize-blacklist" option to every command line.
Reviewers: chandlerc, echristo, vsk, eugenis
Reviewed By: vsk, eugenis
Subscribers: vsk, eugenis, echristo, cfe-commits
Differential Revision: https://reviews.llvm.org/D35849
llvm-svn: 309873
Davide Italiano [Wed, 2 Aug 2017 19:47:37 +0000 (19:47 +0000)]
[NewGVN] Now that load coercion is enable, we pass this test.
llvm-svn: 309872
Tobias Grosser [Wed, 2 Aug 2017 19:27:25 +0000 (19:27 +0000)]
Move setNewAccessRelation to isl++
llvm-svn: 309871
Tobias Grosser [Wed, 2 Aug 2017 19:27:16 +0000 (19:27 +0000)]
Move ScopStmt::setAccessRelation to isl++
llvm-svn: 309870
Tobias Grosser [Wed, 2 Aug 2017 19:11:46 +0000 (19:11 +0000)]
Replace asserts with llvm_unreachable to clarify intent
llvm-svn: 309856
Evandro Menezes [Wed, 2 Aug 2017 18:55:34 +0000 (18:55 +0000)]
[AArch64] Add Exynos M2 feature test (NFC)
Test fusion of AES operations.
llvm-svn: 309855
Kostya Serebryany [Wed, 2 Aug 2017 18:48:45 +0000 (18:48 +0000)]
Add new ASAN_OPTION: sleep_after_init.
Summary: As mentioned in https://github.com/google/sanitizers/issues/834, suggested option can be handy for debugging.
Reviewers: kcc
Reviewed By: kcc
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D35409
llvm-svn: 309854
Philip Pfaffe [Wed, 2 Aug 2017 18:26:48 +0000 (18:26 +0000)]
Fix r309826: Appease clang-format check.
llvm-svn: 309853
Vedant Kumar [Wed, 2 Aug 2017 18:24:12 +0000 (18:24 +0000)]
[docs] Remove accidental unindent to appease the sphinx bot
Bot failure:
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/12043/steps/docs-clang-html/logs/stdio
llvm-svn: 309852
Marshall Clow [Wed, 2 Aug 2017 18:21:34 +0000 (18:21 +0000)]
Fix shadowing warning
llvm-svn: 309851
Jakub Kuderski [Wed, 2 Aug 2017 18:17:52 +0000 (18:17 +0000)]
[Dominators] Teach LoopDeletion to use the new incremental API
Summary:
This patch makes LoopDeletion use the incremental DominatorTree API.
We modify LoopDeletion to perform the deletion in 5 steps:
1. Create a new dummy edge from the preheader to the exit, by adding a conditional branch.
2. Inform the DomTree about the new edge.
3. Remove the conditional branch and replace it with an unconditional edge to the exit. This removes the edge to the loop header, making it unreachable.
4. Inform the DomTree about the deleted edge.
5. Remove the unreachable block from the function.
Creating the dummy conditional branch is necessary to perform incremental DomTree update.
We should consider using the batch updater when it's ready.
Reviewers: dberlin, davide, grosser, sanjoy
Reviewed By: dberlin, grosser
Subscribers: mzolotukhin, llvm-commits
Differential Revision: https://reviews.llvm.org/D35391
llvm-svn: 309850
Hiroshi Inoue [Wed, 2 Aug 2017 18:16:32 +0000 (18:16 +0000)]
[StackColoring] Update AliasAnalysis information in stack coloring pass (part 2)
This patch is update after the first patch (https://reviews.llvm.org/rL309651) based on the post-commit comments.
Stack coloring pass need to maintain AliasAnalysis information when merging stack slots of different types.
Actually, there is a FIXME comment in StackColoring.cpp
// FIXME: In order to enable the use of TBAA when using AA in CodeGen,
// we'll also need to update the TBAA nodes in MMOs with values
// derived from the merged allocas.
But, TBAA has been already enabled in CodeGen without fixing this pass.
The incorrect TBAA metadata results in recent failures in bootstrap test on ppc64le (PR33928) by allowing unsafe instruction scheduling.
Although we observed the problem on ppc64le, this is a platform neutral issue.
This patch makes the stack coloring pass maintains AliasAnalysis information when merging multiple stack slots.
This patch fixes PR33928.
llvm-svn: 309849
Sterling Augustine [Wed, 2 Aug 2017 18:13:59 +0000 (18:13 +0000)]
This ppc64 implementation of clear_cache works for both big and little endian.
llvm-svn: 309848
Vedant Kumar [Wed, 2 Aug 2017 18:10:36 +0000 (18:10 +0000)]
[ubsan] Test -fsanitize=vptr without -fsanitize=null
This reverts commit r309042, thereby adding a test for -fsanitize=vptr
functionality without -fsanitize=null. It also removes -fsanitize=null
from another -fsanitize=vptr test.
llvm-svn: 309847
Vedant Kumar [Wed, 2 Aug 2017 18:10:31 +0000 (18:10 +0000)]
[ubsan] Have -fsanitize=vptr emit a null check if -fsanitize=null isn't available
In r309007, I made -fsanitize=null a hard prerequisite for -fsanitize=vptr. I
did not see the need for the two checks to have separate null checking logic
for the same pointer. I expected the two checks to either always be enabled
together, or to be mutually compatible.
In the mailing list discussion re: r309007 it became clear that that isn't the
case. If a codebase is -fsanitize=vptr clean but not -fsanitize=null clean,
it's useful to have -fsanitize=vptr emit its own null check. That's what this
patch does: with it, -fsanitize=vptr can be used without -fsanitize=null.
Differential Revision: https://reviews.llvm.org/D36112
llvm-svn: 309846
Singapuram Sanjay Srivallabh [Wed, 2 Aug 2017 17:56:39 +0000 (17:56 +0000)]
Fix code format on r309826
Summary:
Fix code format on r309826 / D35458
Reviewers: grosser, bollu
Reviewed By: grosser
Subscribers: pollydev
Tags: #polly
Differential Revision: https://reviews.llvm.org/D36232
llvm-svn: 309845
Keith Wyss [Wed, 2 Aug 2017 17:36:52 +0000 (17:36 +0000)]
Revert "Xray docs with description of Flight Data Recorder binary format."
This reverts commit
3462b8ad41a840fd54dbbd0d3f2a514c5ad6f656.
The docs-llvm-html target failed.
llvm-svn: 309842
Coby Tayree [Wed, 2 Aug 2017 17:36:10 +0000 (17:36 +0000)]
[AsmParser][GAS-compatibility] Ignore an empty 'p2align' directive
GAS ignores the aforementioned issue
this patch aligns LLVM + throws in an appropriate warning
Differential Revision: https://reviews.llvm.org/D36060
llvm-svn: 309841
Rafael Espindola [Wed, 2 Aug 2017 17:35:18 +0000 (17:35 +0000)]
Use more consistent names
Reviewing another change I noticed that we use "getSymbols" to mean
different things in different files. Depending on the file it can
return
ArrayRef<StringRef>
ArrayRef<SymbolBody*>
ArrayRef<Symbol*>
ArrayRef<Elf_Sym>
With this change it always returns an ArrayRef<SymbolBody*>. The other
functions are renamed getELFsyms() and getSymbolNames().
Note that we cannot return ArrayRef<Symbol*> instead of
ArreyRef<SymbolBody*> because local symbols have a SymbolBody but not
a Symbol.
llvm-svn: 309840
Craig Topper [Wed, 2 Aug 2017 17:33:02 +0000 (17:33 +0000)]
[InstCombine] Add missing test case for (xor (sext (cmp)), -1) -> (sext (!cmp)).
llvm-svn: 309839
Marshall Clow [Wed, 2 Aug 2017 17:31:09 +0000 (17:31 +0000)]
Fix PR33727: std::basic_stringbuf only works with DefaultConstructible allocators. Thanks to Jonathan Wakely for the report and suggested fix
llvm-svn: 309838
Keith Wyss [Wed, 2 Aug 2017 17:27:20 +0000 (17:27 +0000)]
Xray docs with description of Flight Data Recorder binary format.
Summary:
Adding a new restructuredText file to document the trace format produced with
an FDR mode handler and read by llvm-xray toolset.
Reviewers: dberris, pelikan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36041
llvm-svn: 309836
Philip Pfaffe [Wed, 2 Aug 2017 17:25:45 +0000 (17:25 +0000)]
Fix r309826: Move intantiation and specialization of OwningScopAnalysisManagerFunctionProxy to the polly namespace.
When compiling with clang, explicit instantiation of the
OwningScopAnalysisManagerFunctionProxy needs to happen within the polly
namespace. Same goes with the specialization of its run method.
llvm-svn: 309835
Adrian Prantl [Wed, 2 Aug 2017 17:19:13 +0000 (17:19 +0000)]
Assert that the offset of a DBG_VALUE is always 0. (NFC)
llvm-svn: 309834
Reid Kleckner [Wed, 2 Aug 2017 17:16:25 +0000 (17:16 +0000)]
Revert "[lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs"
This reverts r309602, check-lit still leaves Output directories in the
source directory.
llvm-svn: 309833
Matt Arsenault [Wed, 2 Aug 2017 17:15:01 +0000 (17:15 +0000)]
AMDGPU: Restore using MRI to find highest used regs
If there are no calls, this is a faster path than
searching the entire program for calls.
This was supposed to be left in r309781.
Fixes unused variable warning.
llvm-svn: 309832
Adrian Prantl [Wed, 2 Aug 2017 17:07:38 +0000 (17:07 +0000)]
Remove the unused Offset field from MachineLocation (NFC)
rdar://problem/
33580047
llvm-svn: 309831
Nirav Dave [Wed, 2 Aug 2017 16:35:58 +0000 (16:35 +0000)]
[DAG] Improve candidate pruning in store merge failure case. NFCI
During store merge we construct a sorted list of consecutive store
candidates and consider subsequences for merging into a single
store. For each subsequence we check if the stored value type is legal
the merged store would have valid and fast and if the constructed
value to be stored is valid. The only properties that affect this
check between subsequences is the size of the subsequence, the
alignment of the first store, the alignment of the stored load value
(when merging stores-of-loads), and whether the merged value is a
constant zero.
If we do not find a viable mergeable subsequence starting from the
first store of length N, we know that a subsequence starting at a
later store of length N will also fail unless the new store's
alignment, the new load's alignment (if we're merging store-of-loads),
or we've dropped stores of nonzero value and could construct a merged
stores of zero (for merging constants).
As a result if we fail to find a valid subsequence starting from the
first store we can safely skip considering subsequences that start
with subsequent stores unless one of the above properties is
true. This significantly (2x) improves compile time in some
pathological cases.
Reviewers: RKSimon, efriedma, zvi, spatel, waltl
Subscribers: grandinj, llvm-commits
Differential Revision: https://reviews.llvm.org/D35901
llvm-svn: 309830
Petr Hosek [Wed, 2 Aug 2017 16:35:00 +0000 (16:35 +0000)]
[ELF] When the code segment is the last, align it to the page boundary
When the data segment is the last segment, it is correct to leave
it unaligned. However, when the code segment is the last segment,
it should be aligned to the page boundary to avoid loading the
non-segment parts of the ELF file at the end of the file.
Differential Revision: https://reviews.llvm.org/D33630
llvm-svn: 309829
Philip Pfaffe [Wed, 2 Aug 2017 15:52:25 +0000 (15:52 +0000)]
[Polly][PM][WIP] Polly pass registration
Summary:
This patch is a first attempt at registering Polly passes with the LLVM tools. Tool plugins are still unsupported, but this registration is usable from the tools if Polly is linked into them (albeit requiring minimal patches to those tools). Registration requires a small amount of machinery (the owning analysis proxies), necessary for injecting ScopAnalysisManager objects into the calling tools.
This patch is marked WIP because the registration is incomplete. Parsing manual pipelines is fully supported, but default pass injection into the O3 pipeline is lacking, mostly because there is opportunity for some redesign here, I believe. The first point of order would be insertion points. I think it makes sense to run before the vectorizers. Running Polly Early, however, is weird. Mostly because it actually is the default (which to me is unexpected), and because Polly runs it's own O1 pipeline. Why not instead insert it at an appropriate place somewhere after simplification happend? Running after the loop optimizers seems intuitive, but it also seems wasteful, since multiple consecutive loops might well be a single scop, and we don't need to run for all of them.
My second request for comments would be regarding all those smallish helper passes we have, like PollyViewer, PollyPrinter, PollyImportJScop. Right now these are controlled by command line options, deciding whether they should be part of the Polly pipeline. What is your opinion on treating them like real passes, and have the user write an appropriate pipeline if they want to use any of them?
Reviewers: grosser, Meinersbur, bollu
Reviewed By: grosser
Subscribers: llvm-commits, pollydev
Tags: #polly
Differential Revision: https://reviews.llvm.org/D35458
llvm-svn: 309826
Evandro Menezes [Wed, 2 Aug 2017 15:34:06 +0000 (15:34 +0000)]
[AArch64] Improve the test of conditional branch fusion
Separate the checking of the fused pairings with B.cc and CBcc.
llvm-svn: 309825
Adrian Prantl [Wed, 2 Aug 2017 15:32:18 +0000 (15:32 +0000)]
Remove unused includes of MachineLocation.h (NFC)
llvm-svn: 309824
Adrian Prantl [Wed, 2 Aug 2017 15:22:17 +0000 (15:22 +0000)]
Remove unreachable code. (NFC)
MachineLocation::getOffset() always returns 0.
rdar://problem/
33580047
llvm-svn: 309823
Singapuram Sanjay Srivallabh [Wed, 2 Aug 2017 15:20:07 +0000 (15:20 +0000)]
Remove debug metadata from copied instruction to prevent GPUModule verification failure
Summary:
**Remove debug metadata from instruction to be copied to prevent the source file's debug metadata being copied into GPUModule and eventually failing Module verification and ASM string codegeneration.**
When copying the instruction onto the Module meant for the GPU, debug metadata attached to an instruction causes all related metadata to be pulled into the Module, including the DICompileUnit, which is not listed in llvm.dbg.cu of the Module. This fails the verification of the Module and generation of the ASM string.
The only debug metadata of the instruction, the DebugLoc, is unset by this patch.
This patch reattempts https://reviews.llvm.org/D35630 by targeting only those instructions that are to end up in a Module meant for the GPU.
Reviewers: grosser, bollu
Reviewed By: grosser
Subscribers: pollydev
Tags: #polly
Differential Revision: https://reviews.llvm.org/D36161
llvm-svn: 309822
Florian Hahn [Wed, 2 Aug 2017 15:17:19 +0000 (15:17 +0000)]
[AArch64] Simplify AES*Tied pseudo expansion (NFC).
Summary:
Suggested by @t.p.northover in https://bugs.llvm.org/show_bug.cgi?id=34015.
Reviewers: javed.absar, t.p.northover, rengolin
Reviewed By: t.p.northover
Subscribers: aemerson, kristof.beyls, llvm-commits, t.p.northover
Differential Revision: https://reviews.llvm.org/D36223
llvm-svn: 309821
Jan Vesely [Wed, 2 Aug 2017 15:00:59 +0000 (15:00 +0000)]
configure.py: Make python3 friendly
mostly prints and exceptions.
Few behavioral changes are documented in the text
Generated Makefile is identical between python2 and python3
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 309820
Chad Rosier [Wed, 2 Aug 2017 14:50:27 +0000 (14:50 +0000)]
[InlineCost] Remove redundant call. NFC.
llvm-svn: 309819
Adrian Prantl [Wed, 2 Aug 2017 14:45:50 +0000 (14:45 +0000)]
Assert that the offset in MachineLocation::set() is always 0. (NFC)
llvm-svn: 309818
Chad Rosier [Wed, 2 Aug 2017 14:40:42 +0000 (14:40 +0000)]
[InlineCost] Simplify more 'and' and 'or' operations.
Differential Revision: https://reviews.llvm.org/D35856
llvm-svn: 309817
Alexey Bataev [Wed, 2 Aug 2017 14:38:07 +0000 (14:38 +0000)]
[SLPVectorizer] Generalize interface of functions, NFC.
llvm-svn: 309816
Walter Lee [Wed, 2 Aug 2017 14:36:52 +0000 (14:36 +0000)]
Define _GNU_SOURCE for RTEMS c++
Summary: This is required by the libc++ locale support.
Reviewers: jyknight
Subscribers: fedor.sergeev
Differential Revision: https://reviews.llvm.org/D36121
llvm-svn: 309815
Alexey Bataev [Wed, 2 Aug 2017 14:22:53 +0000 (14:22 +0000)]
[SLPVectorizer] Test update, NFC.
llvm-svn: 309814
Alex Lorenz [Wed, 2 Aug 2017 14:15:27 +0000 (14:15 +0000)]
[rename] NFC, extract symbol canonicalization logic into function
This function will be used by the clang-refactor's rename actions
llvm-svn: 309813
Alexey Bataev [Wed, 2 Aug 2017 13:25:26 +0000 (13:25 +0000)]
[SLP] Fix for PR31880: shuffle and vectorize repeated scalar ops on extracted elements
Summary:
Currently most of the time vectors of extractelement instructions are
treated as scalars that must be gathered into vectors. But in some
cases, like when we have extractelement instructions from single vector
with different constant indeces or from 2 vectors of the same size, we
can treat this operations as shuffle of a single vector or blending of 2
vectors.
```
define <2 x i8> @g(<2 x i8> %x, <2 x i8> %y) {
%x0 = extractelement <2 x i8> %x, i32 0
%y1 = extractelement <2 x i8> %y, i32 1
%x0x0 = mul i8 %x0, %x0
%y1y1 = mul i8 %y1, %y1
%ins1 = insertelement <2 x i8> undef, i8 %x0x0, i32 0
%ins2 = insertelement <2 x i8> %ins1, i8 %y1y1, i32 1
ret <2 x i8> %ins2
}
```
can be converted to something like
```
define <2 x i8> @g(<2 x i8> %x, <2 x i8> %y) {
%1 = shufflevector <2 x i8> %x, <2 x i8> %y, <2 x i32> <i32 0, i32 3>
%2 = mul <2 x i8> %1, %1
ret <2 x i8> %2
}
```
Currently this type of conversion is considered as high cost
transformation.
Reviewers: mzolotukhin, delena, mkuper, hfinkel, RKSimon
Subscribers: ashahid, RKSimon, spatel, llvm-commits
Differential Revision: https://reviews.llvm.org/D30200
llvm-svn: 309812
Philip Pfaffe [Wed, 2 Aug 2017 13:18:49 +0000 (13:18 +0000)]
[PM] Fix proxy invalidation
Summary: I made a mistake in handling transitive invalidation of analysis results. I've updated the list of preserved analyses as well as the correct result dependences.
The Invalidator passed through the invalidate() path can be used to
transitively invalidate analyses. It frequently happens that analysis
results depend on other analyses, and thus store references to their
results. When the dependee now gets invalidated, the depender needs to
be invalidated as well. This is the purpose of the Invalidator object,
which can be used to check whether some dependee analysis is in the
process of being invalidated. I originally was checking the wrong
dependee analyses, which is an actual error, you can only check analysis
results that are in the cache (which they are if you've captured their
reference). The invalidation I'm handling inside the proxy deals with
the standard analyses the proxy passes into the Scop pipeline, since I'm
capturing their reference.
This checking allows us to actually preserve a couple of results outside
of the proxy, since the Scop pipeline shouldn't break those, or
otherwise should update them accordingly.
Reviewers: grosser, Meinersbur, bollu
Reviewed By: grosser
Subscribers: pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D36216
llvm-svn: 309811
Manuel Klimek [Wed, 2 Aug 2017 13:13:11 +0000 (13:13 +0000)]
Adapt clang-tidy checks to changing semantics of hasDeclaration.
Differential Revision: https://reviews.llvm.org/D36154
llvm-svn: 309810
Manuel Klimek [Wed, 2 Aug 2017 13:04:44 +0000 (13:04 +0000)]
Unify and simplify the behavior of the hasDeclaration matcher.
Originally, we weren't able to match on Type nodes themselves (only QualType),
so the hasDeclaration matcher was initially written to give what we thought are
reasonable results for QualType matches.
When we chagned the matchers to allow matching on Type nodes, it turned out
that the hasDeclaration matcher was by chance written templated enough to now
allow hasDeclaration to also match on (some) Type nodes.
This patch change the hasDeclaration matcher to:
a) work the same on Type and QualType nodes,
b) be completely explicit about what nodes we can match instead of just allowing
anything with a getDecl() to match,
c) explicitly control desugaring only one level in very specific instances.
d) adds hasSpecializedTemplate and tagType matchers to allow migrating
existing use cases that now need more explicit matchers
Note: This patch breaks clang-tools-extra. The corresponding patch there
is approved and will land in a subsequent patch.
Differential Revision: https://reviews.llvm.org/D27104
llvm-svn: 309809
Siddharth Bhat [Wed, 2 Aug 2017 12:23:22 +0000 (12:23 +0000)]
[GPUJIT] Add GPUJIT APIs for allocating and freeing managed memory.
We introduce `polly_mallocManaged` and `polly_freeManaged` as
proxies for `cudaMallocManaged` / `cudaFree`. This is currently not
used by Polly. It is auxiliary code that is used in `COSMO`.
This is useful because `polly_mallocManaged` matches the signature of `malloc`,
while `cudaMallocManaged` does not. We introduce `polly_freeManaged` for
symmetry.
We use this in COSMO to use the unified memory feature of the newer
CUDA APIs (>= 6).
Differential Revision: https://reviews.llvm.org/D35991
llvm-svn: 309808
Philip Pfaffe [Wed, 2 Aug 2017 11:14:41 +0000 (11:14 +0000)]
[SI][NewPM] Collect loop count statistics
llvm-svn: 309807
Diana Picus [Wed, 2 Aug 2017 11:09:30 +0000 (11:09 +0000)]
[MIR] Print target-specific constant pools
This should enable us to test the generation of target-specific constant
pools, e.g. for ARM:
constants:
- id: 0
value: 'g(GOT_PREL)-(LPC0+8-.)'
alignment: 4
isTargetSpecific: true
I intend to use this to test PIC support in GlobalISel for ARM.
This is difficult to test outside of that context, since the existing
MIR tests usually rely on parser support as well, and that seems a bit
trickier to add. We could try to add a unit test, but the setup for that
seems rather convoluted and overkill.
We do test however that the parser reports a nice error when
encountering a target-specific constant pool.
Differential Revision: https://reviews.llvm.org/D36092
llvm-svn: 309806
Philip Pfaffe [Wed, 2 Aug 2017 11:08:01 +0000 (11:08 +0000)]
[SD] Set PollyUseRuntimeAliasChecks correctly
llvm-svn: 309805
Daniel Sanders [Wed, 2 Aug 2017 11:03:36 +0000 (11:03 +0000)]
[globalisel][tablegen] Do not merge memoperands from instructions that weren't in the match.
Summary:
Fix a bug discovered in an out-of-tree target where memoperands from
pseudo-instructions that weren't part of the match were being merged into the
result instructions as part of GIR_MergeMemOperands.
This bug was caused by a change to the handling of State.MIs between rules when
the state machine tables were fused into a single table. Previously, each rule
would reset State.MIs using State.MIs.resize(1) but this is no longer done, as a
result stale data is occasionally left in some elements of State.MIs. Most
opcodes aren't affected by this but GIR_MergeMemOperands merges all memoperands
from the intructions recorded in State.MIs into the result instruction.
Suppose for example, we processed but rejected the following pattern:
(signextend (load x))
at this point, State.MIs contains the signextend and the load. Now suppose we
process and accept this pattern:
(add x, y)
at this point, State.MIs contains the add as well as the (now irrelevant) load.
When GIR_MergeMemOperands is processed, the memoperands from that irrelevant
load will be merged into the result instruction even though it was not part of
the match.
Bringing back the State.MIs.resize(1) would fix the problem but it would limit
our ability to optimize the table in the future. Instead, this patch fixes the
problem by explicitly stating which instructions should be merged into the result.
There's no direct test case in this commit because a test case would be very brittle.
However, at the time of writing this should fix the failures in
http://green.lab.llvm.org/green/job/Compiler_Verifiers_GlobalISEL/ as well as a
failure in test/CodeGen/ARM/GlobalISel/arm-isel.ll when expensive checks are enabled.
Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar
Subscribers: fhahn, kristof.beyls, igorb, llvm-commits
Differential Revision: https://reviews.llvm.org/D36094
llvm-svn: 309804
Vadim Macagon [Wed, 2 Aug 2017 10:12:12 +0000 (10:12 +0000)]
Fix ProcessAPITestCase.test_get_process_info
llvm-svn: 309803
Siddharth Bhat [Wed, 2 Aug 2017 09:19:42 +0000 (09:19 +0000)]
[GPUJIT] Teach GPUJIT to use a pre-existing CUDA context if available.
On mixing the driver and runtime APIs, it is quite possible that a
context already exists due to runtime API usage. In this case, Polly should
try to use the same context.
This patch teaches GPUJIT to detect that a context exists and how to
pick up this context.
Without this, calling `cudaMallocManaged`, for example, before a
polly-generated kernel launch causes P100 to *hang*.
This is a part of (https://reviews.llvm.org/D35991) that was extracted
out.
Differential Revision: https://reviews.llvm.org/D36162
llvm-svn: 309802
Ilya Biryukov [Wed, 2 Aug 2017 09:08:39 +0000 (09:08 +0000)]
[clangd] Run clang-format on all clangd sources. NFC.
llvm-svn: 309801
Ilya Biryukov [Wed, 2 Aug 2017 08:53:48 +0000 (08:53 +0000)]
[clangd] Capitalized descriptions of clangd options. NFC.
To follow the style of other options shown on `clangd -help`.
llvm-svn: 309800
Daniel Marjamaki [Wed, 2 Aug 2017 08:26:56 +0000 (08:26 +0000)]
[StaticAnalyzer] Fix false positives for unreachable code in macros.
Example:
#define MACRO(C) if (C) { static int x; .. }
void foo() {
MACRO(0);
}
Differential Revision: https://reviews.llvm.org/D36141
llvm-svn: 309799
Vitaly Buka [Wed, 2 Aug 2017 07:59:30 +0000 (07:59 +0000)]
[asan] Interceptors for Fuchsia
Summary:
Fuchsia uses the "memintrinsics" interceptors, though not via any
generalized interception mechanism. It doesn't use any other interceptors.
Submitted on behalf of Roland McGrath.
Reviewers: vitalybuka, alekseyshl, kcc
Reviewed By: vitalybuka
Subscribers: kubamracek, phosek, filcab, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36189
llvm-svn: 309798
Vitaly Buka [Wed, 2 Aug 2017 07:51:38 +0000 (07:51 +0000)]
[sanitizer_common] Fuchsia-specific implementation of SanitizerCoverage
Submitted on behalf of Roland McGrath.
Reviewers: kcc, eugenis, alekseyshl, vitalybuka
Reviewed By: kcc
Subscribers: filcab, vitalybuka, phosek, llvm-commits, kubamracek, mgorny
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D35866
llvm-svn: 309797
George Rimar [Wed, 2 Aug 2017 07:51:08 +0000 (07:51 +0000)]
[ELF] - Recommit r309252 "[ELF] - Fix missing relocation when linking executable with --unresolved-symbols=ignore-all"
With fix for undefined weak symbols in executable.
Original commit message:
This is PR32112. Previously when we linked executable with
--unresolved-symbols=ignore-all and undefined symbols, like:
_start:
callq und@PLT
we did not create relocations, though it looks in that case
we should delegate handling of such symbols to runtime linker,
hence should emit them. Patch fixes that.
Differential revision: https://reviews.llvm.org/D35724
llvm-svn: 309796
Ilya Biryukov [Wed, 2 Aug 2017 07:25:24 +0000 (07:25 +0000)]
Use VFS operations in FileManager::makeAbsolutePath.
Summary: It used to call into llvm::sys::fs::make_absolute.
Reviewers: akyrtzi, erikjv, bkramer, krasimir, klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D36155
llvm-svn: 309795
Yuka Takahashi [Wed, 2 Aug 2017 07:20:27 +0000 (07:20 +0000)]
[Bash-autocompletion] Add comment to test so that it is easier to fix
Summary:
clang/test/Driver/autocomplete.c is a test for --autocomplete, and this
test might break if people add/modify flags or HelpText. So I've add
comment for future developers so that they can fix this file according
to the change they had made.
Reviewers: v.g.vassilev, teemperor, ruiu
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D36209
llvm-svn: 309794
Craig Topper [Wed, 2 Aug 2017 06:35:15 +0000 (06:35 +0000)]
[InstCombine] Add test cases for 'or' and 'xor' to match the vector 'and' of 'sext' of 'cmp' test.
When the 'and' test was originally added it was intended to make sure we didn't change it to a sext of and of cmp. But since then the test was changed to expect it to be turned into 'select cmp1, sext cmp2, 0'. Then another optimization was added to turn the select into 'sext (and cmp1, cmp2)' which is exactly the transformation that was being blocked when the test case started.
Looks like 'or' gets optimized in a similar way, but not 'xor'.
llvm-svn: 309793
Dean Michael Berris [Wed, 2 Aug 2017 04:51:40 +0000 (04:51 +0000)]
[XRay][compiler-rt] Remove use of std::mutex and std::shared_ptr from global scope.
Summary:
This change attempts to remove all the dependencies we have on
std::mutex and any std::shared_ptr construction in global variables. We
instead use raw pointers to these objects, and construct them on the
heap. In cases where it's possible, we lazily initialize these pointers.
While we do not have a replacement for std::shared_ptr yet in
compiler-rt, we use this work-around to avoid having to statically
initialize the objects as globals. Subsequent changes should allow us to
completely remove our dependency on std::shared_ptr and instead have our
own implementation of the std::shared_ptr and std::weak_ptr semantics
(or completely rewrite the implementaton to not need these
standard-library provided abstractions).
Reviewers: dblaikie, kpw, pelikan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36078
llvm-svn: 309792