[PATCH] D102552: [GlobalOpt] recompute alignments for loads and stores of updated globals

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 15 05:44:52 PDT 2021


spatel created this revision.
spatel added reviewers: MaskRay, aeubanks, lebedev.ri, fhahn, efriedma.
Herald added subscribers: pengfei, hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.

GlobalOpt can slice structs/arrays and change GEPs in the process, but it was not updating alignments for load/store users. This eventually causes the crashing seen in:
https://llvm.org/PR49661
https://llvm.org/PR50253

On x86, this required SLP+codegen to create an aligned vector store on an invalid address. The bugs would be easier to demonstrate on a target with stricter alignment requirements.

This is my first time looking at this pass, so I'm not sure if this is a complete solution. The alignment updating code is adapted from InstCombine, so I assume that part is tested and good.


https://reviews.llvm.org/D102552

Files:
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll
  llvm/test/Transforms/GlobalOpt/globalsra-align.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102552.345629.patch
Type: text/x-patch
Size: 5048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210515/4086cd94/attachment.bin>


More information about the llvm-commits mailing list