[llvm] e572927 - [AutoUpgrade] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 13:31:22 PDT 2022


Author: Fangrui Song
Date: 2022-03-30T13:31:18-07:00
New Revision: e572927f63435e15f6b3ec231ed1c05f9a8e4178

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

LOG: [AutoUpgrade] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds

Added: 
    

Modified: 
    llvm/lib/IR/AutoUpgrade.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 8aaf5e67256eb..a8547354f77c7 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -3808,9 +3808,9 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
 
     // This must be an upgrade from a named to a literal struct.
     auto *OldST = cast<StructType>(CI->getType());
-    auto *NewST = cast<StructType>(NewFn->getReturnType());
-    assert(OldST != NewST && "Return type must have changed");
-    assert(OldST->getNumElements() == NewST->getNumElements() &&
+    assert(OldST != NewFn->getReturnType() && "Return type must have changed");
+    assert(OldST->getNumElements() ==
+               cast<StructType>(NewFn->getReturnType())->getNumElements() &&
            "Must have same number of elements");
 
     SmallVector<Value *> Args(CI->args());


        


More information about the llvm-commits mailing list