This code was dead because we AI->replaceUsesWithIf above. I verified
this doesn't actually get run by applying
https://gist.github.com/fmayer/aea7cbb4700cfe2c9d932591ae1073c3 to the
Android toolchain and building AOSP, without any crash.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Oh hold on, maybe what we actually want (to fix this) is to replace NewPtr (the BitCast from alignAndPadAlloca) with Info.AI. Sorry for jumping the gun here, the change as is is correct in that it keeps current behaviour, but that is possibly not what we want.
Nevermind, no. We actually want the cast, because otherwise we cast to the (wrong) type of the padded alloca; or at least that's what the test in asserting. Correct me if that's wrong.
Correcting the commit message (sorry): This never got run, because in alignAndPadAlloca we call replaceAllUsesWith, which includes all metadata uses. This means we would never find a LocationOp with AI as value. This was also true before the refactoring to use a shared alignAndPadAlloca, because the loop only got run if !AllocaToPaddedAllocaMap.empty(), which only got populated in the padding code.