[llvm] [instCombine][bugfix] Fix crash caused by using of cast in instCombineSVECmpNE (PR #102472)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 07:40:57 PDT 2024


================
@@ -1174,7 +1174,8 @@ static std::optional<Instruction *> instCombineSVECmpNE(InstCombiner &IC,
     return std::nullopt;
 
   // Where the dupq is a lane 0 replicate of a vector insert
-  if (!cast<ConstantInt>(DupQLane->getArgOperand(1))->isZero())
+  auto *DupQLaneOp1 = dyn_cast<ConstantInt>(DupQLane->getArgOperand(1));
----------------
paulwalker-arm wrote:

Up to you but I think `DupQLaneIdx` would be more readable.

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


More information about the llvm-commits mailing list