From 79378b1b757d5c981e60320f5a735f3e356557a0 Mon Sep 17 00:00:00 2001 From: Volkan Keles Date: Tue, 15 Sep 2020 16:40:38 -0700 Subject: [PATCH] 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. --- llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp index 7421599..5e2b862 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; } -- 2.7.4