Commit Graph

287388 Commits

Author SHA1 Message Date
Aaron Ballman fbedb97dd2 Allow [[maybe_unused]] on static data members; these are considered variables and the attribute should appertain to them.
Patch by S. B. Tam.

llvm-svn: 329904
2018-04-12 12:21:41 +00:00
Simon Pilgrim 0cd0fbd8c5 [X86] Remove system/control schedule itineraries (PR37093)
llvm-svn: 329903
2018-04-12 12:09:24 +00:00
Roman Lebedev 4d37af003f [clang-tidy] readability-function-size: add VariableThreshold param.
Summary:
Pretty straight-forward, just count all the variable declarations in the function's body, and if more than the configured threshold - do complain.

Note that this continues perverse practice of disabling the new option by default.
I'm not certain where is the balance point between not being too noisy, and actually enforcing the good practice.
If we really want to not disable this by default, but also to not cause too many new warnings, we could default to 50 or so.
But that is a lot of variables too...

I was able to find one coding style referencing variable count:
  - https://www.kernel.org/doc/html/v4.15/process/coding-style.html#functions

    > Another measure of the function is the number of local variables. They shouldn’t exceed 5-10, or you’re doing something wrong.

Reviewers: hokein, xazax.hun, JonasToth, aaron.ballman, alexfh

Reviewed By: aaron.ballman

Subscribers: kimgr, Eugene.Zelenko, rnkovacs, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D44602

llvm-svn: 329902
2018-04-12 12:06:42 +00:00
Roman Lebedev 53271ba1d2 [InstCombine][NFC]: Add tests: foldSelectICmpAndAnd(): and is commutative
Summary:
The fold added in D45108 did not account for the fact that
the and instruction is commutative, and if the mask is a variable,
the mask variable and the fold variable may be swapped.

I have noticed this by accident when looking into [[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]]

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D45538

llvm-svn: 329901
2018-04-12 12:04:57 +00:00
Sander de Smalen 650234ba36 [AArch64][AsmParser] Make parse function for VectorLists generic to other vector types.
Summary:
Added 'RegisterKind' to the VectorListOp structure, so that this operand 
type can be reused for SVE vector lists in a later patch. It also
refactors the 'tryParseVectorList' function so it can be used directly
in the ParserMethod of an operand. The parsing can now parse multiple 
kinds of vectors and recover if there is no match.

This is patch [3/6] in a series to add assembler/disassembler support for
SVE's contiguous ST1 (scalar+imm) instructions.

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: rengolin

Subscribers: kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D45429

llvm-svn: 329900
2018-04-12 11:40:52 +00:00
Shiva Chen b48b027d05 [RISCV] Change function alignment to 4 bytes, and 2 bytes for RVC
Summary:

According RISC-V ELF psABI specification, base RV32 and RV64 ISAs only
allow 32-bit instruction alignment, but instruction allow to be aligned
to 16-bit boundaries for C-extension.

So we just align to 4 bytes and 2 bytes for C-extension is enough.

Reviewers: asb, apazos

Differential Revision: https://reviews.llvm.org/D45560

Patch by Kito Cheng.

llvm-svn: 329899
2018-04-12 11:30:59 +00:00
Simon Pilgrim 69e0e8e3d4 [X86] Remove CMOV/SETCC schedule itineraries (PR37093)
llvm-svn: 329898
2018-04-12 11:01:40 +00:00
Jonas Devlieghere a8d916aad0 Revert "Don't assume backing thread shares protocol ID."
This reverts r329891 because the test case is timing out on linux:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/21834

llvm-svn: 329897
2018-04-12 10:51:52 +00:00
Simon Pilgrim 10e3bdaaa8 [X86] Remove MMX/3DNow schedule itineraries (PR37093)
llvm-svn: 329896
2018-04-12 10:49:57 +00:00
Andrea Di Biagio 3e64644de8 [llvm-mca] Removed unused argument from cycleEvent. NFC
llvm-svn: 329895
2018-04-12 10:49:40 +00:00
Benjamin Kramer 8d2acfd8e8 [clang-apply-replacements] Always initialize FormatStyle.
The cleanup logic reads from this for cleanups even if reformatting is
not requested.

