[all-commits] [llvm/llvm-project] e3b4c1: [X86]add assert to confirm not-null ptr in getArit...
XinWang10 via All-commits
all-commits at lists.llvm.org
Thu Mar 16 23:18:05 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e3b4c1bc528bf6d6f8b52aa4e85779cc6fa32511
https://github.com/llvm/llvm-project/commit/e3b4c1bc528bf6d6f8b52aa4e85779cc6fa32511
Author: Wang, Xin10 <xin10.wang at intel.com>
Date: 2023-03-17 (Fri, 17 Mar 2023)
Changed paths:
M llvm/include/llvm/CodeGen/BasicTTIImpl.h
Log Message:
-----------
[X86]add assert to confirm not-null ptr in getArithmeticReductionCost
For the function getArithmeticReductionCost, it receive a ptr and dereferce it without check,
It is called many times in getTypeBasedIntrinsicInstrCost, the ptr passed to it is inited
from line 1709.
>From the code, we can not ensure the ptr VecOpTy is inited when Tys is empty or Tys[VecTyIndex]
is not a VectorType, so that the getArithmeticReductionCost will do an undefined behavior.
I add assert to it, found the ptr passed to it in llvm tests are all not nullptr, but I think the check is
still meaningful for us.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D146118
More information about the All-commits
mailing list