[llvm-branch-commits] [llvm] [mcp-frameinst: 3/4]: [MCP][NFC] Opinionated refactoring using new type (PR #186239)

Scott Linder via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 13 07:30:45 PDT 2026


================
@@ -94,6 +94,32 @@ static cl::opt<cl::boolOrDefault>
 
 namespace {
 
+struct DefSrcPair {
+  const MachineOperand *Def;
+  const MachineOperand *Src;
+
+  DefSrcPair(const DestSourcePair &DSP)
+      : Def(DSP.Destination), Src(DSP.Source) {}
+
+  static DefSrcPair fromAssert(std::optional<DefSrcPair> DSP) {
+    assert(DSP && "Expected copy instruction");
----------------
slinder1 wrote:

AFAIK `operator*` when not engaged is UB, and `value` is defined to throw an exception. I imagine all useful stdlibs will still assert in `operator*` but ideally we don't rely on it.

https://github.com/llvm/llvm-project/pull/186239


More information about the llvm-branch-commits mailing list