[PATCH] D98757: [AMX] Not fold constant bitcast into amx intrisic

Chang Lin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 16 22:47:44 PDT 2021


clin1 added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:101
 /// Constant fold bitcast, symbolically evaluating it with DataLayout.
 /// This always returns a non-null constant, but it may be a
 /// ConstantExpr if unfoldable.
----------------
xiangzhangllvm wrote:
> clin1 wrote:
> > API for this function always returns non-null: can we return ConstantExpr::getBitCast(C,DestTy) instead? Then the change in SCCP is not needed either.
> I tried, the SCCP will also fold the bitcast into the following instruction.
I see, that makes sense. But are we sure that all callers of FoldBitCast are doing a null check: for example, FoldReinterpretLoadFromConstPtr calls FoldBitCast several times, and null is not checked before dereference. Maybe the AMX type cannot happen in this case?
Alternative: can AMX be checked in SCCP?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98757/new/

https://reviews.llvm.org/D98757



More information about the cfe-commits mailing list