[PATCH] D126455: [FuncSpec] Make the Function Specializer part of the IPSCCP pass.

Sinan Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 23:15:06 PDT 2022


sinan added a comment.

tryToReplaceWithConstant method in SCCP does not update the lattice value map at SCCPSolver, and it might lead to a problem that

if

  %arg = getelementptr %struct, %struct* @Global, i32 0, i32 3
  %tmp0 = call i64 @func2(i64* %arg)

is folded into

  %tmp0 = call i64 @func2(i64* getelementptr inbounds %struct, %struct* @Global, i32 0, i32 3)

a new callbase argument appears, but it is not recorded at SCCPSolver, and this leads to problems such as D128822 <https://reviews.llvm.org/D128822>.

Suggestion:
FunctionSpecializer::tryToReplaceWithConstant use the code piece below to update the propagated argument, and maybe we need such a change for tryToReplaceWithConstant as well.

  for (auto *I : UseInsts)
    Solver.visit(I);


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126455/new/

https://reviews.llvm.org/D126455



More information about the llvm-commits mailing list