summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't call doFinalization from verifyFunction.Rafael Espindola2013-11-131-1/+0
| | | | | | | | | | | | | | | | verifyFunction needs to call doInitialization to collect metadata and avoid crashing when verifying debug info in a function. But it should not call doFinalization since that is where the verifier will check declarations, variables and aliases, which is not desirable when one only wants to verify a function. A possible cleanup would be to split the class into a ModuleVerifier and FunctionVerifier. Issue reported by Ilia Filippov. Patch by Michael Kruse. llvm-svn: 194574
* Remove linkonce_odr_auto_hide.Rafael Espindola2013-11-011-4/+0
| | | | | | | | | | | | | | | linkonce_odr_auto_hide was in incomplete attempt to implement a way for the linker to hide symbols that are known to be available in every TU and whose addresses are not relevant for a particular DSO. It was redundant in that it all its uses are equivalent to linkonce_odr+unnamed_addr. Unlike those, it has never been connected to clang or llvm's optimizers, so it was effectively dead. Given that nothing produces it, this patch just nukes it (other than the llvm-c enum value). llvm-svn: 193865
* Enable variable arguments support for intrinsics.Andrew Trick2013-10-311-1/+41
| | | | llvm-svn: 193766
* Add calls to doInitialization() and doFinalization() in verifyFunction()Rafael Espindola2013-10-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | The function verifyFunction() in lib/IR/Verifier.cpp misses some calls. It creates a temporary FunctionPassManager that will run a single Verifier pass. Unfortunately, FunctionPassManager is no PassManager and does not call doInitialization() and doFinalization() by itself. Verifier does important tasks in doInitialization() such as collecting type information used to check DebugInfo metadata and doFinalization() does some additional checks. Therefore these checks were missed and debug info couldn't be verified at all, it just crashed if the function had some. verifyFunction() is currently not used in llvm unless -debug option is enabled, and in unittests/IR/VerifierTest.cpp VerifierTest had to be changed to create the function in a module from which the type debug info can be collected. Patch by Michael Kruse. llvm-svn: 193719
* Add support for metadata representing .ident directives.Rafael Espindola2013-10-161-0/+20
| | | | llvm-svn: 192764
* Add a GlobalAlias::isValidLinkage to reduce code duplication.Rafael Espindola2013-10-091-2/+1
| | | | | | Thanks to Reid Kleckner for the suggestion. llvm-svn: 192298
* Add support for aliases with linkonce_odr.Rafael Espindola2013-10-061-1/+1
| | | | | | This will be used to extend constructor aliases in clang. llvm-svn: 192066
* Debug Info: Use DIScopeRef for DIType::getContext.Manman Ren2013-09-091-2/+2
| | | | | | | | | | | | | | | | | In DIBuilder, the context field of a TAG_member is updated to use the scope reference. Verifier is updated accordingly. DebugInfoFinder now needs to generate a type identifier map to have access to the actual scope. Same applies for BreakpointPrinter. processModule of DebugInfoFinder is called during initialization phase of the verifier to make sure the type identifier map is constructed early enough. We are now able to unique a simple class as demonstrated by the added testing case. llvm-svn: 190334
* Revert patches to add case-range support for PR1255.Bob Wilson2013-09-091-20/+5
| | | | | | | | | | | | | | | | | The work on this project was left in an unfinished and inconsistent state. Hopefully someone will eventually get a chance to implement this feature, but in the meantime, it is better to put things back the way the were. I have left support in the bitcode reader to handle the case-range bitcode format, so that we do not lose bitcode compatibility with the llvm 3.3 release. This reverts the following commits: 155464, 156374, 156377, 156613, 156704, 156757, 156804 156808, 156985, 157046, 157112, 157183, 157315, 157384, 157575, 157576, 157586, 157612, 157810, 157814, 157815, 157880, 157881, 157882, 157884, 157887, 157901, 158979, 157987, 157989, 158986, 158997, 159076, 159101, 159100, 159200, 159201, 159207, 159527, 159532, 159540, 159583, 159618, 159658, 159659, 159660, 159661, 159703, 159704, 160076, 167356, 172025, 186736 llvm-svn: 190328
* Remove verifier check that attribute 'builtin' is only applied to calls toRichard Smith2013-09-071-8/+0
| | | | | | | | functions marked 'nobuiltin'. That approach doesn't play well with LTO, and there's no harm in marking a call as 'builtin' if it was going to be a builtin regardless. llvm-svn: 190233
* Add function attribute 'optnone'.Andrea Di Biagio2013-08-231-1/+17
| | | | | | | | This function attribute indicates that the function is not optimized by any optimization or code generator passes with the exception of interprocedural optimization passes. llvm-svn: 189101
* Debug Info Finder|Verifier: handle DbgLoc attached to instructions.Manman Ren2013-08-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also remove checking of llvm.dbg.sp since it is not used in generating dwarf. Current state of Finder: DebugInfoFinder tries to list all debug info MDNodes used in a module. To list debug info MDNodes used by an instruction, DebugInfoFinder provides processDeclare, processValue and processLocation to handle DbgDeclareInst, DbgValueInst and DbgLoc attached to instructions. processModule will go through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes used by the CUs. TODO: 1> Finder has a list of CUs, SPs, Types, Scopes and global variables. We need to add a list of variables that are used by DbgDeclareInst and DbgValueInst. 2> MDString fields should be null or isa<MDString> and MDNode fields should be null or isa<MDNode>. We currently use empty string or int 0 to represent null. 3> Go though Verify functions and make sure that they check field types. 4> Clean up existing testing cases to remove llvm.dbg.sp and make sure each testing case has a llvm.dbg.cu. Re-apply r187609 with fix to pass ocaml binding. vmcore.ml generates a debug location with scope being metadata !{}, in verifier we treat this as a null scope. llvm-svn: 187812
* Temporarily revert "Debug Info Finder|Verifier: handle DbgLoc attached toEric Christopher2013-08-021-5/+0
| | | | | | | | instructions." in an attempt to bring back some bots. This reverts commit r187609. llvm-svn: 187638
* Debug Info Finder|Verifier: handle DbgLoc attached to instructions.Manman Ren2013-08-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Also remove checking of llvm.dbg.sp since it is not used in generating dwarf. Current state of Finder: DebugInfoFinder tries to list all debug info MDNodes used in a module. To list debug info MDNodes used by an instruction, DebugInfoFinder provides processDeclare, processValue and processLocation to handle DbgDeclareInst, DbgValueInst and DbgLoc attached to instructions. processModule will go through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes used by the CUs. TODO: 1> Finder has a list of CUs, SPs, Types, Scopes and global variables. We need to add a list of variables that are used by DbgDeclareInst and DbgValueInst. 2> MDString fields should be null or isa<MDString> and MDNode fields should be null or isa<MDNode>. We currently use empty string or int 0 to represent null. 3> Go though Verify functions and make sure that they check field types. 4> Clean up existing testing cases to remove llvm.dbg.sp and make sure each testing case has a llvm.dbg.cu. llvm-svn: 187609
* Reject bitcasts between address spaces with different sizesMatt Arsenault2013-07-311-20/+104
| | | | llvm-svn: 187506
* Debug Info Finder: use processDeclare and processValue to list debug infoManman Ren2013-07-231-1/+14
| | | | | | | | | | | MDNodes used by DbgDeclareInst and DbgValueInst. Another 16 testing cases failed and they are disabled with -disable-debug-info-verifier. A total of 34 cases are disabled with -disable-debug-info-verifier and will be corrected. llvm-svn: 186902
* Disallow global aliases to bitcast between address spacesMatt Arsenault2013-07-201-4/+15
| | | | llvm-svn: 186767
* Remove trailing whitespace, fix file path in commentMatt Arsenault2013-07-201-33/+33
| | | | llvm-svn: 186766
* Debug Info Verifier: simplify DIxxx::VerifyManman Ren2013-07-201-0/+3
| | | | | | | | Simplify DIxxx:Verify to not call Verify on an operand. Instead, we use DebugInfoFinder to list all MDNodes that should be a DIScope and all MDNodes that should be a DIType and we will call Verify on those lists. llvm-svn: 186737
* s/compiler_used/compiler.used/.Rafael Espindola2013-07-191-1/+1
| | | | | | | We were incorrectly using compiler_used instead of compiler.used. Unfortunately the passes using the broken name had tests also using the broken name. llvm-svn: 186705
* Debug Info: enable verifying by default and disable testing cases that fail.Manman Ren2013-07-191-0/+32
| | | | | | | | | | | | | | | | | | | 1> Use DebugInfoFinder to find debug info MDNodes. 2> Add disable-debug-info-verifier to disable verifying debug info. 3> Disable verifying for testing cases that fail (will update the testing cases later on). 4> MDNodes generated by clang can have empty filename for TAG_inheritance and TAG_friend, so DIType::Verify is modified accordingly. Note that DebugInfoFinder does not list all debug info MDNode. For example, clang can generate: metadata !{i32 786468}, which will fail to verify. This MDNode is used by debug info but not included in DebugInfoFinder. This MDNode is generated as a temporary node in DIBuilder::createFunction Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) }; MDNode::getTemporary(VMContext, TElts) llvm-svn: 186634
* Extend 'readonly' and 'readnone' to work on function arguments as well asNick Lewycky2013-07-061-8/+13
| | | | | | | functions. Make the function attributes pass add it to known library functions and when it can deduce it. llvm-svn: 185735
* IRVerifier: Correctly check attribute typesTobias Grosser2013-07-021-1/+2
| | | | | | | | | | | Add missing parenthesis such that all and not only the very first attribute is checked. Testing this piece of code is not possible with an LLVM-IR test file, as the LLVM-IR parser has a similar check such that the wrong IR does not even arrive at the verifier. llvm-svn: 185408
* Added support for the Builtin attribute.Michael Gottesman2013-06-271-0/+16
| | | | | | | | The Builtin attribute is an attribute that can be placed on function call site that signal that even though a function is declared as being a builtin, rdar://problem/13727199 llvm-svn: 185049
* [APFloat] Converted all references to APFloat::isNormal => ↵Michael Gottesman2013-06-191-1/+1
| | | | | | | | APFloat::isFiniteNonZero. Turns out all the references were in llvm and not in clang. llvm-svn: 184356
* We want a string representation of the attribute, not the kind as a string.Bill Wendling2013-06-181-2/+2
| | | | llvm-svn: 184239
* Require members of llvm.used to be named.Rafael Espindola2013-06-111-0/+1
| | | | | | | | The effect of llvm.used is to introduce an invisible reference, so this seems a reasonable restriction. It will be used to provide an easy ordering of the entries in llvm.used. llvm-svn: 183743
* Make it explicit that GlobalAlias are ok in llvm.used.Rafael Espindola2013-05-271-5/+4
| | | | | | No functionality change. llvm-svn: 182747
* Add a new function attribute 'cold' to functions.Diego Novillo2013-05-241-1/+2
| | | | | | | | | | | Other than recognizing the attribute, the patch does little else. It changes the branch probability analyzer so that edges into blocks postdominated by a cold function are given low weight. Added analysis and code generation tests. Added documentation for the new attribute. llvm-svn: 182638
* Add some constraints to use of 'returned':Stephen Lin2013-04-231-0/+4
| | | | | | | | | 1) Disallow 'returned' on parameter that is also 'sret' (no sensible semantics, as far as I can tell). 2) Conservatively disallow tail calls through 'returned' parameters that also are 'zext' or 'sext' (for consistency with treatment of other zero-extending and sign-extending operations in tail call position detection...can be revised later to handle situations that can be determined to be safe). This is a new attribute that is not yet used, so there is no impact. llvm-svn: 180118
* Also verify llvm.compiler_used.Rafael Espindola2013-04-221-1/+2
| | | | llvm-svn: 180020
* Clarify that llvm.used can contain aliases.Rafael Espindola2013-04-221-0/+23
| | | | | | | Also add a check for llvm.used in the verifier and simplify clients now that they can assume they have a ConstantArray. llvm-svn: 180019
* Add CodeGen support for functions that always return arguments via a new ↵Stephen Lin2013-04-201-6/+45
| | | | | | parameter attribute 'returned', which is taken advantage of in target-independent tail call opportunity detection and in ARM call lowering (when placed on an integral first parameter). llvm-svn: 179925
* This patch addresses two cleanup issues:Bill Wendling2013-04-181-81/+71
| | | | | | | | | | | | | | | | 1. Verify::VerifyParameterAttrs in "lib/IR/Verifier.cpp" and AttrBuilder::removeFunctionOnlyAttrs in "lib/IR/Attributes.cpp" (only called by Verify::VerifyFunctionAttrs) separately maintained a list of function-only attribute types. I've consolidated the logic into a new function used for both cases in "lib/IR/Verifier.cpp", so this logic is in one place (other than the AsmParser front-end) 2. Various functions in "lib/IR/Verifier.cpp" passed AttributeSet around by reference needlessly, as it's just a handle to an immutable pimpl body. Patch by Stephen Lin! llvm-svn: 179790
* Unify clang/llvm attributes for asan/tsan/msan (LLVM part)Kostya Serebryany2013-02-261-3/+3
| | | | | | | | | | | | | | | | | | | These are two related changes (one in llvm, one in clang). LLVM: - rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode) - rename thread_safety => sanitize_thread - rename no_uninitialized_checks -> sanitize_memory CLANG: - add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis)) - add __attribute__((no_sanitize_thread)) - add __attribute__((no_sanitize_memory)) for S in address thread memory If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not set llvm attribute sanitize_S llvm-svn: 176075
* Implement the NoBuiltin attribute.Bill Wendling2013-02-221-1/+2
| | | | | | | | The 'nobuiltin' attribute is applied to call sites to indicate that LLVM should not treat the callee function as a built-in function. I.e., it shouldn't try to replace that function with different code. llvm-svn: 175835
* [tsan/msan] adding thread_safety and uninitialized_checks attributesKostya Serebryany2013-02-111-0/+2
| | | | llvm-svn: 174864
* Add 'empty' query methods to the builder and use them in the verifier.Bill Wendling2013-02-101-1/+1
| | | | llvm-svn: 174832
* Make the AttrBuilder creation method of Attribute private so that people ↵Bill Wendling2013-01-311-1/+3
| | | | | | won't use it. llvm-svn: 174023
* Revert for now:Bill Wendling2013-01-311-3/+1
| | | | | | | | | --- Reverse-merging r174010 into '.': U include/llvm/IR/Attributes.h U lib/IR/Verifier.cpp U lib/IR/Attributes.cpp llvm-svn: 174012
* Remove the AttrBuilder version of the Attribute::get function.Bill Wendling2013-01-311-1/+3
| | | | | | | | The AttrBuilder is there to build up multiple attributes. The Attribute class represents only one attribute at a time. So remove this unnecessary builder creator method. llvm-svn: 174010
* Convert typeIncompatible to return an AttributeSet.Bill Wendling2013-01-301-2/+2
| | | | | | | There are still places which treat the Attribute object as a collection of attributes. I'm systematically removing them. llvm-svn: 173990
* Attempt to fix dragonegg. Use the number of slots to determine if the ↵Bill Wendling2013-01-301-1/+1
| | | | | | AttributeSet has attributes or not. llvm-svn: 173902
* Remove some introspection functions.Bill Wendling2013-01-251-2/+2
| | | | | | | | The 'getSlot' function and its ilk allow introspection into the AttributeSet class. However, that class should be opaque. Allow access through accessor methods instead. llvm-svn: 173522
* Add an accessor method to get the slot's index. This will limit the use of ↵Bill Wendling2013-01-251-12/+12
| | | | | | AttributeWithIndex. llvm-svn: 173495
* Use the AttributeSet query instead of the Attribute query.Bill Wendling2013-01-251-2/+2
| | | | llvm-svn: 173434
* Use AttributeSet instead of Attribute to verify things.Bill Wendling2013-01-211-53/+52
| | | | llvm-svn: 173101
* Push some more methods down to hide the use of the Attribute class.Bill Wendling2013-01-181-29/+49
| | | | | | | | Because the Attribute class is going to stop representing a collection of attributes, limit the use of it as an aggregate in favor of using AttributeSet. This replaces some of the uses for querying the function attributes. llvm-svn: 172844
* [IR] Add 'Append' and 'AppendUnique' module flag behaviors.Daniel Dunbar2013-01-161-13/+33
| | | | llvm-svn: 172659
* [IR] Add verification for module flags with the "require" behavior.Daniel Dunbar2013-01-151-7/+35
| | | | llvm-svn: 172549
OpenPOWER on IntegriCloud