summaryrefslogtreecommitdiffstats
path: root/unittests
Commit message (Collapse)AuthorAgeFilesLines
* Merging r310475:Tom Stellard2017-11-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r310475 | belleyb | 2017-08-09 06:47:01 -0700 (Wed, 09 Aug 2017) | 28 lines [Support] PR33388 - Fix formatv_object move constructor formatv_object currently uses the implicitly defined move constructor, but it is buggy. In typical use-cases, the problem doesn't show-up because all calls to the move constructor are elided. Thus, the buggy constructors are never invoked. The issue especially shows-up when code is compiled using the -fno-elide-constructors compiler flag. For instance, this is useful when attempting to collect accurate code coverage statistics. The exact issue is the following: The Parameters data member is correctly moved, thus making the parameters occupy a new memory location in the target object. Unfortunately, the default copying of the Adapters blindly copies the vector of pointers, leaving each of these pointers referencing the parameters in the original object instead of the copied one. These pointers quickly become dangling when the original object is deleted. This quickly leads to crashes. The solution is to update the Adapters pointers when performing a move. The copy constructor isn't useful for format objects and can thus be deleted. This resolves PR33388. Differential Revision: https://reviews.llvm.org/D34463 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318333 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r313998:Tom Stellard2017-09-281-0/+3
| | | | | | | | | | | | ------------------------------------------------------------------------ r313998 | bmakam | 2017-09-22 10:46:36 -0700 (Fri, 22 Sep 2017) | 3 lines [Falkor] Add falkor CPU to host detection This returns "falkor" for Falkor CPU. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314437 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r309928:Hans Wennborg2017-08-031-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r309928 | ewancrawford | 2017-08-03 02:23:03 -0700 (Thu, 03 Aug 2017) | 56 lines [Cloning] Move distinct GlobalVariable debug info metadata in CloneModule Duplicating the distinct Subprogram and CU metadata nodes seems like the incorrect thing to do in CloneModule for GlobalVariable debug info. As it results in the scope of the GlobalVariable DI no longer being consistent with the rest of the module, and the new CU is absent from llvm.dbg.cu. Fixed by adding RF_MoveDistinctMDs to MapMetadata flags for GlobalVariables. Current unit test IR after clone: ``` @gv = global i32 1, comdat($comdat), !dbg !0, !type !5 define private void @f() comdat($comdat) personality void ()* @persfn !dbg !14 { !llvm.dbg.cu = !{!10} !0 = !DIGlobalVariableExpression(var: !1) !1 = distinct !DIGlobalVariable(name: "gv", linkageName: "gv", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true) !2 = distinct !DISubprogram(name: "f", linkageName: "f", scope: null, file: !3, line: 4, type: !4, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !6, variables: !5) !3 = !DIFile(filename: "filename.c", directory: "/file/dir/") !4 = !DISubroutineType(types: !5) !5 = !{} !6 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "CloneModule", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, globals: !8) !7 = !DIFile(filename: "filename.c", directory: "/file/dir") !8 = !{!0} !9 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)") !10 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "CloneModule", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, globals: !11) !11 = !{!12} !12 = !DIGlobalVariableExpression(var: !13) !13 = distinct !DIGlobalVariable(name: "gv", linkageName: "gv", scope: !14, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true) !14 = distinct !DISubprogram(name: "f", linkageName: "f", scope: null, file: !3, line: 4, type: !4, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !10, variables: !5) ``` Patched IR after clone: ``` @gv = global i32 1, comdat($comdat), !dbg !0, !type !5 define private void @f() comdat($comdat) personality void ()* @persfn !dbg !2 { !llvm.dbg.cu = !{!6} !0 = !DIGlobalVariableExpression(var: !1) !1 = distinct !DIGlobalVariable(name: "gv", linkageName: "gv", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true) !2 = distinct !DISubprogram(name: "f", linkageName: "f", scope: null, file: !3, line: 4, type: !4, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !6, variables: !5) !3 = !DIFile(filename: "filename.c", directory: "/file/dir/") !4 = !DISubroutineType(types: !5) !5 = !{} !6 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "CloneModule", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, globals: !8) !7 = !DIFile(filename: "filename.c", directory: "/file/dir") !8 = !{!0} !9 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)") ``` Reviewers: aprantl, probinson, dblaikie, echristo, loladiro Reviewed By: aprantl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36082 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@309965 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: Add a file: field to DIImportedEntity.Adrian Prantl2017-07-192-14/+21
| | | | | | | | | | | | | | | | | | | | | | | DIImportedEntity has a line number, but not a file field. To determine the decl_line/decl_file we combine the line number from the DIImportedEntity with the file from the DIImportedEntity's scope. This does not work correctly when the parent scope is a DINamespace or a DIModule, both of which do not have a source file. This patch adds a file field to DIImportedEntity to unambiguously identify the source location of the using/import declaration. Most testcase updates are mechanical, the interesting one is the removal of the FIXME in test/DebugInfo/Generic/namespace.ll. This fixes PR33822. See https://bugs.llvm.org/show_bug.cgi?id=33822 for more context. <rdar://problem/33357889> https://bugs.llvm.org/show_bug.cgi?id=33822 Differential Revision: https://reviews.llvm.org/D35583 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308398 91177308-0d34-0410-b5e6-96231b3b80d8
* [codeview] Remove TypeServerHandler and PDBTypeServerHandlerReid Kleckner2017-07-173-187/+2
| | | | | | | | | | | | | | | | | Summary: Instead of wiring these through the CVTypeVisitor interface, clients should inspect the CVTypeArray before visiting it and potentially load up the type server's TPI stream if they need it. No tests relied on this functionality because LLD was the only client. Reviewers: ruiu Subscribers: mgorny, hiraditya, zturner, llvm-commits Differential Revision: https://reviews.llvm.org/D35394 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308212 91177308-0d34-0410-b5e6-96231b3b80d8
* [YAMLTraits] Add filename support to yaml::InputAlex Bradbury2017-07-171-0/+16
| | | | | | | | | | | | | | | | | | | | Summary: The current yaml::Input constructor takes a StringRef of data as its first parameter, discarding any filename information that may have been present when a YAML file was opened. Add an alterate yaml::Input constructor that takes a MemoryBufferRef, which can have a filename associated with it. This leads to clearer diagnostic messages. Sponsored By: DARPA, AFRL Reviewed By: arphaman Differential Revision: https://reviews.llvm.org/D35398 Patch by: Jonathan Anderson (trombonehero) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308172 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM/LCG] Teach the LazyCallGraph to maintain reference edges from everyChandler Carruth2017-07-152-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | function to every defined function known to LLVM as a library function. LLVM can introduce calls to these functions either by replacing other library calls or by recognizing patterns (such as memset_pattern or vector math patterns) and replacing those with calls. When these library functions are actually defined in the module, we need to have reference edges to them initially so that we visit them during the CGSCC walk in the right order and can effectively rebuild the call graph afterward. This was discovered when building code with Fortify enabled as that is a common case of both inline definitions of library calls and simplifications of code into calling them. This can in extreme cases of LTO-ing with libc introduce *many* more reference edges. I discussed a bunch of different options with folks but all of them are unsatisfying. They either make the graph operations substantially more complex even when there are *no* defined libfuncs, or they introduce some other complexity into the callgraph. So this patch goes with the simplest possible solution of actual synthetic reference edges. If this proves to be a memory problem, I'm happy to implement one of the clever techniques to save memory here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308088 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Fix reachable visitation and reenable a unit testJakub Kuderski2017-07-151-1/+27
| | | | | | | | This fixes a minor bug in insertion to a reachable node that caused DominatorTree.InsertDeleteExhaustive flakiness. The patch also adds a new testcase for this exact failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308074 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Temporarily disable a flaky unit testJakub Kuderski2017-07-141-1/+1
| | | | | | | | The DominatorTree.InsertDeleteExhaustive uses a RNG with a constant seed to generate different sequences of updates. The test fails on some buildbots and this patch disables it for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308070 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Remove an extra semicolon and add a missing include.Jakub Kuderski2017-07-141-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308065 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Implement incremental deletionsJakub Kuderski2017-07-141-0/+127
| | | | | | | | | | | | | | | | | Summary: This patch implements incremental edge deletions. It also makes DominatorTreeBase store a pointer to the parent function. The parent function is needed to perform full rebuilts during some deletions, but it is also used to verify that inserted and deleted edges come from the same function. Reviewers: dberlin, davide, grosser, sanjoy, brzycki Reviewed By: dberlin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35342 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308062 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Implement incremental insertionsJakub Kuderski2017-07-141-0/+125
| | | | | | | | | | | | | | | | | Summary: This patch introduces incremental edge insertions based on the Depth Based Search algorithm. Insertions should work for both dominators and postdominators. Reviewers: dberlin, grosser, davide, sanjoy, brzycki Reviewed By: dberlin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35341 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308054 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Make IsPostDominator a template parameterJakub Kuderski2017-07-141-11/+10
| | | | | | | | | | | | | | | | | Summary: DominatorTreeBase used to have IsPostDominators (bool) member to indicate if the tree is a dominator or a postdominator tree. This made it possible to switch between the two 'modes' at runtime, but it isn't used in practice anywhere. This patch makes IsPostDominator a template argument. This way, it is easier to switch between different algorithms at compile-time based on this argument and design external utilities around it. It also makes it impossible to incidentally assign a postdominator tree to a dominator tree (and vice versa), and to further simplify template code in GenericDominatorTreeConstruction. Reviewers: dberlin, sanjoy, davide, grosser Reviewed By: dberlin Subscribers: mzolotukhin, llvm-commits Differential Revision: https://reviews.llvm.org/D35315 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308040 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Define Arc less-than operator inline.Jakub Kuderski2017-07-132-7/+5
| | | | | | This fixes warnings on some buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307974 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Rename Update.Arc to Update.EdgeJakub Kuderski2017-07-132-7/+7
| | | | | | Update.Arc of type Arc caused a warning on some buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307968 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Add CFGBuilder testing utilityJakub Kuderski2017-07-133-0/+366
| | | | | | | | | | | | | | | | | | | Summary: This patch introduces a new testing utility for building and modifying CFG -- CFGBuilder. The primary use case for the utility is testing the upcoming incremental dominator tree update API. The current design provides a simple mechanism of constructing arbitrary graphs and then applying series of updates to them. CFGBuilder takes care of creating empty functions, connecting and disconnecting basic blocks. Under the hood it uses SwitchInst and UnreachableInst. It will be also possible to create a thin wrapper over CFGBuilder for parsing string input and to hook it up to other textual tools (e.g. opt used with FileCheck). Reviewers: dberlin, sanjoy, grosser, dblaikie Reviewed By: dblaikie Subscribers: davide, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D34798 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307960 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: Add llvm::center_justify.Frederich Munch2017-07-131-0/+5
| | | | | | | | | | | | | | Summary: Completes the set. Reviewers: ruiu Reviewed By: ruiu Subscribers: ruiu, llvm-commits Differential Revision: https://reviews.llvm.org/D35278 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307922 91177308-0d34-0410-b5e6-96231b3b80d8
* [AArch64] Add an SVE target feature to the backend and TargetParser.Amara Emerson2017-07-131-2/+3
| | | | | | | The feature will be used properly once assembler/disassembler support begins to land. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307917 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow clients to specify search order of DynamicLibraries.Frederich Munch2017-07-121-0/+10
| | | | | | | | | | | | | | Summary: Different JITs and other clients of LLVM may have different needs in how symbol resolution should occur. Reviewers: v.g.vassilev, lhames, karies Reviewed By: v.g.vassilev Subscribers: pcanal, llvm-commits Differential Revision: https://reviews.llvm.org/D33529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307849 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Fix a silly bug in my recent update to the CG update logic.Chandler Carruth2017-07-121-6/+6
| | | | | | | | I used the wrong variable to update. This was even covered by a unittest I wrote, and the comments for the unittest were correct (if confusing) but the test itself just matched the buggy behavior. =[ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307764 91177308-0d34-0410-b5e6-96231b3b80d8
* Have Module::createRNG return a unique_ptrSerge Guelton2017-07-121-1/+1
| | | | | | | Instead of a raw pointer, this makes memory management safer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307762 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance synchscope representationKonstantin Zhuravlyov2017-07-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenCL 2.0 introduces the notion of memory scopes in atomic operations to global and local memory. These scopes restrict how synchronization is achieved, which can result in improved performance. This change extends existing notion of synchronization scopes in LLVM to support arbitrary scopes expressed as target-specific strings, in addition to the already defined scopes (single thread, system). The LLVM IR and MIR syntax for expressing synchronization scopes has changed to use *syncscope("<scope>")*, where <scope> can be "singlethread" (this replaces *singlethread* keyword), or a target-specific name. As before, if the scope is not specified, it defaults to CrossThread/System scope. Implementation details: - Mapping from synchronization scope name/string to synchronization scope id is stored in LLVM context; - CrossThread/System and SingleThread scopes are pre-defined to efficiently check for known scopes without comparing strings; - Synchronization scope names are stored in SYNC_SCOPE_NAMES_BLOCK in the bitcode. Differential Revision: https://reviews.llvm.org/D21723 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307722 91177308-0d34-0410-b5e6-96231b3b80d8
* fix typos in comments; NFCHiroshi Inoue2017-07-111-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307626 91177308-0d34-0410-b5e6-96231b3b80d8
* InstrProf: Fix unit test which accidentally used a duplicate nameVedant Kumar2017-07-101-4/+1
| | | | | | | | | | This unit test constructed some profile records incorrectly. One of the records had a duplicate name: adding that record into the writer caused an error unrelated to what needed to be tested. Reported by David Blaikie! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307596 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Enable registration of out-of-tree passes with PassBuilderPhilip Pfaffe2017-07-102-0/+522
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a callback registration API to the PassBuilder, enabling registering out-of-tree passes with it. Through the Callback API, callers may register callbacks with the various stages at which passes are added into pass managers, including parsing of a pass pipeline as well as at extension points within the default -O pipelines. Registering utilities like `require<>` and `invalidate<>` needs to be handled manually by the caller, but a helper is provided. Additionally, adding passes at pipeline extension points is exposed through the opt tool. This patch adds a `-passes-ep-X` commandline option for every extension point X, which opt parses into pipelines inserted into that extension point. Reviewers: chandlerc Reviewed By: chandlerc Subscribers: lksbhm, grosser, davide, mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D33464 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307532 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Fix another "oops" spotted by eddyb and reported in IRC.Chandler Carruth2017-07-101-1/+1
| | | | | | This test pretty clearly should be calling 'maxnum' here. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307519 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm-profdata: Reduce memory usage by using Error callback rather than memberDavid Blaikie2017-07-102-97/+88
| | | | | | | | | | | | | | | | Reduces llvm-profdata memory usage on a large profile from 7.8GB to 5.1GB. The ProfData API now supports reporting all the errors/warnings rather than only the first, though llvm-profdata ignores everything after the first for now to preserve existing behavior. (if there's a desire for other behavior, happy to implement that - but might be as well left for a separate patch) Reviewers: davidxl Differential Revision: https://reviews.llvm.org/D35149 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307516 91177308-0d34-0410-b5e6-96231b3b80d8
* CGSCCPassManagerTest.cpp: Fix warnings. [-Wunused-variable]NAKAMURA Takumi2017-07-091-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307511 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Fix a nasty bug in the new PM where we failed to properlyChandler Carruth2017-07-091-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | invalidation of analyses when merging SCCs. While I've added a bunch of testing of this, it takes something much more like the inliner to really trigger this as you need to have partially-analyzed SCCs with updates at just the right time. So I've added a direct test for this using the inliner and verifying the domtree. Without the changes here, this test ends up finding a stale dominator tree. However, to handle this properly, we need to invalidate analyses *before* merging the SCCs. After talking to Philip and Sanjoy about this they convinced me this was the right approach. To do this, we need a callback mechanism when merging SCCs so we can observe the cycle that will be merged before the merge happens. This API update ended up being surprisingly easy. With this commit, the new PM passes the test-suite again. It hadn't since MemorySSA was enabled for EarlyCSE as that also will find this bug very quickly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307498 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Add unittesting of the call graph update logic with complexChandler Carruth2017-07-091-0/+166
| | | | | | | | | | | dependencies between analyses. This uncovers even more issues with the proxies and the splitting apart of SCCs which are fixed in this patch. I discovered this while trying to add more rigorous testing for a change I'm making to the call graph update invalidation logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307497 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Fix a test case to use a correct escape for a null byte followedChandler Carruth2017-07-091-7/+7
| | | | | | | | | | by a valid octal digit. The length argument shows that this was in fact the intent. This was pointed out in IRC, thanks to eddyb! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307496 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Teach PreservedAnalyses to have an `allInSet` static factoryChandler Carruth2017-07-091-0/+7
| | | | | | | function template to simplify building a quick object with a set marked as preserved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307493 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Add a default constructor and a bool conversion to function_ref.Chandler Carruth2017-07-091-0/+14
| | | | | | | | | | The internal representation has a natural way to handle this and it seems nicer than having to wrap this in an optional (with its own separate flag). This also matches how std::function works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307490 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Finish implementing and fix a chain of bugs uncovered by testingChandler Carruth2017-07-091-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the invalidation propagation logic from an SCC to a Function. I wrote the infrastructure to test this but didn't actually use it in the unit test where it was designed to be used. =[ My bad. Once I actually added it to the test case I discovered that it also hadn't been properly implemented, so I've implemented it. The logic in the FAM proxy for an SCC pass to propagate invalidation follows the same ideas as the FAM proxy for a Module pass, but the implementation is a bit different to reflect the fact that it is forwarding just for an SCC. However, implementing this correctly uncovered a surprising "bug" (it was conservatively correct but relatively very expensive) in how we handle invalidation when splitting one SCC into multiple SCCs. We did an eager invalidation when in reality we should be deferring invaliadtion for the *current* SCC to the CGSCC pass manager and just invaliating the newly constructed SCCs. Otherwise we end up invalidating too much too soon. This was exposed by the inliner test case that I've updated. Now, we invalidate *just* the split off '(test1_f)' SCC when doing the CG update, and then the inliner finishes and invalidates the '(test1_g, test1_h)' SCC's analyses. The first few attempts at fixing this hit still more bugs, but all of those are covered by existing tests. For example, the inliner should also preserve the FAM proxy to avoid unnecesasry invalidation, and this is safe because the CG update routines it uses handle any necessary adjustments to the FAM proxy. Finally, the unittests for the CGSCC pass manager needed a bunch of updates where we weren't correctly preserving the FAM proxy because it hadn't been fully implemented and failing to preserve it didn't matter. Note that this doesn't yet fix the current crasher due to MemSSA finding a stale dominator tree, but without this the fix to that crasher doesn't really make any sense when testing because it relies on the proxy behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307487 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Revert "Revert "Switch external cvtres.exe for llvm's own ↵Eric Beckmann2017-07-081-1/+2
| | | | | | | | | | | | | | | | | | | | resource library."""" This reverts commit 147f45ff24456aea59575fa4ac16c8fa554df46a. Revert "Revert "Revert "Revert "Replace trivial use of external rc.exe by writing our own .res file."""" This reverts commit 61a90a67ed54a1f0dfeab457b65abffa129569e4. The patches were intially reverted because they were causing a failure on CrWinClangLLD. Unfortunately, this was done haphazardly and didn't compile, so the revert was reverted again quickly to fix this. One that was done, the revert of the revert was itself reverted. This allowed me to finally fix the actual bug in r307452. This patch re-enables the code path that had originally been causing the bug, now that it (should) be fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307460 91177308-0d34-0410-b5e6-96231b3b80d8
* ProfData: Fix some unchecked Errors in unit testsDavid Blaikie2017-07-073-124/+146
| | | | | | | | | | | | | | | | | | | | | The 'NoError' function was meant to be used as the input to ASSERT/EXPECT_TRUE, but it is easy to forget this (it could be annotated with nodiscard to help this) so many sites that look like they're checked are not (& silently discard the failure). Only one site actually has an Error sneaking out this way and I've replaced that one with a FIXME+consumeError. The rest of the code has been modified to use the EXPECT_THAT_ERROR macros Zach introduced a while back. Between the options available this seems OK/good/something to standardize on - though it's difficult to build a matcher that could handle checking for a specific llvm::Error result, so those remain using the custom ErrorEquals (& the nodiscard added to ensure it is not misused as it was previous to this patch). It could still be generalized a bit further (even not as far as a matcher, but at least support multiple kinds of Error, etc) & added to the general Error utility header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307440 91177308-0d34-0410-b5e6-96231b3b80d8
* [cloning] Do not duplicate types when cloning functionsGor Nishanov2017-07-071-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is an addon to the change rl304488 cloning fixes. (Originally rl304226 reverted rl304228 and reapplied rl304488 https://reviews.llvm.org/D33655) rl304488 works great when DILocalVariables that comes from the inlined function has a 'unique-ed' type, but, in the case when the variable type is distinct we will create a second DILocalVariable in the scope of the original function that was inlined. Consider cloning of the following function: ``` define private void @f() !dbg !5 { %1 = alloca i32, !dbg !11 call void @llvm.dbg.declare(metadata i32* %1, metadata !14, metadata !12), !dbg !18 ret void, !dbg !18 } !14 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !17) ; came from an inlined function !15 = distinct !DISubprogram(name: "inlined", linkageName: "inlined", scope: null, file: !6, line: 8, type: !7, isLocal: true, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !0, variables: !16) !16 = !{!14} !17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32) ``` Without this fix, when function 'f' is cloned, we will create another DILocalVariable for "inlined", due to its type being distinct. ``` define private void @f.1() !dbg !23 { %1 = alloca i32, !dbg !26 call void @llvm.dbg.declare(metadata i32* %1, metadata !28, metadata !12), !dbg !30 ret void, !dbg !30 } !14 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !17) !15 = distinct !DISubprogram(name: "inlined", linkageName: "inlined", scope: null, file: !6, line: 8, type: !7, isLocal: true, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !0, variables: !16) !16 = !{!14} !17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32) ; !28 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !29) ; OOPS second DILocalVariable !29 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32) ``` Now we have two DILocalVariable for "inlined" within the same scope. This result in assert in AsmPrinter/DwarfDebug.h:131: void llvm::DbgVariable::addMMIEntry(const llvm::DbgVariable &): Assertion `V.Var == Var && "conflicting variable"' failed. (Full example: See: https://bugs.llvm.org/show_bug.cgi?id=33492) In this change we prevent duplication of types so that when a metadata for DILocalVariable is cloned it will get uniqued to the same metadate node as an original variable. Reviewers: loladiro, dblaikie, aprantl, echristo Reviewed By: loladiro Subscribers: EricWF, llvm-commits Differential Revision: https://reviews.llvm.org/D35106 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307418 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] sys::getProcessTriple should return a macOS triple usingAlex Lorenz2017-07-071-0/+61
| | | | | | | | | | | | | | | | the system's version of macOS sys::getProcessTriple returns LLVM_HOST_TRIPLE, whose system version might not be the actual version of the system on which the compiler running. This commit ensures that, for macOS, sys::getProcessTriple returns a triple with the system's macOS version. rdar://33177551 Differential Revision: https://reviews.llvm.org/D34446 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307372 91177308-0d34-0410-b5e6-96231b3b80d8
* [ORC] Errorize the ORC APIs.Lang Hames2017-07-077-62/+90
| | | | | | | | | | This patch updates the ORC layers and utilities to return and propagate llvm::Errors where appropriate. This is necessary to allow ORC to safely handle error cases in cross-process and remote JITing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307350 91177308-0d34-0410-b5e6-96231b3b80d8
* [ORC] Update GlobalMappingLayer::addModuleSet to addModule.Lang Hames2017-07-061-1/+1
| | | | | | | | This layer was accidentally left out of r306166. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307319 91177308-0d34-0410-b5e6-96231b3b80d8
* Prototype: Reduce llvm-profdata merge memory usage furtherDavid Blaikie2017-07-061-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The InstrProfWriter already stores the name and hash of the record in the nested maps it uses for lookup while merging - this data is duplicated in the value within the maps. Refactor the InstrProfRecord to use a nested struct for the counters themselves so that InstrProfWriter can use this nested struct alone without the name or hash duplicated there. This work is incomplete, but enough to demonstrate the value (around a 50% decrease in memory usage for a large test case (10GB -> 5GB)). Though most of that decrease is probably from removing the SoftInstrProfError as well, but I haven't implemented a replacement for it yet. (it needs to go with the counters, because the operations on the counters - merging, etc, are where the failures are - unlike the name/hash which are totally unused by those counter-related operations and thus easy to split out) Ongoing discussion about removing SoftInstrProfError as a field of the InstrProfRecord is happening on the thread that added it - including the possibility of moving back towards an earlier version of that proposed patch that passed SoftInstrProfError through the various APIs, rather than as a member of InstrProfRecord. Reviewers: davidxl Differential Revision: https://reviews.llvm.org/D34838 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307298 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify InstrProfRecord tests, eliminating named temporaries in favor of ↵David Blaikie2017-07-062-107/+56
| | | | | | | | | braced init args This will also simplify an API transition and class renaming coming soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307236 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Revert "Replace trivial use of external rc.exe by writing ↵Eric Beckmann2017-07-051-2/+1
| | | | | | | | | | | | | | our own .res file.""" This reverts commit 5fecbbbe5049665d86834cf69d8f75db4f392308. The initial revert was done in order to prevent ongoing errors on chromium bots such as CrWinClangLLD. However, this was done haphazardly and I didn't realize there were test and compilation failures, so this revert was reverted. Now that those have been fixed, we can revert the revert of the revert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307226 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Replace trivial use of external rc.exe by writing our own ↵Eric Beckmann2017-07-051-1/+2
| | | | | | | | .res file."" This reverts commit 8c8dce3b8f15d6ebaefc35ce88f15a85c8cdbd6e. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307191 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Replace trivial use of external rc.exe by writing our own .res file."Eric Beckmann2017-07-051-2/+1
| | | | | | | | | This patch still seems to break CrWinClangLLD, reverting this once more until I can discover root problem. This reverts commit 3dbbc8ce43be50ffde2b1c655c6d3a25796fe78b. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307188 91177308-0d34-0410-b5e6-96231b3b80d8
* [Orc] Remove the memory manager argument to addModule, and de-templatize theLang Hames2017-07-043-54/+47
| | | | | | | | | | | | | | | | | | symbol resolver argument. De-templatizing the symbol resolver is part of the ongoing simplification of ORC layer API. Removing the memory management argument (and delegating construction of memory managers for RTDyldObjectLinkingLayer to a functor passed in to the constructor) allows us to build JITs whose base object layers need not be compatible with RTDyldObjectLinkingLayer's memory mangement scheme. For example, a 'remote object layer' that sends fully relocatable objects directly to the remote does not need a memory management scheme at all (that will be handled by the remote). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307058 91177308-0d34-0410-b5e6-96231b3b80d8
* MathExtras UnitTest: Assert that isPowerOf2(0) is false. NFC.Zvi Rackover2017-07-031-0/+2
| | | | | | | | | | | | | | | | | Summary: This is a follow-up on D34077. Elena observed that the correctness of the code relies on isPowerOf2(0) returning false. Adding a test to cover this corner-case. Reviewers: delena, davide, craig.topper Reviewed By: davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34939 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307046 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Replace trivial use of external rc.exe by writing our own ↵Eric Beckmann2017-07-011-1/+2
| | | | | | | | | | | | | | | | | | .res file."" Summary: This reverts commit 51931072a7c9a52540baf76fc30ef391d2529a2f. This revert was originally done because the integrations of the new WindowsResource library into LLD was causing error in chromium, due to bugs in how resource sections were handled. These bugs were fixed, meaning that the features may be reintegrated. Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34922 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306941 91177308-0d34-0410-b5e6-96231b3b80d8
* [Dominators] Reapply r306892, r306893, r306893.Jakub Kuderski2017-07-011-0/+13
| | | | | | | | | This reverts commit r306907 and reapplies the patches in the title. The patches used to make one of the CodeGen/ARM/2011-02-07-AntidepClobber.ll test to fail because of a missing null check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306919 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Dominators] Teach IDF to use level information"Jakub Kuderski2017-06-301-13/+0
| | | | | | | | | | | | | | This reverts commit r306894. Revert "[Dominators] Add NearestCommonDominator verification" This reverts commit r306893. Revert "[Dominators] Keep tree level in DomTreeNode and use it to find NCD and answer dominance queries" This reverts commit r306892. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306907 91177308-0d34-0410-b5e6-96231b3b80d8