================
@@ -870,10 +909,29 @@ bool InstrLowerer::isSamplingEnabled() const {
bool InstrLowerer::isCounterPromotionEnabled() const {
if (DoCounterPromotion.getNumOccurrences() > 0)
return DoCounterPromotion;
-
return Options.DoCounterPromotion;
}
+bool InstrLowerer::isAtomic() const {
+ return Options.Atomic || AtomicCounterUpdateAll;
+}
+
+static void doAtomicPromotionCheck(Function *F) {
+ for (const llvm::Instruction &I : llvm::instructions(F)) {
+ const Value *Addr = nullptr;
+ if (const LoadInst *LI = dyn_cast<LoadInst>(&I))
+ Addr = LI->getOperand(0);
+ else if (const StoreInst *LI = dyn_cast<StoreInst>(&I))
+ Addr = LI->getOperand(1);
+
+ if (Addr && Addr->stripInBoundsOffsets()->getName().starts_with(
+ getInstrProfCountersVarPrefix())) {
+ LLVM_DEBUG(dbgs() << "Missed candidate: "; I.dump());
----------------
david-xl wrote:
Make the debug message clearer: "Expect atomic update: "
https://github.com/llvm/llvm-project/pull/202487
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits