[PATCH] D53776: [DAGCombiner] Fix for big endian in ForwardStoreValueToDirectLoad

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 26 13:36:55 PDT 2018


bjope added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12870
+      (Offset >= 0) &&
       (Offset * 8 <= LDMemType.getSizeInBits()) &&
       (Offset * 8 + LDMemType.getSizeInBits() <= STMemType.getSizeInBits());
----------------
@niravd do you remember why we have the check `(Offset * 8 <= LDMemType.getSizeInBits())` here?

>From my point of view it looks wrong. Maybe it is supposed to be `(Offset * 8 <= STMemType.getSizeInBits())`, i.e. checking that the load starts before the last bit written by the store. But then I guess it is enough to check
`(Offset >= 0) && (Offset * 8 + LDMemType.getSizeInBits() <= STMemType.getSizeInBits())` or are we trying to catch some special case when we get overflow in the int64_t?


Repository:
  rL LLVM

https://reviews.llvm.org/D53776





More information about the llvm-commits mailing list