[llvm] [AMDGPU] Do not fold COPY with implicit use of exec (PR #136003)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 04:58:59 PDT 2025


================
@@ -1092,7 +1092,8 @@ void SIFoldOperandsImpl::foldOperand(
   } else {
     if (UseMI->isCopy() && OpToFold.isReg() &&
         UseMI->getOperand(0).getReg().isVirtual() &&
-        !UseMI->getOperand(1).getSubReg()) {
+        !UseMI->getOperand(1).getSubReg() &&
+        !OpToFold.getParent()->hasRegisterImplicitUseOperand(AMDGPU::EXEC)) {
----------------
arsenm wrote:

Our use of implicit exec operands on copies is super unsound and we should stop doing it. That being said, I think this should just generalize to disallowing handling a copy with any implicit operands

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


More information about the llvm-commits mailing list