aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-08-15[StatepointLowering] Use FrameIndex instead of TargetFrameIndex (#153555)Cullen Rhodes1-1/+1
TargetFrameIndex shouldn't be used as an operand to target-independent node such as a load. This causes ISel issues. #81635 fixed a similar issue with this code using a TargetConstant, instead of a Constant. Fixes #142314.
2025-03-18[CodeGen] Avoid repeated hash lookups (NFC) (#131722)Kazu Hirata1-7/+10
2025-03-14[SelectionDAG] Avoid repeated hash lookups (NFC) (#131266)Kazu Hirata1-2/+3
2025-01-21[SelectionDAG] Avoid repeated hash lookups (NFC) (#123697)Kazu Hirata1-2/+3
2024-11-03[SelectionDAG] Remove unused includes (NFC) (#114697)Kazu Hirata1-1/+0
Identified with misc-include-cleaner.
2024-08-26[GC] Rename gc_args to gc_live [nfc]Philip Reames1-2/+2
Better reflect the recent history of the code, and improve readability for when I have to glance back at this to answer a question.
2024-07-20Reapply "[LLVM][LTO] Factor out RTLib calls and allow them to be dropped ↵Joseph Huber1-1/+1
(#98512)" This reverts commit 740161a9b98c9920dedf1852b5f1c94d0a683af5. I moved the `ISD` dependencies into the CodeGen portion of the handling, it's a little awkward but it's the easiest solution I can think of for now.
2024-07-20Revert "[LLVM][LTO] Factor out RTLib calls and allow them to be dropped ↵NAKAMURA Takumi1-1/+1
(#98512)" This reverts commit c05126bdfc3b02daa37d11056fa43db1a6cdef69. (llvmorg-19-init-17714-gc05126bdfc3b) See #99610
2024-07-16[LLVM][LTO] Factor out RTLib calls and allow them to be dropped (#98512)Joseph Huber1-1/+1
Summary: The LTO pass and LLD linker have logic in them that forces extraction and prevent internalization of needed runtime calls. However, these currently take all RTLibcalls into account, even if the target does not support them. The target opts-out of a libcall if it sets its name to nullptr. This patch pulls this logic out into a class in the header so that LTO / lld can use it to determine if a symbol actually needs to be kept. This is important for targets like AMDGPU that want to be able to use `lld` to perform the final link step, but does not want the overhead of uncalled functions. (This adds like a second to the link time trivially)
2024-06-13[llvm][SelectionDAG] Fix up chains in lowerInvokeable. rdar://113994760 (#94004)Jon Roelofs1-0/+3
lowerInvokeable wasn't updating the returned chain after emitting the lowerEndEH, which caused SwiftErrorVal-handling code to re-set the DAG root, and thus accidentally skip the EH_LABEL node it was supposed to have addeed. After fixing that, a few places needed to be adjusted that assume the specific shape of the returned DAG. Fixes: #64826 Fixes: rdar://113994760
2024-02-13[StatepointLowering] Use Constant instead of TargetConstant for undef value ↵Danila Malyutin1-1/+1
(#81635) Prevents isel errors when trying to lower gc relocate of undef value (which turns into CopyToReg of TargetConstant). Such relocates may occur after DCE (e.g. after GVN removes some dead blocks) if there are not passes like instcombine scheduled after to clean them up. Fixes #80294 --------- Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2024-01-25[llvm] Move CodeGenTypes library to its own directory (#79444)Nico Weber1-1/+1
Finally addresses https://reviews.llvm.org/D148769#4311232 :) No behavior change.
2023-10-14[StatepointLowering] Take return attributes of `gc.result` into account (#68439)Markus Böck1-4/+8
The current lowering of statepoints does not take into account return attributes present on the `gc.result` leading to different code being generated than if one were to not use statepoints. These return attributes can affect the ABI which is why it is important that they are applied in the lowering.
2023-10-10Move global namespace cl::opt inside llvm:: or internalize themFangrui Song1-3/+3
2023-09-01[llvm] Fix duplicate word typos. NFCFangrui Song1-1/+1
Those fixes were taken from https://reviews.llvm.org/D137338
2023-08-25[StatepointLowering] Fix possible nullptr access in debug outputDanila Malyutin1-1/+3
Differential Revision: https://reviews.llvm.org/D158866
2023-06-27Fix "this this" duplicate typo in comment. NFC.Simon Pilgrim1-1/+1
2023-06-11[NFC] Replace ;; with ;David Green1-1/+1
2023-05-03Restore CodeGen/MachineValueType.h from `Support`NAKAMURA Takumi1-1/+1
This is rework of; - rG13e77db2df94 (r328395; MVT) Since `LowLevelType.h` has been restored to `CodeGen`, `MachinveValueType.h` can be restored as well. Depends on D148767 Differential Revision: https://reviews.llvm.org/D149024
2023-03-27[llvm] Use isIntOrFPConstant (NFC)Kazu Hirata1-2/+1
2023-01-18[StatepointLowering] Move statepoint correctness checks to Verifier. NFC.Denis Antrushin1-31/+3
Since D140504, GCStrategy is available for use in opt. Now we can move statepoint correctness checks from StatepointLowering.cpp to Verifier. Reviewed By: reames Differential Revision: https://reviews.llvm.org/D141948
2022-12-16[CodeGen] std::optional::value => operator*/operator->Fangrui Song1-4/+2
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 fixes LLVMMIRParser, LLVMGlobalISel, LLVMAsmPrinter, LLVMSelectionDAG.
2022-12-14Don't include Optional.hKazu Hirata1-1/+0
These files no longer use llvm::Optional.
2022-12-13[CodeGen] llvm::Optional => std::optionalFangrui Song1-6/+6
2022-12-10Don't include None.h (NFC)Kazu Hirata1-1/+0
I've converted all known uses of None to std::nullopt, so we no longer need to include None.h. 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-07[NFC] Use Register instead of unsigned for variables that receive a Register ↵Gregory Alfonso1-1/+1
object Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D139451
2022-12-02[CodeGen] Use std::nullopt instead of None (NFC)Kazu Hirata1-9/+9
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-03[StatepointLowering] remove unused parameter. NFCNick Desaulniers1-3/+2
Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D136885
2022-08-20Remove redundant initialization of Optional (NFC)Kazu Hirata1-1/+1
2022-07-18[SDAG] Fix release buildNikita Popov1-1/+1
This variable was only declared in debug builds, but is needed in release builds as well.
2022-07-18[Verifier] Make Verifier recognize undef tokens as correct IRMax Kazantsev1-7/+24
Undef tokens may appear in unreached code as result of RAUW of some optimization, and it should not be considered as bad IR. Patch by Dmitry Bakunevich! Differential Revision: https://reviews.llvm.org/D128904 Reviewed By: mkazantsev
2022-07-17[CodeGen] Qualify auto variables in for loops (NFC)Kazu Hirata1-5/+6
2022-07-13[llvm] Use value instead of getValue (NFC)Kazu Hirata1-2/+2
2022-06-25[llvm] Don't use Optional::hasValue (NFC)Kazu Hirata1-4/+4
This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only.
2022-06-25Revert "Don't use Optional::hasValue (NFC)"Kazu Hirata1-6/+8
This reverts commit aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.
2022-06-25Don't use Optional::hasValue (NFC)Kazu Hirata1-8/+6
2022-06-20[llvm] Don't use Optional::hasValue (NFC)Kazu Hirata1-1/+1
2022-06-18[llvm] Use value_or instead of getValueOr (NFC)Kazu Hirata1-2/+2
2022-05-16[StatepointLowering] Properly handle local and non-local relocates of the ↵Denis Antrushin1-3/+3
same value. FunctionLoweringInfo::StatepointRelocationMaps map is used to pass GC pointer lowering information from statepoint to gc.relocate which may appear ini different block. D124444 introduced different lowering for local and non-local relocates. Local relocates use SDValue and non-local relocates use value exported to VReg. But I overlooked the fact that StatepointRelocationMap is indexed not by GCRelocate instruction, but by derived pointer. This works incorrectly when we have two relocates (one local and another non-local) of the same value, because they need different relocation records. This patch fixes the problem by recording relocation information per relocate instruction, not per derived pointer. This way, each gc.relocate can be lowered differently. Reviewed By: skatkov Differential Revision: https://reviews.llvm.org/D125538
2022-04-27[StatepointLowering] Only export STATEPOINT results if used in nonlocal blocks.Denis Antrushin1-5/+30
Cuurently we always export STATEPOINT results (GC pointers lowered via VRegs) to virtual registers. When processing gc.relocate instructions we have to generate CopyFromRegs node and then export it to VReg again if gc.relocate is used in other basic blocks. This results in generation of extra COPY MIR instruction if statepoint and its gc.relocate are in the same BB, but gc.relocate result is used in other blocks. This patch changes this behavior to export statepoint results only if used in other basic blocks. For local uses StatepointLoweringState.(get|set)Location() API is used to communicate appropriate statepoint result from `LowerStatepoint()` to `visitGCRelocate()` This is NFC and is purely compile time optimization. On big methids it can improve codegen compile time up to 10%. Reviewed By: reames Differential Revision: https://reviews.llvm.org/D124444
2022-03-12Cleanup includes: DebugInfo & CodeGenserge-sans-paille1-0/+4
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D121332
2022-01-31[Statepoint] Remove another use of getActualReturnType [NFC]Philip Reames1-14/+20
For the cross block gc.result projection case, we only care about the return type if there is a cross block gc.result, and if there is one, we can take the type from the gc.result. At the moment, this makes little difference, but for opaque pointers we need a means to get result typing without relying on pointee types.
2022-01-31[Statepoints] Take result type from gc.result [NFC]Philip Reames1-1/+1
When lowering a gc.result, we can assume that the result type of the gc.result matches the type of the underlying call. This is explicitly required in LangRef. At the moment, this makes little difference, but for opaque pointers we need a means to get result typing without relying on pointee types.
2022-01-31Sink getGCResultLocality to sole use [NFC]Philip Reames1-1/+13
2021-10-03[Analysis, CodeGen] Migrate from arg_operands to args (NFC)Kazu Hirata1-1/+1
Note that arg_operands is considered a legacy name. See llvm/include/llvm/IR/InstrTypes.h for details.
2021-05-18[Statepoint Lowering] Cleanup: remove unused option ↵Serguei Katkov1-4/+0
statepoint-always-spill-base.
2021-05-13[GC][NFC] Move GCStrategy from CodeGen to IRMax Kazantsev1-1/+1
We want it to be available in analyzes so that we could use the CodeGen notion in middle-end passes (for example, to check if a GC may free some particular pointer). This is a preparatory patch that simply moves the files around. Note: if this causes some build issues, this patch must just be reverted. Differential Revision: https://reviews.llvm.org/D100557 Reviewed By: reames
2021-04-07[Statepoint Lowering] Allow other than N byte sized types in deopt bundleYevgeny Rouban1-2/+5
I do not see any bit-width restriction from the point of the LLVM Lang Ref - Operand Bundles on the types of the deopt bundle operands. Statepoint Lowering seems to be able to work with any types. This patch relaxes the two related assertions and adds a new test for this change. Reviewed By: reames Differential Revision: https://reviews.llvm.org/D100006
2021-03-11[Statepoint Lowering] Handle the case with several gc.resultSerguei Katkov1-4/+6
Recently gc.result has been marked with readnone instead of readonly and this opens a door for different optimization to duplicate gc.result. Statepoint lowering is not ready to see several gc.results. The problem appears when there are gc.results with one located in the same basic block and another located in other basic block. In this case we need both export VR and fill local setValue. Note that this case is not sufficient optimization done before CodeGen. It is evident that local gc.result dominates all other gc.results and it is handled by GVN and EarlyCSE. But anyway, even if IR is not optimal Backend should not crash on a valid IR. Reviewers: reames, dantrushin Reviewed By: dantrushin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D98393
2021-03-10[Statepoint Lowering] Fix the crash with gc.relocate in a separate blockSerguei Katkov1-36/+35
If it was decided to relocate derived pointer using the spill its value is not exported in general case. When gc.relocate is located in an another block than a statepoint we cannot get SD for derived value but for spill case it is not required at all. However implementation of gc.relocate lowering unconditionally request SD value causing the assert triggering. The CL fixes this by handling spill case earlier than SD is really required. Reviewers: reames, dantrushin Reviewed By: dantrushin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D98324