[PATCH] D137475: Explicitly initialize opaque pointer mode in CodeGenAction
Matthias Braun via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 7 12:49:20 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcafe50daf525: Explicitly initialize opaque pointer mode in CodeGenAction (authored by MatzeB).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137475/new/
https://reviews.llvm.org/D137475
Files:
clang/lib/CodeGen/CodeGenAction.cpp
clang/test/CodeGen/Inputs/thinlto-opaque.ll
clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
clang/test/CodeGen/thinlto-opaque-typed-mix.ll
Index: clang/test/CodeGen/thinlto-opaque-typed-mix.ll
===================================================================
--- /dev/null
+++ clang/test/CodeGen/thinlto-opaque-typed-mix.ll
@@ -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
+}
Index: clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
===================================================================
--- clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
+++ clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
@@ -100,7 +100,7 @@
; CHECK-IR: br i1 {{.*}}, label %trap
; We still have to call it as virtual.
- ; CHECK-IR: %call3 = tail call i32 %7
+ ; CHECK-IR: %call3 = tail call i32 {{%[0-9]+}}
%call3 = tail call i32 %8(%struct.A* nonnull %obj, i32 %call)
ret i32 %call3
}
Index: clang/test/CodeGen/Inputs/thinlto-opaque.ll
===================================================================
--- /dev/null
+++ clang/test/CodeGen/Inputs/thinlto-opaque.ll
@@ -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
+}
Index: clang/lib/CodeGen/CodeGenAction.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -1102,6 +1102,8 @@
CompilerInstance &CI = getCompilerInstance();
SourceManager &SM = CI.getSourceManager();
+ VMContext->setOpaquePointers(CI.getCodeGenOpts().OpaquePointers);
+
// For ThinLTO backend invocations, ensure that the context
// merges types based on ODR identifiers. We also need to read
// the correct module out of a multi-module bitcode file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137475.473757.patch
Type: text/x-patch
Size: 2446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221107/e2887343/attachment.bin>
More information about the cfe-commits
mailing list