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