Skip to content

Commit 8f25313

Browse files
committed
LICM: make sure that getMemoryBehavior is only called for address values
It was called for non-address operands of fix_lifetime. Just exclude such fix_lifetime instructions from moving. It's not important anyway.
1 parent 084d60d commit 8f25313

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/SILOptimizer/LoopTransforms/LICM.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,8 @@ void LoopTreeOptimization::analyzeCurrentLoop(
10211021
std::any_of(sideEffects.begin(), sideEffects.end(),
10221022
[&](SILInstruction *W) { return W->mayRelease(); });
10231023
for (auto *FL : FixLifetimes) {
1024+
if (!FL->getOperand()->getType().isAddress())
1025+
continue;
10241026
if (!sideEffectsMayRelease || !mayWriteTo(AA, sideEffects, FL)) {
10251027
SinkDown.push_back(FL);
10261028
}

test/SILOptimizer/licm.sil

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ sil_global @globalArray : $Storage
2525

2626
// CHECK: bb2({{.*}}):
2727
// CHECK-NOT: load
28-
// CHECK-NOT: fix_lifetime
2928
// CHECK: cond_br
3029

3130
sil @memset : $@convention(thin) (@inout Builtin.NativeObject, Int) -> () {

0 commit comments

Comments
 (0)