[llvm] 9284b03 - [Coroutines] Remove unused variable [NFC]
    Mikael Holmen via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Sep 29 03:01:41 PDT 2023
    
    
  
Author: Mikael Holmen
Date: 2023-09-29T11:59:23+02:00
New Revision: 9284b03e87df5153fe425b6b81b8402f666deb18
URL: https://github.com/llvm/llvm-project/commit/9284b03e87df5153fe425b6b81b8402f666deb18
DIFF: https://github.com/llvm/llvm-project/commit/9284b03e87df5153fe425b6b81b8402f666deb18.diff
LOG: [Coroutines] Remove unused variable [NFC]
gcc warned about it:
 ../lib/Transforms/Coroutines/CoroFrame.cpp:2785:15: warning: unused variable 'MD' [-Wunused-variable]
  2785 |   if (MDNode *MD = AI->getMetadata(LLVMContext::MD_coro_outside_frame))
       |               ^~
Fix the warning by removing the unused variable and change the call
from getMetadata to hasMetadata.
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 4a289c0ef2bc195..0f75de1ba6032bc 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -2782,7 +2782,7 @@ static void collectFrameAlloca(AllocaInst *AI, coro::Shape &Shape,
 
   // The __coro_gro alloca should outlive the promise, make sure we
   // keep it outside the frame.
-  if (MDNode *MD = AI->getMetadata(LLVMContext::MD_coro_outside_frame))
+  if (AI->hasMetadata(LLVMContext::MD_coro_outside_frame))
     return;
 
   // The code that uses lifetime.start intrinsic does not work for functions
        
    
    
More information about the llvm-commits
mailing list