[X86][AMX] Add check for potentially dereferencing null return value
authorBing1 Yu <bing1.yu@intel.com>
Mon, 10 Apr 2023 09:09:35 +0000 (17:09 +0800)
committerBing1 Yu <bing1.yu@intel.com>
Tue, 11 Apr 2023 05:01:03 +0000 (13:01 +0800)
Reviewed By: xiangzhangllvm

Differential Revision: https://reviews.llvm.org/D147921

llvm/lib/Target/X86/X86LowerAMXType.cpp

index 547f897..6966ee4 100644 (file)
@@ -488,7 +488,7 @@ static void replaceWithTileLoad(Use &U, Value *Ptr, bool IsPHI = false) {
   // Get tile shape.
   IntrinsicInst *II = nullptr;
   if (IsPHI) {
-    Value *PhiOp = dyn_cast<PHINode>(V)->getIncomingValue(0);
+    Value *PhiOp = cast<PHINode>(V)->getIncomingValue(0);
     II = cast<IntrinsicInst>(PhiOp);
   } else {
     II = cast<IntrinsicInst>(V);