Skip to content

Commit 0650840

Browse files
committed
get code compiling after rebase
1 parent 288b8da commit 0650840

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,9 @@ static void EmitHLSLSplatCast(CodeGenFunction &CGF, Address DestVal,
496496
QualType SrcTy, SourceLocation Loc) {
497497
// Flatten our destination
498498
SmallVector<QualType> DestTypes; // Flattened type
499-
SmallVector<llvm::Value *, 4> IdxList;
500499
SmallVector<std::pair<Address, llvm::Value *>, 16> StoreGEPList;
501500
// ^^ Flattened accesses to DestVal we want to store into
502-
CGF.FlattenAccessAndType(DestVal, DestTy, IdxList, StoreGEPList, DestTypes);
501+
CGF.FlattenAccessAndType(DestVal, DestTy, StoreGEPList, DestTypes);
503502

504503
if (const VectorType *VT = SrcTy->getAs<VectorType>()) {
505504
assert(VT->getNumElements() == 1 && "Invalid HLSL splat cast.");
@@ -511,7 +510,15 @@ static void EmitHLSLSplatCast(CodeGenFunction &CGF, Address DestVal,
511510
for (unsigned i = 0; i < StoreGEPList.size(); i++) {
512511
llvm::Value *Cast =
513512
CGF.EmitScalarConversion(SrcVal, SrcTy, DestTypes[i], Loc);
514-
CGF.PerformStore(StoreGEPList[i], Cast);
513+
514+
// store back
515+
llvm::Value *Idx = StoreGEPList[i].second;
516+
if (Idx) {
517+
llvm::Value *V =
518+
CGF.Builder.CreateLoad(StoreGEPList[i].first, "load.for.insert");
519+
Cast = CGF.Builder.CreateInsertElement(V, Cast, Idx);
520+
}
521+
CGF.Builder.CreateStore(Cast, StoreGEPList[i].first);
515522
}
516523
}
517524

0 commit comments

Comments
 (0)