[llvm] [SandboxIR] Implement CallBrInst (PR #100823)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 11:12:24 PDT 2024


================
@@ -177,6 +178,41 @@ class RemoveFromParent : public IRChangeBase {
 #endif // NDEBUG
 };
 
+class CallBrInstSetDefaultDest : public IRChangeBase {
+  CallBrInst *CallBr;
+  BasicBlock *OrigDefaultDest;
+
+public:
+  CallBrInstSetDefaultDest(CallBrInst *CallBr, Tracker &Tracker);
+  void revert() final;
+  void accept() final {}
+#ifndef NDEBUG
+  void dump(raw_ostream &OS) const final {
+    dumpCommon(OS);
+    OS << "CallBrInstSetDefaultDest";
+  }
+  LLVM_DUMP_METHOD void dump() const final;
+#endif
+};
+
+class CallBrInstSetIndirectDest : public IRChangeBase {
----------------
vporpo wrote:

It is doable, but it has some drawbacks, the main one being that it creates an inconsistency without too much benefit. All change classes so far are final, but in that case, `CallBrInstSetDefaultDest`'s would not be final. Also the implementation of `revert()` would have to be different, so there is not too much to reuse code-wise. I think I would rather keep it as it is. Wdyt?

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


More information about the llvm-commits mailing list