Skip to content

Commit f0ca7c2

Browse files
committed
Minor refactoring
1 parent b9a9ada commit f0ca7c2

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -873,11 +873,12 @@ void ThreadSanitizer::eliminateInstrByPrePostDominance(
873873
if (CurrUnderlyingObj == DomUnderlyingObj ||
874874
(CurrUnderlyingObj && DomUnderlyingObj &&
875875
AA->isMustAlias(CurrAddr, DomAddr))) {
876-
const bool CurrIsWrite =
877-
isa<StoreInst>(*CurrInst) ||
878-
(CurrII.Flags & InstructionInfo::kCompoundRW);
879-
const bool DomIsWrite = isa<StoreInst>(*DomInst) ||
880-
(DomII.Flags & InstructionInfo::kCompoundRW);
876+
auto isWriteOperation = [](const InstructionInfo &II) {
877+
return isa<StoreInst>(II.Inst) ||
878+
(II.Flags & InstructionInfo::kCompoundRW);
879+
};
880+
const bool CurrIsWrite = isWriteOperation(CurrII);
881+
const bool DomIsWrite = isWriteOperation(DomII);
881882

882883
// Check compatibility logic (DomInst covers CurrInst):
883884
// 1. If DomInst is a write, it covers both read and write of

0 commit comments

Comments
 (0)