Implement classof for SetCondInst so that instcombine doesn't break on dyn_cast<SetCo...
authorChris Lattner <sabre@nondot.org>
Fri, 23 Aug 2002 18:30:58 +0000 (18:30 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 23 Aug 2002 18:30:58 +0000 (18:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3493 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/iOperators.h

index 3bdb13df0f6eaaa19168a0f96bcb521ee8c8e265..730906a8374253bec9770e3efc76cfca7e7f0059 100644 (file)
@@ -34,6 +34,17 @@ public:
   // For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
   //
   BinaryOps getInverseCondition() const;
+
+  // Methods for support type inquiry through isa, cast, and dyn_cast:
+  static inline bool classof(const SetCondInst *) { return true; }
+  static inline bool classof(const Instruction *I) {
+    return I->getOpcode() == SetEQ || I->getOpcode() == SetNE ||
+           I->getOpcode() == SetLE || I->getOpcode() == SetGE ||
+           I->getOpcode() == SetLT || I->getOpcode() == SetGT;
+  }
+  static inline bool classof(const Value *V) {
+    return isa<Instruction>(V) && classof(cast<Instruction>(V));
+  }
 };
 
 #endif