aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-12-16 22:57:55 +0000
committerFangrui Song <i@maskray.me>2022-12-16 22:57:56 +0000
commitfb8eb84e5fd0b3219bd89522cceee3a8e128a85f (patch)
tree39fd35032d16004218385bda66de4002e2839e0c /llvm/lib/Transforms/Utils/LoopUtils.cpp
parent2fa744e631cbabe583da010ec56560edbc7a5384 (diff)
downloadllvm-fb8eb84e5fd0b3219bd89522cceee3a8e128a85f.zip
llvm-fb8eb84e5fd0b3219bd89522cceee3a8e128a85f.tar.gz
llvm-fb8eb84e5fd0b3219bd89522cceee3a8e128a85f.tar.bz2
[Transforms,InstCombine] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls __throw_bad_optional_access in libc++. Moreover, the API is unavailable without _LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 1244864..bc81e0f 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -356,7 +356,7 @@ TransformationMode llvm::hasUnrollTransformation(const Loop *L) {
std::optional<int> Count =
getOptionalIntLoopAttribute(L, "llvm.loop.unroll.count");
if (Count)
- return Count.value() == 1 ? TM_SuppressedByUser : TM_ForcedByUser;
+ return *Count == 1 ? TM_SuppressedByUser : TM_ForcedByUser;
if (getBooleanLoopAttribute(L, "llvm.loop.unroll.enable"))
return TM_ForcedByUser;
@@ -377,7 +377,7 @@ TransformationMode llvm::hasUnrollAndJamTransformation(const Loop *L) {
std::optional<int> Count =
getOptionalIntLoopAttribute(L, "llvm.loop.unroll_and_jam.count");
if (Count)
- return Count.value() == 1 ? TM_SuppressedByUser : TM_ForcedByUser;
+ return *Count == 1 ? TM_SuppressedByUser : TM_ForcedByUser;
if (getBooleanLoopAttribute(L, "llvm.loop.unroll_and_jam.enable"))
return TM_ForcedByUser;