[clang] [llvm] [WPD]: Apply speculative WPD in non-lto mode. (PR #145031)
Hassnaa Hamdi via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 03:06:00 PDT 2025
================
@@ -0,0 +1,130 @@
+; -stats requires asserts
+; REQUIRES: asserts
+
+; Check that we can still devirtualize outside LTO mode
+; Check that we skip devirtualization for empty functions outside LTO mode
+
+; RUN: opt -S -passes=wholeprogramdevirt -wholeprogramdevirt-nolto -pass-remarks=wholeprogramdevirt -stats %s 2>&1 | FileCheck %s
+
+target datalayout = "e-p:64:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK: remark: devirt-single.cc:30:32: single-impl: devirtualized a call to vf
+; CHECK: remark: devirt-single.cc:41:32: single-impl: devirtualized a call to vf
+; CHECK: remark: devirt-single.cc:51:32: single-impl: devirtualized a call to vf
+; CHECK: remark: devirt-single.cc:13:0: devirtualized vf
+; CHECK-NOT: devirtualized
+
+ at vt1 = constant [1 x ptr] [ptr @vf], !type !8
+ at vt2 = constant [1 x ptr] [ptr @vf_empty], !type !12
+
+define i1 @vf(ptr %this) #0 !dbg !7 {
+ ret i1 true
+}
+
+; This should NOT be devietualized because during non-lto empty functions
----------------
hassnaaHamdi wrote:
fixed
https://github.com/llvm/llvm-project/pull/145031
More information about the llvm-commits
mailing list