Marc-Andre Laperle [Tue, 10 Apr 2018 17:34:46 +0000 (17:34 +0000)]
[clangd] Use operator<< to prevent printers issues in Gtest
Summary:
It is possible that there will be two different instantiations of
the printer template for a given type and some tests could end up calling the
wrong (default) one. For example, it was seen in CodeCompleteTests.cpp when
printing CompletionItems that it would use the wrong printer because the default
is also instantiated in ClangdTests.cpp.
With this change, objects that were previously printed with a custom Printer now
get printed through the operator<< which is declared alongside the class.
This rule of the thumb should make it less error-prone.
Reviewers: simark, ilya-biryukov, sammccall
Reviewed By: simark, ilya-biryukov, sammccall
Subscribers: bkramer, hokein, sammccall, klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits
Differential Revision: https://reviews.llvm.org/D44764
llvm-svn: 329725
Aaron Smith [Tue, 10 Apr 2018 17:33:18 +0000 (17:33 +0000)]
[DebugInfoPDB] Add DIA implementations of findSymbolByRVA and findSymbolByAddr
llvm-svn: 329724
Jessica Paquette [Tue, 10 Apr 2018 17:32:12 +0000 (17:32 +0000)]
Fix test failure in arm64-no-section.ll
There was a missing not line. Also, tail call before ret -> call before ret.
llvm-svn: 329723
Jim Ingham [Tue, 10 Apr 2018 17:20:27 +0000 (17:20 +0000)]
Fix the Xcode build for the addition of OptionArgsParser.
llvm-svn: 329722
Julie Hockett [Tue, 10 Apr 2018 16:53:51 +0000 (16:53 +0000)]
[clang-tidy] Adding alias for anon namespaces in header (fuchsia module)
Adding alias to google-build-namespaces to the Fuchsia module (checks
for anonymous namespaces in headers).
Differential Revision: https://reviews.llvm.org/D45447
llvm-svn: 329720
Krzysztof Parzyszek [Tue, 10 Apr 2018 16:46:13 +0000 (16:46 +0000)]
[CodeGen] Fix printing bundles in MIR output
Delay printing the newline until after the opening bracket was
printed, e.g.
BUNDLE implicit-def $r1, implicit-def $r21, implicit $r1 {
renamable $r1 = S2_asr_i_r renamable $r1, 1
renamable $r21 = A2_tfrsi 0
}
instead of
BUNDLE implicit-def $r1, implicit-def $r21, implicit $r1
{ renamable $r1 = S2_asr_i_r renamable $r1, 1
renamable $r21 = A2_tfrsi 0
}
llvm-svn: 329719
Peter Collingbourne [Tue, 10 Apr 2018 16:19:30 +0000 (16:19 +0000)]
Revert r329611, "AArch64: Allow offsets to be folded into addresses with ELF."
Caused a build failure in check-tsan.
llvm-svn: 329718
Sam Clegg [Tue, 10 Apr 2018 16:12:49 +0000 (16:12 +0000)]
[WebAssembly] Add support for custom sections
Copy user-defined custom sections into the output, concatenating
sections with the same name.
Differential Revision: https://reviews.llvm.org/D45340
llvm-svn: 329717
Jessica Paquette [Tue, 10 Apr 2018 15:53:28 +0000 (15:53 +0000)]
Add missing nullptr check to AArch64MachObjectWriter::recordRelocation
There was missing nullptr check before a call to getSection() in
recordRelocation. This would result in a segfault in code like the attached
test.
This adds the missing check and a test which makes sure we get the expected
error output.
llvm-svn: 329716
Nicolai Haehnle [Tue, 10 Apr 2018 15:46:43 +0000 (15:46 +0000)]
AMDGPU/MC: Allow disassembling without symbol info
Summary:
We would like the UMR debugging tool[0] to be able to provide
disassembly for currently live waves based on plain memory
dumps, and we want to leverage the LLVM disassembler for this.
This mostly works, except that UMR clearly can't provide real
symbol info, so it wants to set DisInfo == nullptr.
[0] https://cgit.freedesktop.org/amd/umr/
Reviewers: arsenm, rampitec, artem.tamazov, dp
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D45477
Change-Id: Ibb2c5af2e66f2e100b4702fd81308e1932bc4ee6
llvm-svn: 329715
Andrew V. Tischenko [Tue, 10 Apr 2018 15:45:43 +0000 (15:45 +0000)]
I removed the failed test.
llvm-svn: 329714
Guansong Zhang [Tue, 10 Apr 2018 15:28:31 +0000 (15:28 +0000)]
[OpenMP] Remove extra warning when we build
Summary:
This one line change is to remove this warning message
"warning: integer conversion resulted in a change of sign"
Reviewers: grokos
Reviewed By: grokos
Subscribers: openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D45415
llvm-svn: 329713
Aaron Smith [Tue, 10 Apr 2018 15:25:04 +0000 (15:25 +0000)]
[PDB] Remove dead code and run clang format; NFC
llvm-svn: 329712
Andrea Di Biagio [Tue, 10 Apr 2018 15:14:15 +0000 (15:14 +0000)]
[llvm-mca] Simplify code. NFC
llvm-svn: 329711
Gabor Buella [Tue, 10 Apr 2018 15:03:03 +0000 (15:03 +0000)]
[X86] Disable SGX for Skylake Server - CPP test
Summary: Fix test case - corresponding to r329701
Reviewers: craig.topper, davezarzycki
Reviewed By: davezarzycki
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D45488
llvm-svn: 329710
Chad Rosier [Tue, 10 Apr 2018 14:57:13 +0000 (14:57 +0000)]
Fix spelling. NFC.
llvm-svn: 329709
Andrea Di Biagio [Tue, 10 Apr 2018 14:55:14 +0000 (14:55 +0000)]
[llvm-mca] Move the logic that prints dispatch unit statistics from BackendStatistics to its own view.
This patch moves the logic that collects and analyzes dispatch events to the
DispatchStatistics view.
Added flag -dispatch-stats to print statistics related to the dispatch logic.
llvm-svn: 329708
Aaron Smith [Tue, 10 Apr 2018 14:47:12 +0000 (14:47 +0000)]
[pdbutil] Print the checksum hex string when using the '-lines' option
llvm-svn: 329707
Kostya Kortchinsky [Tue, 10 Apr 2018 14:41:40 +0000 (14:41 +0000)]
[sanitizer] Allow BackgroundThread to not depend on StackDepot v2
Summary:
This is a redo of D45296.
It looks like the random stack-protector issues I was getting were coming from
my Android emulator, and updating everything all around and relaunching stuff
ended up making it go away.
I guess I'll have to see how it behaves on the bots.
Only additional change from the previous CL is some `const` were appropriate.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D45461
llvm-svn: 329706
Pavel Labath [Tue, 10 Apr 2018 14:23:41 +0000 (14:23 +0000)]
[CodeGen/Dwarf] Rename the "sizetype" synthetic type and add it to the accelerator table
Summary:
This type is created on-demand and used as the base type for array
ranges. Since it is "special", its construction did not go through the
createTypeDIE function and so it was never inserted into the accelerator
table, although it clearly belongs there.
I add an explicit addAccelType call to insert it into the table.
During review, we also decided to rename the type to something more
unique to avoid confusion in case the user has own "sizetype" type. The
new name for the type size __ARRAY_SIZE_TYPE__.
Reviewers: JDevlieghere, aprantl, dblaikie
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45445
llvm-svn: 329705
Simon Pilgrim [Tue, 10 Apr 2018 14:21:33 +0000 (14:21 +0000)]
Fix whitespace indentation. NFCI.
llvm-svn: 329704
Pavel Labath [Tue, 10 Apr 2018 14:11:53 +0000 (14:11 +0000)]
[Testing/Support] Make Failed() matcher work with abstract error types
Failed<ErrorInfoBase>() did not compile, because it was attempting to
create a copy of the Error object when passing it to the nested matcher,
which was not possible because ErrorInfoBase is abstract.
This commit fixes the problem by making sure we pass the ErrorInfo
object by reference, which also improves the handling of non-abstract
objects, as we avoid potentially slicing an object during the copy.
llvm-svn: 329703
Nico Weber [Tue, 10 Apr 2018 14:08:25 +0000 (14:08 +0000)]
Attempt to fix Windows build after r329698.
llvm-svn: 329702
Gabor Buella [Tue, 10 Apr 2018 14:04:21 +0000 (14:04 +0000)]
[X86] Disable SGX for Skylake Server
Reviewers: craig.topper, zvi, echristo
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D45058
llvm-svn: 329701
Gabor Buella [Tue, 10 Apr 2018 13:58:57 +0000 (13:58 +0000)]
[X86] Disable SGX for Skylake Server
Reviewers: craig.topper, zvi, echristo
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D45057
llvm-svn: 329700
Nico Weber [Tue, 10 Apr 2018 13:36:38 +0000 (13:36 +0000)]
Use llvm::sys::fs::real_path() in clang.
No expected behavior change.
https://reviews.llvm.org/D45165
llvm-svn: 329698
Nico Weber [Tue, 10 Apr 2018 13:33:45 +0000 (13:33 +0000)]
s/LLVM_ON_WIN32/_WIN32/, lldb
LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the
default macro instead of a reinvented one.
See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.
llvm-svn: 329697
Nico Weber [Tue, 10 Apr 2018 13:15:21 +0000 (13:15 +0000)]
s/LLVM_ON_WIN32/_WIN32/, lld
LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the
default macro instead of a reinvented one.
See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.
llvm-svn: 329696
Nico Weber [Tue, 10 Apr 2018 13:14:03 +0000 (13:14 +0000)]
s/LLVM_ON_WIN32/_WIN32/, clang-tools-extra
LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the
default macro instead of a reinvented one.
See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.
llvm-svn: 329695
Andrea Di Biagio [Tue, 10 Apr 2018 12:50:03 +0000 (12:50 +0000)]
[llvm-mca] Increase the default number of iterations to 100.
llvm-svn: 329694
Andrew V. Tischenko [Tue, 10 Apr 2018 12:17:01 +0000 (12:17 +0000)]
The test was fixed.
llvm-svn: 329693
David Green [Tue, 10 Apr 2018 11:37:21 +0000 (11:37 +0000)]
[DA] Improve alias checking in dependence analysis
Improve the alias analysis to account for cases where we
know that src/dst pairs cannot alias due to things like
TBAA. As we know they are noalias, we know no dependency
can occur. Also fixes issues around the size parameter
to AA being incorrect.
Differential Revision: https://reviews.llvm.org/D42381
llvm-svn: 329692
Francis Visoiu Mistrih [Tue, 10 Apr 2018 11:29:40 +0000 (11:29 +0000)]
[AArch64] Use FP to access the emergency spill slot
In the presence of variable-sized stack objects, we always picked the
base pointer when resolving frame indices if it was available.
This makes us hit an assert where we can't reach the emergency spill
slot if it's too far away from the base pointer. Since on AArch64 we
decide to place the emergency spill slot at the top of the frame, it
makes more sense to use FP to access it.
The changes here don't affect only emergency spill slots but all the
frame indices. The goal here is to try to choose between FP, BP and SP
so that we minimize the offset and avoid scavenging, or worse, asserting
when trying to access a slot allocated by the scavenger.
Previously discussed here: https://reviews.llvm.org/D40876.
Differential Revision: https://reviews.llvm.org/D45358
llvm-svn: 329691
Tim Renouf [Tue, 10 Apr 2018 11:25:15 +0000 (11:25 +0000)]
[AMDGPU] For OS type AMDPAL, fixed scratch on compute shader
Summary:
For OS type AMDPAL, the scratch descriptor is loaded from offset 0 of
the GIT, whose 32 bit pointer is in s0 (s8 for gfx9 merged shaders).
This commit fixes that to use offset 0x10 instead of offset 0 for a
compute shader, per the PAL ABI spec.
V2: Ensure s0 (s8 for gfx9 merged shader) is marked live-in when loading
scratch descriptor from GIT.
Reviewers: kzhuravl, nhaehnle, timcorringham
Subscribers: kzhuravl, wdng, yaxunl, t-tye, llvm-commits, dstuttard, nhaehnle, arsenm
Differential Revision: https://reviews.llvm.org/D44468
Change-Id: I93dffa647758e37f613bb5e0dfca840d82e6d26f
llvm-svn: 329690
Gabor Buella [Tue, 10 Apr 2018 11:20:05 +0000 (11:20 +0000)]
CodeGen tests - typo fixes NFC
llvm-svn: 329689
Simon Dardis [Tue, 10 Apr 2018 11:09:17 +0000 (11:09 +0000)]
[compiler-rt][asan][mips] UnXFAIL some consistently passing tests
llvm-svn: 329688
Tim Northover [Tue, 10 Apr 2018 11:04:29 +0000 (11:04 +0000)]
AArch64: diagnose unpredictable store-exclusive instructions
Much like any written register in load/store instructions, the status register
is not allowed to overlap with any others. So diagnose it like we already do
with the other cases.
llvm-svn: 329687
Andrea Di Biagio [Tue, 10 Apr 2018 10:49:41 +0000 (10:49 +0000)]
[X86][Broadwell] HWPort5 should not be added to BroadwellModelProcResources.
The BroadwellModelProcResources had an entry for HWPort5, which is a Haswell
resource, and not a Broadwell processor resource. That entry was added to the
Broadwell model because variable blends were consuming it.
This was clearly a typo (the resource name should have been BWPort5), which
unfortunately was never caught before. It was not reported as an error because
HWPort5 is a resource defined by the Haswell model. It has been found when
testing some code with llvm-mca: the list of resources in the resource pressure
view was odd.
This patch fixes the issue; now variable blend instructions consume 2 cycles on
BWPort5 instead of HWPort5. This is enough to get rid of the extra (spurious)
entry in the BroadWellModelProcResources table.
llvm-svn: 329686
Sam McCall [Tue, 10 Apr 2018 10:36:46 +0000 (10:36 +0000)]
[Tooling] fix UB when interpolating compile commands with an empty index
llvm-svn: 329685
Andrew V. Tischenko [Tue, 10 Apr 2018 10:34:13 +0000 (10:34 +0000)]
-ftime-report switch support in Clang.
The current support of the feature produces only 2 lines in report:
-Some general Code Generation Time;
-Total time of Backend Consumer actions.
This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc.
Differential Revision: https://reviews.llvm.org/D43578
llvm-svn: 329684
Alexandre Ganea [Tue, 10 Apr 2018 10:26:23 +0000 (10:26 +0000)]
[llvm-ar] Temporarily make the tool case detection test Windows-only to fix the build (introduced in r329658)
llvm-svn: 329683
Pavel Labath [Tue, 10 Apr 2018 10:07:22 +0000 (10:07 +0000)]
Args: replace isprint8 usage with isprint
It looks like we introduced isprint8 way back in r169417 to be used on
getopt's short_options, which we sometimes set to values which are out
of range for normal chars to indicate options with no short form.
However, this is not how the function is used in the Args class, where
we explicitly process a string character by character.
This removes the last external dependency from the Args class.
llvm-svn: 329682
Sander de Smalen [Tue, 10 Apr 2018 10:03:13 +0000 (10:03 +0000)]
[AArch64][SVE] Asm: Add support for unpredicated LSL/LSR (shift by immediate) instructions.
Reviewers: rengolin, fhahn, javed.absar, SjoerdMeijer, huntergr, t.p.northover, echristo, evandro
Reviewed By: rengolin, fhahn
Subscribers: tschuett, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D45371
llvm-svn: 329681
Andrea Di Biagio [Tue, 10 Apr 2018 09:55:33 +0000 (09:55 +0000)]
Reapply "[llvm-mca] Do not separate iterations with a newline in the timeline view."
This reapplies r329403 with a fix for the floating point rounding issue.
llvm-svn: 329680
Pavel Labath [Tue, 10 Apr 2018 09:48:05 +0000 (09:48 +0000)]
Move OptionElementVector helper structs from Args to Options
These are not used anywhere in the Args class. They should have been
moved as a part of r327110 (Moving Option parsing from Args to Options),
but I did not notice them then.
This does not affect the layering in any way, but in makes sense for the
structs to be defined in the near the code that uses them.
llvm-svn: 329679
George Rimar [Tue, 10 Apr 2018 09:44:44 +0000 (09:44 +0000)]
[ELF] - Do not crash when trying to order --defsym/linker script symbols.
Currently, we crash because File is null for
such symbols.
Differential revision: https://reviews.llvm.org/D45440
llvm-svn: 329678
Pavel Labath [Tue, 10 Apr 2018 09:03:59 +0000 (09:03 +0000)]
Move Args::StringTo*** functions to a new OptionArgParser class
Summary:
The idea behind this is to move the functionality which depend on other lldb
classes into a separate class. This way, the Args class can be turned
into a lightweight arc+argv wrapper and moved into the lower lldb
layers.
Reviewers: jingham, zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D44306
llvm-svn: 329677
Clement Courbet [Tue, 10 Apr 2018 08:43:46 +0000 (08:43 +0000)]
[MC][TableGen] Fix r329675.
Caught by bots with -Wmissing-braces.
llvm-svn: 329676
Clement Courbet [Tue, 10 Apr 2018 08:16:37 +0000 (08:16 +0000)]
[MC][TableGen] Add optional libpfm counter names for ProcResUnits.
Summary:
Subtargets can define the libpfm counter names that can be used to
measure cycles and uops issued on ProcResUnits.
This allows making llvm-exegesis available on more targets.
Fixes PR36984.
Reviewers: gchatelet, RKSimon, andreadb, craig.topper
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45360
llvm-svn: 329675
Sander de Smalen [Tue, 10 Apr 2018 07:01:53 +0000 (07:01 +0000)]
[AArch64][SVE] Asm: Add support for SVE INDEX instructions.
Reviewers: rengolin, fhahn, javed.absar, SjoerdMeijer, huntergr, t.p.northover, echristo, evandro
Reviewed By: rengolin, fhahn
Subscribers: tschuett, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D45370
llvm-svn: 329674
Chandler Carruth [Tue, 10 Apr 2018 06:40:51 +0000 (06:40 +0000)]
[x86] Model the direction flag (DF) separately from the rest of EFLAGS.
This cleans up a number of operations that only claimed te use EFLAGS
due to using DF. But no instructions which we think of us setting EFLAGS
actually modify DF (other than things like popf) and so this needlessly
creates uses of EFLAGS that aren't really there.
In fact, DF is so restrictive it is pretty easy to model. Only STD, CLD,
and the whole-flags writes (WRFLAGS and POPF) need to model this.
I've also somewhat cleaned up some of the flag management instruction
definitions to be in the correct .td file.
Adding this extra register also uncovered a failure to use the correct
datatype to hold X86 registers, and I've corrected that as necessary
here.
Differential Revision: https://reviews.llvm.org/D45154
llvm-svn: 329673
Petr Hosek [Tue, 10 Apr 2018 05:54:36 +0000 (05:54 +0000)]
[sanitizer] Enable threads for libc++ build used by the symbolizer
Disabling threads makes <atomic> unusable, but this is needed by LLVM
libraries that are dependencies of the symbolizer.
Differential Revision: https://reviews.llvm.org/D45424
llvm-svn: 329672
Akira Hatanaka [Tue, 10 Apr 2018 05:15:01 +0000 (05:15 +0000)]
[ExprConstant] Use an AST node and a version number as a key to create
an APValue and retrieve it from map Temporaries.
The version number is needed when a single AST node is visited multiple
times and is used to create APValues that are required to be distinct
from each other (for example, MaterializeTemporaryExprs in default
arguments and VarDecls in loops).
rdar://problem/
36505742
Differential Revision: https://reviews.llvm.org/D42776
llvm-svn: 329671
Craig Topper [Tue, 10 Apr 2018 03:44:15 +0000 (03:44 +0000)]
[X86] Prevent folding loads with 64-bit ANDs with immediates that fit in 32-bits.
Prefer to use the 32-bit AND with immediate instead.
Primarily I'm doing this to ensure that immediates created by shrinkAndImmediate will always get absorbed into the AND. But I do believe this would be a reduction in the number of uops that need to execute. Ideally we should shrink the 'and' and the 'load' during DAG combine to re-enable the fold.
Fixes PR37063.
llvm-svn: 329667
Michael Zolotukhin [Tue, 10 Apr 2018 03:40:29 +0000 (03:40 +0000)]
Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
This reverts r329661. Bots are still unhappy.
llvm-svn: 329666
Billy Robert O'Neal III [Tue, 10 Apr 2018 03:04:07 +0000 (03:04 +0000)]
[libcxx] [test] Use the correct type from strlen. Include correct header.
llvm-svn: 329665
Michael Zolotukhin [Tue, 10 Apr 2018 02:16:45 +0000 (02:16 +0000)]
Revert "Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading.""
This reapplies commit r329644.
llvm-svn: 329661
Michael Zolotukhin [Tue, 10 Apr 2018 02:16:29 +0000 (02:16 +0000)]
[SSAUpdaterBulk] Handle CFG with unreachable from entry blocks.
llvm-svn: 329660
Alexandre Ganea [Tue, 10 Apr 2018 01:58:45 +0000 (01:58 +0000)]
[DebugInfo][COFF] Fix reading variable-length encoded records
While reading Codeview records which contain variable-length encoded integers,
such as LF_BCLASS, LF_ENUMERATE, LF_MEMBER, LF_VBCLASS or LF_IVBCLASS,
the record's size would be improperly calculated in cases where the value was
indeed of a variable length (>= LF_NUMERIC). This caused a bad alignement on
the next record, which would/might crash later on.
Differential Revision: https://reviews.llvm.org/D45104
llvm-svn: 329659
Alexandre Ganea [Tue, 10 Apr 2018 01:50:25 +0000 (01:50 +0000)]
[llvm-ar] Fix lib.exe detection when running within MSVC toolchain
Differential Revision: https://reviews.llvm.org/D44808
llvm-svn: 329658
Chandler Carruth [Tue, 10 Apr 2018 01:41:17 +0000 (01:41 +0000)]
[x86] Introduce a pass to begin more systematically fixing PR36028 and similar issues.
The key idea is to lower COPY nodes populating EFLAGS by scanning the
uses of EFLAGS and introducing dedicated code to preserve the necessary
state in a GPR. In the vast majority of cases, these uses are cmovCC and
jCC instructions. For such cases, we can very easily save and restore
the necessary information by simply inserting a setCC into a GPR where
the original flags are live, and then testing that GPR directly to feed
the cmov or conditional branch.
However, things are a bit more tricky if arithmetic is using the flags.
This patch handles the vast majority of cases that seem to come up in
practice: adc, adcx, adox, rcl, and rcr; all without taking advantage of
partially preserved EFLAGS as LLVM doesn't currently model that at all.
There are a large number of operations that techinaclly observe EFLAGS
currently but shouldn't in this case -- they typically are using DF.
Currently, they will not be handled by this approach. However, I have
never seen this issue come up in practice. It is already pretty rare to
have these patterns come up in practical code with LLVM. I had to resort
to writing MIR tests to cover most of the logic in this pass already.
I suspect even with its current amount of coverage of arithmetic users
of EFLAGS it will be a significant improvement over the current use of
pushf/popf. It will also produce substantially faster code in most of
the common patterns.
This patch also removes all of the old lowering for EFLAGS copies, and
the hack that forced us to use a frame pointer when EFLAGS copies were
found anywhere in a function so that the dynamic stack adjustment wasn't
a problem. None of this is needed as we now lower all of these copies
directly in MI and without require stack adjustments.
Lots of thanks to Reid who came up with several aspects of this
approach, and Craig who helped me work out a couple of things tripping
me up while working on this.
Differential Revision: https://reviews.llvm.org/D45146
llvm-svn: 329657
Vlad Tsyrklevich [Tue, 10 Apr 2018 01:31:01 +0000 (01:31 +0000)]
ShadowCallStack/x86_64: Ignore pseudo-machine instructions
llvm-svn: 329656
Michael Kruse [Tue, 10 Apr 2018 01:20:51 +0000 (01:20 +0000)]
[CodeGen] Allow undefined loads in statement instances outside context.
A check in assert-builds was meant to verify that a load provides a
value in all statement instances (i.e. its domain). The domain is
commonly gist'ed within the parameter context to contain fewer
constraints. However, statement instances outside the context are
no valid executions, hence the value provided can be undefined.
Refine the check for valid loads to only needed to be defined within
the SCoP context.
In addition, the JSONImporter had to be changed to allow importing
access relations that are broader than the current access relation,
but still defined over all statement instances.
This should fix the compiler crash in test-suite's oggenc of the
-polly-process-unprofitable buildbot.
llvm-svn: 329655
Michael Kruse [Tue, 10 Apr 2018 01:20:47 +0000 (01:20 +0000)]
[CodeGen] Convert BlockGenerator::generateScalarLoads to isl++. NFC.
llvm-svn: 329654
Michael Kruse [Tue, 10 Apr 2018 01:20:41 +0000 (01:20 +0000)]
[ScopInfo] Avoid iterator invalidation.
Commit r329640 introduced the removal of all MemoryAccesses of a Scop.
It accidentally continued iterating over a vector whose iterators
have been invalidated by a MemoryAccess removal.
Make a copy of the MemoryAccesses to remove to iterate over while
removing them.
llvm-svn: 329653
George Burgess IV [Tue, 10 Apr 2018 01:11:26 +0000 (01:11 +0000)]
[AST] Attempt to fix buildbot warnings + appease MSVC; NFCI
GCC 4.8.4 on a bot was warning about `ArgPassingKind` not fitting in
`ArgPassingRestrictions`, which appears to be incorrect, since
`ArgPassingKind` only has three potential values:
"warning: 'clang::RecordDecl::ArgPassingRestrictions' is too small to
hold all values of 'enum clang::RecordDecl::ArgPassingKind'"
Additionally, I remember hearing (though my knowledge may be outdated)
that MSVC won't merge adjacent bitfields if their types are different.
Try to fix both issues by turning these into `uint8_t`s.
llvm-svn: 329652
Vitaly Buka [Tue, 10 Apr 2018 00:53:16 +0000 (00:53 +0000)]
Object: Don't mark alias unconditionally defined
Summary:
Can't remove EmitAssignment override as llvm/test/Object/X86/nm-bitcodeweak.test
expects this behavior.
Reviewers: pcc, espindola
Subscribers: mehdi_amini, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D44596
llvm-svn: 329651
Michael Zolotukhin [Tue, 10 Apr 2018 00:42:43 +0000 (00:42 +0000)]
Revert "[PR16756] Use SSAUpdaterBulk in JumpThreading."
This reverts commit r329644.
llvm-svn: 329650
Hideki Saito [Tue, 10 Apr 2018 00:38:36 +0000 (00:38 +0000)]
Fix for the buildbot failure. Now-unused private field TTI deleted.
llvm-svn: 329649
Fangrui Song [Tue, 10 Apr 2018 00:12:28 +0000 (00:12 +0000)]
[CachePruning] Fix comment about ext4 per-directory file limit. NFC
There is a limit on number of subdirectories if dir_nlinks is not
enabled (31998), but per-directory number of files is not limited.
llvm-svn: 329648
Jan Vesely [Tue, 10 Apr 2018 00:11:58 +0000 (00:11 +0000)]
hypot: Port from amd builtins
v2: Fix whitespace errors
Use only subnormal path.
Passes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>
llvm-svn: 329647
Alexandre Ganea [Tue, 10 Apr 2018 00:09:15 +0000 (00:09 +0000)]
Fix line endings (CR/LF -> LF) introduced by rL329613
reviewer: zturner
llvm-svn: 329646
Hideki Saito [Mon, 9 Apr 2018 23:45:40 +0000 (23:45 +0000)]
[NFC][LV] Move InterleaveInfo from Legal to CostModel
Summary:
Another clean up, following D43208.
Interleaved memory access analysis/optimization has nothing to do with vectorization legality. It doesn't really belong there. On the other hand, cost model certainly has to know about it.
In principle, vectorization should proceed like Legality ==> Optimization ==> CostModel ==> CodeGen, and this change just does that,
by moving the interleaved access analysis/decision out of Legal, and run it just before CostModel object is created.
After this, I can move LoopVectorizationLegality and Hints/Requirements classes into it's own header file, making it shareable within Transform tree. I have the patch already but I don't want to mix with this change. Eventual goal is to move to Analysis tree, but I first need to move RecurrenceDescriptor/InductionDescriptor from Transform/Util/LoopUtil.* to Analysis.
Reviewers: rengolin, hfinkel, mkuper, dcaballe, sguggill, fhahn, aemerson
Reviewed By: rengolin
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45072
llvm-svn: 329645
Michael Zolotukhin [Mon, 9 Apr 2018 23:37:37 +0000 (23:37 +0000)]
[PR16756] Use SSAUpdaterBulk in JumpThreading.
Summary:
SSAUpdater is a bottleneck in JumpThreading, and this patch improves the
situation by using SSAUpdaterBulk instead.
Compile time impact: no noticable changes on CTMark, a big improvement
on the test from PR16756.
Reviewers: dberlin, davide, MatzeB
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D44282
llvm-svn: 329644
Michael Zolotukhin [Mon, 9 Apr 2018 23:37:20 +0000 (23:37 +0000)]
[PR16756] Add SSAUpdaterBulk.
Summary:
SSAUpdater is a bottleneck in a number of passes, and one of the reasons
is that it performs a lot of unnecessary computations (DT/IDF) over and
over again. This patch adds a new SSAUpdaterBulk that uses existing DT
and avoids recomputing IDF when possible.
Reviewers: dberlin, davide, MatzeB
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D44282
llvm-svn: 329643
Rui Ueyama [Mon, 9 Apr 2018 23:30:21 +0000 (23:30 +0000)]
Add a test for nested --start-group.
llvm-svn: 329642
Michael Kruse [Mon, 9 Apr 2018 23:13:05 +0000 (23:13 +0000)]
[ScopInfo] Completely remove MemoryAccesses when their parent statement is removed.
Removing a statement left its MemoryAccesses in some lists and maps of
the SCoP. Which lists depends on at which phase of the SCoP
construction the statement is deleted. Follow-up passes could still see
the already deleted MemoryAccesses by iterating through these
lists/maps, resulting in an access violation.
When removing a ScopStmt, also remove all its MemoryAccesses by using
the same mechnism that removes a MemoryAccess.
llvm-svn: 329640
Michael Kruse [Mon, 9 Apr 2018 23:13:01 +0000 (23:13 +0000)]
[ScopInfo] Actually remove from list.
std::remove, despite its name, does not remove elements from a list, but
only moves them to the end of a list. Call erase() to shorten the
vector to the remaining elements.
Test case included in next commit.
llvm-svn: 329639
George Burgess IV [Mon, 9 Apr 2018 23:09:27 +0000 (23:09 +0000)]
[MemorySSA] remove cruft; NFC.
The caching walker used to hold its own caches, which made its `reset()`
function meaningful. Since caching has been moved out of it, there's no
reason to continue to have these cache-related methods.
Similarly, the EXPENSIVE_CHECKS block that's getting removed used to
rerun the query with caching disabled. Since that's how we always do
queries now, it's redundant.
llvm-svn: 329638
Rui Ueyama [Mon, 9 Apr 2018 23:05:48 +0000 (23:05 +0000)]
Add --warn-backrefs to maintain compatibility with other linkers
I'm proposing a new command line flag, --warn-backrefs in this patch.
The flag and the feature proposed below don't exist in GNU linkers
nor the current lld.
--warn-backrefs is an option to detect reverse or cyclic dependencies
between static archives, and it can be used to keep your program
compatible with GNU linkers after you switch to lld. I'll explain the
feature and why you may find it useful below.
lld's symbol resolution semantics is more relaxed than traditional
Unix linkers. Therefore,
ld.lld foo.a bar.o
succeeds even if bar.o contains an undefined symbol that have to be
resolved by some object file in foo.a. Traditional Unix linkers
don't allow this kind of backward reference, as they visit each
file only once from left to right in the command line while
resolving all undefined symbol at the moment of visiting.
In the above case, since there's no undefined symbol when a linker
visits foo.a, no files are pulled out from foo.a, and because the
linker forgets about foo.a after visiting, it can't resolve
undefined symbols that could have been resolved otherwise.
That lld accepts more relaxed form means (besides it makes more
sense) that you can accidentally write a command line or a build
file that works only with lld, even if you have a plan to
distribute it to wider users who may be using GNU linkers. With
--check-library-dependency, you can detect a library order that
doesn't work with other Unix linkers.
The option is also useful to detect cyclic dependencies between
static archives. Again, lld accepts
ld.lld foo.a bar.a
even if foo.a and bar.a depend on each other. With --warn-backrefs
it is handled as an error.
Here is how the option works. We assign a group ID to each file. A
file with a smaller group ID can pull out object files from an
archive file with an equal or greater group ID. Otherwise, it is a
reverse dependency and an error.
A file outside --{start,end}-group gets a fresh ID when
instantiated. All files within the same --{start,end}-group get the
same group ID. E.g.
ld.lld A B --start-group C D --end-group E
A and B form group 0, C, D and their member object files form group
1, and E forms group 2. I think that you can see how this group
assignment rule simulates the traditional linker's semantics.
Differential Revision: https://reviews.llvm.org/D45195
llvm-svn: 329636
Akira Hatanaka [Mon, 9 Apr 2018 22:48:22 +0000 (22:48 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.
This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.
This reapplies r329617. r329617 didn't specify the underlying type for
enum ArgPassingKind, which caused regression tests to fail on a windows
bot.
rdar://problem/
39194693
Differential Revision: https://reviews.llvm.org/D45384
llvm-svn: 329635
Vitaly Buka [Mon, 9 Apr 2018 22:46:40 +0000 (22:46 +0000)]
GetRandom / OpenBSD, using getentropy to get high quality randomness
Summary:
- getentropy presence since late 2014, safe to use.
- guarantees to delivers good random data up to 256 bytes.
- fall back to /dev/urandom as long the buffer is correct.
Patch by David CARLIER
Reviewers: kubamracek, vitalybuka
Reviewed By: vitalybuka
Subscribers: cryptoad, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D44866
llvm-svn: 329633
George Burgess IV [Mon, 9 Apr 2018 22:45:14 +0000 (22:45 +0000)]
[MemorySSA] Remove redundant assert; NFC
The `if (!Def && !Use) return nullptr;` right above this assert sort of
defeats the purpose.
llvm-svn: 329632
Vitaly Buka [Mon, 9 Apr 2018 22:38:26 +0000 (22:38 +0000)]
libFuzzer, OpenBSD support
Summary:
- Enabling libfuzzer on OpenBSD
- OpenBSD can t support asan, msan ... the tests can t be run.
Patch by David CARLIER
Reviewers: eugenis, phosek, vitalybuka
Reviewed By: vitalybuka
Subscribers: srhines, mgorny, krytarowski, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D44877
llvm-svn: 329631
Eugene Zelenko [Mon, 9 Apr 2018 22:14:10 +0000 (22:14 +0000)]
[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
llvm-svn: 329630
Vlad Tsyrklevich [Mon, 9 Apr 2018 22:11:28 +0000 (22:11 +0000)]
[CFI] Disable CFI checks for __cxa_decrement_exception_refcount
Summary:
exception_header->exceptionDestructor is a void(*)(void*) function
pointer; however, it can point to destructors like std::
exception::~exception that don't match that type signature.
Reviewers: pcc, vitalybuka
Reviewed By: vitalybuka
Subscribers: kcc, christof, cfe-commits
Differential Revision: https://reviews.llvm.org/D45455
llvm-svn: 329629
Eugene Zelenko [Mon, 9 Apr 2018 21:54:38 +0000 (21:54 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 329628
Akira Hatanaka [Mon, 9 Apr 2018 21:47:58 +0000 (21:47 +0000)]
Revert "[ObjC++] Never pass structs that transitively contain __weak fields in"
This reverts commit r329617. It broke a windows bot.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/16372/steps/test/logs/stdio
llvm-svn: 329627
Simon Pilgrim [Mon, 9 Apr 2018 21:46:57 +0000 (21:46 +0000)]
[X86] Added missing AAD/AAM immediate schedule tests
Added some more TODOs for missing instructions
llvm-svn: 329626
Daniel Sanders [Mon, 9 Apr 2018 21:10:09 +0000 (21:10 +0000)]
[globalisel][legalizerinfo] Add support for the Lower action in getActionDefinitionsBuilder() and use it in AArch64.
Lower is slightly odd. It often doesn't change the type but the lowerings
do use the new type to decide what code to create. Treat it like a mutation
but provide convenience functions that re-use the existing type.
Re-uses the existing tests:
test/CodeGen/AArch64/GlobalISel/legalize-rem.mir
test/CodeGen/AArch64/GlobalISel//legalize-mul.mir
test/CodeGen/AArch64/GlobalISel//legalize-cmpxchg-with-success.mir
llvm-svn: 329623
Matt Arsenault [Mon, 9 Apr 2018 21:04:30 +0000 (21:04 +0000)]
Fix printing of stack id in MachineFrameInfo
uint8_t is printed as a char, so it needs to be
casted to do the right thing.
llvm-svn: 329622
Zhaoshi Zheng [Mon, 9 Apr 2018 20:55:37 +0000 (20:55 +0000)]
[MemorySSAUpdater] Mark Phi users of a node being moved as non-optimize
Fix PR36484, as suggested:
<quote>
during moves, mark the direct users of the erased things that were phis as "not to be optimized"
<quote>
llvm-svn: 329621
Konstantin Zhuravlyov [Mon, 9 Apr 2018 20:47:22 +0000 (20:47 +0000)]
AMDGPU: Remove max_scratch_backing_memory_byte_size from kernel header
1. Remove max_scratch_backing_memory_byte_size from kernel header
2. Make it a reserved field
3. Ignore it while parsing assembly for backwards compatibility
4. Bump up minor version of kernel header
Differential Revision: https://reviews.llvm.org/D45452
llvm-svn: 329620
Casey Carter [Mon, 9 Apr 2018 20:41:45 +0000 (20:41 +0000)]
[test] [NFC] cleanup aligned_storage test
* `s/"" )/"")/g`
* Don't redundantly test triviality for `TEST_STD_VER > 17`
llvm-svn: 329618
Akira Hatanaka [Mon, 9 Apr 2018 20:39:47 +0000 (20:39 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.
This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.
rdar://problem/
39194693
llvm-svn: 329617
Craig Topper [Mon, 9 Apr 2018 20:37:14 +0000 (20:37 +0000)]
[X86] Don't use Lower512IntUnary to split bitcasts with v32i16/v64i8 types on targets without AVX512BW.
LowerIntUnary as its name says has an assert for integer types. But for the bitcast case one side might be an FP type.
Rather than making sure the function really works for fp types and renaming it. Just do really basic splitting directly. The LowerIntUnary has the advantage that it can peek through BUILD_VECTOR because every other call is during Lowering. But these calls are during legalization and will be followed by a DAG combine round.
Revert some change to LowerVectorIntUnary that were originally made just to make these two calls work even in pure integer cases.
This was found purely by compiling the avx512f-builtins.c test from clang so I've copied over the offending function from that.
llvm-svn: 329616
Peter Collingbourne [Mon, 9 Apr 2018 20:18:10 +0000 (20:18 +0000)]
shadowcallstack: Make runtime tests compatible with aarch64.
Differential Revision: https://reviews.llvm.org/D45303
llvm-svn: 329614
Alexandre Ganea [Mon, 9 Apr 2018 20:17:56 +0000 (20:17 +0000)]
[Debuginfo][COFF] Minimal serialization support for precompiled types records
This change adds support for the LF_PRECOMP and LF_ENDPRECOMP records required
to read/write Microsoft precompiled types .objs.
See https://en.wikipedia.org/wiki/Precompiled_header#Microsoft_Visual_C_and_C++
This also adds handling for the .debug$P section, which is actually a .debug$T
section in disguise, found only in precompiled .objs.
Differential Revision: https://reviews.llvm.org/D45283
llvm-svn: 329613
Vitaly Buka [Mon, 9 Apr 2018 20:10:29 +0000 (20:10 +0000)]
asan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address
Summary:
Right now to disable -fsanitize=kernel-address instrumentation, one needs to use no_sanitize("kernel-address"). Make either no_sanitize("address") or no_sanitize("kernel-address") disable both ASan and KASan instrumentation. Also remove redundant test.
Patch by Andrey Konovalov
Reviewers: eugenis, kcc, glider, dvyukov, vitalybuka
Reviewed By: eugenis, vitalybuka
Differential Revision: https://reviews.llvm.org/D44981
llvm-svn: 329612
Peter Collingbourne [Mon, 9 Apr 2018 19:59:57 +0000 (19:59 +0000)]
AArch64: Allow offsets to be folded into addresses with ELF.
This is a code size win in code that takes offseted addresses
frequently, such as C++ constructors that typically need to compute
an offseted address of a vtable. It reduces the size of Chromium for
Android's .text section by 46KB, or 56KB with ThinLTO (which exposes
more opportunities to use a direct access rather than a GOT access).
Because the addend range is limited in COFF and Mach-O, this is
enabled for ELF only.
Differential Revision: https://reviews.llvm.org/D45199
llvm-svn: 329611