summaryrefslogtreecommitdiff
path: root/unittests
AgeCommit message (Collapse)Author
2017-11-30Split TypeTableBuilder into two classes.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319456 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[FuzzMutate] Correctly handle vector types in the insertvalue operationIgor Laevsky
Differential Revision: https://reviews.llvm.org/D40397 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319442 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[FuzzMutate] Don't use index operands as sinksIgor Laevsky
Differential Revision: https://reviews.llvm.org/D40396 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319441 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[FuzzMutate] Pick correct index for the insertvalue instructionIgor Laevsky
Differential Revision: https://reviews.llvm.org/D40395 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[FuzzMutate] Don't create load as a new source if it doesn't match with the ↵Igor Laevsky
descriptor Differential Revision: https://reviews.llvm.org/D40394 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[FuzzMutate] Don't crash when we can't remove instruction from empty functionIgor Laevsky
Differential Revision: https://reviews.llvm.org/D40393 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[Coverage] Use the most-recent completed region count (PR35437)Vedant Kumar
This is a fix for the coverage segment builder. If multiple regions must be popped off the active stack at once, and more than one of them end at the same location, emit a segment using the count from the most-recent completed region. Fixes PR35437, rdar://35760630 Testing: invoked llvm-cov on a stage2 build of clang, additional unit tests, check-profile git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28[CodeView] Refactor / Rewrite TypeSerializer and TypeTableBuilder.Zachary Turner
The motivation behind this patch is that future directions require us to be able to compute the hash value of records independently of actually using them for de-duplication. The current structure of TypeSerializer / TypeTableBuilder being a single entry point that takes an unserialized type record, and then hashes and de-duplicates it is not flexible enough to allow this. At the same time, the existing TypeSerializer is already extremely complex for this very reason -- it tries to be too many things. In addition to serializing, hashing, and de-duplicating, ti also supports splitting up field list records and adding continuations. All of this functionality crammed into this one class makes it very complicated to work with and hard to maintain. To solve all of these problems, I've re-written everything from scratch and split the functionality into separate pieces that can easily be reused. The end result is that one class TypeSerializer is turned into 3 new classes SimpleTypeSerializer, ContinuationRecordBuilder, and TypeTableBuilder, each of which in isolation is simple and straightforward. A quick summary of these new classes and their responsibilities are: - SimpleTypeSerializer : Turns a non-FieldList leaf type into a series of bytes. Does not do any hashing. Every time you call it, it will re-serialize and return bytes again. The same instance can be re-used over and over to avoid re-allocations, and in exchange for this optimization the bytes returned by the serializer only live until the caller attempts to serialize a new record. - ContinuationRecordBuilder : Turns a FieldList-like record into a series of fragments. Does not do any hashing. Like SimpleTypeSerializer, returns references to privately owned bytes, so the storage is invalidated as soon as the caller tries to re-use the instance. Works equally well for LF_FIELDLIST as it does for LF_METHODLIST, solving a long-standing theoretical limitation of the previous implementation. - TypeTableBuilder : Accepts sequences of bytes that the user has already serialized, and inserts them by de-duplicating with a hash table. For the sake of convenience and efficiency, this class internally stores a SimpleTypeSerializer so that it can accept unserialized records. The same is not true of ContinuationRecordBuilder. The user is required to create their own instance of ContinuationRecordBuilder. Differential Revision: https://reviews.llvm.org/D40518 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319198 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-28[Support] Add unit test for printLowerCaseFrancis Visoiu Mistrih
Add test case for the function added in r319171. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319177 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloadingMichal Gorny
Prevent unloading shared libraries on Linux when dlclose() is called. This is necessary since command-line option parsing API relies on registering the global option instances in the option parser instance which can be loaded in a different shared library. Given that we can't reliably remove those options when a library is unloaded, the parser ends up containing dangling references. Since glibc has relatively complex library unloading rules, some of the LLVM libraries can be unloaded while others (including the Support library) stay loaded causing quite a mayhem. To reliably prevent that, just forbid unloading all libraries -- it's a very bad idea anyway. While the issue arguably happens only with BUILD_SHARED_LIBS, it may affect any library reusing llvm::cl interface. Based on patch provided Ross Hayward on https://bugs.gentoo.org/617154. Previously hit by Fedora back in Feb 2016: https://lists.freedesktop.org/archives/mesa-dev/2016-February/107242.html Differential Revision: https://reviews.llvm.org/D40459 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Fixed the ability to recursively get an attribute value from a DWARFDie.Greg Clayton
The previous implementation would only look 1 DW_AT_specification or DW_AT_abstract_origin deep. This means DWARFDie::getName() would fail in certain cases. I ran into such a case while creating a tool that used the LLVM DWARF parser to generate a symbolication format so I have seen this in the wild. Differential Revision: https://reviews.llvm.org/D40156 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319104 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Rename MCTargetOptionsCommandFlags.h to .def as it is not a normal/modular ↵David Blaikie
header as much as it is for stamping out some global/static variables git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319086 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Fix -Werror build for signed/unsigned comparison with use of explicit ↵David Blaikie
unsigned literals git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319081 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[BinaryStream] Support growable streams.Zachary Turner
The existing library assumed that a stream's length would never change. This makes some things simpler, but it's not flexible enough for what we need, especially for writable streams where what you really want is for each call to write to actually append. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319070 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27[NFC] Add missing unit tests for EquivalenceClassesMax Kazantsev
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319018 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-23[YAMLParser] Don't crash on null keys in KeyValueNodes.Benjamin Kramer
Found by clangd-fuzzer! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318935 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22Allow TempFile::discard to be called twice.Rafael Espindola
We already allowed keep+discard. It is important to be able to discard a temporary if a rename fail. It is also convenient as it allows the use of RAII for discarding. Allow discarding twice for similar reasons. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318867 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-20Add ADL support to range based <algorithm> extensionsDavid Blaikie
This adds support for ADL in the range based <algorithm> extensions (llvm::for_each etc.). Also adds the helper functions llvm::adl::begin and llvm::adl::end which wrap std::begin and std::end with ADL support. Saw this was missing from a recent llvm weekly post about adding llvm::for_each and thought I might add it. Patch by Stephen Dollberg! Differential Revision: https://reviews.llvm.org/D40006 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318703 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-18[asan] Add a full redzone after every stack variableWalter Lee
We were not doing that for large shadow granularity. Also add more stack frame layout tests for large shadow granularity. Differential Revision: https://reviews.llvm.org/D39475 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17Fix a bunch more layering of CodeGen headers that are in TargetDavid Blaikie
All these headers already depend on CodeGen headers so moving them into CodeGen fixes the layering (since CodeGen depends on Target, not the other way around). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16[DebugInfo/PDB] Adding getUndecoratedNameEx and IPDB interfaces for ↵Aaron Smith
IDiaEnumTables and IDiaTable. Initial changes to support debugging PE/COFF files with LLDB on Windows through DIA SDK. There is another set of changes required on the LLDB side before this does anything. Differential Revision: https://reviews.llvm.org/D39517 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318403 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16[SCEV][NFC] Introduce isSafeToExpandAt function to SCEVExpanderMax Kazantsev
This function checks that: 1) It is safe to expand a SCEV; 2) It is OK to materialize it at the specified location. For example, attempt to expand a loop's AddRec to the same loop's preheader should fail. Differential Revision: https://reviews.llvm.org/D39236 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318377 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16Need to work around the gcc Wunused-function bug as far back as gcc 6.1, ↵Eric Christopher
update accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318372 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15[cfi-verify] Validate there are no register clobbers between CFI-check and ↵Mitch Phillips
instruction execution. Summary: This patch adds another failure mode for `validateCFIProtection(..)`, wherein any register that affects the indirect control flow instruction is clobbered to between the CFI-check and the instruction's execution. Also includes a modification to make MCInstrDesc::hasDefOfPhysReg public. Reviewers: vlad.tsyrklevich Reviewed By: vlad.tsyrklevich Subscribers: llvm-commits, pcc, kcc Differential Revision: https://reviews.llvm.org/D39820 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318238 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[cfi-verify] Made FileAnalysis operate on a GraphResult rather than build ↵Mitch Phillips
one and validate it. Refactors the behaviour of building graphs out of FileAnalysis, allowing for analysis of the GraphResult by the callee without having to rebuild the graph. Means when we want to analyse the constructed graph (planned for later revisions), we don't do repeated work. Also makes CFI verification in FileAnalysis now return an enum that allows us to differentiate why something failed, not just that it did/didn't fail. Reviewers: vlad.tsyrklevich Subscribers: kcc, pcc, llvm-commits Differential Revision: https://reviews.llvm.org/D39764 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317927 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[ADT] Rewrite mapped_iterator in terms of iterator_adaptor_base.Lang Hames
Summary: This eliminates the boilerplate implementation of the iterator interface in mapped_iterator. This patch also adds unit tests that verify that the mapped function is applied by operator* and operator->, and that references returned by the map function are returned via operator*. Reviewers: dblaikie, chandlerc Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D39855 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317902 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[Coverage] Use the wrapped segment when a line has entry segmentsVedant Kumar
We've worked around bugs in the frontend by ignoring the count from wrapped segments when a line has at least one region entry segment. Those frontend bugs are now fixed, so it's time to regenerate the checked-in covmapping files and remove the workaround. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317761 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Let replaceVTableHolder accept any type.Adrian Prantl
In Rust, a trait can be implemented for any type, and if a trait object pointer is used for the type, then a virtual table will be emitted for that trait/type combination. We would like debuggers to be able to inspect trait objects, which requires finding the concrete type associated with a given vtable. This patch changes LLVM so that any type can be passed to replaceVTableHolder. This allows the Rust compiler to emit the needed debug info -- associating a vtable with the concrete type for which it was emitted. This is a DWARF extension: DWARF only specifies the meaning of DW_AT_containing_type in one specific situation. This style of DWARF extension is routine, though, and LLVM already has one such case for DW_AT_containing_type. Patch by Tom Tromey! Differential Revision: https://reviews.llvm.org/D39503 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Convert FileOutputBuffer::commit to Error.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Update unittest too.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317651 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Target/TargetInstrInfo.h -> CodeGen/TargetInstrInfo.h to match layeringDavid Blaikie
This header includes CodeGen headers, and is not, itself, included by any Target headers, so move it into CodeGen to match the layering of its implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317647 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07Extend SpecialCaseList to allow users to blame matches on entries in the file.Mitch Phillips
Summary: Extends SCL functionality to allow users to find the line number in the file the SCL is built from through SpecialCaseList::inSectionBlame(...). Also removes the need to compile the SCL before use. As the matcher now contains a list of regexes to test against instead of a single regex, the regexes can be individually built on each insertion rather than one large compilation at the end of construction. This change also fixes a bug where blank lines would cause the parser to become out-of-sync with the line number. An error on line `k` was being reported as being on line `k - num_blank_lines_before_k`. Note: This change has a cyclical dependency on D39486. Both these changes must be submitted at the same time to avoid a build breakage. Reviewers: vlad.tsyrklevich Reviewed By: vlad.tsyrklevich Subscribers: kcc, pcc, llvm-commits Differential Revision: https://reviews.llvm.org/D39485 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317617 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[DWARFv5] Support DW_FORM_strp in the .debug_line header.Paul Robinson
Supporting this form in .debug_line.dwo will be done as a follow-up. Differential Revision: https://reviews.llvm.org/D33155 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317607 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07Silence MSVC error C2398Kristof Beyls
Reported by http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/6000/steps/build-unified-tree/logs/stdio The error messages were all similar to: llvm\unittests\CodeGen\GlobalISel\LegalizerInfoTest.cpp(54): error C2398: Element '1': conversion from '' to 'unsigned int' requires a narrowing conversion git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317578 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[GlobalISel] Enable legalizing non-power-of-2 sized types.Kristof Beyls
This changes the interface of how targets describe how to legalize, see the below description. 1. Interface for targets to describe how to legalize. In GlobalISel, the API in the LegalizerInfo class is the main interface for targets to specify which types are legal for which operations, and what to do to turn illegal type/operation combinations into legal ones. For each operation the type sizes that can be legalized without having to change the size of the type are specified with a call to setAction. This isn't different to how GlobalISel worked before. For example, for a target that supports 32 and 64 bit adds natively: for (auto Ty : {s32, s64}) setAction({G_ADD, 0, s32}, Legal); or for a target that needs a library call for a 32 bit division: setAction({G_SDIV, s32}, Libcall); The main conceptual change to the LegalizerInfo API, is in specifying how to legalize the type sizes for which a change of size is needed. For example, in the above example, how to specify how all types from i1 to i8388607 (apart from s32 and s64 which are legal) need to be legalized and expressed in terms of operations on the available legal sizes (again, i32 and i64 in this case). Before, the implementation only allowed specifying power-of-2-sized types (e.g. setAction({G_ADD, 0, s128}, NarrowScalar). A worse limitation was that if you'd wanted to specify how to legalize all the sized types as allowed by the LLVM-IR LangRef, i1 to i8388607, you'd have to call setAction 8388607-3 times and probably would need a lot of memory to store all of these specifications. Instead, the legalization actions that need to change the size of the type are specified now using a "SizeChangeStrategy". For example: setLegalizeScalarToDifferentSizeStrategy( G_ADD, 0, widenToLargerAndNarrowToLargest); This example indicates that for type sizes for which there is a larger size that can be legalized towards, do it by Widening the size. For example, G_ADD on s17 will be legalized by first doing WidenScalar to make it s32, after which it's legal. The "NarrowToLargest" indicates what to do if there is no larger size that can be legalized towards. E.g. G_ADD on s92 will be legalized by doing NarrowScalar to s64. Another example, taken from the ARM backend is: for (unsigned Op : {G_SDIV, G_UDIV}) { setLegalizeScalarToDifferentSizeStrategy(Op, 0, widenToLargerTypesUnsupportedOtherwise); if (ST.hasDivideInARMMode()) setAction({Op, s32}, Legal); else setAction({Op, s32}, Libcall); } For this example, G_SDIV on s8, on a target without a divide instruction, would be legalized by first doing action (WidenScalar, s32), followed by (Libcall, s32). The same principle is also followed for when the number of vector lanes on vector data types need to be changed, e.g.: setAction({G_ADD, LLT::vector(8, 8)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(16, 8)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(4, 16)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(8, 16)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(2, 32)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(4, 32)}, LegalizerInfo::Legal); setLegalizeVectorElementToDifferentSizeStrategy( G_ADD, 0, widenToLargerTypesUnsupportedOtherwise); As currently implemented here, vector types are legalized by first making the vector element size legal, followed by then making the number of lanes legal. The strategy to follow in the first step is set by a call to setLegalizeVectorElementToDifferentSizeStrategy, see example above. The strategy followed in the second step "moreToWiderTypesAndLessToWidest" (see code for its definition), indicating that vectors are widened to more elements so they map to natively supported vector widths, or when there isn't a legal wider vector, split the vector to map it to the widest vector supported. Therefore, for the above specification, some example legalizations are: * getAction({G_ADD, LLT::vector(3, 3)}) returns {WidenScalar, LLT::vector(3, 8)} * getAction({G_ADD, LLT::vector(3, 8)}) then returns {MoreElements, LLT::vector(8, 8)} * getAction({G_ADD, LLT::vector(20, 8)}) returns {FewerElements, LLT::vector(16, 8)} 2. Key implementation aspects. How to legalize a specific (operation, type index, size) tuple is represented by mapping intervals of integers representing a range of size types to an action to take, e.g.: setScalarAction({G_ADD, LLT:scalar(1)}, {{1, WidenScalar}, // bit sizes [ 1, 31[ {32, Legal}, // bit sizes [32, 33[ {33, WidenScalar}, // bit sizes [33, 64[ {64, Legal}, // bit sizes [64, 65[ {65, NarrowScalar} // bit sizes [65, +inf[ }); Please note that most of the code to do the actual lowering of non-power-of-2 sized types is currently missing, this is just trying to make it possible for targets to specify what is legal, and how non-legal types should be legalized. Probably quite a bit of further work is needed in the actual legalizing and the other passes in GlobalISel to support non-power-of-2 sized types. I hope the documentation in LegalizerInfo.h and the examples provided in the various {Target}LegalizerInfo.cpp and LegalizerInfoTest.cpp explains well enough how this is meant to be used. This drops the need for LLT::{half,double}...Size(). Differential Revision: https://reviews.llvm.org/D30529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317560 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-06[IR] redefine 'UnsafeAlgebra' / 'reassoc' fast-math-flags and add 'trans' ↵Sanjay Patel
fast-math-flag As discussed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-November/107104.html and again more recently: http://lists.llvm.org/pipermail/llvm-dev/2017-October/118118.html ...this is a step in cleaning up our fast-math-flags implementation in IR to better match the capabilities of both clang's user-visible flags and the backend's flags for SDNode. As proposed in the above threads, we're replacing the 'UnsafeAlgebra' bit (which had the 'umbrella' meaning that all flags are set) with a new bit that only applies to algebraic reassociation - 'AllowReassoc'. We're also adding a bit to allow approximations for library functions called 'ApproxFunc' (this was initially proposed as 'libm' or similar). ...and we're out of bits. 7 bits ought to be enough for anyone, right? :) FWIW, I did look at getting this out of SubclassOptionalData via SubclassData (spacious 16-bits), but that's apparently already used for other purposes. Also, I don't think we can just add a field to FPMathOperator because Operator is not intended to be instantiated. We'll defer movement of FMF to another day. We keep the 'fast' keyword. I thought about removing that, but seeing IR like this: %f.fast = fadd reassoc nnan ninf nsz arcp contract afn float %op1, %op2 ...made me think we want to keep the shortcut synonym. Finally, this change is binary incompatible with existing IR as seen in the compatibility tests. This statement: "Newer releases can ignore features from older releases, but they cannot miscompile them. For example, if nsw is ever replaced with something else, dropping it would be a valid way to upgrade the IR." ( http://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility ) ...provides the flexibility we want to make this change without requiring a new IR version. Ie, we're not loosening the FP strictness of existing IR. At worst, we will fail to optimize some previously 'fast' code because it's no longer recognized as 'fast'. This should get fixed as we audit/squash all of the uses of 'isFast()'. Note: an inter-dependent clang commit to use the new API name should closely follow commit. Differential Revision: https://reviews.llvm.org/D39304 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-04Move these CMake projects into the Tests folder on IDEs like Visual Studio ↵Aaron Ballman
rather than leave it in the root directory. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317414 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Move TargetFrameLowering.h to CodeGen where it's implementedDavid Blaikie
This header already includes a CodeGen header and is implemented in lib/CodeGen, so move the header there to match. This fixes a link error with modular codegeneration builds - where a header and its implementation are circularly dependent and so need to be in the same library, not split between two like this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03[cfi-verify] Add blacklist parsing for result filtering.Mitch Phillips
Adds blacklist parsing behaviour for filtering results into four categories: - Expected Protected: Things that are not in the blacklist and are protected. - Unexpected Protected: Things that are in the blacklist and are protected. - Expected Unprotected: Things that are in the blacklist and are unprotected. - Unexpected Unprotected: Things that are not in the blacklist and are unprotected. now can optionally be invoked with a second command line argument, which specifies the blacklist file that the binary was built with. Current statistics for chromium: Reviewers: vlad.tsyrklevich Subscribers: mgorny, llvm-commits, pcc, kcc Differential Revision: https://reviews.llvm.org/D39525 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317364 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03Add llvm::for_each as a range-based extensions to <algorithm> and make use ↵Aaron Ballman
of it in some cases where it is a more clear alternative to std::for_each. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03[cfi-verify] Add an interesting unit test where undef search length changes ↵Mitch Phillips
result. Add an interesting unit test, found by changing --search-length-undef from the default. Program handles it correctly but good for ensuring correctness on further changes :) Reviewers: pcc Subscribers: mgorny, llvm-commits, kcc, vlad.tsyrklevich Differential Revision: https://reviews.llvm.org/D38658 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317355 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01Fix APFloat mod signSerguei Katkov
fmod specification requires the sign of the remainder is the same as numerator in case remainder is zero. Reviewers: gottesmm, scanon, arsenm, davide, craig.topper Reviewed By: scanon Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D39225 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317081 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01Revert rL317019, "[ADT] Split optional to only include copy mechanics and ↵NAKAMURA Takumi
dtor for non-trivial types." Seems g++-4.8 (eg. Ubuntu 14.04) doesn't like this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317077 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31[ADT] Split optional to only include copy mechanics and dtor for non-trivial ↵Benjamin Kramer
types. This makes uses of Optional more transparent to the compiler (and clang-tidy) and generates slightly smaller code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317019 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27Fix llvm-special-case-list-fuzzer regexp exceptionVlad Tsyrklevich
Summary: Original oss-fuzz report: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3727#c2 The minimized test case that causes this failure: 5b 5b 5b 3d 47 53 00 5b 3d 5d 5b 5d 0a [[[=GS.[=][]. Note the string "=GS\x00". The failure happens because the code is searching the string against an array of known collated names. "GS\x00" is a hit, but since len takes into account an extra NUL byte, indexing into cp->name[len] goes one byte past it's allocated memory. Fix this to use a strlen(cp->name) comparison to account for NUL bytes in the input. Reviewers: pcc Reviewed By: pcc Subscribers: hctim, kcc Differential Revision: https://reviews.llvm.org/D39380 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316786 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26Reapply r316582 [Local] Fix a bug in the domtree update logic for ↵Balaram Makam
MergeBasicBlockIntoOnlyPred. Summary: This reverts r316612 to reapply r316582. The buildbot failure was unrelated to this commit. Reviewers: Subscribers: git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316669 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25Revert r316582 [Local] Fix a bug in the domtree update logic for ↵Balaram Makam
MergeBasicBlockIntoOnlyPred. Summary: This reverts commit r316582. It looks like this commit broke tests on one buildbot: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/5719 . . . Failing Tests (1): LLVM :: Transforms/CalledValuePropagation/simple-arguments.ll Reviewers: Subscribers: git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316612 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25Add FileVerifier::isCFIProtected().Mitch Phillips
Add a CFI protection check that is implemented by building a graph and inspecting the output to deduce if the indirect CF instruction is CFI protected. Also added the output of this instruction to printIndirectInstructions(). Reviewers: vlad.tsyrklevich Subscribers: llvm-commits, kcc, pcc, mgorny Differential Revision: https://reviews.llvm.org/D38428 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.Balaram Makam
Summary: For some irreducible CFG the domtree nodes might be dead, do not update domtree for dead nodes. Reviewers: kuhar, dberlin, hfinkel Reviewed By: kuhar Subscribers: llvm-commits, mcrosier Differential Revision: https://reviews.llvm.org/D38960 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316582 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24Check special-case-list regex before insertion.Mitch Phillips
Summary: Checks that the supplied regex to SpecialCaseList::Matcher::insert(..) is non-empty. Reported by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3688 Verified that this fixes the provided assertion failure (built with {asan, fuzzer}): ``` mitchp@mitchp2:~/llvm-build/git-fuzz$ ninja llvm-special-case-list-fuzzer[12/12] Linking CXX executable bin/llvm-special-case-list-fuzzer mitchp@mitchp2:~/llvm-build/git-fuzz$ bin/llvm-special-case-list-fuzzer ~/Downloads/clusterfuzz-testcase-6748633157337088 INFO: Seed: 1697404507 INFO: Loaded 1 modules (18581 inline 8-bit counters): 18581 [0x9e9f60, 0x9ee7f5), INFO: Loaded 1 PC tables (18581 PCs): 18581 [0x9ee7f8,0xa37148), bin/llvm-special-case-list-fuzzer: Running 1 inputs 1 time(s) each. Running: /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088 Executed /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088 in 0 ms *** *** NOTE: fuzzing was not performed, you have only *** executed the target code on a fixed set of inputs. *** mitchp@mitchp2:~/llvm-build/git-fuzz$ ``` Reviewers: kcc, vsk Reviewed By: vsk Subscribers: vsk, llvm-commits, vlad.tsyrklevich Differential Revision: https://reviews.llvm.org/D39212 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316537 91177308-0d34-0410-b5e6-96231b3b80d8