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

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 01:57:08 PST 2023


khei4 added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:770
 
+Constant *llvm::ConstantFoldLoadFromAllEqAggregate(Constant *C, Type *Ty) {
+
----------------
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?


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

https://reviews.llvm.org/D144445



More information about the llvm-commits mailing list