[PATCH] D82892: [NFC] Added comparision for all types in haveSameSpecialState() of Instruction.cpp

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 12:38:11 PDT 2020


tejohnson added a comment.

In D82892#2151280 <https://reviews.llvm.org/D82892#2151280>, @vish99 wrote:

> In D82892#2151162 <https://reviews.llvm.org/D82892#2151162>, @tejohnson wrote:
>
> > Why not just make hasSamePropertiesAs a pure virtual on Instruction, then you don't need any switch statement in haveSameSpecialState? You'd need to do the cast on the Instruction operand within the implementations, but that would be cleaner IMO. For the ones that currently return true, you wouldn't need the cast just an opcode comparison.
>
>
> I think adding a virtual method to Instruction class would fail a static_assert in OperandTraits which says a subclass of User shouldn't be polymorphic and if virtual methods are added to subclasses of User, it breaks use lists.


Ah got it, no wonder there are no virtual methods in Instruction.h right now. Nevermind this suggestion then!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82892/new/

https://reviews.llvm.org/D82892





More information about the llvm-commits mailing list