[llvm] IR: introduce struct with CmpInst::Predicate and samesign (PR #116867)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 06:02:47 PST 2024


artagnon wrote:

> > * Can you please move this out of CmpInst? The fact that CmpInst::Predicate cannot be forward-declared has been a regular source of friction -- we sometimes use `unsigned` in headers just because of this. We can avoid repeating that mistake now...
> 
> Thanks for the context.

I was actually thinking about making functions like getInversePredicate() automatically work with CmpPredicate, but I suppose we'd have to trade that off in favor of having CmpPredicate forward-declarable: perhaps we can eventually move CmpInst::Predicate into CmpPredicate, once we migrate the entire codebase (do you know if this will have significant compile-time impact? I've marked the functions in CmpPredicate constexpr so they're inlined). Also, since nothing in IR can be marked virtual, we have no choice but to create CmpPredicate variants of the base functions: I've added "Cmp" to the name, to avoid confusion between a function in CmpInst and an overshadowing one in ICmpInst.

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


More information about the llvm-commits mailing list