Skip to content

Commit d5d6feb

Browse files
committed
Fix stack-use-after-scope
1 parent f232a52 commit d5d6feb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,11 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
497497
// vslidedown+vslideup.
498498
// TODO: Multiplying by LT.first implies this legalizes into multiple copies
499499
// of similar code, but I think we expand through memory.
500-
ArrayRef<unsigned> Opcodes;
500+
unsigned Opcodes[2] = {RISCV::VSLIDEDOWN_VX, RISCV::VSLIDEUP_VX};
501501
if (Index >= 0 && Index < 32)
502-
Opcodes = {RISCV::VSLIDEDOWN_VI, RISCV::VSLIDEUP_VX};
502+
Opcodes[0] = RISCV::VSLIDEDOWN_VI;
503503
else if (Index < 0 && Index > -32)
504-
Opcodes = {RISCV::VSLIDEDOWN_VX, RISCV::VSLIDEUP_VI};
505-
else
506-
Opcodes = {RISCV::VSLIDEDOWN_VX, RISCV::VSLIDEUP_VX};
504+
Opcodes[1] = RISCV::VSLIDEUP_VI;
507505
return LT.first * getRISCVInstructionCost(Opcodes, LT.second, CostKind);
508506
}
509507
case TTI::SK_Reverse: {

0 commit comments

Comments
 (0)