[llvm] [ReplaceConstant] Don't create instructions for the same constant multiple times in the same basic block (PR #169141)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 27 04:11:01 PST 2025


================
@@ -22,9 +22,9 @@ static bool isExpandableUser(User *U) {
   return isa<ConstantExpr>(U) || isa<ConstantAggregate>(U);
 }
 
-static SmallVector<Instruction *, 4> expandUser(BasicBlock::iterator InsertPt,
-                                                Constant *C) {
-  SmallVector<Instruction *, 4> NewInsts;
+static void expandUser(BasicBlock::iterator InsertPt, Constant *C,
+                       SmallVector<Instruction *, 4> &NewInsts) {
----------------
jayfoad wrote:

```suggestion
                       SmallVectorImpl<Instruction *> &NewInsts) {
```

https://github.com/llvm/llvm-project/pull/169141


More information about the llvm-commits mailing list