[llvm] [IR] PossiblyExactOperator -> PossiblyExactInst (NFC) (PR #72501)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 01:12:28 PST 2023


nikic wrote:

> I don't really have an opinion on the `setExact` implementation itself. As long as there's an `Instruction::setExact`, it may as well be implement there directly. If anything, I'd question whether `Instruction::setExact` should exist in the first place. I think there's a good argument that there should only be a `PossiblyExactInst::setExact` method -- though I expect making that change would require more changes elsewhere.

Yeah, I agree that having the method only on PossiblyExactInst etc would be cleaner. I expect the reason that we currently put these on Instruction instead is pragmatic: We usually do not use specific subclasses for individual operators, so e.g. if you do a `BinaryOperator::CreateSDiv()` and then want to call `setIsExact()` on it, you'd have to cast that first. How that we no longer need to deal with constant expressions, we *could* make that return `PossiblyExactInst` directly. I'm not sure how far-spread these changes have to be to make usage ergonomic.

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


More information about the llvm-commits mailing list