Skip to content

Commit c1a2b12

Browse files
committed
Address feedback.
1 parent 3720504 commit c1a2b12

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,8 @@ void isSafePHISelectUseForScalarRepl(Instruction *I, uint64_t Offset,
14771477
}
14781478
}
14791479

1480+
// Returns whether the `OpIdx` argument of HL intrinsic call `CI` is expected to
1481+
// be a user-defined-type.
14801482
static bool isUDTIntrinsicArg(CallInst *CI, unsigned OpIdx) {
14811483
if (HLOpcodeGroup::HLIntrinsic != GetHLOpcodeGroup(CI->getCalledFunction()))
14821484
return false;
@@ -1579,12 +1581,9 @@ void isSafeForScalarRepl(Instruction *I, uint64_t Offset, AllocaInfo &Info) {
15791581
// Most HL functions are safe for scalar repl.
15801582
if (HLOpcodeGroup::NotHL == group)
15811583
return MarkUnsafe(Info, User);
1582-
else if (HLOpcodeGroup::HLIntrinsic == group) {
1583-
for (unsigned OpIdx = 0; OpIdx < CI->getNumArgOperands(); OpIdx++) {
1584-
if (CI->getArgOperand(OpIdx) == I && isUDTIntrinsicArg(CI, OpIdx))
1585-
return MarkUnsafe(Info, User);
1586-
}
1587-
}
1584+
else if (HLOpcodeGroup::HLIntrinsic == group &&
1585+
isUDTIntrinsicArg(CI, U.getOperandNo()))
1586+
return MarkUnsafe(Info, User);
15881587
} else {
15891588
return MarkUnsafe(Info, User);
15901589
}
@@ -2714,10 +2713,9 @@ static void memcpyAggCallArg(CallInst *CI, unsigned ArgIdx, bool CopyIn,
27142713
Type *userTyElt = userTy->getElementType();
27152714
Value *Alloca = AllocaBuilder.CreateAlloca(userTyElt);
27162715
IRBuilder<> Builder(CI);
2717-
if (CopyIn) {
2716+
if (CopyIn)
27182717
Builder.CreateMemCpy(Alloca, userTyV, DL.getTypeAllocSize(userTyElt),
27192718
false);
2720-
}
27212719
CI->setArgOperand(ArgIdx, Alloca);
27222720
if (CopyOut) {
27232721
Builder.SetInsertPoint(CI->getNextNode());

0 commit comments

Comments
 (0)