[PATCH] D51203: AMDGPU: Handle 32-bit address wraparounds for SMRD opcodes

Marek Olšák via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 09:20:02 PDT 2018


mareko added inline comments.


================
Comment at: lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp:1362-1369
+  // A 32-bit (address + offset) can wrap around, while the same expression
+  // might not wrap around in 64 bits. We need to fix this case for tests that
+  // do (Addr - BigConst + BigConst), so assume that a "sufficiently small"
+  // offset never causes a wraparound. The chosen number is a guess. Address
+  // wraparounds are never expected to occur in normal apps.
+  if (Addr32Bit && (uint64_t)ByteOffset > 256 * 1024)
+    return false;
----------------
arsenm wrote:
> Can we check NUW flags on the add instead?
Yes, but where would I check for 256 * 1024?


Repository:
  rL LLVM

https://reviews.llvm.org/D51203





More information about the llvm-commits mailing list