[llvm] d762350 - [NFC] Properly handle optional minor value for ArchInfo::Version

Zixu Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 17:28:27 PST 2023


Author: Zixu Wang
Date: 2023-03-02T16:45:29-08:00
New Revision: d7623507ac25635f0fdbf84161a744684f4da338

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

LOG: [NFC] Properly handle optional minor value for ArchInfo::Version

Use `value_or` instead of `value` for checking minor versions in
`ArchInfo::implies`.

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

Added: 
    

Modified: 
    llvm/include/llvm/TargetParser/AArch64TargetParser.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
index f7b8bdcfb73d7..348606964ea4b 100644
--- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -288,8 +288,8 @@ struct ArchInfo {
       return this->Version > Other.Version;
     }
     if (this->Version.getMajor() == 9 && Other.Version.getMajor() == 8) {
-      return this->Version.getMinor().value() + 5 >=
-             Other.Version.getMinor().value();
+      return this->Version.getMinor().value_or(0) + 5 >=
+             Other.Version.getMinor().value_or(0);
     }
     return false;
   }


        


More information about the llvm-commits mailing list