[PATCH] D148521: [VP] Change getVPForBaseOpcode to return std::optional
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 18 05:15:35 PDT 2023
luke added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:937
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue Operand) {
- unsigned VPOpcode = ISD::getVPForBaseOpcode(Opcode);
+ unsigned VPOpcode = ISD::getVPForBaseOpcode(Opcode).value();
assert(ISD::getVPMaskIdx(VPOpcode) == 1 &&
----------------
craig.topper wrote:
> I think we're supposed to use operator* instead of value().
>
> There were commits like this in December
>
> ```
> [lldb] llvm::Optional::value() && => operator*/operator->
>
> std::optional::value() has undesired exception checking semantics and is
> unavailable in older Xcode (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). The
> call sites block std::optional migration.
> ```
Good shout. Hopefully we can still use `has_value()`, I've changed it to just manually assert it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148521/new/
https://reviews.llvm.org/D148521
More information about the llvm-commits
mailing list