[PATCH] D144445: [ConstantFold][InstSimplify] folding load for constant global all-element-equal arrays and structs

JunMa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 04:38:07 PST 2023


junparser added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:770
 
+Constant *llvm::ConstantFoldLoadFromAllEqAggregate(Constant *C, Type *Ty) {
+
----------------
khei4 wrote:
> junparser wrote:
> > What you need maybe something like Constant::getSplatValue with proper handle with constant struct and array
> @junparser
> Thank you for the review! 
> Yeah, we can say so, but `Splat` seems like from [[ https://lists.llvm.org/pipermail/llvm-dev/2017-May/112758.html | conventions around vector type ]] 
> , so if implemented as a method, it might be better to separate them.
> As you see, architecturally this element's equality checking might be general enough to implement as a Constant method. Is it better?
Since this is complement for ConstantFoldLoadFromUniformValue, so it is better to do inside ConstantFoldLoadFromUniformValue.


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

https://reviews.llvm.org/D144445



More information about the llvm-commits mailing list