[llvm-bugs] [Bug 48472] New: LowerConstantIntrinsics pass thinks address of global is constant
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Thu Dec 10 06:12:51 PST 2020
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=48472
            Bug ID: 48472
           Summary: LowerConstantIntrinsics pass thinks address of global
                    is constant
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: john.brawn at arm.com
                CC: llvm-bugs at lists.llvm.org
If llc is given the following input:
  @x = global i8 0, align 1
  define i32 @example() {
  entry:
    %0 = call i1 @llvm.is.constant.i32(i32 ptrtoint (i8* @x to i32))
    %1 = zext i1 %0 to i32
    ret i32 %1
  }
  declare i1 @llvm.is.constant.i32(i32)
then LowerConstantIntrinsics will optimise this to "ret i32 1". It shouldn't be
doing this as the argument is an address of a global and LangRef says:
  In particular, note that if the argument is a constant expression which
refers to a global (the address of which _is_ a constant, but not manifest
during the compile), then the intrinsic evaluates to 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/20201210/67f53f78/attachment.html>
    
    
More information about the llvm-bugs
mailing list