https://llvm.org/bugs/show_bug.cgi?id=31929
Bug ID: 31929 Summary: branch condition should be known from llvm.assume Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Scalar Optimizations Assignee: unassignedb...@nondot.org Reporter: spatel+l...@rotateright.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Filing this based on the request in: https://reviews.llvm.org/D28204 These are purposely minimized to be instcombine tests. If we decide that the functionality doesn't belong there, then the tests may require additional instructions to thwart other transformations (phi -> select) and/or trigger from a different pass (LICM?). ----------------------------------------------------------------------------- declare void @llvm.assume(i1) define i8 @assume_guarantees_notnull(i8* %x) { entry: %notnull = icmp ne i8* %x, null tail call void @llvm.assume(i1 %notnull) br i1 %notnull, label %if, label %endif <--- condition is known true if: %ld = load i8, i8* %x br label %endif endif: %sel = phi i8 [ 0, %entry ], [ %ld, %if ] ret i8 %sel } Depending on how we want to solve this, it may be relevant to use a non-pointer value in the icmp: define i8 @assume_guarantees_notnull(i8 %y, i8* %x) { entry: %notnull = icmp ne i8 %y, 0 <--- type shouldn't matter? tail call void @llvm.assume(i1 %notnull) br i1 %notnull, label %if, label %endif if: %ld = load i8, i8* %x, align 1 br label %endif endif: %sel = phi i8 [ 0, %entry ], [ %ld, %if ] ret i8 %sel } ---------------------------------------------------------------------------- For reference, we handle the 'select' variant of these examples in instcombine by calling computeKnownBits when we know there might be an assumption that defines the condition. That was bug 31512 / https://reviews.llvm.org/rL291915 . -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs