[PATCH] D136169: [AMDGPU] Avoid SCC clobbering before S_CSELECT_B32

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 11:37:25 PDT 2022


alex-t added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp:2235
+        while (I != MBB->end()) {
+          if (*I != MI && I->getOpcode() ==  AMDGPU::S_CSELECT_B32) {
+            NeedSaveSCC = true;
----------------
alex-t wrote:
> arsenm wrote:
> > Shouldn't special case s_cselect*
> I see it looks like a dirty hack. And it is really. Otherwise, we will have a huge amount of SCC save/restore instructions along the code. Most of them will be unnecessary. In fact, only s_cselect and carry out instructions really use SCC but most of the SALU read it.
> BTW I am curious why did not we hit any errors related to SCC clobbering before s_cselect patch?
> 
Oops. Sorry I was wrong.
It is really no need to special case s_cselect here. I checked the TD files and we only have SCC uses where it is really necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136169



More information about the llvm-commits mailing list