[llvm] 17bc82d - [AsmWriter][NFC] Simplify writeDIGenericSubrange

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 13 09:31:18 PDT 2021


Author: Alfonso Gregory
Date: 2021-08-13T09:31:13-07:00
New Revision: 17bc82dd3be92ab1a56facae99fc4dd71e60d323

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

LOG: [AsmWriter][NFC] Simplify writeDIGenericSubrange

Reviewed By: MaskRay

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

Added: 
    

Modified: 
    llvm/lib/IR/AsmWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 69e2d85e58fef..5842d400eb67b 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1931,10 +1931,9 @@ static void writeDIGenericSubrange(raw_ostream &Out, const DIGenericSubrange *N,
 
   auto IsConstant = [&](Metadata *Bound) -> bool {
     if (auto *BE = dyn_cast_or_null<DIExpression>(Bound)) {
-      return BE->isConstant()
-                 ? DIExpression::SignedOrUnsignedConstant::SignedConstant ==
-                       *BE->isConstant()
-                 : false;
+      return BE->isConstant() &&
+             DIExpression::SignedOrUnsignedConstant::SignedConstant ==
+                 *BE->isConstant();
     }
     return false;
   };


        


More information about the llvm-commits mailing list