Skip to content

Commit 7ebbbd8

Browse files
authored
[DAG] Always use stack to promote bitcast when the source is vector (#151065)
The optimization introduced by #125637 tried to avoid using stacks to promote bitcast with vector result type. However, it wouldn't be correct if the input type is vector. This patch limits that optimizations to only scalar to vector bitcasts.
1 parent 849009c commit 7ebbbd8

File tree

12 files changed

+4642
-929
lines changed

12 files changed

+4642
-929
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,8 +2217,9 @@ SDValue DAGTypeLegalizer::PromoteIntOp_BITCAST(SDNode *N) {
22172217

22182218
switch (getTypeAction(InVT)) {
22192219
case TargetLowering::TypePromoteInteger: {
2220-
// TODO: Handle big endian
2221-
if (OutVT.isVector() && DAG.getDataLayout().isLittleEndian()) {
2220+
// TODO: Handle big endian & vector input type.
2221+
if (OutVT.isVector() && !InVT.isVector() &&
2222+
DAG.getDataLayout().isLittleEndian()) {
22222223
EVT EltVT = OutVT.getVectorElementType();
22232224
TypeSize EltSize = EltVT.getSizeInBits();
22242225
TypeSize NInSize = NInVT.getSizeInBits();

llvm/test/CodeGen/AMDGPU/ctpop16.ll

Lines changed: 275 additions & 55 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)