[PATCH] D96208: [AssumptionCache] Do not track llvm.assume calls (PR49043)

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 6 10:18:40 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG378f4e5ec26c: [AssumptionCache] Do not track llvm.assume calls (PR49043) (authored by jdoerfert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96208

Files:
  llvm/include/llvm/Analysis/AssumptionCache.h
  llvm/test/Transforms/GVNSink/assumption.ll


Index: llvm/test/Transforms/GVNSink/assumption.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/GVNSink/assumption.ll
@@ -0,0 +1,32 @@
+; RUN: opt < %s -S -passes="print<assumptions>,gvn-sink,loop-unroll" -unroll-count=3 | FileCheck %s
+;
+; This crashed because the cached assumption was replaced and the replacement
+; was then in the cache twice.
+;
+; PR49043
+
+ at g = external global i32
+
+define void @main() {
+bb:
+  %i1.i = load volatile i32, i32* @g
+  %i32.i = icmp eq i32 %i1.i, 0
+  call void @llvm.assume(i1 %i32.i) #3
+  br label %bb4.i
+
+bb4.i:                                            ; preds = %bb4.i, %bb
+  %i.i = load volatile i32, i32* @g
+  %i3.i = icmp eq i32 %i.i, 0
+  call void @llvm.assume(i1 %i3.i) #3
+  br label %bb4.i
+
+func_1.exit:                                      ; No predecessors!
+  unreachable
+}
+
+declare void @llvm.assume(i1)
+
+; CHECK:  call void @llvm.assume(
+; CHECK:  call void @llvm.assume(
+; CHECK:  call void @llvm.assume(
+
Index: llvm/include/llvm/Analysis/AssumptionCache.h
===================================================================
--- llvm/include/llvm/Analysis/AssumptionCache.h
+++ llvm/include/llvm/Analysis/AssumptionCache.h
@@ -45,7 +45,7 @@
   enum : unsigned { ExprResultIdx = std::numeric_limits<unsigned>::max() };
 
   struct ResultElem {
-    WeakTrackingVH Assume;
+    WeakVH Assume;
 
     /// contains either ExprResultIdx or the index of the operand bundle
     /// containing the knowledge.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96208.321950.patch
Type: text/x-patch
Size: 1543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210206/619721b4/attachment.bin>


More information about the llvm-commits mailing list