aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/ModuloSchedule.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-12-16 23:21:27 +0000
committerFangrui Song <i@maskray.me>2022-12-16 23:21:27 +0000
commit51b685734b0e185bca9d0eec66b3bcb636ed9c02 (patch)
tree1d3cf7527fef8d8023e8de1858ef42a350be2747 /llvm/lib/CodeGen/ModuloSchedule.cpp
parentbe931f89451b650e081daf875213c19f658caf25 (diff)
downloadllvm-51b685734b0e185bca9d0eec66b3bcb636ed9c02.zip
llvm-51b685734b0e185bca9d0eec66b3bcb636ed9c02.tar.gz
llvm-51b685734b0e185bca9d0eec66b3bcb636ed9c02.tar.bz2
[Transforms,CodeGen] 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/CodeGen/ModuloSchedule.cpp')
-rw-r--r--llvm/lib/CodeGen/ModuloSchedule.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp
index 20d2517..a005882 100644
--- a/llvm/lib/CodeGen/ModuloSchedule.cpp
+++ b/llvm/lib/CodeGen/ModuloSchedule.cpp
@@ -1470,7 +1470,7 @@ Register KernelRewriter::phi(Register LoopReg, std::optional<Register> InitReg,
const TargetRegisterClass *RC) {
// If the init register is not undef, try and find an existing phi.
if (InitReg) {
- auto I = Phis.find({LoopReg, InitReg.value()});
+ auto I = Phis.find({LoopReg, *InitReg});
if (I != Phis.end())
return I->second;
} else {
@@ -1491,10 +1491,10 @@ Register KernelRewriter::phi(Register LoopReg, std::optional<Register> InitReg,
return R;
// Found a phi taking undef as input, so rewrite it to take InitReg.
MachineInstr *MI = MRI.getVRegDef(R);
- MI->getOperand(1).setReg(InitReg.value());
- Phis.insert({{LoopReg, InitReg.value()}, R});
+ MI->getOperand(1).setReg(*InitReg);
+ Phis.insert({{LoopReg, *InitReg}, R});
const TargetRegisterClass *ConstrainRegClass =
- MRI.constrainRegClass(R, MRI.getRegClass(InitReg.value()));
+ MRI.constrainRegClass(R, MRI.getRegClass(*InitReg));
assert(ConstrainRegClass && "Expected a valid constrained register class!");
(void)ConstrainRegClass;
UndefPhis.erase(I);