[llvm] [IRBuilder][ConstantFold] Fold constant for CreateInsertVector. (PR #116229)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 08:00:55 PST 2024
HanKuanChen wrote:
> There shouldn't be an IRBuilderFolder API that is specific to this intrinsic. This is a specific instance of general intrinsic folding support.
What should I do if I want to make `CreateInsertVector` fold constant just like `CreateInsertElement`
```
Value *CreateInsertElement(Value *Vec, Value *NewElt, Value *Idx,
const Twine &Name = "") {
if (Value *V = Folder.FoldInsertElement(Vec, NewElt, Idx))
return V;
return Insert(InsertElementInst::Create(Vec, NewElt, Idx), Name);
}
```
https://github.com/llvm/llvm-project/pull/116229
More information about the llvm-commits
mailing list