[PATCH] D130106: [LV] Fix miscompile due to srem/sdiv speculation safety condition
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 11:42:31 PDT 2022
reames created this revision.
reames added reviewers: fhahn, david-arm.
Herald added subscribers: frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, asb, hiraditya, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: LLVM.
An srem or sdiv has two cases which can cause undefined behavior, not just one. The existing code did not account for this, and as a result, we miscompiled when we encountered e.g. a srem i64 %v, -1 in a conditional block.
Instead of hand rolling the logic, just use the utility function which exists exactly for this purpose.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D130106
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/RISCV/scalable-divrem.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130106.445896.patch
Type: text/x-patch
Size: 8036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220719/93b2224e/attachment.bin>
More information about the llvm-commits
mailing list