Found by msan.

llvm-svn: 329894
2018-04-12 10:35:24 +00:00
Simon Pilgrim 32d368147f [X86] Remove X87 schedule itineraries (PR37093)
First of a number of commits to remove x86 schedule itineraries entirely - approved off-line with @craig.topper

llvm-svn: 329893
2018-04-12 10:27:37 +00:00
Roman Lebedev 34812c0d0d [clang-apply-replacements] Don't forget to link to clangToolingRefactor
Fixes build:

[1/3] Linking CXX shared library lib/libclangApplyReplacements.so.7svn
FAILED: lib/libclangApplyReplacements.so.7svn
<...>
/usr/local/bin/ld.lld: error: undefined symbol: clang::tooling::AtomicChange::replace(clang::SourceManager const&, clang::SourceLocation, unsigned int, llvm::StringRef)
>>> referenced by ApplyReplacements.cpp
>>>               tools/clang/tools/extra/clang-apply-replacements/CMakeFiles/clangApplyReplacements.dir/lib/Tooling/ApplyReplacements.cpp.o:(clang::replace::mergeAndDeduplicate(std::vector<clang::tooling::TranslationUnitReplacements, std::allocator<clang::tooling::TranslationUnitReplacements> > const&, std::vector<clang::tooling::TranslationUnitDiagnostics, std::allocator<clang::tooling::TranslationUnitDiagnostics> > const&, llvm::DenseMap<clang::FileEntry const*, std::vector<clang::tooling::AtomicChange, std::allocator<clang::tooling::AtomicChange> >, llvm::DenseMapInfo<clang::FileEntry const*>, llvm::detail::DenseMapPair<clang::FileEntry const*, std::vector<clang::tooling::AtomicChange, std::allocator<clang::tooling::AtomicChange> > > >&, clang::SourceManager&))

/usr/local/bin/ld.lld: error: undefined symbol: clang::tooling::applyAtomicChanges[abi:cxx11](llvm::StringRef, llvm::StringRef, llvm::ArrayRef<clang::tooling::AtomicChange>, clang::tooling::ApplyChangesSpec const&)
>>> referenced by ApplyReplacements.cpp
>>>               tools/clang/tools/extra/clang-apply-replacements/CMakeFiles/clangApplyReplacements.dir/lib/Tooling/ApplyReplacements.cpp.o:(clang::replace::applyChanges[abi:cxx11](llvm::StringRef, std::vector<clang::tooling::AtomicChange, std::allocator<clang::tooling::AtomicChange> > const&, clang::tooling::ApplyChangesSpec const&, clang::DiagnosticsEngine&))
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Refs. D43764, rL329813

llvm-svn: 329892
2018-04-12 10:01:20 +00:00
Jonas Devlieghere 0045c72f9c Don't assume backing thread shares protocol ID.
When we're dealing with virtual (memory) threads created by the OS
plugins, there's no guarantee that the real thread and the backing
thread share a protocol ID. Instead, we should iterate over the memory
threads to find the virtual thread that is backed by the current real
thread.

Differential revision: https://reviews.llvm.org/D45497

rdar://36485830

llvm-svn: 329891
2018-04-12 09:58:20 +00:00
Jonas Devlieghere 4955c77c2d [dotest] Fix syntax error and typo.
Python uses `elif` rather than `else if`. Fixes r329889.

llvm-svn: 329890
2018-04-12 09:35:17 +00:00
Jonas Devlieghere 1bf22e7722 [dotest] Use in-tree dsymutil on Darwin
Summary:
With the upstream implementation of dsymutil containing almost all
functionality from the one shipped with Xcode, we want to use the
in-tree version for running the test suite.

This will also allow us to re-enable TestUnicodeSymbols which was
failing because of the discrepancy in how Unicode symbols were hashed in
lldb and older versions of dsymutil.

Reviewers: aprantl, davide, jingham, labath

