Skip to content

Commit 7bd0159

Browse files
committed
Make sure convergence tokens are preserved
1 parent 0176ce4 commit 7bd0159

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,12 +1134,14 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
11341134

11351135
// TODO: Handle this for update_dpp, mov_ddp8, and all permlane variants.
11361136
if (isTypeLegal(BCSrc->getType())) {
1137-
SmallVector<Value *, 2> Args(II.args());
1138-
Args[0] = BCSrc;
1139-
CallInst *NewCall = IC.Builder.CreateIntrinsic(
1140-
II.getIntrinsicID(), {BCSrc->getType()}, Args);
1141-
NewCall->takeName(&II);
1142-
return new BitCastInst(NewCall, II.getType());
1137+
Module *M = IC.Builder.GetInsertBlock()->getModule();
1138+
// Mutate the call in place to ensure operand bundles are preserved.
1139+
Function *Remangled =
1140+
Intrinsic::getOrInsertDeclaration(M, IID, {BCSrc->getType()});
1141+
1142+
II.setCalledFunction(Remangled);
1143+
IC.replaceOperand(II, 0, BCSrc);
1144+
return new BitCastInst(&II, II.getType());
11431145
}
11441146
}
11451147

0 commit comments

Comments
 (0)