[PATCH] D119818: [MemoryDepndency] Relax the re-ordering with volatile store.

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 19:56:22 PST 2022


skatkov updated this revision to Diff 409132.
skatkov added a comment.

Handled comments. Will land soon.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119818/new/

https://reviews.llvm.org/D119818

Files:
  llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
  llvm/test/Analysis/MemoryDependenceAnalysis/reorder-volatile.ll


Index: llvm/test/Analysis/MemoryDependenceAnalysis/reorder-volatile.ll
===================================================================
--- llvm/test/Analysis/MemoryDependenceAnalysis/reorder-volatile.ll
+++ llvm/test/Analysis/MemoryDependenceAnalysis/reorder-volatile.ll
@@ -53,11 +53,8 @@
 
 define i32 @test_store(i32 %x) {
 ; CHECK-LABEL: @test_store(
-; CHECK-NEXT:    [[L1:%.*]] = load atomic i32, i32* @w unordered, align 4
 ; CHECK-NEXT:    store volatile i32 [[X:%.*]], i32* @u, align 4
-; CHECK-NEXT:    [[L2:%.*]] = load atomic i32, i32* @w unordered, align 4
-; CHECK-NEXT:    [[RES:%.*]] = sub i32 [[L1]], [[L2]]
-; CHECK-NEXT:    ret i32 [[RES]]
+; CHECK-NEXT:    ret i32 0
 ;
   %l1 = load atomic i32, i32* @w unordered, align 4
   store volatile i32 %x, i32* @u, align 4
Index: llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -556,13 +556,11 @@
           return MemDepResult::getClobber(SI);
       }
 
-      // FIXME: this is overly conservative.
       // While volatile access cannot be eliminated, they do not have to clobber
       // non-aliasing locations, as normal accesses can for example be reordered
       // with volatile accesses.
       if (SI->isVolatile())
-        if (!QueryInst || isNonSimpleLoadOrStore(QueryInst) ||
-            isOtherMemAccess(QueryInst))
+        if (!QueryInst || QueryInst->isVolatile())
           return MemDepResult::getClobber(SI);
 
       // If alias analysis can tell that this store is guaranteed to not modify


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119818.409132.patch
Type: text/x-patch
Size: 1657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/3e020bca/attachment-0001.bin>


More information about the llvm-commits mailing list