@@ -143,6 +143,7 @@ struct CBufferResource {
143
143
Value *Result = nullptr ;
144
144
unsigned int Remaining =
145
145
((DL.getTypeSizeInBits (Ty) / 8 ) / Intrin.EltSize ) - 1 ;
146
+
146
147
if (Remaining == 0 ) {
147
148
// We only have a single element, so we're done.
148
149
Result = Elt;
@@ -154,30 +155,30 @@ struct CBufferResource {
154
155
Result = Builder.CreateInsertElement (PoisonValue::get (VT), Result,
155
156
Builder.getInt32 (0 ), Name);
156
157
}
157
- } else {
158
- // Walk each element and extract it, wrapping to new rows as needed.
159
- SmallVector<Value *> Extracts{Elt};
160
- while (Remaining--) {
161
- CurrentIndex %= Intrin.NumElts ;
162
-
163
- if (CurrentIndex == 0 )
164
- CBufLoad = Builder.CreateIntrinsic (
165
- Intrin.RetTy , Intrin.IID ,
166
- {Handle, ConstantInt::get (Builder.getInt32Ty (), ++CurrentRow)},
167
- nullptr , Name + " .load" );
168
-
169
- Extracts.push_back (Builder.CreateExtractValue (
170
- CBufLoad, {CurrentIndex++}, Name + " .extract" ));
171
- }
158
+ return Result;
159
+ }
160
+
161
+ // Walk each element and extract it, wrapping to new rows as needed.
162
+ SmallVector<Value *> Extracts{Elt};
163
+ while (Remaining--) {
164
+ CurrentIndex %= Intrin.NumElts ;
165
+
166
+ if (CurrentIndex == 0 )
167
+ CBufLoad = Builder.CreateIntrinsic (
168
+ Intrin.RetTy , Intrin.IID ,
169
+ {Handle, ConstantInt::get (Builder.getInt32Ty (), ++CurrentRow)},
170
+ nullptr , Name + " .load" );
172
171
173
- // Finally, we build up the original loaded value.
174
- Result = PoisonValue::get (Ty);
175
- for (int I = 0 , E = Extracts.size (); I < E; ++I)
176
- Result = Builder.CreateInsertElement (Result, Extracts[I],
177
- Builder.getInt32 (I),
178
- Name + formatv (" .upto{}" , I));
172
+ Extracts.push_back (Builder.CreateExtractValue (
173
+ CBufLoad, {CurrentIndex++}, Name + " .extract" ));
179
174
}
180
175
176
+ // Finally, we build up the original loaded value.
177
+ Result = PoisonValue::get (Ty);
178
+ for (int I = 0 , E = Extracts.size (); I < E; ++I)
179
+ Result = Builder.CreateInsertElement (Result, Extracts[I],
180
+ Builder.getInt32 (I),
181
+ Name + formatv (" .upto{}" , I));
181
182
return Result;
182
183
}
183
184
};
0 commit comments