[MergedLoadStoreMotion] Merge stores with conflicting value types
authorJeff Byrnes <jeffrey.byrnes@amd.com>
Tue, 28 Mar 2023 23:47:58 +0000 (16:47 -0700)
committerJeff Byrnes <jeffrey.byrnes@amd.com>
Tue, 4 Apr 2023 19:01:29 +0000 (12:01 -0700)
commit9b79d0b610ccf5557266232d8c7a132ef9ee9365
tree4ecbfc06e06c23fbc224566bb2482c5347d60557
parentd9d840cdaf51a9795930750d1b91d614a3849137
[MergedLoadStoreMotion] Merge stores with conflicting value types

Since memory does not have an intrinsic type, we do not need to require value type matching on stores in order to sink them. To facilitate that, this patch finds stores which are sinkable, but have conflicting types, and bitcasts the ValueOperand so they are easily sinkable into a PHINode. Rather than doing fancy analysis to optimally insert the bitcast, we always insert right before the relevant store in the diamond branch. The assumption is that later passes (e.g. GVN, SimplifyCFG) will clean up bitcasts as needed.

Differential Revision: https://reviews.llvm.org/D147348
llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/Instruction.cpp
llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
llvm/test/Transforms/MergedLoadStoreMotion/st_sink_conflict_type.ll [new file with mode: 0644]
llvm/test/Transforms/PhaseOrdering/bitcast-store-branch.ll [new file with mode: 0644]