[llvm-bugs] [Bug 31882] New: print a remark when an llvm.assume has a false param
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 6 09:58:06 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31882
Bug ID: 31882
Summary: print a remark when an llvm.assume has a false param
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Filing this based on Daniel's example in:
https://reviews.llvm.org/D29404
declare void @llvm.assume(i1) nounwind
define i32 @assume_false(i32 %p) {
entry:
%cmp = icmp eq i32 %p, 42
call void @llvm.assume(i1 %cmp)
br i1 %cmp, label %bb2, label %bb3
bb2:
%cmp3 = icmp eq i32 %p, 43
call void @llvm.assume(i1 %cmp3)
ret i32 15
bb3:
ret i32 17
}
-----------------------------------------------------------------------
-instsimplify tells us that the 2nd icmp is false via isKnownNonEqual() which
calls computeKnownBits() which calls computeKnownBitsFromAssume():
$ ./opt -instsimplify badass.ll -S
...
declare void @llvm.assume(i1) #0
define i32 @assume_false(i32 %p) {
entry:
%cmp = icmp eq i32 %p, 42
call void @llvm.assume(i1 %cmp)
br i1 %cmp, label %bb2, label %bb3
bb2:
call void @llvm.assume(i1 false) <--- oops...alternative facts!
ret i32 15
bb3:
ret i32 17
}
--------------------------------------------------------------------------
As mentioned in D29404, we can't print a strong warning, but we can at least
print a weasel-worded remark because it's likely that either the program or the
compiler has a bug when a condition that was supposed to be true was proven
false.
--
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/20170206/01025fb8/attachment-0001.html>
More information about the llvm-bugs
mailing list