[llvm] [SelectionDAG] Reduce code duplication between getStore, getTruncStore, and getIndexedStore. (PR #137435)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 23:37:32 PDT 2025
s-barannikov wrote:
Mutating a node isn't nice. This appears to work:
```C++
auto *ST = cast<StoreSDNode>(N);
SDValue NewST = DAG.getStore(ST->getChain(), SDLoc(N), 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);
```
https://github.com/llvm/llvm-project/pull/137435
More information about the llvm-commits
mailing list