@@ -210,19 +210,14 @@ class OpLowerer {
210210 });
211211 }
212212
213- [[nodiscard]] bool lowerBarrier (Function& F, Intrinsic::ID IntrId) {
213+ [[nodiscard]] bool lowerBarrier (Function &F, Intrinsic::ID IntrId,
214+ ArrayRef<dxil::BarrierMode> BarrierModes) {
215+ unsigned BarrierMode = 0 ;
216+ for (const dxil::BarrierMode B : BarrierModes) {
217+ BarrierMode |= (unsigned )B;
218+ }
214219 IRBuilder<> &IRB = OpBuilder.getIRB ();
215220 return replaceFunction (F, [&](CallInst *CI) -> Error {
216- unsigned BarrierMode = 0 ;
217- switch (IntrId) {
218- default :
219- report_fatal_error (" Unhandled barrier operation type." );
220- break ;
221- case Intrinsic::dx_groupMemoryBarrierWithGroupSync:
222- BarrierMode = (unsigned )dxil::BarrierMode::TGSMFence | (unsigned )dxil::BarrierMode::SyncThreadGroup;
223- break ;
224- }
225-
226221 std::array<Value *, 1 > Args{IRB.getInt32 (BarrierMode)};
227222
228223 IRB.SetInsertPoint (CI);
@@ -505,8 +500,10 @@ class OpLowerer {
505500 HasErrors |= replaceFunctionWithOp (F, OpCode); \
506501 break ;
507502#include " DXILOperation.inc"
508- case Intrinsic::dx_groupMemoryBarrierWithGroupSync:
509- HasErrors |= lowerBarrier (F, ID);
503+ case Intrinsic::dx_group_memory_barrier_with_group_sync:
504+ HasErrors |= lowerBarrier (
505+ F, ID,
506+ {dxil::BarrierMode::TGSMFence, dxil::BarrierMode::SyncThreadGroup});
510507 break ;
511508 case Intrinsic::dx_handle_fromBinding:
512509 HasErrors |= lowerHandleFromBinding (F);
0 commit comments