Skip to content

Commit 47cb073

Browse files
Addressed PR comments
1 parent 53383a1 commit 47cb073

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,21 +1264,21 @@ bool MachineLICMBase::IsProfitableToHoist(MachineInstr &MI,
12641264

12651265
// If we have a COPY with other uses in the loop, hoist to allow the users to
12661266
// also be hoisted.
1267-
Register defReg;
1267+
Register DefReg;
12681268
if (MI.isCopy() && MI.getOperand(0).isReg() &&
1269-
(defReg = MI.getOperand(0).getReg()).isVirtual() &&
1269+
(DefReg = MI.getOperand(0).getReg()).isVirtual() &&
12701270
MI.getOperand(1).isReg() && MI.getOperand(1).getReg().isVirtual() &&
12711271
IsLoopInvariantInst(MI, CurLoop) &&
12721272
any_of(MRI->use_nodbg_instructions(MI.getOperand(0).getReg()),
1273-
[&CurLoop, this, defReg, Cost](MachineInstr &UseMI) {
1273+
[&CurLoop, this, DefReg, Cost](MachineInstr &UseMI) {
12741274
if (!CurLoop->contains(&UseMI))
12751275
return false;
12761276

12771277
// COPY is a cheap instruction, but if moving it won't cause high
12781278
// RP we're fine to hoist it even if the user can't be hoisted
12791279
// later Otherwise we want to check the user if it's hoistable
12801280
if (CanCauseHighRegPressure(Cost, false) &&
1281-
!CurLoop->isLoopInvariant(UseMI, defReg))
1281+
!CurLoop->isLoopInvariant(UseMI, DefReg))
12821282
return false;
12831283

12841284
return true;

llvm/test/CodeGen/AMDGPU/copy-hoist-no-spills.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
1+
; NOTE: There must be no spill reload inside the loop starting with LBB0_1:
22
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -O2 -vectorize-loops -vectorize-slp -amdgpu-early-inline-all=true -amdgpu-function-calls=false < %s | FileCheck %s
33
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9-p9:192:256:256:32"
44
target triple = "amdgcn-amd-amdhsa"

0 commit comments

Comments
 (0)