[PATCH] D116887: [SROA] Switch replacement of dead/UB/unreachable ops from undef to poison
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 9 05:02:53 PST 2022
nlopes created this revision.
nlopes added reviewers: nikic, aeubanks, LemonBoy, lebedev.ri, efriedma.
Herald added subscribers: bollu, hiraditya.
nlopes requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
SROA has 3 data-structures where it stores sets of instructions that should be deleted:
- DeadUsers -> instructions that are UB or have no users
- DeadOperands -> instructions that are UB or operands of useless phis
- DeadInsts -> "dead" instructions, including loads of uninitialized memory with users
The first 2 sets can be RAUW with poison instead of undef. No brainer as UB can be replaced with poison, and for instructions with no users RAUW is a NOP.
The 3rd case cannot be currently replaced with poison because the set mixes the loads of uninit memory. I leave that alone for now.
Another case where we can use poison is in the construction of vectors from multiple loads. The base vector for the first insertelement is now poison as it doesn't matter as it is fully overwritten by inserts.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116887
Files:
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/Transforms/SROA/basictest-opaque-ptrs.ll
llvm/test/Transforms/SROA/basictest.ll
llvm/test/Transforms/SROA/non-capturing-call.ll
llvm/test/Transforms/SROA/phi-and-select.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116887.398416.patch
Type: text/x-patch
Size: 16407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220109/8edff13c/attachment.bin>
More information about the llvm-commits
mailing list