Skip to content

Commit 794e336

Browse files
committed
[ConstExpr] Look through move_value insts.
Just like begin_borrow and copy_value, move_value should be looked through because the interpreter doesn't model the memory operation it encodes.
1 parent 3277d0e commit 794e336

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/SILOptimizer/Utils/ConstExpr.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,10 @@ SymbolicValue ConstExprFunctionState::computeConstantValue(SILValue value) {
488488
if (auto *bai = dyn_cast<BeginAccessInst>(value))
489489
return getConstantValue(bai->getOperand());
490490

491-
// Look through copy_value and begin_borrow since the interpreter doesn't
492-
// model these memory management instructions.
493-
if (isa<CopyValueInst>(value) || isa<BeginBorrowInst>(value))
491+
// Look through copy_value, begin_borrow, and move_value since the
492+
// interpreter doesn't model these memory management instructions.
493+
if (isa<CopyValueInst>(value) || isa<BeginBorrowInst>(value) ||
494+
isa<MoveValueInst>(value))
494495
return getConstantValue(cast<SingleValueInstruction>(value)->getOperand(0));
495496

496497
// Builtin.RawPointer and addresses have the same representation.

0 commit comments

Comments
 (0)