goldsteinn wrote: Note, the new function `getScalarizationOfInsertElement` is quite similiar to `cheapToScalarize`. I couldn't really see a way to properly merge the two, but that might be a better direction. https://github.com/llvm/llvm-project/pull/84645