<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [SimplifyCFG] switch transform drops "unpredictable" metadata"
href="https://bugs.llvm.org/show_bug.cgi?id=43313">43313</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[SimplifyCFG] switch transform drops "unpredictable" metadata
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The branches in this IR are all marked unpredictable, but after 'opt
-simplifycfg', we have a switch instruction that is not marked unpredictable:
<a href="https://godbolt.org/z/neLzN3">https://godbolt.org/z/neLzN3</a>
define dso_local i64 @constant_time_lookup(i64 %0, i64* nocapture readonly %1)
local_unnamed_addr #0 {
%3 = icmp eq i64 %0, 0
br i1 %3, label %.thread, label %5, !unpredictable !2
.thread: ; preds = %2
%4 = load i64, i64* %1, align 8, !tbaa !3
br label %.thread30
5: ; preds = %2
%6 = icmp eq i64 %0, 1
br i1 %6, label %7, label %11, !unpredictable !2
7: ; preds = %5
%8 = getelementptr inbounds i64, i64* %1, i64 1
%9 = load i64, i64* %8, align 8, !tbaa !3
%10 = or i64 %9, 0
br label %.thread30
11: ; preds = %5
%12 = icmp eq i64 %0, 2
br i1 %12, label %13, label %17, !unpredictable !2
13: ; preds = %11
%14 = getelementptr inbounds i64, i64* %1, i64 2
%15 = load i64, i64* %14, align 8, !tbaa !3
%16 = or i64 %15, 0
br label %.thread30
17: ; preds = %11
%18 = icmp eq i64 %0, 3
br i1 %18, label %19, label %23, !unpredictable !2
19: ; preds = %17
%20 = getelementptr inbounds i64, i64* %1, i64 3
%21 = load i64, i64* %20, align 8, !tbaa !3
%22 = or i64 %21, 0
br label %.thread30
23: ; preds = %17
%24 = icmp eq i64 %0, 4
br i1 %24, label %25, label %29, !unpredictable !2
25: ; preds = %23
%26 = getelementptr inbounds i64, i64* %1, i64 4
%27 = load i64, i64* %26, align 8, !tbaa !3
%28 = or i64 %27, 0
br label %.thread30
29: ; preds = %23
%30 = icmp eq i64 %0, 5
br i1 %30, label %31, label %35, !unpredictable !2
31: ; preds = %29
%32 = getelementptr inbounds i64, i64* %1, i64 5
%33 = load i64, i64* %32, align 8, !tbaa !3
%34 = or i64 %33, 0
br label %.thread30
35: ; preds = %29
%36 = icmp eq i64 %0, 6
br i1 %36, label %37, label %41, !unpredictable !2
37: ; preds = %35
%38 = getelementptr inbounds i64, i64* %1, i64 6
%39 = load i64, i64* %38, align 8, !tbaa !3
%40 = or i64 %39, 0
br label %.thread30
41: ; preds = %35
%42 = icmp eq i64 %0, 7
br i1 %42, label %43, label %.thread30, !unpredictable !2
43: ; preds = %41
%44 = getelementptr inbounds i64, i64* %1, i64 7
%45 = load i64, i64* %44, align 8, !tbaa !3
%46 = or i64 %45, 0
br label %.thread30
.thread30: ; preds = %7, %.thread, %13,
%19, %25, %31, %37, %43, %41
%.1.7 = phi i64 [ %46, %43 ], [ 0, %41 ], [ %40, %37 ], [ %34, %31 ], [ %28,
%25 ], [ %22, %19 ], [ %16, %13 ], [ %4, %.thread ], [ %10, %7 ]
ret i64 %.1.7
}
attributes #0 = { norecurse nounwind readonly uwtable
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false"
"less-precise-fpmad"="false" "min-legal-vector-width"="0"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false"
"use-soft-float"="false" }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 8.0.0 (tags/RELEASE_800/final 356655)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"long", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>