-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly initialize opaque pointer mode in CodeGenAction
Explicitly call `LLVMContext::setOpaquePointers` in `CodeGenAction` before loading any IR files. With this we use the mode specified on the command-line rather than lazily initializing it based on the contents of the IR. This helps when using `-fthinlto-index` which may end up mixing files with typed and opaque pointer types which fails when the first file happened to use typed pointers since we cannot downgrade IR with opaque pointer types to typed pointer types. Differential Revision: https://reviews.llvm.org/D137475
- Loading branch information
Showing
4 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64--" | ||
|
||
define ptr @f2() { | ||
ret ptr null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; REQUIRES: x86-registered-target | ||
; Test that mixing bitcode file with opaque and typed pointers works. | ||
|
||
; RUN: mkdir -p %t | ||
; RUN: opt -module-summary -o %t/typed.bc %s | ||
; RUN: opt -module-summary -o %t/opaque.bc %S/Inputs/thinlto-opaque.ll | ||
; RUN: llvm-lto2 run -thinlto-distributed-indexes %t/typed.bc %t/opaque.bc \ | ||
; RUN: -o %t/native.o -r %t/typed.bc,main,plx -r %t/typed.bc,f2, \ | ||
; RUN: -r %t/opaque.bc,f2,p | ||
|
||
; RUN: %clang_cc1 -triple x86_64-- -emit-obj -o %t/native.o %t/typed.bc \ | ||
; RUN: -Wno-override-module \ | ||
; RUN: -fthinlto-index=%t/typed.bc.thinlto.bc | ||
|
||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64--" | ||
|
||
declare i8* @f2() | ||
|
||
define i32 @main() { | ||
call i8* @f2() | ||
ret i32 0 | ||
} |