[llvm] [AMDGPU] Fix crash in allowsMisalignedMemoryAccesses with i1 (PR #105794)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 01:45:47 PDT 2024


================
@@ -1695,7 +1695,8 @@ bool SITargetLowering::allowsMisalignedMemoryAccessesImpl(
     if (!Subtarget->hasUnalignedDSAccessEnabled() && Alignment < Align(4))
       return false;
 
-    Align RequiredAlignment(PowerOf2Ceil(Size/8)); // Natural alignment.
+    Align RequiredAlignment(
+        PowerOf2Ceil(std::max(Size / 8, 1u))); // Natural alignment.
----------------
jayfoad wrote:

Use divideCeil?

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


More information about the llvm-commits mailing list