matthias-springer wrote: `legalize` is called from multiple places, so it's easier to do this check in `legalize`. There will be some logic that removes pointers of newly-created operation from the set. https://github.com/llvm/llvm-project/pull/148360