[llvm] [SandboxIR] Implement UnaryInstruction class (PR #101541)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 12:33:25 PDT 2024


vporpo wrote:

> Having multiple ways of checking if an instruction has a single operand is worse than just having one way

But this is very much the llvm-way of checking things, which is by casting to the appropriate class with isa<>, and dyn_cast<>.

> in general I'm a big advocate of only adding what you actually need and use; you can always add missing functionality later if it comes up

I agree with this, but in this case there the `UnaryInstruction` class is actually used as a parent class,  it's not dead code. Yes, we aren't actually using `isa<UnaryInstruction>()`, but this is true for all of SandboxIR at this point.

I think that we should not try to diverge from LLVM IR unless there is some technical issue or something, which I don't feel this is the case. In the docs we are claiming that Sandbox IR feels-like LLVM, so we should try to stick to this as much as possible.


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


More information about the llvm-commits mailing list