[llvm] 79378b1 - GlobalISel: Fix a failing combiner test

Volkan Keles via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 16:42:43 PDT 2020


Author: Volkan Keles
Date: 2020-09-15T16:40:38-07:00
New Revision: 79378b1b757d5c981e60320f5a735f3e356557a0

URL: https://github.com/llvm/llvm-project/commit/79378b1b757d5c981e60320f5a735f3e356557a0
DIFF: https://github.com/llvm/llvm-project/commit/79378b1b757d5c981e60320f5a735f3e356557a0.diff

LOG: GlobalISel: Fix a failing combiner test

test/CodeGen/AArch64/GlobalISel/combine-trunc.mir was failing
due to the different order for evaluating function arguments.
This patch updates the related code to fix the issue.

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index 74215999ea60..5e2b86200ce5 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -2113,8 +2113,9 @@ bool CombinerHelper::applyCombineTruncOfShl(
   Register ShiftSrc = MatchInfo.first;
   Register ShiftAmt = MatchInfo.second;
   Builder.setInstrAndDebugLoc(MI);
-  Builder.buildShl(DstReg, Builder.buildTrunc(DstTy, ShiftSrc),
-                   Builder.buildTrunc(DstTy, ShiftAmt), SrcMI->getFlags());
+  auto TruncShiftSrc = Builder.buildTrunc(DstTy, ShiftSrc);
+  auto TruncShiftAmt = Builder.buildTrunc(DstTy, ShiftAmt);
+  Builder.buildShl(DstReg, TruncShiftSrc, TruncShiftAmt, SrcMI->getFlags());
   MI.eraseFromParent();
   return true;
 }


        


More information about the llvm-commits mailing list