1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
Michael Zolotukhin 2e643205bc [JumpThreading] Don't try to rewrite a use if it's already valid.
Summary:
When recording uses we need to rewrite after cloning a loop we need to
check if the use is not dominated by the original def. The initial
assumption was that the cloned basic block will introduce a new path and
thus the original def will only dominate the use if they are in the same
BB, but as the reproducer from PR37745 shows it's not always the case.

This fixes PR37745.

Reviewers: haicheng, Ka-Ka

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D48111

llvm-svn: 335675
2018-06-26 22:19:48 +00:00

20 lines
348 B
LLVM

; RUN: opt -jump-threading -verify-each -S -mtriple=x86_64-- -o - %s
define void @foo() {
entry:
br i1 false, label %A, label %B
A:
%x = phi i32 [ undef, %entry ], [ %z, %B ]
br label %B
B:
%y = phi i32 [ undef, %entry ], [ %x, %A ]
%z = add i32 %y, 1
%cmp = icmp ne i32 %z, 0
br i1 %cmp, label %exit, label %A
exit:
ret void
}