[llvm] 8772800 - [coro][nfc] Use Load/Store instruction APIs

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 06:07:38 PDT 2023


Author: Felipe de Azevedo Piovezan
Date: 2023-04-18T09:07:41-04:00
New Revision: 877280088a5465aa7c1db23708894737091106b5

URL: https://github.com/llvm/llvm-project/commit/877280088a5465aa7c1db23708894737091106b5
DIFF: https://github.com/llvm/llvm-project/commit/877280088a5465aa7c1db23708894737091106b5.diff

LOG: [coro][nfc] Use Load/Store instruction APIs

Instead of hard-coding operand indices, it is cleaner to use the APIs
provided by the Load/Store Inst classes.

Differential Revision: https://reviews.llvm.org/D148571

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 90fe01ae67c5c..8c130be0092fd 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -2832,7 +2832,7 @@ void coro::salvageDebugInfo(
 
   while (auto *Inst = dyn_cast_or_null<Instruction>(Storage)) {
     if (auto *LdInst = dyn_cast<LoadInst>(Inst)) {
-      Storage = LdInst->getOperand(0);
+      Storage = LdInst->getPointerOperand();
       // FIXME: This is a heuristic that works around the fact that
       // LLVM IR debug intrinsics cannot yet distinguish between
       // memory and value locations: Because a dbg.declare(alloca) is
@@ -2842,7 +2842,7 @@ void coro::salvageDebugInfo(
       if (!SkipOutermostLoad)
         Expr = DIExpression::prepend(Expr, DIExpression::DerefBefore);
     } else if (auto *StInst = dyn_cast<StoreInst>(Inst)) {
-      Storage = StInst->getOperand(0);
+      Storage = StInst->getValueOperand();
     } else {
       SmallVector<uint64_t, 16> Ops;
       SmallVector<Value *, 0> AdditionalValues;


        


More information about the llvm-commits mailing list