[llvm-bugs] [Bug 25068] New: Failure to remove redundant assume given alignment on call

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 5 17:40:52 PDT 2015


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

            Bug ID: 25068
           Summary: Failure to remove redundant assume given alignment on
                    call
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: listmail at philipreames.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This assume in the following test case should be removable.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare align 8 i8* @get()

; Function Attrs: nounwind
declare void @llvm.assume(i1) #0

define void @test() {
  %p = tail call align 8 i8* @get()
  %ptrint = ptrtoint i8* %p to i64
  %maskedptr = and i64 %ptrint, 7
  %maskcond = icmp eq i64 %maskedptr, 0
  tail call void @llvm.assume(i1 %maskcond)
  ret void
}

I believe the problem is that ValueTracking hasn't been taught that the low
bits of an aligned pointer result are known to be zero.  

Note that this example is particularly problematic since the inliner will
*introduce* @llvm.assume calls with this pattern.  I haven't caught it
producing something quite this trivial, but I have seen cases where the IR
simplifies to something this simple.

-- 
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/20151006/28a36db7/attachment-0001.html>


More information about the llvm-bugs mailing list