aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/IntrinsicInst.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-12-16 22:44:08 +0000
committerFangrui Song <i@maskray.me>2022-12-16 22:44:08 +0000
commit2fa744e631cbabe583da010ec56560edbc7a5384 (patch)
treedb931423c9394a852b65bdf5072ba997463114d5 /llvm/lib/IR/IntrinsicInst.cpp
parent27249c06b775c73b7fa9f2d8e48cac1a85169481 (diff)
downloadllvm-2fa744e631cbabe583da010ec56560edbc7a5384.zip
llvm-2fa744e631cbabe583da010ec56560edbc7a5384.tar.gz
llvm-2fa744e631cbabe583da010ec56560edbc7a5384.tar.bz2
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). This commit fixes LLVMAnalysis and its dependencies.
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r--llvm/lib/IR/IntrinsicInst.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 6f9cd2d..6fd59d8 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -301,13 +301,13 @@ ConstrainedFPIntrinsic::getExceptionBehavior() const {
bool ConstrainedFPIntrinsic::isDefaultFPEnvironment() const {
std::optional<fp::ExceptionBehavior> Except = getExceptionBehavior();
if (Except) {
- if (Except.value() != fp::ebIgnore)
+ if (*Except != fp::ebIgnore)
return false;
}
std::optional<RoundingMode> Rounding = getRoundingMode();
if (Rounding) {
- if (Rounding.value() != RoundingMode::NearestTiesToEven)
+ if (*Rounding != RoundingMode::NearestTiesToEven)
return false;
}
@@ -444,13 +444,13 @@ MaybeAlign VPIntrinsic::getPointerAlignment() const {
std::optional<unsigned> PtrParamOpt =
getMemoryPointerParamPos(getIntrinsicID());
assert(PtrParamOpt && "no pointer argument!");
- return getParamAlign(PtrParamOpt.value());
+ return getParamAlign(*PtrParamOpt);
}
/// \return The pointer operand of this load,store, gather or scatter.
Value *VPIntrinsic::getMemoryPointerParam() const {
if (auto PtrParamOpt = getMemoryPointerParamPos(getIntrinsicID()))
- return getArgOperand(PtrParamOpt.value());
+ return getArgOperand(*PtrParamOpt);
return nullptr;
}
@@ -472,7 +472,7 @@ Value *VPIntrinsic::getMemoryDataParam() const {
auto DataParamOpt = getMemoryDataParamPos(getIntrinsicID());
if (!DataParamOpt)
return nullptr;
- return getArgOperand(DataParamOpt.value());
+ return getArgOperand(*DataParamOpt);
}
std::optional<unsigned> VPIntrinsic::getMemoryDataParamPos(Intrinsic::ID VPID) {