[PATCH] D50861: [AST] Mark invariant.starts as being readonly

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 17:56:34 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL340245: [AST] Mark invariant.starts as being readonly (authored by reames, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50861?vs=161100&id=161627#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50861

Files:
  llvm/trunk/lib/Analysis/AliasSetTracker.cpp
  llvm/trunk/test/Transforms/LICM/invariant.start.ll


Index: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
===================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp
@@ -174,7 +174,8 @@
   // but don't actually modify any specific memory location.
   using namespace PatternMatch;
   bool MayWriteMemory = I->mayWriteToMemory() &&
-                        !match(I, m_Intrinsic<Intrinsic::experimental_guard>());
+    !match(I, m_Intrinsic<Intrinsic::experimental_guard>()) &&
+    !(I->use_empty() && match(I, m_Intrinsic<Intrinsic::invariant_start>()));
   if (!MayWriteMemory) {
     Alias = SetMayAlias;
     Access |= RefAccess;
Index: llvm/trunk/test/Transforms/LICM/invariant.start.ll
===================================================================
--- llvm/trunk/test/Transforms/LICM/invariant.start.ll
+++ llvm/trunk/test/Transforms/LICM/invariant.start.ll
@@ -7,9 +7,9 @@
 define void @test1(i1 %cond, i32* %ptr) {
 ; CHECK-LABEL: @test1(
 ; CHECK-LABEL: entry:
+; CHECK: %val = load i32, i32* %ptr
 ; CHECK-LABEL: loop:
 ; CHECK: call {}* @llvm.invariant.start.p0i32(i64 4, i32* %ptr)
-; CHECK: %val = load i32, i32* %ptr
 
 ; ALIAS-N2-LABEL: @test1(
 ; ALIAS-N2-LABEL: entry:
@@ -28,14 +28,14 @@
   br label %loop
 }
 
-;; TODO: By default, despite the loop varying invariant.start, we should be
+;; despite the loop varying invariant.start, we should be
 ;; able to hoist the load
 define void @test2(i1 %cond, i32* %ptr) {
 ; CHECK-LABEL: @test2(
 ; CHECK-LABEL: entry:
+; CHECK: %val = load i32, i32* %ptr
 ; CHECK-LABEL: loop:
 ; CHECK: call {}* @llvm.invariant.start.p0i32(i64 4, i32* %piv)
-; CHECK: %val = load i32, i32* %ptr
 
 ; ALIAS-N2-LABEL: @test2(
 ; ALIAS-N2-LABEL: entry:
@@ -54,13 +54,12 @@
   br label %loop
 }
 
-; By default, should be able to hoist since store doesn't alias
 define void @test3(i1 %cond, i32* %ptr) {
 ; CHECK-LABEL: @test3(
 ; CHECK-LABEL: entry:
+; CHECK: %val = load i32, i32* %ptr
 ; CHECK-LABEL: loop:
 ; CHECK: call {}* @llvm.invariant.start.p0i32(i64 4, i32* %ptr)
-; CHECK: %val = load i32, i32* %ptr
 
 ; ALIAS-N2-LABEL: @test3(
 ; ALIAS-N2-LABEL: entry:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50861.161627.patch
Type: text/x-patch
Size: 2167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180821/7c010937/attachment.bin>


More information about the llvm-commits mailing list