[llvm] [IR] Add nowrap flags for trunc instruction (PR #85592)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 18 03:51:19 PDT 2024
================
@@ -946,6 +946,56 @@ class PossiblyNonNegInst : public CastInst {
}
};
+/// Cast Instruction that can have a nowrap flags (only trunc)
+class PossiblyNoWrapInst : public CastInst {
+public:
+ enum { AnyWrap = 0, NoUnsignedWrap = (1 << 0), NoSignedWrap = (1 << 1) };
+
+ static bool classof(const Instruction *I) {
+ return I->getOpcode() == Instruction::Trunc;
+ }
+
+ static bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
----------------
elhewaty wrote:
In the internal `classof` there's a check `I->getOpcode() == Instrucntion::Trunc`,
won't `dyn_cast` cause a null pointer dereference?
https://github.com/llvm/llvm-project/pull/85592
More information about the llvm-commits
mailing list