[llvm-bugs] [Bug 37745] New: JumpThreading create instruction that reference its own value

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 8 02:50:12 PDT 2018


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

            Bug ID: 37745
           Summary: JumpThreading create instruction that reference its
                    own value
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: karl-johan.karlsson at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20412
  --> https://bugs.llvm.org/attachment.cgi?id=20412&action=edit
Reproducer: opt -jump-threading -verify-each -S -mtriple=x86_64--

$ ./opt -jump-threading -verify-each -S -mtriple=x86_64-- -o -
./jumpthreading.ll -print-after-all -print-before-all
*** IR Dump Before Jump Threading ***
define void @f1() {
entry:
  br i1 false, label %lbl1, label %if.end

lbl1:                                             ; preds = %if.end, %entry
  %p1.addr.0 = phi i16 [ undef, %entry ], [ %inc, %if.end ]
  br label %if.end

if.end:                                           ; preds = %lbl1, %entry
  %p1.addr.1 = phi i16 [ %p1.addr.0, %lbl1 ], [ undef, %entry ]
  %inc = add nsw i16 %p1.addr.1, 1
  %tobool = icmp ne i16 %inc, 0
  br i1 %tobool, label %if.end4, label %lbl1

if.end4:                                          ; preds = %if.end
  ret void
}
*** IR Dump After Jump Threading ***
define void @f1() {
if.end:
  %inc = add nsw i16 undef, 1
  %tobool = icmp ne i16 %inc, 0
  br i1 %tobool, label %if.end4, label %if.end.thread

if.end.thread:                                    ; preds = %if.end
  %inc1 = add nsw i16 %inc1, 1
  br label %if.end4

if.end4:                                          ; preds = %if.end.thread,
%if.end
  ret void
}
*** IR Dump Before Module Verifier ***
define void @f1() {
if.end:
  %inc = add nsw i16 undef, 1
  %tobool = icmp ne i16 %inc, 0
  br i1 %tobool, label %if.end4, label %if.end.thread

if.end.thread:                                    ; preds = %if.end
  %inc1 = add nsw i16 %inc1, 1
  br label %if.end4

if.end4:                                          ; preds = %if.end.thread,
%if.end
  ret void
}
Only PHI nodes may reference their own value!
  %inc1 = add nsw i16 %inc1, 1
LLVM ERROR: Broken function found, compilation aborted!

-- 
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/20180608/7393c5ea/attachment.html>


More information about the llvm-bugs mailing list