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

            Bug ID: 44501
           Summary: bblockaddress does not work correctly with program
                    address spaces
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Core LLVM classes
          Assignee: unassignedb...@nondot.org
          Reporter: matthew.arsena...@amd.com
                CC: arichardson....@gmail.com, llvm-bugs@lists.llvm.org

This program should fail the verifier, as the blockaddress pointer type does
not match the function's address space.

target datalayout = "e-p:64:64-p1:32:32-P1"

define i32 @label_size(i64 %idx) addrspace(1) {
entry:
  %int = ptrtoint i8* blockaddress(@label_size, %bb) to i32
  br label %bb

bb:
  ret i32 %int
}

If you do use the correct pointer type, the parser fails on it:
define i32 @label_size(i64 %idx) addrspace(1) {
entry:
  %int = ptrtoint i8 addrspace(1)* blockaddress(@label_size, %bb) to i32
  br label %bb

bb:
  ret i32 %int
}

gives "error: constant expression type mismatch"

Additionally, DataLayout::getTypeSizeInBits does not account for the program
address space when checking for the size of labels.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to