[llvm] ce9c0fa - [X86][AMX] combineLdSt - don't dereference dyn_cast. NFC
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon May 2 08:46:02 PDT 2022
Author: Simon Pilgrim
Date: 2022-05-02T16:45:43+01:00
New Revision: ce9c0faca1611041d3dbc3712c4c54c4fab58fb9
URL: https://github.com/llvm/llvm-project/commit/ce9c0faca1611041d3dbc3712c4c54c4fab58fb9
DIFF: https://github.com/llvm/llvm-project/commit/ce9c0faca1611041d3dbc3712c4c54c4fab58fb9.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/X86/X86LowerAMXType.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86LowerAMXType.cpp b/llvm/lib/Target/X86/X86LowerAMXType.cpp
index 0ad3e6c9d81cd..81f258dc9659e 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<Instruction *> &Casts) {
bool Change = false;
for (auto *Cast : Casts) {
- IntrinsicInst *II = dyn_cast<IntrinsicInst>(Cast);
+ auto *II = cast<IntrinsicInst>(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<Instruction *> &Casts) {
Store->eraseFromParent();
} else { // x86_cast_vector_to_tile
SmallVector<Instruction *, 2> DeadLoads;
- LoadInst *Load = dyn_cast<LoadInst>(Cast->getOperand(0));
+ auto *Load = dyn_cast<LoadInst>(Cast->getOperand(0));
if (!Load || !Load->hasOneUse())
continue;
// %65 = load <256 x i32>, <256 x i32>* %p, align 64
More information about the llvm-commits
mailing list