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

Vishal Chebrolu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 12:35:29 PDT 2020


vish99 added a comment.

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.


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