[llvm] a088c61 - [SPIRV] Fix -Wunused-but-set-variable after #92531

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 10:37:03 PDT 2024


Author: Fangrui Song
Date: 2024-06-03T10:36:59-07:00
New Revision: a088c61d5c409ec0b8994340866d5864ba913516

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

LOG: [SPIRV] Fix -Wunused-but-set-variable after #92531

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp b/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
index 2cdeb32579038..4b0e7c421df3e 100644
--- a/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
@@ -63,10 +63,7 @@ class SPIRVMergeRegionExitTargets : public FunctionPass {
       return output;
     }
 
-    if (auto *RI = dyn_cast<ReturnInst>(T))
-      return output;
-
-    assert(false && "Unhandled terminator type.");
+    assert(isa<ReturnInst>(T) && "Unhandled terminator type.");
     return output;
   }
 
@@ -76,7 +73,7 @@ class SPIRVMergeRegionExitTargets : public FunctionPass {
       BasicBlock *BB,
       const std::unordered_map<BasicBlock *, ConstantInt *> &TargetToValue) {
     auto *T = BB->getTerminator();
-    if (auto *RI = dyn_cast<ReturnInst>(T))
+    if (isa<ReturnInst>(T))
       return nullptr;
 
     IRBuilder<> Builder(BB);


        


More information about the llvm-commits mailing list