Skip to content

Commit d90e99a

Browse files
committed
Separate the loop to resolve use after free
Change-Id: Id3cf508092d5c6321cc980ae168e79d525f558a3
1 parent 5b9dff4 commit d90e99a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ bool AMDGPULateCodeGenPrepare::runOnFunction(Function &F) {
183183
for (auto &BB : F)
184184
for (Instruction &I : make_early_inc_range(BB)) {
185185
Changed |= visit(I);
186+
}
187+
188+
// TODO -- combine the loops. visitLoad instruction deletes loads, which may
189+
// cause use after free in optimizeLiveType. However, deferring the deletion
190+
// of those may corrupt the logic in optimizeLiveType.
191+
for (auto &BB : F)
192+
for (Instruction &I : make_early_inc_range(BB)) {
186193
Changed |= LRO.optimizeLiveType(&I);
187194
}
188195

0 commit comments

Comments
 (0)