[llvm] [DAGCombiner] Don't drop atomic property of original load. (PR #75626)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 17 11:55:50 PST 2023


topperc wrote:

This changes causes the same X86 changes

```
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c782ad117ce6..90a0cf5acb12 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -15165,7 +15165,7 @@ SDValue DAGCombiner::visitBITCAST(SDNode *N) {
                                     *LN0->getMemOperand())) {
       SDValue Load =
           DAG.getLoad(VT, SDLoc(N), LN0->getChain(), LN0->getBasePtr(),
-                      LN0->getPointerInfo(), LN0->getAlign(),
+                      LN0->getPointerInfo(), LN0->getOriginalAlign(),
                       LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
       DAG.ReplaceAllUsesOfValueWith(N0.getValue(1), Load.getValue(1));
       return Load;
```

getAlign() combines the base alignment of the MMO with the MMO offset. This can cause the base alignment of the newly created MMO to become smaller than the original MMO. This can produce different results if the MMO is later split into multiple MMOs with different offsets.

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


More information about the llvm-commits mailing list