[llvm] [IR] Fix crashes caused by #85592 (PR #87169)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 30 15:59:13 PDT 2024


================
@@ -28,8 +28,9 @@ bool Operator::hasPoisonGeneratingFlags() const {
     return OBO->hasNoUnsignedWrap() || OBO->hasNoSignedWrap();
   }
   case Instruction::Trunc: {
-    auto *TI = dyn_cast<TruncInst>(this);
----------------
shiltian wrote:

This style is really bad. Either using a `cast` directly w/o a check or check the result before use.

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


More information about the llvm-commits mailing list