Subscribers: mgorny, llvm-commits, lldb-commits

Differential Revision: https://reviews.llvm.org/D45518

llvm-svn: 329889
2018-04-12 09:25:32 +00:00
Petar Jovanovic 984db9ecbc [MIPS GlobalISel] minor update to MIR tests added in r329819
Remove 'registers' section, as suggested (D. Sanders) at code review

https://reviews.llvm.org/D44304

llvm-svn: 329888
2018-04-12 09:12:29 +00:00
Jonas Paulsson 319ce96fe4 [SystemZ] Use ResourceCycles=30 for FPd unit (NFC).
This is better than listing FPd 30 times :-)

Review: Ulrich Weigand
llvm-svn: 329887
2018-04-12 08:08:42 +00:00
Jonas Paulsson e3f53e5d14 [SystemZ] Remove FullInstRWOverlapCheck from SchedMachineModels.
This is NFC, even though it caught just a few cases of overlapping regular
expressions.

Review: Ulrich Weigand
llvm-svn: 329886
2018-04-12 08:06:04 +00:00
Jonas Paulsson 26e171f0a7 [HexagonMachineScheduler] Remove local (copied) getWeakLeft().
Since the common code getWeakLeft() is now available, there should not
be a local copy of this function in target.

llvm-svn: 329885
2018-04-12 07:39:33 +00:00
Jonas Paulsson e8f1ac7063 [MachineScheduler] NFC refactoring
This patch makes tryCandidate() virtual and some utility functions like
tryLess(), tryGreater(), ... externally available (used to be static).

This makes it possible for a target to derive a new MachineSchedStrategy from
GenericScheduler and reuse most parts.

It was necessary to wrap functions with the same names in
AMDGPU/SIMachineScheduler in a local namespace.

Review: Andy Trick, Florian Hahn
https://reviews.llvm.org/D43329

llvm-svn: 329884
2018-04-12 07:21:39 +00:00
Craig Topper 46300d1ff6 [LegalizeTypes] Remove unnecessary type action check on the type of operand 0 when promoting shift result type. NFC
Operand 0 should have the same type of the result. So if the result type needs to be promoted, operand 0 needs to be promoted unconditionally.

llvm-svn: 329883
2018-04-12 06:51:58 +00:00
David Chisnall 10e590e950 ObjCGNU: Fix empty v3 protocols being emitted two fields short
Summary:
Protocols that were being referenced but could not be fully realized were being emitted without `properties`/`optional_properties`. Since all v3 protocols must be 9 processor words wide, the lack of these fields is catastrophic for the runtime.

