aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DebugInfo.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-04-28[Assignment Tracking] Check getTypeSizeInBits result for scalable vector typesOCHyams1-6/+7
Without this patch, in `getAssignmentInfo` the result of `getTypeSizeInBits` is cast to `uint64_t`, which a) is an operation that will eventually be unsupported by the API according to the comments, and b) causes an assertion failure if the type is a scalable vector. Don't cast the `TypeSize` to `uint64_t` and check `isScalable` before getting the fixed size. This can result in incorrect variable locations, see llvm.org/PR62346 (but is better than crashing). Reviewed By: paulwalker-arm Differential Revision: https://reviews.llvm.org/D149137
2023-04-20[NFC] Return unique dbg intrinsics from findDbgValues and findDbgUsersOCHyams1-37/+25
The out-param vector from findDbgValues and findDbgUsers should not include duplicates, which is possible if the debug intrinsic uses the value multiple times. This filter is already in place for multiple uses in a `DIArgLists`; extend it to cover dbg.assigns too because a Value may be used in both the address and value components. Additionally, refactor the duplicated functionality between findDbgValues and FindDbgUsers into a new function findDbgIntrinsics. Reviewed By: jmorse, StephenTozer Differential Revision: https://reviews.llvm.org/D148788
2023-04-19Remove unused ValueTracking.h include from DebugInfo.cppOCHyams1-1/+0
Buildbot: https://buildkite.com/llvm-project/upstream-bazel/builds/ 59967#01879985-8d44-4041-9cd0-a1e41371208e See https://reviews.llvm.org/D148536
2023-04-19Reapply "[Assignment Tracking] Fix fragment error for some DSE-shortened stores"OCHyams1-0/+135
This reverts commit 6db6ab4815a44bfcaabfcdd84a0ff458394f6f52 which reverts D148536. Build issues addressed in D148698.
2023-04-19Revert "[Assignment Tracking] Fix fragment error for some DSE-shortened stores"OCHyams1-135/+0
This reverts commit fca3e8e024f0015604d21e6f76f3e199345679c5. Buildbot: https://lab.llvm.org/buildbot/#/builders/121/builds/29766
2023-04-19[Assignment Tracking] Fix fragment error for some DSE-shortened storesOCHyams1-0/+135
`shortenAssignment` inserts dbg.assigns with fragments describing the dead part of a shortened store after each dbg.assign linked to the store. Without this patch it doesn't take into account that the dead part of a shortened store may be outside the bounds of a variable of a linked dbg.assign. It also doesn't correctly account for a non-zero offset in the address modifying `DIExpression` of the dbg.assign (which is possible for fragments now even though whole variables currently cannot have a non-zero offset in their alloca). Fix this by moving the dead slice into variable-space and performing an intersect of that adjusted slice with the existing fragment. This fixes a verifier error reported when building fuchsia with assignment tracking enabled: https://ci.chromium.org/ui/p/fuchsia/builders/ci/ clang_toolchain.ci.core.x64-release/b8784000953022145169/overview Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D148536
2023-04-18[Assignment Tracking] Skip empty-metadata dbg.declares in AssignmentTrackingPassOCHyams1-0/+2
Debug intrinsics sometimes end up with empty metadata location operands. The debug intrinsic interfaces return nullptr when retrieving location operand in this case. Skip empty-metadata dbg.declares to avoid dereferencing the nullptr. This doesn't affect the final debug info in any way. Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D148204
2023-04-12[Assignment Tracking] Ignore VLA-backed variablesOCHyams1-0/+3
VLA backed variables currently trip an assertion in SROA with D146987 (enabling assignment tracking). Disable assignment tracking for VLA variables until that can be investigated. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D148140
2023-04-12[Assignment Tracking] Fix assertion in AssignmentTrackingPass::runOnFunctionOCHyams1-3/+7
The assertion exists to ensure all variables passed into `trackAssignments` end up with dbg.assigns associated with their backing allocas. The assertion compared the passed-in and tracked variables using `DebugVariable`, which includes the fragment as part of the variable identity. It is possible for the backing alloca to be smaller than a variable (see test case). In this case the input variable `(Var X, no fragment, no InlinedAt)` isn't equal to the dbg.assign variable `(Var X, some fragment, no InlinedAt)`. To cover this case the assertion now ignores fragments through the use of `DebugVariableAggregate`. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D148100
2023-04-11[Assignment Tracking] Trunc fragments for stores to vars smaller than the allocaOCHyams1-12/+21
In D147777 emitDbgAssign was fixed to discard assignments which touched any bits outside the bounds of a variable. This patch changes emitDbgAssign to discard assignments which touch bits only outside the variable bounds, and creates a truncated fragment expression for stores partially overlapping the variable. This is necessary because the alloca is interpreted as a store (of undef), meaning without this patch emitDbgAssign would discard the inital dbg.assign for a variable that is smaller than the alloca. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D148018
2023-04-09[Assignment Tracking] Fix fragments for assignments to variables smaller ↵OCHyams1-2/+18
than the alloca Prior to this patch the trackAssignments function would attribute all stores to an alloca to all variables linked to the alloca. This is wrong in the case where the alloca contains variables which are smaller than the alloca, and caused erroneous fragment information to be generated. Now stores outside the variable bounds are discarded, and we check whether a fragment is needed based on whether the store covers the entire variable as opposed to whether it covers the entire alloca (except for variables of unknown size). Note that trackAssignments doesn't yet understand whole variables sitting at anything other than offset 0 in an alloca - those variables are still tracked using dbg.declares. Fixes https://lab.llvm.org/buildbot/#/builders/70/builds/36007 Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D147777
2023-03-29[Assignment Tracking] Don't run declare-to-assign on functions marked optnoneOCHyams1-0/+4
Assignment tracking doesn't add value when optimisations are disabled - don't apply it to functions marked optnone. Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D147129
2023-03-02[DebugInfo] Remove `dbg.addr` from IRJ. Ryan Stinnett1-17/+4
Part of `dbg.addr` removal Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898 Differential Revision: https://reviews.llvm.org/D144801
2023-02-22[Assignment Tracking] Only set module flag if pass modifies a functionOCHyams1-3/+11
The module flag "debug-info-assignment-tracking" is set by the declare-to-assign pass to indicate that assignment tracking is enabled. This patch changes declare-to-assign to only set the flag if it makes a modification. This lets the compiler avoid doing extra work for no benefit, such as is currently the case if assignment tracking is requested for a build with line tables only (-gmlt) or a build without debug info. Reviewed By: scott.linder Differential Revision: https://reviews.llvm.org/D144481
2023-02-14[NFC][IR] Make Module::getNamedMDList() privateVasileios Porpodas1-1/+1
This patch adds several missing NamedMDList modifier functions, like removeNamedMDNode(), eraseNamedMDNode() and insertNamedMDNode(). There is no longer need to access the list directly so it also makes getNamedMDList() private. Differential Revision: https://reviews.llvm.org/D143969
2023-02-08add LLVMGetDINodeTag to C bindingsDavide Bertola1-0/+4
Differential Revision: https://reviews.llvm.org/D138415
2023-01-25Avoid removing useful loop metadata when stripping debug infoShe Dongrui1-11/+75
The stripDebugLocFromLoopID() may mistakenly remove useful metadata nodes when they are operands of a child node, which also has DILocation operands. It can be reproduced by the output of clang for code similar to the following: for(int i = 0; i < n; i++) x[i] = 10; -strip-debug removes the child node of llvm.loop.vectorize.followup_all, which contains llvm.loop.isvectorized and llvm.loop.unroll.count. This patch fixes by checking all children nodes and only remove a metadata node if all its children are DILocation. Differential Revision: https://reviews.llvm.org/D141909
2023-01-20[Assignment Tracking][NFC] Replace LLVM command line option with a module flagOCHyams1-7/+28
Remove LLVM flag -experimental-assignment-tracking. Assignment tracking is still enabled from Clang with the command line -Xclang -fexperimental-assignment-tracking which tells Clang to ask LLVM to run the pass declare-to-assign. That pass converts conventional debug intrinsics to assignment tracking metadata. With this patch it now also sets a module flag debug-info-assignment-tracking with the value `i1 true` (using the flag conflict rule `Max` since enabling assignment tracking on IR that contains only conventional debug intrinsics should cause no issues). Update the docs and tests too. Reviewed By: CarlosAlbertoEnciso Differential Revision: https://reviews.llvm.org/D142027
2022-12-20[llvm] Remove redundant initialization of std::optional (NFC)Kazu Hirata1-1/+1
2022-12-16std::optional::value => operator*/operator->Fangrui Song1-1/+1
value() has undesired exception checking semantics and calls __throw_bad_optional_access in libc++. Moreover, the API is unavailable without _LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). This commit fixes LLVMAnalysis and its dependencies.
2022-12-04[llvm] Use std::nullopt instead of None in comments (NFC)Kazu Hirata1-1/+1
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04DebugInfo: convert Optional to std::optionalKrzysztof Parzyszek1-10/+11
2022-12-02[IR] Use std::nullopt instead of None (NFC)Kazu Hirata1-6/+8
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-13[IR] Use llvm::any_of (NFC)Kazu Hirata1-4/+3
2022-11-09Fix an unused-variable warning in release build, NFC.Haojian Wu1-3/+2
2022-11-09[Assignment Tracking][8/*] Add DIAssignID merging utilitiesOCHyams1-0/+30
The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir Add method: Instruction::mergeDIAssignID( ArrayRef<const Instruction* > SourceInstructions) which merges the DIAssignID metadata attachments on `SourceInstructions` and `this` and replaces uses of the original IDs with the new shared one. This is used when stores are merged, for example sinking stores out of a if-diamond CFG or vectorizing contiguous stores. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D133291
2022-11-08[NFC] Ignore unused vars in no-asserts buildsJordan Rupprecht1-0/+2
2022-11-08[Assignment Tracking][6/*] Add trackAssignments functionOCHyams1-0/+235
The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir Add trackAssignments which adds assignment tracking metadata to a function for a specified set of variables. The intended callers are the inliner and the front end - those calls will be added in separate patches. I've added a pass called declare-to-assign (AssignmentTrackingPass) that converts dbg.declare intrinsics to dbg.assigns using trackAssignments so that the function can be easily tested (see llvm/test/DebugInfo/Generic/track-assignments.ll). The pass could also be used by front ends to easily test out enabling assignment tracking. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D132225
2022-11-08Reapply: [NFC] Move getDebugValueLoc from static in Local.cpp to DebugInfo.hOCHyams1-0/+12
Reverted in b22d80dc6a6af6328d68f7b944627f9278ff6ffb. Move getDebugValueLoc so that it can be accessed from DebugInfo.h for the Assignment Tracking patch stack and remove redundant parameter Src. Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D132357
2022-11-08Reapply [Assignment Tracking][5/*] Add core infrastructure for instruction ↵OCHyams1-0/+69
reference Previously reverted in 41f5a0004e442ae71c8e754fdadb4bd1e172fb2d. Fold in D133576 previously reverted in d29d5ffb6332569e85d5eda5130603bbd8664635. --- The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir Overview It's possible to find intrinsics linked to an instruction by looking at the MetadataAsValue uses of the attached DIAssignID. That covers instruction -> intrinsic(s) lookup. Add a global DIAssignID -> instruction(s) map which gives us the ability to perform intrinsic -> instruction(s) lookup. Add plumbing to keep the map up to date through optimisations and add utility functions including two that perform those lookups. Finally, add a unittest. Details In llvm/lib/IR/LLVMContextImpl.h add AssignmentIDToInstrs which maps DIAssignID * attachments to Instruction *s. Because the DIAssignID * is the key we can't use a TrackingMDNodeRef for it, and therefore cannot easily update the mapping when a temporary DIAssignID is replaced. Temporary DIAssignID's are only used in IR parsing to deal with metadata forward references. Update llvm/lib/AsmParser/LLParser.cpp to avoid using temporary DIAssignID's for attachments. In llvm/lib/IR/Metadata.cpp add Instruction::updateDIAssignIDMapping which is called to remove or add an entry (or both) to AssignmentIDToInstrs. Call this from Instruction::setMetadata and add a call to setMetadata in Intruction's dtor that explicitly unsets the DIAssignID so that the mappging gets updated. In llvm/lib/IR/DebugInfo.cpp and DebugInfo.h add utility functions: getAssignmentInsts(const DbgAssignIntrinsic *DAI) getAssignmentMarkers(const Instruction *Inst) RAUW(DIAssignID *Old, DIAssignID *New) deleteAll(Function *F) deleteAssignmentMarkers(const Instruction *Inst) These core utils are tested in llvm/unittests/IR/DebugInfoTest.cpp. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D132224
2022-11-07Revert "[NFC] Move getDebugValueLoc from static in Local.cpp to DebugInfo.h"Shubham Sandeep Rastogi1-12/+0
This reverts commit 80378a4ca725eeeae940b99220b3913f7b73c895. I am reverting this patch because I need to revert 171f7024cc82e8702abebdedb699d37b50574be7 and without reverting this patch, reverting 171f7024cc82e8702abebdedb699d37b50574be7 causes conflicts. Patch 171f7024cc82e8702abebdedb699d37b50574be7 introduced a cyclic dependancy in the module build. https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48197/consoleFull#-69937453049ba4694-19c4-4d7e-bec5-911270d8a58c In file included from <module-includes>:1: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/Argument.h:18:10: fatal error: cyclic dependency in module 'LLVM_IR': LLVM_IR -> LLVM_intrinsic_gen -> LLVM_IR ^ While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14: While building module 'LLVM_IR' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57: In file included from <module-includes>:12: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/DebugInfo.h:24:10: fatal error: could not build module 'LLVM_intrinsic_gen' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14: In file included from <module-includes>:15: In file included from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCContext.h:23: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57:10: fatal error: could not build module 'LLVM_IR' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14:10: fatal error: could not build module 'LLVM_MC' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 4 errors generated.
2022-11-07Revert "[Assignment Tracking][5/*] Add core infrastructure for instruction ↵Shubham Sandeep Rastogi1-60/+0
reference" This reverts commit 171f7024cc82e8702abebdedb699d37b50574be7. Reverting this patch because it causes a cyclic dependency in the module build https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48197/consoleFull#-69937453049ba4694-19c4-4d7e-bec5-911270d8a58c In file included from <module-includes>:1: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/Argument.h:18:10: fatal error: cyclic dependency in module 'LLVM_IR': LLVM_IR -> LLVM_intrinsic_gen -> LLVM_IR ^ While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14: While building module 'LLVM_IR' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57: In file included from <module-includes>:12: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/DebugInfo.h:24:10: fatal error: could not build module 'LLVM_intrinsic_gen' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14: In file included from <module-includes>:15: In file included from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCContext.h:23: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57:10: fatal error: could not build module 'LLVM_IR' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14:10: fatal error: could not build module 'LLVM_MC' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 4 errors generated.
2022-11-07Revert "[Assignment Tracking][5.1/*] Add deleteAssignmentMarkers function"Shubham Sandeep Rastogi1-9/+0
This reverts commit 4c44fa1c3829c2d0c6ce10b576dafbc2e0631d47. This patch has to be reverted because I need to revert 171f7024cc82e8702abebdedb699d37b50574be7 and without reverting this patch, reverting 171f7024cc82e8702abebdedb699d37b50574be7 causes conflicts. Patch 171f7024cc82e8702abebdedb699d37b50574be7 introduced a cyclic dependency in the module build. https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48197/consoleFull#-69937453049ba4694-19c4-4d7e-bec5-911270d8a58c In file included from <module-includes>:1: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/Argument.h:18:10: fatal error: cyclic dependency in module 'LLVM_IR': LLVM_IR -> LLVM_intrinsic_gen -> LLVM_IR ^ While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14: While building module 'LLVM_IR' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57: In file included from <module-includes>:12: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/DebugInfo.h:24:10: fatal error: could not build module 'LLVM_intrinsic_gen' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14: In file included from <module-includes>:15: In file included from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCContext.h:23: /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57:10: fatal error: could not build module 'LLVM_IR' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14:10: fatal error: could not build module 'LLVM_MC' ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 4 errors generated.
2022-11-07[NFC] Move getDebugValueLoc from static in Local.cpp to DebugInfo.hOCHyams1-0/+12
Move getDebugValueLoc so that it can be accessed from DebugInfo.h for the Assignment Tracking patch stack and remove redundant parameter Src. Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D132357
2022-11-07[Assignment Tracking][5.1/*] Add deleteAssignmentMarkers functionOCHyams1-0/+9
deleteAssignmentMarkers(const Instruction *Inst) does exactly as you'd expect - it deletes any dbg.assign intrinsics linked to Inst. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D133576
2022-11-07[Assignment Tracking][5/*] Add core infrastructure for instruction referenceOCHyams1-0/+60
The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir Overview It's possible to find intrinsics linked to an instruction by looking at the MetadataAsValue uses of the attached DIAssignID. That covers instruction -> intrinsic(s) lookup. Add a global DIAssignID -> instruction(s) map which gives us the ability to perform intrinsic -> instruction(s) lookup. Add plumbing to keep the map up to date through optimisations and add utility functions including two that perform those lookups. Finally, add a unittest. Details In llvm/lib/IR/LLVMContextImpl.h add AssignmentIDToInstrs which maps DIAssignID * attachments to Instruction *s. Because the DIAssignID * is the key we can't use a TrackingMDNodeRef for it, and therefore cannot easily update the mapping when a temporary DIAssignID is replaced. Temporary DIAssignID's are only used in IR parsing to deal with metadata forward references. Update llvm/lib/AsmParser/LLParser.cpp to avoid using temporary DIAssignID's for attachments. In llvm/lib/IR/Metadata.cpp add Instruction::updateDIAssignIDMapping which is called to remove or add an entry (or both) to AssignmentIDToInstrs. Call this from Instruction::setMetadata and add a call to setMetadata in Intruction's dtor that explicitly unsets the DIAssignID so that the mappging gets updated. In llvm/lib/IR/DebugInfo.cpp and DebugInfo.h add utility functions: getAssignmentInsts(const DbgAssignIntrinsic *DAI) getAssignmentMarkers(const Instruction *Inst) RAUW(DIAssignID *Old, DIAssignID *New) deleteAll(Function *F) These core utils are tested in llvm/unittests/IR/DebugInfoTest.cpp. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D132224
2022-11-07[Assignment Tracking][3/*] Add DIAssignID metadata boilerplateOCHyams1-2/+6
The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir Add the DIAssignID metadata attachment boilerplate. Includes a textual-bitcode roundtrip test and tests that the verifier and parser catch badly formed IR. This piece of metadata links together stores (used as an attachment) and the yet-to-be-added llvm.dbg.assign debug intrinsic (used as an operand). Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D132222
2022-11-03Revert "[Assignment Tracking][3/*] Add DIAssignID metadata boilerplate"OCHyams1-6/+2
This reverts commit c285df77e9b78f971f9cd9d025248c20b030cc2a. A sanitizer bot found an issue: https://lab.llvm.org/buildbot/#/builders/5/builds/28809/steps/13/logs/stdio
2022-11-03[Assignment Tracking][3/*] Add DIAssignID metadata boilerplateOCHyams1-2/+6
The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir Add the DIAssignID metadata attachment boilerplate. Includes a textual-bitcode roundtrip test and tests that the verifier and parser catch badly formed IR. This piece of metadata links together stores (used as an attachment) and the yet-to-be-added llvm.dbg.assign debug intrinsic (used as an operand). Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D132222
2022-11-02[Assignment Tracking][2/*] Add flags to enable Assignment TrackingOCHyams1-0/+7
The Assignment Tracking debug-info feature is outlined in this RFC: https://discourse.llvm.org/t/ rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir Enable in clang: -Xclang -fexperimental-assignment-tracking Enable in llvm tools: -experimental-assignment-tracking When assignment tracking is enabled in clang it will pass on the flag to enable the feature in lllvm. It's undefined behaviour to read IR that contains assignment tracking metadata without specifying the feature flags. Tests will come with later patches that add assignment tracking features. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D132221
2022-11-01[llvm-c] Harmonize usage of unwrap (NFC)Aaron Puchert1-1/+1
Some places were using unwrap<T>(x) = cast<T>(unwrap(x)), even though the unwrapped value already had type T. Removing the template argument makes it clear that no cast is intended. Other places were using cast<T>(unwrap(x)), we replace that with the shorthand unwrap<T>(x) for consistency.
2022-09-30[DebugInfo][LICM] Drop DebugLoc from IntrinsicInst when hoistingJuan Manuel MARTINEZ CAAMAÑO1-1/+8
The DebugLoc is conserved when hoisting function calls, to ensure the DIScope is preserved if inlining occurs. This commit drops the DebugLoc in the case the call is an intrinsic call that won't be lowered into a function call. Differential Revision: https://reviews.llvm.org/D134429
2022-09-05Revert "Use llvm::none_of (NFC)"Kazu Hirata1-5/+5
This partially reverts commit f5a68feab30a529280c2912dc464e3a81e276f9a. Fixes https://github.com/llvm/llvm-project/issues/57557
2022-08-28[llvm] Qualify auto in range-based for loops (NFC)Kazu Hirata1-1/+1
2022-08-14Use llvm::none_of (NFC)Kazu Hirata1-5/+5
2022-08-14Use llvm::all_of (NFC)Kazu Hirata1-6/+5
2022-02-02Cleanup header dependencies in LLVMCoreserge-sans-paille1-3/+2
Based on the output of include-what-you-use. This is a big chunk of changes. It is very likely to break downstream code unless they took a lot of care in avoiding hidden ehader dependencies, something the LLVM codebase doesn't do that well :-/ I've tried to summarize the biggest change below: - llvm/include/llvm-c/Core.h: no longer includes llvm-c/ErrorHandling.h - llvm/IR/DIBuilder.h no longer includes llvm/IR/DebugInfo.h - llvm/IR/IRBuilder.h no longer includes llvm/IR/IntrinsicInst.h - llvm/IR/LLVMRemarkStreamer.h no longer includes llvm/Support/ToolOutputFile.h - llvm/IR/LegacyPassManager.h no longer include llvm/Pass.h - llvm/IR/Type.h no longer includes llvm/ADT/SmallPtrSet.h - llvm/IR/PassManager.h no longer includes llvm/Pass.h nor llvm/Support/Debug.h And the usual count of preprocessed lines: $ clang++ -E -Iinclude -I../llvm/include ../llvm/lib/IR/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 6400831 after: 6189948 200k lines less to process is no that bad ;-) Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D118652
2021-12-27[clang][CodeGen] Remove the signed version of createExpressionShao-Ce SUN1-4/+4
Fix a TODO. Remove the callers of this signed version and delete. Reviewed By: CodaFi Differential Revision: https://reviews.llvm.org/D116014
2021-11-05[llvm] Use make_early_inc_range (NFC)Kazu Hirata1-2/+1
2021-09-30Expose `DIBuilder::finalizeSubprogram()` through the LLVM C APIKoutheir Attouchi1-0/+5
The LLVM C API function is called `LLVMDIBuilderFinalizeSubprogram()`. Reviewed By: CodaFi Differential Revision: https://reviews.llvm.org/D104794