================ @@ -0,0 +1,561 @@ +//===---- LoongArchMemoryBarrierOpt.cpp - Memory barrier Optimization -----===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// This pass removes or merges redundant memory barrier instructions. +/// +/// - DBAR x + DBAR y -> DBAR (x & y) +/// - DBAR x + AMO_DB -> AMO_DB +/// - DBAR x + AMO -> AMO_DB +/// - DBAR x + LL -> LL +/// - AMO_DB + DBAR x -> AMO_DB +/// - AMO + DBAR x -> AMO_DB +/// - SC + DBAR x -> SC +/// +//===----------------------------------------------------------------------===// + +#include "LoongArch.h" +#include "LoongArchInstrInfo.h" +#include "LoongArchSubtarget.h" +#include "llvm/CodeGen/MachineDominators.h" +#include "llvm/CodeGen/MachinePostDominators.h" +#include "llvm/InitializePasses.h" + +using namespace llvm; + +#define DEBUG_TYPE "loongarch-memory-barrier-opt" +#define LOONGARCH_MEMORY_BARRIER_OPT_NAME \ + "LoongArch Memory Barrier Optimisation pass" + +static cl::opt<bool> RequireNoPathBypass( + "loongarch-require-no-path-bypass", + cl::desc("Optimize only when no paths bypass either memory barrier"), + cl::init(true), cl::Hidden); + +static cl::opt<bool> MergeAMOWithMB( + "loongarch-merge-amo-with-dbar", + cl::desc("Merge AMOs with DBARs into AMO_DB during optimization"), + cl::init(true), cl::Hidden); + +static cl::opt<bool> DisableInlineAsm( + "loongarch-disable-inline-asm-barrier-opt", + cl::desc("Disable optimization of memory barriers in InlineAsm"), + cl::init(false), cl::Hidden); ---------------- heiher wrote:
Thanks! I'll revert this commit and drop the inline asm part. https://github.com/llvm/llvm-project/pull/218597 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
