[PATCH] D33802: [AMDGPU] Preserve operand order in SIFoldOperands

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 13:38:51 PDT 2017


arsenm added inline comments.


================
Comment at: lib/Target/AMDGPU/SIFoldOperands.cpp:243-251
     if (!CanCommute ||
         !TII->commuteInstruction(*MI, false, CommuteIdx0, CommuteIdx1))
       return false;
 
-    if (!TII->isOperandLegal(*MI, OpNo, OpToFold))
+    if (!TII->isOperandLegal(*MI, OpNo, OpToFold)) {
+      TII->commuteInstruction(*MI, false, CommuteIdx0, CommuteIdx1);
       return false;
----------------
This is still undoing the commute, I meant to move the operand legal check before the first commuteInstruction.


Repository:
  rL LLVM

https://reviews.llvm.org/D33802





More information about the llvm-commits mailing list