From ce9c0faca1611041d3dbc3712c4c54c4fab58fb9 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 2 May 2022 16:20:06 +0100 Subject: [PATCH] [X86][AMX] combineLdSt - don't dereference dyn_cast. NFC This leads to null pointer dereference warnings - use cast<> which will assert that the cast correct. --- llvm/lib/Target/X86/X86LowerAMXType.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/X86/X86LowerAMXType.cpp b/llvm/lib/Target/X86/X86LowerAMXType.cpp index 0ad3e6c..81f258d 100644 --- a/llvm/lib/Target/X86/X86LowerAMXType.cpp +++ b/llvm/lib/Target/X86/X86LowerAMXType.cpp @@ -964,7 +964,7 @@ static void combineLoadCast(IntrinsicInst *Cast, LoadInst *LD) { static bool combineLdSt(SmallVectorImpl &Casts) { bool Change = false; for (auto *Cast : Casts) { - IntrinsicInst *II = dyn_cast(Cast); + auto *II = cast(Cast); // %43 = call <256 x i32> @llvm.x86.cast.tile.to.vector(x86_amx %42) // store <256 x i32> %43, <256 x i32>* %p, align 64 // --> @@ -984,7 +984,7 @@ static bool combineLdSt(SmallVectorImpl &Casts) { Store->eraseFromParent(); } else { // x86_cast_vector_to_tile SmallVector DeadLoads; - LoadInst *Load = dyn_cast(Cast->getOperand(0)); + auto *Load = dyn_cast(Cast->getOperand(0)); if (!Load || !Load->hasOneUse()) continue; // %65 = load <256 x i32>, <256 x i32>* %p, align 64 -- 2.7.4