summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
...
* Support all integer types in DiagnosticInfoOptimizationBase::ArgumentAdam Nemet2017-08-241-2/+10
| | | | | | We were missing size_t (unsigned long) on macOS. llvm-svn: 311628
* Retire the llvm.dbg.mir hack after r311594.Adrian Prantl2017-08-231-1/+1
| | | | llvm-svn: 311610
* Add a Verifier check for DILocation's scopes.Adrian Prantl2017-08-231-0/+4
| | | | | | Found via https://bugs.llvm.org/show_bug.cgi?id=33997. llvm-svn: 311608
* Parse and print DIExpressions inline to ease IR and MIR testingReid Kleckner2017-08-231-1/+21
| | | | | | | | | | | | | | | | | | | Summary: Most DIExpressions are empty or very simple. When they are complex, they tend to be unique, so checking them inline is reasonable. This also avoids the need for CodeGen passes to append to the llvm.dbg.mir named md node. See also PR22780, for making DIExpression not be an MDNode. Reviewers: aprantl, dexonsmith, dblaikie Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D37075 llvm-svn: 311594
* [IR] AutoUpgrade ModuleFlagBehavior for PIC and PIE levelSteven Wu2017-08-211-5/+23
| | | | | | | | | | | | | | | | | | | Summary: From r303590, ModuleFlagBehavior for PIC and PIE level is changed from Error to Max. This will cause bitcode compatibility issue when linking against a bitcode static archive built with old compiler. Add an auto-ugprade path to upgrade the the ModuleFlagBehavior in the old bitcode to match the new one so IRLinker can link them. Reviewers: tejohnson, mehdi_amini, dexonsmith Reviewed By: dexonsmith Subscribers: hans, llvm-commits Differential Revision: https://reviews.llvm.org/D36556 llvm-svn: 311387
* [ORE] Remove Old Optimization Remark APISam Elliott2017-08-211-43/+4
| | | | | | | | | | | | | | Summary: https://bugs.llvm.org/show_bug.cgi?id=33789 Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36972 llvm-svn: 311380
* Move helper classes into anonymous namespaces.Benjamin Kramer2017-08-201-0/+2
| | | | | | No functionality change intended. llvm-svn: 311288
* IR: Make stripDebugInfo robust against (invalid) empty basic blocksJustin Bogner2017-08-181-0/+3
| | | | | | | | | | Since stripDebugInfo runs before the verifier when reading IR, we can end up in a situation where we read some invalid IR but don't know its invalid yet. Before this patch we would crash in stripDebugInfo when given IR with a completely empty basic block, and after we get a nice error from the verifier instead. llvm-svn: 311202
* [Verifier] Avoid visiting DIGlobalVariables twice.Davide Italiano2017-08-171-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | We currently visit them twice. Once, through `visitMDNode()` -> (the code generated by) `../include/llvm/IR/Metadata.def:109` -> `visitDIGlobalVariable()` Then, through `visitMDNode()` -> `visitDIGlobalVariableExpression()` -> `visitDIGlobalVariable()` This results in verification failures printed twice, e.g.: $ ./opt -verify ../../test/DebugInfo/pr34186.ll missing global variable type !4 = distinct !DIGlobalVariable(name: "pat", scope: !0, file: !1, line: 27, isLocal: true, isDefinition: true) missing global variable type !4 = distinct !DIGlobalVariable(name: "pat", scope: !0, file: !1, line: 27, isLocal: true, isDefinition: true) ./opt: ../../test/DebugInfo/pr34186.ll: error: input module is broken! The patch removes one call so we ensure each GV is visited exactly once. Differential Revision: https://reviews.llvm.org/D36797 llvm-svn: 311081
* [Dominators] Introduce batch updatesJakub Kuderski2017-08-161-0/+10
| | | | | | | | | | | | | | | | | Summary: This patch introduces a way of informing the (Post)DominatorTree about multiple CFG updates that happened since the last tree update. This makes performing tree updates much easier, as it internally takes care of applying the updates in lockstep with the (virtual) updates to the CFG, which is done by reverse-applying future CFG updates. The batch updater is able to remove redundant updates that cancel each other out. In the future, it should be also possible to reorder updates to reduce the amount of work needed to perform the updates. Reviewers: dberlin, sanjoy, grosser, davide, brzycki Reviewed By: brzycki Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D36167 llvm-svn: 311015
* [Verifier] Reject globals without a type associated.Davide Italiano2017-08-161-0/+1
| | | | llvm-svn: 311012
* Add strictfp attribute to prevent unwanted optimizations of libm callsAndrew Kaylor2017-08-142-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D34163 llvm-svn: 310885
* [OptDiag] Updating Remarks in SampleProfileEli Friedman2017-08-111-0/+10
| | | | | | | | | | | | | | | | Updating remark API to newer OptimizationDiagnosticInfo API. This allows remarks to show up in diagnostic yaml file, and enables use of opt-viewer tool. Hotness information for remarks (L505 and L751) do not display hotness information, most likely due to profile information not being propagated yet. Unsure if this is the desired outcome. Patch by Tarun Rajendran. Differential Revision: https://reviews.llvm.org/D36127 llvm-svn: 310763
* [AVX512] Remove and autoupgrade many of the broadcast intrinsicsCraig Topper2017-08-111-0/+23
| | | | | | | | | | | | | | | | | Summary: This autoupgrades most of the broadcast intrinsics. They've been unused in clang for some time. This leaves the 32x2 intrinsics because they are still used in clang. Reviewers: RKSimon, zvi, igorb Reviewed By: RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36606 llvm-svn: 310725
* Prevent unused warning in non-assert builds (introduced in r310014).Daniel Jasper2017-08-041-2/+2
| | | | llvm-svn: 310022
* Un-revert r310014: false revert, it wasn't the cause of build breakVictor Leschuk2017-08-041-4/+25
| | | | llvm-svn: 310021
* Revert r310014 as it breaks build lld-x86_64-darwin13Victor Leschuk2017-08-041-25/+4
| | | | llvm-svn: 310020
* Teach GlobalSRA to update the debug info for split-up globals.Adrian Prantl2017-08-041-4/+25
| | | | | | | | | This is similar to what we are doing in "regular" SROA and creates DW_OP_LLVM_fragment operations to describe the resulting variables. rdar://problem/33654891 llvm-svn: 310014
* Remove PrologEpilogInserter's usage of DBG_VALUE's offset fieldAdrian Prantl2017-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the last half-dozen commits to LLVM I removed code that became dead after removing the offset parameter from llvm.dbg.value gradually proceeding from IR towards the backend. Before I can move on to DwarfDebug and friends there is one last side-called offset I need to remove: This patch modifies PrologEpilogInserter's use of the DBG_VALUE's offset argument to use a DIExpression instead. Because the PrologEpilogInserter runs at the Machine level I had to play a little trick with a named llvm.dbg.mir node to get the DIExpressions to print in MIR dumps (which print the llvm::Module followed by the MachineFunction dump). I also had to add rudimentary DwarfExpression support to CodeView and as a side-effect also fixed a bug (CodeViewDebug::collectVariableInfo was supposed to give up on variables with complex DIExpressions, but would fail to do so for fragments, which are also modeled as DIExpressions). With this last holdover removed we will have only one canonical way of representing offsets to debug locations which will simplify the code in DwarfDebug (and future versions of CodeViewDebug once it starts handling more complex expressions) and make it easier to reason about. This patch is NFC-ish: All test case changes are for assembler comments and the binary output does not change. rdar://problem/33580047 Differential Revision: https://reviews.llvm.org/D36125 llvm-svn: 309751
* [LV] Avoid redundant operations manipulating masksAyal Zaks2017-07-311-0/+2
| | | | | | | | | | | | | | | | The Loop Vectorizer generates redundant operations when manipulating masks: AND with true, OR with false, compare equal to true. Instead of relying on a subsequent pass to clean them up, this patch avoids generating them. Use null (no-mask) to represent all-one full masks, instead of a constant all-one vector, following the convention of masked gathers and scatters. Preparing for a follow-up VPlan patch in which these mask manipulating operations are modeled using recipes. Differential Revision: https://reviews.llvm.org/D35725 llvm-svn: 309558
* Migrate PGOMemOptSizeOpt to use new OptimizationRemarkEmitter PassSam Elliott2017-07-301-0/+3
| | | | | | | | | | | | | | | | | Summary: Fixes PR33790. This patch still needs a yaml-style test, which I shall write tomorrow Reviewers: anemet Reviewed By: anemet Subscribers: anemet, llvm-commits Differential Revision: https://reviews.llvm.org/D35981 llvm-svn: 309497
* Remove the obsolete offset parameter from @llvm.dbg.valueAdrian Prantl2017-07-282-4/+24
| | | | | | | | | | | | There is no situation where this rarely-used argument cannot be substituted with a DIExpression and removing it allows us to simplify the DWARF backend. Note that this patch does not yet remove any of the newly dead code. rdar://problem/33580047 Differential Revision: https://reviews.llvm.org/D35951 llvm-svn: 309426
* [ConstantFolder] Don't try to fold gep when the idx is a vector.Davide Italiano2017-07-271-4/+8
| | | | | | | | | | | | | | | | The code in ConstantFoldGetElementPtr() assumes integers, and therefore it crashes trying to get the integer bidwith of a vector type (in this case <4 x i32>. I just changed the code to prevent the folding in case of vectors and I didn't bother to generalize as this doesn't seem to me something that really happens in practice, but I'm willing to change the patch if you think it's worth it. This is hard to trigger from -instsimplify or -instcombine only as the second instruction is dead, so the test uses loop-unroll. Differential Revision: https://reviews.llvm.org/D35956 llvm-svn: 309330
* [OptRemark] Allow streaming of 64-bit integersAdam Nemet2017-07-271-0/+6
| | | | llvm-svn: 309293
* [Dominators] Move root-finding out of DomTreeBase and simplify itJakub Kuderski2017-07-261-6/+4
| | | | | | | | | | | | | | | | Summary: This patch moves root-finding logic from DominatorTreeBase to GenericDomTreeConstruction.h. It makes the behavior simpler and more consistent by always adding a virtual root to PostDominatorTrees. Reviewers: dberlin, davide, grosser, sanjoy Reviewed By: dberlin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35597 llvm-svn: 309146
* Support, IR, ADT: Check nullptr after allocation with malloc/realloc or callocMatthias Braun2017-07-201-0/+2
| | | | | | | | | | | | As a follow up of the bad alloc handler patch, this patch introduces nullptr checks on pointers returned from the malloc/realloc/calloc functions. In addition some memory size assignments are moved behind the allocation of the corresponding memory to fulfill exception safe memory management (RAII). patch by Klaus Kretzschmar Differential Revision: https://reviews.llvm.org/D35414 llvm-svn: 308576
* Debug Info: Add a file: field to DIImportedEntity.Adrian Prantl2017-07-194-20/+32
| | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 308398
* Normalize constructor call syntax, NFCI.Serge Guelton2017-07-181-1/+1
| | | | llvm-svn: 308275
* [AArch64] Extend CallingConv::X86_64_Win64 to AArch64 as wellMartin Storsjo2017-07-171-1/+1
| | | | | | | | | | | | Rename the enum value from X86_64_Win64 to plain Win64. The symbol exposed in the textual IR is changed from 'x86_64_win64cc' to 'win64cc', but the numeric value is kept, keeping support for old bitcode. Differential Revision: https://reviews.llvm.org/D34474 llvm-svn: 308208
* IR/Core.cpp: Prune unused "llvm/Bitcode/BitcodeReader.h".NAKAMURA Takumi2017-07-171-1/+0
| | | | llvm-svn: 308161
* [IR] Implement ↵Craig Topper2017-07-151-19/+67
| | | | | | | | | | | | | | | | | | | Constant::isNegativeZeroValue/isZeroValue/isAllOnesValue/isOneValue/isMinSignedValue for ConstantDataVector without going through getElementAsConstant Summary: Currently these methods call ConstantDataVector::getSplatValue which uses getElementsAsConstant to create a Constant object representing the element value. This method incurs a map lookup to see if we already have created such a Constant before and if not allocates a new Constant object. This patch changes these methods to use getElementAsAPFloat and getElementAsInteger so we can just examine the data values directly. Reviewers: spatel, pcc, dexonsmith, bogner, craig.topper Reviewed By: craig.topper Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35040 llvm-svn: 308112
* [Dominators] Implement incremental deletionsJakub Kuderski2017-07-141-0/+5
| | | | | | | | | | | | | | | | | 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 llvm-svn: 308062
* [Dominators] Implement incremental insertionsJakub Kuderski2017-07-141-0/+5
| | | | | | | | | | | | | | | | | 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 llvm-svn: 308054
* [Dominators] Make IsPostDominator a template parameterJakub Kuderski2017-07-141-1/+7
| | | | | | | | | | | | | | | | | 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 llvm-svn: 308040
* [Dominators] Simplify templatesJakub Kuderski2017-07-131-16/+6
| | | | | | | | | | | | | | Summary: DominatorTreeBase and related classes used overcomplicated template machinery. This patch simplifies them and gets rid of DominatorTreeBaseTraits and DominatorTreeBaseByTraits, which weren't actually used outside the DomTree construction. Reviewers: dberlin, sanjoy, davide, grosser Reviewed By: dberlin, davide, grosser Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35285 llvm-svn: 307953
* [PM] Use range-based for loops in LegacyPassManager.cpp (NFC).Florian Hahn2017-07-131-28/+23
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch replaces a bunch of iterator-based for loops with range-based for loops. There are 2 iterator-based loops left in this file in removeNotPreservedAnalysis, but I think those cannot be replaced by range-based for loops as they modify the container they are iterating over. Unless I missed something, this schould be a NFC and I would appreciate if someone could have a quick look to confirm that. Reviewers: chandlerc, pcc, jhenderson Reviewed By: jhenderson Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D35310 llvm-svn: 307902
* Add element atomic memset intrinsicDaniel Neilson2017-07-121-1/+32
| | | | | | | | | | | | | | Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memset intrinsic. This intrinsic is essentially memset with the implementation requirement that all stores used for the assignment are done with unordered-atomic stores of a given element size. Reviewers: eli.friedman, reames, mkazantsev, skatkov Reviewed By: reames Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, efriedma, llvm-commits Differential Revision: https://reviews.llvm.org/D34885 llvm-svn: 307854
* Add element atomic memmove intrinsicDaniel Neilson2017-07-121-0/+36
| | | | | | | | | | | | | | Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memmove intrinsic. This intrinsic is essentially memmove with the implementation requirement that all loads/stores used for the copy are done with unordered-atomic loads/stores of a given element size. Reviewers: eli.friedman, reames, mkazantsev, skatkov Reviewed By: reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34884 llvm-svn: 307796
* Have Module::createRNG return a unique_ptrSerge Guelton2017-07-121-2/+2
| | | | | | Instead of a raw pointer, this makes memory management safer. llvm-svn: 307762
* Fix unused variable warningsKonstantin Zhuravlyov2017-07-121-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D35280 llvm-svn: 307740
* Enhance synchscope representationKonstantin Zhuravlyov2017-07-118-72/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 307722
* [IR] Remove unnecessary const_casts from ConstantDataSequential and it's ↵Craig Topper2017-07-111-29/+25
| | | | | | subclasses. llvm-svn: 307666
* [IR] Add Type::isIntOrIntVectorTy(unsigned) similar to the existing ↵Craig Topper2017-07-092-3/+3
| | | | | | isIntegerTy(unsigned), but also works for vectors. llvm-svn: 307492
* [IR] Make use of ↵Craig Topper2017-07-093-19/+14
| | | | | | Type::isPtrOrPtrVectorTy/isIntOrIntVectorTy/isFPOrFPVectorTy to shorten code. NFC llvm-svn: 307491
* [SafepointIRVerifier] Avoid false positives in GC verifier for compare ↵Anna Thomas2017-07-071-2/+46
| | | | | | | | | | | | | | | | | | | between pointers Today the safepoint IR verifier catches some unrelocated uses of base pointers that are actually valid. With this change, we narrow down the set of false positives. Specifically, the verifier knows about compares to null and compares between 2 unrelocated pointers. Reviewed by: skatkov Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35057 llvm-svn: 307392
* [SafepointIRVerifier] NFC: Refactor code for identifying exclusive base typeAnna Thomas2017-07-071-37/+72
| | | | | | | | | Added a new Enum to identify if the base pointer is exclusively null or exlusively some constant or not exclusively any constant. Converted the base pointer identification method from recursive to iterative form. llvm-svn: 307340
* [Constants] Replace calls to ConstantInt::equalsInt(0)/equalsInt(1) with ↵Craig Topper2017-07-061-12/+12
| | | | | | isZero and isOne. NFCI llvm-svn: 307293
* [Constants] If we already have a ConstantInt*, prefer to use ↵Craig Topper2017-07-061-7/+7
| | | | | | | | isZero/isOne/isMinusOne instead of isNullValue/isOneValue/isAllOnesValue inherited from Constant. NFCI Going through the Constant methods requires redetermining that the Constant is a ConstantInt and then calling isZero/isOne/isMinusOne. llvm-svn: 307292
* [IR] Use CmpInst::isFPPredicate/isIntPredicate in a few other places. NFCCraig Topper2017-07-052-7/+6
| | | | llvm-svn: 307224
* [SafepointIRVerifier] Add verifier pass for finding GC relocation bugsAnna Thomas2017-07-053-0/+360
| | | | | | | | | | | | | | | | | | | | Original Patch and summary by Philip Reames. RewriteStatepointsForGC tries to rewrite a function in a manner where the optimizer can't end up using a pointer value after it might have been relocated by a safepoint. This pass checks the invariant that RSForGC is supposed to establish and that (if we constructed semantics correctly) later passes must preserve. This has been a really useful diagnostic tool when initially developing the rewriting scheme and has found numerous bugs. Differential Revision: https://reviews.llvm.org/D15940 Reviewed by: swaroop.sridhar, mjacob Subscribers: llvm-commits llvm-svn: 307112
OpenPOWER on IntegriCloud