[PATCH] D75201: [ThinLTO/LowerTypeTests] Handle unpromoted local type ids
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 09:33:17 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG873c0d0786dc: [ThinLTO/LowerTypeTests] Handle unpromoted local type ids (authored by tejohnson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75201/new/
https://reviews.llvm.org/D75201
Files:
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
Index: llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
===================================================================
--- llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
+++ llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
@@ -33,6 +33,8 @@
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-grtev4-linux-gnu"
+ at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @g, i8* null }]
+
%struct.D = type { i32 (...)** }
@_ZTV1D = internal constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
@@ -57,6 +59,23 @@
; CHECK-IR-LABEL: ret i32
; CHECK-IR-LABEL: }
+; Function Attrs: inlinehint nounwind uwtable
+define internal void @_ZN1DC2Ev(%struct.D* %this) unnamed_addr align 2 {
+entry:
+ %this.addr = alloca %struct.D*, align 8
+ store %struct.D* %this, %struct.D** %this.addr, align 8
+ %this1 = load %struct.D*, %struct.D** %this.addr
+ %0 = bitcast %struct.D* %this1 to i32 (...)***
+ store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTV1D, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+ ret void
+}
+
+define internal void @g() section ".text.startup" {
+ %d = alloca %struct.D, align 8
+ call void @_ZN1DC2Ev(%struct.D* %d)
+ ret void
+}
+
declare i1 @llvm.type.test(i8*, metadata)
declare void @llvm.assume(i1)
Index: llvm/lib/Transforms/IPO/LowerTypeTests.cpp
===================================================================
--- llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1040,9 +1040,11 @@
report_fatal_error("Second argument of llvm.type.test must be metadata");
auto TypeIdStr = dyn_cast<MDString>(TypeIdMDVal->getMetadata());
+ // If this is a local unpromoted type, which doesn't have a metadata string,
+ // treat as Unknown and delay lowering, so that we can still utilize it for
+ // later optimizations.
if (!TypeIdStr)
- report_fatal_error(
- "Second argument of llvm.type.test must be a metadata string");
+ return;
TypeIdLowering TIL = importTypeId(TypeIdStr->getString());
Value *Lowered = lowerTypeTestCall(TypeIdStr, CI, TIL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75201.247678.patch
Type: text/x-patch
Size: 2342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200302/8735c545/attachment.bin>
More information about the llvm-commits
mailing list