As an example, the runtime cannot know [here](https://github.com/gnustep/libobjc2/blob/master/protocol.c#L73) that `properties` and `optional_properties` are invalid.

Reviewers: rjmccall, theraven

Reviewed By: rjmccall, theraven

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D45305

llvm-svn: 329882
2018-04-12 06:46:15 +00:00
Zinovy Nis 60874d4faf [clang-tidy] [modernize-use-auto] Fix test modernize-use-auto-new-remove-stars.cpp after improvement
'tooling::fixit::getText' considers a length of "int *" to be 5 instead of 3 
in a new algorithm in https://reviews.llvm.org/rCTE329873. It was the root of 
the test failure.

llvm-svn: 329881
2018-04-12 06:45:47 +00:00
Tobias Grosser be483ae665 Add isl operator overloads for isl::pw_aff (Try II)
Piecewise affine expressions have directly corresponding mathematical
operators. Introduce these operators as overloads as this makes writing
code with isl::pw_aff expressions more directly readable.

We can now write:

  A = B + C    instead of    A = B.add(C)

Reviewers: Meinersbur, bollu, sebpop

Reviewed By: Meinersbur

Subscribers: philip.pfaffe, pollydev, llvm-commits

Differential Revision: https://reviews.llvm.org/D45534

llvm-svn: 329880
2018-04-12 06:15:17 +00:00
Akira Hatanaka ff6c4f3702 [Sema][ObjC] Ensure that the return type of an ObjC method is a complete
type.

Copy the code in ActOnStartOfFunctionDef that checks a function's return
type to ActOnStartOfObjCMethodDef. This fixes an assertion failure in
IRGen caused by an uninstantiated return type.

rdar://problem/38691818

llvm-svn: 329879
2018-04-12 06:01:41 +00:00
Hiroshi Inoue bcadfee2ad [NFC] fix trivial typos in documents and comments
"is is" -> "is", "if if" -> "if", "or or" -> "or"

llvm-svn: 329878
2018-04-12 05:53:20 +00:00
Alex Bradbury 21d28fe8b8 [RISCV] Codegen support for RV32D floating point comparison operations
Also add double-prevoius-failure.ll which captures a test case that at one
point triggered a compiler crash, while developing calling convention support
for f64 on RV32D with soft-float ABI.

llvm-svn: 329877
2018-04-12 05:50:06 +00:00
Alex Bradbury 60baa2e015 [RISCV] Codegen support for RV32D floating point conversion operations
This also includes support and a test for truncating stores, which are now
possible thanks to the fpround pattern.

llvm-svn: 329876
2018-04-12 05:47:15 +00:00
Zinovy Nis 0b0b882356 [Documentation] Fix options order for Release Notes in modernize-use-auto.
llvm-svn: 329875
2018-04-12 05:45:16 +00:00
Alex Bradbury 5d0dfa5e0e [RISCV] Add codegen support for RV32D floating point arithmetic operations
llvm-svn: 329874
2018-04-12 05:42:42 +00:00
Zinovy Nis dfaa021e99 [clang-tidy] [modernize-use-auto] Get only a length of token, not the token itself
llvm-svn: 329873
2018-04-12 05:41:24 +00:00
Alex Bradbury 8f296478eb [RISCV] Add tests missed in r329871
llvm-svn: 329872
2018-04-12 05:36:44 +00:00
Alex Bradbury 0b4175f160 [RISCV] Codegen support for RV32D floating point load/store, fadd.d, calling conv
fadd.d is required in order to force floating point registers to be used in
test code, as parameters are passed in integer registers in the soft float
ABI.

Much of this patch is concerned with support for passing f64 on RV32D with a
soft-float ABI. Similar to Mips, introduce pseudoinstructions to build an f64
out of a pair of i32 and to split an f64 to a pair of i32. BUILD_PAIR and
EXTRACT_ELEMENT can't be used, as a BITCAST to i64 would be necessary, but i64
is not a legal type.

llvm-svn: 329871
2018-04-12 05:34:25 +00:00
Yan Luo bedca0b41b Test commit access
llvm-svn: 329870
2018-04-12 04:26:49 +00:00
Richard Trieu caaccee77d [ODRHash] Skip more types hashing TypedefType
To get the underlying type for TypedefType's, also skip ElaboratedType's.

llvm-svn: 329869
2018-04-12 02:26:49 +00:00
George Burgess IV 48ee59b6f0 [DeadArgElim] Remove allocsize attributes on callsites
We're already removing allocsize attributes from Functions that we
remove args from, since removing arguments from a function may make the
allocsize attribute incorrect. It appears we forgot to also remove them
from callsites.

Without this, I get verifier errors on `@Test2`.

It probably wouldn't be too hard to make DAE properly update allocsize
attributes instead of dropping them, but I can't think of a scenario
where that'd be useful in practice.

llvm-svn: 329868
2018-04-12 02:06:01 +00:00
Jake Ehrlich a8c689e70c Revert "[llvm-objcopy] Switch over to using TableGen for parsing arguments"
TableGen seems to work differently on windows. I'll need to revert this

This reverts commit 7a153ddea067b24da59f6a66c733d79205969501.

llvm-svn: 329867
2018-04-12 00:40:50 +00:00
Saleem Abdulrasool dee344cf85 Lex: make `clang::Preprocessor::macros` work on MSVC
The order of argument construction is reversed on MS ABI on Windows.
When `macros` was invoked, the `end` call is made prior to `begin`.  In
such a case, the DenseMap (`ModuleMap`) is populated after the `end`
iterator is constructed.  This reversal results in the invalidation of
the end iterator, resulting in a failure at runtime (assertion failure
in `DenseMap<T>::operator!=` that "handles are not in sync!").  Ensure
that the end iterator is constructed after the begin iterator.  This
fixes the use of `macros(bool)`, which symptomized as an assertion
failure in the swift compiler in the clang importer.

llvm-svn: 329866
2018-04-11 23:47:25 +00:00
Michael Zolotukhin 815f453f76 Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time.
This reapplies commit r329644.

llvm-svn: 329865
2018-04-11 23:37:53 +00:00
Michael Zolotukhin 4fbb93003b [SSAUpdaterBulk] Fix linux bootstrap/sanitizer failures: explicitly specify order of evaluation.
The standard says that the order of evaluation of an expression
  s[x] = foo()
is unspecified. In our case, we first create an empty entry in the map,
then call foo(), then store its return value to the created entry. The
problem is that foo uses the map as a cache, so if it finds that there
is an entry in the map, it stops computation. This change explicitly
sets the order, thus fixing this heisenbug.

llvm-svn: 329864
2018-04-11 23:37:37 +00:00
Jake Ehrlich cafa11289a [llvm-objcopy] Switch over to using TableGen for parsing arguments
Swithces from using the command line library to using TableGen. This will allow
llvm-strip to exist and allow refinements of the command line syntax.

Differential Revision: https://reviews.llvm.org/D44236

llvm-svn: 329863
2018-04-11 23:37:03 +00:00
Simon Pilgrim 7b88d09e75 [X86] Remove unused itinerary argument from FMA3/FMA4/XOP instructions. NFCI.
llvm-svn: 329862
2018-04-11 23:24:38 +00:00
Weiming Zhao 1bd40005ba Add missing vtable anchors
Summary: This patch adds anchor() for MemoryBuffer, raw_fd_ostream, RTDyldMemoryManager, SectionMemoryManager, etc.

Reviewers: jlebar, eli.friedman, dblaikie

Reviewed By: dblaikie

Subscribers: mehdi_amini, mgorny, dblaikie, weimingz, llvm-commits

Differential Revision: https://reviews.llvm.org/D45244

llvm-svn: 329861
2018-04-11 23:09:20 +00:00
Simon Pilgrim 4eb879c686 X86FoldTableEntry - avoid unnecessary std::string creation. NFCI.
llvm-svn: 329860
2018-04-11 23:08:30 +00:00
whitequark 1ae61a6126 [LLVM-C] Add LLVMGetHostCPU{Name,Features}.
Without these functions it's hard to create a TargetMachine for
Orc JIT that creates efficient native code.

It's not sufficient to just expose LLVMGetHostCPUName(), because
for some CPUs there's fewer features actually available than
the CPU name indicates (e.g. AVX might be missing on some CPUs
identified as Skylake).

Differential Revision: https://reviews.llvm.org/D44861

llvm-svn: 329856
2018-04-11 22:40:42 +00:00
Tom Stellard a557852719 Driver: Add gcc search path for RHEL devtoolset-7
Reviewers: bruno

Reviewed By: bruno

Subscribers: bruno, cfe-commits

Differential Revision: https://reviews.llvm.org/D44130

llvm-svn: 329854
2018-04-11 22:29:35 +00:00
Simon Pilgrim 781dece55e Don't repeatedly evaluate size() in the for loop. NFCI.
llvm-svn: 329853
2018-04-11 22:24:48 +00:00
Nemanja Ivanovic c564dc060a [PowerPC] Fix condition for 64-bit rotate when replacing r+r instr with r+i
This patch fixes https://bugs.llvm.org/show_bug.cgi?id=37039
The condition only covers one of the two 64-bit rotate instructions. This just
adds the second (RLDICLo).

Patch by Josh Stone.

llvm-svn: 329852
2018-04-11 21:25:44 +00:00
Eugene Zelenko e69b33f232 [Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 329851
2018-04-11 20:57:28 +00:00