[llvm] [SandboxIR] Implement AddrSpaceCastInst (PR #101260)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 20:46:32 PDT 2024


================
@@ -1411,6 +1413,43 @@ class BitCastInst : public CastInst {
 #endif
 };
 
+class AddrSpaceCastInst : public CastInst {
+public:
+  static Value *create(Value *Src, Type *DestTy, BBIterator WhereIt,
+                       BasicBlock *WhereBB, Context &Ctx,
+                       const Twine &Name = "");
+  static Value *create(Value *Src, Type *DestTy, Instruction *InsertBefore,
+                       Context &Ctx, const Twine &Name = "");
+  static Value *create(Value *Src, Type *DestTy, BasicBlock *InsertAtEnd,
+                       Context &Ctx, const Twine &Name = "");
+
+  static bool classof(const Value *From) {
+    if (auto *I = dyn_cast<Instruction>(From))
+      return cast<Instruction>(From)->getOpcode() == Opcode::AddrSpaceCast;
----------------
tschuett wrote:

```Ì```  and  ```cast<Instruction>(From)``` are the same. Please use:
```
return I->getOpcode() == Opcode::AddrSpaceCast:
```

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


More information about the llvm-commits mailing list