[llvm] [CodeGen] Generate mem intrinsic address calculations with nuw (PR #80184)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 09:27:00 PST 2024


================
@@ -7574,14 +7574,20 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, const SDLoc &dl,
 
       Value = DAG.getExtLoad(
           ISD::EXTLOAD, dl, NVT, Chain,
-          DAG.getMemBasePlusOffset(Src, TypeSize::getFixed(SrcOff), dl),
+          isDereferenceable
+              ? DAG.getObjectPtrOffset(dl, Src, TypeSize::getFixed(SrcOff))
+              : DAG.getMemBasePlusOffset(Src, TypeSize::getFixed(SrcOff), dl),
----------------
dschuff wrote:

Yeah that's actually the only difference between the 2 functions (getObjectPtrOffset is just [implemented](https://github.com/llvm/llvm-project/blob/e0e6236fd61f906f8529dcaa8ecd0beec1f5a18a/llvm/include/llvm/CodeGen/SelectionDAG.h#L1045) in terms of getMemBasePlusOffset anway). So if you think it's a good idea I wouldn't mind just collapsing them as a separate refactoring (it would also fix the annoyance that the 2 functions have the same parameters but in a different order).

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


More information about the llvm-commits mailing list