summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
...
* [LLVM-C] Use Length-Providing Value Name Getters and SettersRobert Widmann2018-05-191-0/+10
| | | | | | | | | | | | | | | | Summary: - Provide LLVMGetValueName2 and LLVMSetValueName2 that return and take the length of the provided C string respectively - Deprecate LLVMGetValueName and LLVMSetValueName Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits, harlanhaskins Differential Revision: https://reviews.llvm.org/D46890 llvm-svn: 332810
* [NFC] Change cast from r332739 to a static castJessica Paquette2018-05-181-1/+2
| | | | | | | | | The casts in the delta computation for size remarks should have been static casts. This fixes that. Thanks to Dávid Bolvanský for pointing that out. llvm-svn: 332758
* Add remarks describing when a pass changes the IR instruction count of a moduleJessica Paquette2018-05-183-3/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a remark which tells the user when a pass changes the number of IR instructions in a module. It can be enabled by using -Rpass-analysis=size-info. The point of this is to make it easier to collect statistics on how passes modify programs in terms of code size. This is similar in concept to timing reports, but using a remark-based interface makes it easy to diff changes over multiple compilations of the same program. By adding functionality like this, we can see * Which passes impact code size the most * How passes impact code size at different optimization levels * Which pass might have contributed the most to an overall code size regression The patch lives in the legacy pass manager, but since it's simply emitting remarks, it shouldn't be too difficult to adapt the functionality to the new pass manager as well. This can also be adapted to handle MachineInstr counts in code gen passes. https://reviews.llvm.org/D38768 llvm-svn: 332739
* In thin and full LTO + CFI, direct function calls may go through jump tableDmitry Mikulin2018-05-171-29/+0
| | | | | | | | | entries to reach the target. Since these calls don't require type checks, we can short-circuit them to their real targets. Differential Revision: https://reviews.llvm.org/D46326 llvm-svn: 332610
* [STLExtras] Add size() for ranges, and remove distance()Vedant Kumar2018-05-161-1/+3
| | | | | | | | | | r332057 introduced distance() for ranges. Based on post-commit feedback, this renames distance() to size(). The new size() is also only enabled when the operation is O(1). Differential Revision: https://reviews.llvm.org/D46976 llvm-svn: 332551
* [Debugify] Add -debugify-each for testing each pass in a pipelineVedant Kumar2018-05-151-0/+8
| | | | | | | | | | | | | | | | This adds a -debugify-each mode to opt which, when enabled, wraps each {Module,Function}Pass in a pipeline with logic to add, check, and strip synthetic debug info for testing purposes. This mode can be used to test complex pipelines for debug info bugs, or to collect statistics about the number of debug values & locations lost throughout various stages of a pipeline. Patch by Son Tuan Vu! Differential Revision: https://reviews.llvm.org/D46525 llvm-svn: 332312
* [CodeView] Improve debugging of virtual base class member variablesBrock Wyma2018-05-141-1/+5
| | | | | | | | Initial support for passing the virtual base pointer offset to CodeViewDebug. https://reviews.llvm.org/D46271 llvm-svn: 332296
* [X86] Remove and autoupgrade avx512.vbroadcast.ss/avx512.vbroadcast.sd ↵Craig Topper2018-05-141-1/+3
| | | | | | intrinsics. llvm-svn: 332271
* Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-145-26/+33
| | | | | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
* Fix "not all control paths return a value" MSVC warning. NFCI.Simon Pilgrim2018-05-141-0/+1
| | | | llvm-svn: 332238
* [LLVM-C] Add Bindings For Module FlagsRobert Widmann2018-05-141-0/+104
| | | | | | | | | | | | | | | | | | | Summary: The first foray into merging debug info into the echo tests. - Add bindings to Module::getModuleFlagsMetadata() in the form of LLVMCopyModuleFlagsMetadata - Add the opaque type LLVMModuleFlagEntry to represent Module::ModuleFlagEntry - Add accessors for LLVMModuleFlagEntry's behavior, key, and metadata node. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: aprantl, JDevlieghere, llvm-commits, harlanhaskins Differential Revision: https://reviews.llvm.org/D46792 llvm-svn: 332219
* [X86] Remove and autoupgrade the cvtusi2sd intrinsic. Use ↵Craig Topper2018-05-141-0/+5
| | | | | | uitofp+insertelement instead. llvm-svn: 332206
* [X86] Remove and autoupgrade masked vpermd/vpermps intrinsics.Craig Topper2018-05-131-7/+13
| | | | llvm-svn: 332198
* [X86] Remove an autoupgrade legacy cvtss2sd intrinsics.Craig Topper2018-05-131-0/+5
| | | | llvm-svn: 332187
* [X86] Remove and autoupgrade cvtsi2ss/cvtsi2sd intrinsics to match what ↵Craig Topper2018-05-121-0/+11
| | | | | | clang has used for a very long time. llvm-svn: 332186
* [X86] Remove some unused masked conversion intrinsics that can be replaced ↵Craig Topper2018-05-121-3/+33
| | | | | | | | with an older intrinsic and a select. This is what clang already uses. llvm-svn: 332170
* [X86] Remove and autoupgrade a bunch of FMA instrinsics that are no longer ↵Craig Topper2018-05-111-0/+83
| | | | | | used by clang. llvm-svn: 332146
* [X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.Craig Topper2018-05-111-0/+11
| | | | llvm-svn: 332079
* [STLExtras] Add distance() for ranges, pred_size(), and succ_size()Vedant Kumar2018-05-101-3/+1
| | | | | | | | | | | This commit adds a wrapper for std::distance() which works with ranges. As it would be a common case to write `distance(predecessors(BB))`, this also introduces `pred_size()` and `succ_size()` helpers to make that easier to write. Differential Revision: https://reviews.llvm.org/D46668 llvm-svn: 332057
* [LLVM-C] Consolidate llgo's DIBuilder BindingsRobert Widmann2018-05-101-0/+11
| | | | | | | | | | | | | | Summary: Move and correct LLVMDIBuilderCreateTypedef. This is the last API in DIBuilderBindings.h, so it is being removed and the C API will now be re-exported from IRBindings.h. Reviewers: whitequark, harlanhaskins, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46725 llvm-svn: 332041
* [LLVM-C] Add Accessors for Common DIType and DILocation PropertiesRobert Widmann2018-05-101-0/+42
| | | | | | | | | | | | | | | | Summary: - Adds getters for the line, column, and scope of a DILocation - Adds getters for the name, size in bits, offset in bits, alignment in bits, line, and flags of a DIType Reviewers: whitequark, harlanhaskins, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46627 llvm-svn: 332014
* [LLVM-C] Move DIBuilder Bindings For Temporary MDNodesRobert Widmann2018-05-101-0/+17
| | | | | | | | | | | | | | Summary: Move LLVMTemporaryMDNode and LLVMMetadataReplaceAllUsesWith to the C bindings and add LLVMDeleteTemporaryMDNode for deleting non-RAUW'ed temporary nodes. Reviewers: whitequark, harlanhaskins, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46632 llvm-svn: 332010
* [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.Shiva Chen2018-05-096-23/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to set breakpoints on labels and list source code around labels, we need collect debug information for labels, i.e., label name, the function label belong, line number in the file, and the address label located. In order to keep these information in LLVM IR and to allow backend to generate debug information correctly. We create a new kind of metadata for labels, DILabel. The format of DILabel is !DILabel(scope: !1, name: "foo", file: !2, line: 3) We hope to keep debug information as much as possible even the code is optimized. So, we create a new kind of intrinsic for label metadata to avoid the metadata is eliminated with basic block. The intrinsic will keep existing if we keep it from optimized out. The format of the intrinsic is llvm.dbg.label(metadata !1) It has only one argument, that is the DILabel metadata. The intrinsic will follow the label immediately. Backend could get the label metadata through the intrinsic's parameter. We also create DIBuilder API for labels to be used by Frontend. Frontend could use createLabel() to allocate DILabel objects, and use insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR. Differential Revision: https://reviews.llvm.org/D45024 Patch by Hsiangkai Wang. llvm-svn: 331841
* Fix a bunch of places where operator-> was used directly on the return from ↵Craig Topper2018-05-051-2/+2
| | | | | | | | | | dyn_cast. Inspired by r331508, I did a grep and found these. Mostly just change from dyn_cast to cast. Some cases also showed a dyn_cast result being converted to bool, so those I changed to isa. llvm-svn: 331577
* [DebugInfo] Correction for an assert in DIExpression::createFragmentExpressionBjorn Pettersson2018-05-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When we create a fragment expression, and there already is an old fragment expression, we assert that the new fragment is within the range for the old fragment. If for example the old fragment expression says that we describe bit 10-16 of a variable (Offset=10, Size=6), and we now want to create a new fragment expression only describing bit 3-6 of the original value, then the resulting fragment expression should have Offset=13, Size=3. The assert is supposed to catch if the resulting fragment expression is outside the range for the old fragment. However, it used to verify that the Offset+Size of the new fragment was smaller or equal than Offset+Size for the old fragment. What we really want to check is that Offset+Size of the new fragment is smaller than the Size of the old fragment. Reviewers: aprantl, vsk Reviewed By: aprantl Subscribers: davide, llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D46391 llvm-svn: 331465
* Rename invariant.group.barrier to launder.invariant.groupPiotr Padlewski2018-05-032-7/+18
| | | | | | | | | | | | | | Summary: This is one of the initial commit of "RFC: Devirtualization v2" proposal: https://docs.google.com/document/d/16GVtCpzK8sIHNc2qZz6RN8amICNBtvjWUod2SujZVEo/edit?usp=sharing Reviewers: rsmith, amharc, kuhar, sanjoy Subscribers: arsenm, nhaehnle, javed.absar, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45111 llvm-svn: 331448
* Remove @brief commands from doxygen comments, too.Adrian Prantl2018-05-012-3/+3
| | | | | | | | | | | | | | | | | This is a follow-up to r331272. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done https://reviews.llvm.org/D46290 llvm-svn: 331275
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-0111-61/+61
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* IWYU for llvm-config.h in llvm, additions.Nico Weber2018-04-307-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See r331124 for how I made a list of files missing the include. I then ran this Python script: for f in open('filelist.txt'): f = f.strip() fl = open(f).readlines() found = False for i in xrange(len(fl)): p = '#include "llvm/' if not fl[i].startswith(p): continue if fl[i][len(p):] > 'Config': fl.insert(i, '#include "llvm/Config/llvm-config.h"\n') found = True break if not found: print 'not found', f else: open(f, 'w').write(''.join(fl)) and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p` and tried to fix include ordering and whatnot. No intended behavior change. llvm-svn: 331184
* [LLVM-C] Add DIBuilder bindings to create import declarationsRobert Widmann2018-04-281-0/+49
| | | | | | | | | | | | | | Summary: Add bindings to create import declarations for modules, functions, types, and other entities. This wraps the conveniences available in the existing DIBuilder API, but these seem C++-specific. Reviewers: whitequark, harlanhaskins, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46167 llvm-svn: 331123
* [LLVM-C] Miscellaneous Cleanups in DIBuilder BindingsRobert Widmann2018-04-281-16/+52
| | | | | | | | | | | | | | | | Summary: * rL328953 does not include bindings for LLVMDIBuilderCreateClassType and LLVMDIBuilderCreateBitFieldMemberType despite declaring their prototypes. Provide these bindings now. * Switch to more precise types with specific numeric limits matching the DIBuilder's C++ API. Reviewers: harlanhaskins, whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46168 llvm-svn: 331114
* Fix a bug in GlobalOpt's handling of DIExpressions.Adrian Prantl2018-04-271-4/+4
| | | | | | | | | This patch adds support for fragment expressions TryToShrinkGlobalToBoolean() which were previously just dropped. Thanks to Reid Kleckner for providing me a reproducer! llvm-svn: 331086
* [IR] Do not assume that function pointers are alignedMikhail Maltsev2018-04-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The value tracking analysis uses function alignment to infer that the least significant bits of function pointers are known to be zero. Unfortunately, this is not correct for ARM targets: the least significant bit of a function pointer stores the ARM/Thumb state information (i.e., the LSB is set for Thumb functions and cleared for ARM functions). The original approach (https://reviews.llvm.org/D44781) introduced a new field for function pointer alignment in the DataLayout structure to address this. But it seems unlikely that optimizations based on function pointer alignment would bring much benefit in practice to justify the additional maintenance burden, so this patch simply assumes that function pointer alignment is always unknown. Reviewers: javed.absar, efriedma Reviewed By: efriedma Subscribers: kristof.beyls, llvm-commits, hfinkel, rogfer01 Differential Revision: https://reviews.llvm.org/D46110 llvm-svn: 331025
* [x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsicsChandler Carruth2018-04-261-104/+2
| | | | | | | | The LLVM commit introduces a crash in LLVM's instruction selection. I filed http://llvm.org/PR37260 with the test case. llvm-svn: 330997
* Update stale comment in AsmWriter.cppVlad Tsyrklevich2018-04-261-1/+3
| | | | | | | | | | | | | | | | | | Summary: The old comment referred to llvm/IR/Writer.h which doesn't longer exist. This patch replaces it with an up-to-date description of AsmWriter library. Patch by Alex Yursha. Reviewers: gribozavr, vlad.tsyrklevich Reviewed By: vlad.tsyrklevich Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45895 llvm-svn: 330962
* Rename Attributes.gen, Intrinsics.gen to Attributes.inc, Intrinsics.incNico Weber2018-04-251-7/+7
| | | | | | | | | Virtually all other tablegen outputs are called .inc, not .gen, so rename these two too for consistency. No behavior change. https://reviews.llvm.org/D46058 llvm-svn: 330843
* [LLVM-C] DIBuilder Bindings For Variable ExpressionsRobert Widmann2018-04-231-0/+66
| | | | | | | | | | | | | | Summary: Add DIBuilder bindings for (global) variable expressions, variable value expressions, and debug value intrinsic insertion. Reviewers: harlanhaskins, deadalnix, whitequark Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45979 llvm-svn: 330661
* Fix -Wtautological-compare warning with npos on WindowsReid Kleckner2018-04-231-2/+1
| | | | llvm-svn: 330614
* [LLVM-C] DIBuilderBindings for Subrange and ArraysRobert Widmann2018-04-231-0/+19
| | | | | | | | | | | | | | Summary: Move Go bindings for subranges and DINode arrays. Reviewers: harlanhaskins, whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45933 llvm-svn: 330594
* [LLVM-C] Finish Up Scope BindingsRobert Widmann2018-04-231-0/+33
| | | | | | | | | | | | | | Summary: Adds bindings for Module and NameSpace scopes and LLVMDIBuilderCreateForwardDecl, a counterpart to LLVMDIBuilderCreateReplaceableCompositeType. Reviewers: harlanhaskins, whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45934 llvm-svn: 330591
* [LLVM-C] Add DIBuilder Bindings For Variable CreationRobert Widmann2018-04-221-0/+44
| | | | | | | | | | | | | | Summary: Wrap LLVMDIBuilderCreateAutoVariable, LLVMDIBuilderCreateParameterVariable, LLVMDIBuilderCreateExpression, and move and correct LLVMDIBuilderInsertDeclareBefore and LLVMDIBuilderInsertDeclareAtEnd from the Go bindings to the C bindings. Reviewers: harlanhaskins, whitequark, deadalnix Reviewed By: harlanhaskins, whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45928 llvm-svn: 330555
* Lowering x86 adds/addus/subs/subus intrinsics (llvm part)Alexander Ivchenko2018-04-191-2/+104
| | | | | | | | | | | | | This is the patch that lowers x86 intrinsics to native IR in order to enable optimizations. The patch also includes folding of previously missing saturation patterns so that IR emits the same machine instructions as the intrinsics. Patch by tkrupa Differential Revision: https://reviews.llvm.org/D44785 llvm-svn: 330322
* [BasicBlock] Add instructionsWithoutDebug methods to skip debug insts.Florian Hahn2018-04-191-0/+18
| | | | | | | | | | Reviewers: aprantl, vsk, mattd, chandlerc Reviewed By: aprantl, vsk Differential Revision: https://reviews.llvm.org/D45657 llvm-svn: 330316
* [LLVM-C] [PR34633] Avoid calling ->dump() methods from LLVMDump*.whitequark2018-04-171-5/+3
| | | | | | | | | | LLVMDump* functions are available in Release builds too. Patch by Brenton Bostick. Differential Revision: https://reviews.llvm.org/D44600 llvm-svn: 330189
* [IR] Upgrade comment token in objc retain release marker for asm callGerolf Hoflehner2018-04-171-0/+13
| | | | | | Older compiler issued '#' instead of ';' llvm-svn: 330173
* [DebugInfo] Follow-up bug fix on "Fixing a couple of DI duplication bugs of ↵Roman Tereshin2018-04-161-2/+0
| | | | | | | | | | | | CloneModule" Apparently, DebugInfoFinder::processCompileUnit doesn't process all of the possible kinds of DIImportedEntit'ies, e.g. DIGlobalVariable's. Previously introduced `llvm_unreachable` is therefore incorrect. Removing it here. llvm-svn: 330167
* [Attributes] Fix a bug in AttributeList::get so it can handle a mix of ↵Craig Topper2018-04-161-0/+4
| | | | | | | | | | FunctionIndex and ReturnIndex/arg indices at the same time The code uses the index of the last element in the sorted array to determine the maximum size needed for the vector. But if the last index is a FunctionIndex(~0), attrIdxToArrayIdx will return 0 and the vector will have size 1. If there are any indices before FunctionIndex, those values would return a value larger than 0 from attrIdxToArrayIdx. So in this case we need to look in front of the FunctionIndex to get the true size needed. Differential Revision: https://reviews.llvm.org/D45632 llvm-svn: 330136
* [DebugInfo][OPT] NFC follow-up on "Fixing a couple of DI duplication bugs of ↵Roman Tereshin2018-04-131-41/+16
| | | | | | CloneModule" llvm-svn: 330070
* [DebugInfo][OPT] Fixing a couple of DI duplication bugs of CloneModuleRoman Tereshin2018-04-131-3/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As demonstrated by the regression tests added in this patch, the following cases are valid cases: 1. A Function with no DISubprogram attached, but various debug info related to its instructions, coming, for instance, from an inlined function, also defined somewhere else in the same module; 2. ... or coming exclusively from the functions inlined and eliminated from the module entirely. The ValueMap shared between CloneFunctionInto calls within CloneModule needs to contain identity mappings for all of the DISubprogram's to prevent them from being duplicated by MapMetadata / RemapInstruction calls, this is achieved via DebugInfoFinder collecting all the DISubprogram's. However, CloneFunctionInto was missing calls into DebugInfoFinder for functions w/o DISubprogram's attached, but still referring DISubprogram's from within (case 1). This patch fixes that. The fix above, however, exposes another issue: if a module contains a DISubprogram referenced only indirectly from other debug info metadata, but not attached to any Function defined within the module (case 2), cloning such a module causes a DICompileUnit duplication: it will be moved in indirecty via a DISubprogram by DebugInfoFinder first (because of the first bug fix described above), without being self-mapped within the shared ValueMap, and then will be copied during named metadata cloning. So this patch makes sure DebugInfoFinder visits DICompileUnit's referenced from DISubprogram's as it goes w/o re-processing llvm.dbg.cu list over and over again for every function cloned, and makes sure that CloneFunctionInto self-maps DICompileUnit's referenced from the entire function, not just its own DISubprogram attached that may also be missing. The most convenient way of tesing CloneModule I found is to rely on CloneModule call from `opt -run-twice`, instead of writing tedious unit tests. That feature has a couple of properties that makes it hard to use for this purpose though: 1. CloneModule doesn't copy source filename, making `opt -run-twice` report it as a difference. 2. `opt -run-twice` does the second run on the original module, not its clone, making the result of cloning completely invisible in opt's actual output with and without `-run-twice` both, which directly contradicts `opt -run-twice`s own error message. This patch fixes this as well. Reviewed By: aprantl Reviewers: loladiro, GorNishanov, espindola, echristo, dexonsmith Subscribers: vsk, debug-info, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D45593 llvm-svn: 330069
* [X86] Remove the pmuldq/pmuldq intrinsics and replace with native IR.Craig Topper2018-04-131-18/+45
| | | | | | | | This completes the work started in r329604 and r329605 when we changed clang to no longer use the intrinsics. We lost some InstCombine SimplifyDemandedBit optimizations through this change as we aren't able to fold 'and', bitcast, shuffle very well. llvm-svn: 329990
OpenPOWER on IntegriCloud