Skip to content

Commit

Permalink
Fix MemorySSA bug, broken julia-licm test (#49900)
Browse files Browse the repository at this point in the history
(cherry picked from commit e169d20)
  • Loading branch information
pchintalapudi authored and KristofferC committed Jun 6, 2023
1 parent d85c82a commit 167708b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/llvm-julia-licm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ static void eraseInstruction(Instruction &I,
//Stolen and modified from LICM.cpp
static void moveInstructionBefore(Instruction &I, Instruction &Dest,
MemorySSAUpdater &MSSAU,
ScalarEvolution *SE) {
ScalarEvolution *SE,
MemorySSA::InsertionPlace Place = MemorySSA::BeforeTerminator) {
I.moveBefore(&Dest);
if (MSSAU.getMemorySSA())
if (MemoryUseOrDef *OldMemAcc = cast_or_null<MemoryUseOrDef>(
MSSAU.getMemorySSA()->getMemoryAccess(&I)))
MSSAU.moveToPlace(OldMemAcc, Dest.getParent(),
MemorySSA::BeforeTerminator);
Place);
if (SE)
SE->forgetValue(&I);
}
Expand Down Expand Up @@ -228,7 +229,7 @@ struct JuliaLICM : public JuliaPassContext {
continue;
}
++SunkPreserveEnd;
moveInstructionBefore(*call, *exit_pts[0], MSSAU, SE);
moveInstructionBefore(*call, *exit_pts[0], MSSAU, SE, MemorySSA::Beginning);
for (unsigned i = 1; i < exit_pts.size(); i++) {
// Clone exit
auto CI = CallInst::Create(call, {}, exit_pts[i]);
Expand Down

0 comments on commit 167708b

Please sign in to comment.