[PATCH] D155051: [AMDGPU] Add sanity check that fixes bad shift operation in AMD backend

Konrad Kusiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 03:23:11 PDT 2023


konradkusiak97 added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp:878
+
   unsigned AllowedBitsForMin = llvm::countr_zero(MaxMask);
   if ((1u << AllowedBitsForMin) <= MinMask)
----------------
JonChesterfield wrote:
> Should this be if masks are equal?
> 
> Not sure sanity check describes the condition, maybe drop the comment
Hm, If the masks are equal, the result will be returning `false`. I think that's the correct behaviour that the author of this function had in mind. That's based on the fact that there is `<=` and not `<` sign in `if ((1u << AllowedBitsForMin) <= MinMask)`, so it really checks if the masks overlap - and two equal masks overlap fully.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155051/new/

https://reviews.llvm.org/D155051



More information about the llvm-commits mailing list