[llvm-bugs] [Bug 47378] New: Assertion `(LocalChanged || (RefHash == StructuralHash(F))) && "Pass modifies its input and doesn't report it."' for -gvn pass

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 1 00:49:55 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47378

            Bug ID: 47378
           Summary: Assertion `(LocalChanged || (RefHash ==
                    StructuralHash(F))) && "Pass modifies its input and
                    doesn't report it."' for -gvn pass
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: david.stenberg at ericsson.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 23910
  --> https://bugs.llvm.org/attachment.cgi?id=23910&action=edit
IR reproducer.

LLVM commit: 113861b444610aebd1c05760a3e0ee6284f42211

Requires an expensive checks build to reproduce.

$ opt -S -gvn gvn.ll
Pass modifies its input and doesn't report it: Global Value Numbering
Pass modifies its input and doesn't report it
UNREACHABLE executed at ../lib/IR/LegacyPassManager.cpp:1525!

Code change that the pass produces without the assertion enabled:

@@ -15,6 +18,7 @@
   %2 = load i16, i16* @b, align 1
   %inc = add nsw i16 %2, 1
   store i16 %inc, i16* @b, align 1
+  %.pre = trunc i32 %0 to i16
   br label %if.end

 if.else:                                          ; preds = %entry
@@ -23,10 +27,10 @@
   br label %if.end

 if.end:                                           ; preds = %if.else, %if.then
-  %3 = trunc i32 %0 to i16
-  %arrayidx = getelementptr inbounds [1 x i16], [1 x i16]* @c, i16 0, i16 %3
-  %4 = load i16, i16* %arrayidx, align 1
-  store i16 %4, i16* @b, align 1
+  %.pre-phi = phi i16 [ %conv, %if.else ], [ %.pre, %if.then ]
+  %arrayidx = getelementptr inbounds [1 x i16], [1 x i16]* @c, i16 0, i16
%.pre-phi
+  %3 = load i16, i16* %arrayidx, align 1
+  store i16 %3, i16* @b, align 1
   ret i16 undef
 }@@ -15,6 +18,7 @@
   %2 = load i16, i16* @b, align 1
   %inc = add nsw i16 %2, 1
   store i16 %inc, i16* @b, align 1
+  %.pre = trunc i32 %0 to i16
   br label %if.end

 if.else:                                          ; preds = %entry
@@ -23,10 +27,10 @@
   br label %if.end

 if.end:                                           ; preds = %if.else, %if.then
-  %3 = trunc i32 %0 to i16
-  %arrayidx = getelementptr inbounds [1 x i16], [1 x i16]* @c, i16 0, i16 %3
-  %4 = load i16, i16* %arrayidx, align 1
-  store i16 %4, i16* @b, align 1
+  %.pre-phi = phi i16 [ %conv, %if.else ], [ %.pre, %if.then ]
+  %arrayidx = getelementptr inbounds [1 x i16], [1 x i16]* @c, i16 0, i16
%.pre-phi
+  %3 = load i16, i16* %arrayidx, align 1
+  store i16 %3, i16* @b, align 1
   ret i16 undef
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200901/ea99e7a3/attachment.html>


More information about the llvm-bugs mailing list