[llvm] [SelectionDAG] Reduce code duplication between getStore, getTruncStore, and getIndexedStore. (PR #137435)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 27 22:32:42 PDT 2025


topperc wrote:

> Mutating a node isn't nice. This appears to work:
> 
> ```c++
>       auto *ST = cast<StoreSDNode>(N);
>       SDValue NewST = DAG.getStore(ST->getChain(), dl, Const64,
>                                    ST->getBasePtr(), ST->getOffset(), MemVT,
>                                    ST->getMemOperand(), ST->getAddressingMode(),
>                                    /*IsTruncating=*/true);
>       return ST->isUnindexed()
>                  ? DCI.CombineTo(N, NewST, /*AddTo=*/false)
>                  : DCI.CombineTo(N, NewST, NewST.getValue(1), /*AddTo=*/false);
> ```

Thanks I'll try that.

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


More information about the llvm-commits mailing list