[llvm] [NFC][WPD] Add constant propagation tests checking relative vtables (PR #138989)
Paul Kirth via llvm-commits
llvm-commits at lists.llvm.org
Wed May 7 18:02:04 PDT 2025
================
@@ -0,0 +1,284 @@
+; RUN: opt -S -passes=wholeprogramdevirt -whole-program-visibility %s | FileCheck %s
+
+;; This target uses 32-bit sized and aligned pointers.
+target datalayout = "e-p:32:32"
+
+;; Constant propagation should be agnostic towards sections.
+;; Also the new global should be in the original vtable's section.
+; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [8 x i8], [3 x ptr], [0 x i8] } { [8 x i8] c"\00\00\01\00\00\00\03\00", [3 x ptr] [ptr @vf0i1, ptr @vf1i8, ptr @vf1i32], [0 x i8] zeroinitializer }, section "vt1sec", !type [[T8:![0-9]+]]
+ at vt1 = constant [3 x ptr] [
+ptr @vf0i1,
+ptr @vf1i8,
+ptr @vf1i32
+], section "vt1sec", !type !0
+
+;; This represents a normal vtable using the default ABI alignments.
+;; For this test, the pointers are 32-bit aligned.
----------------
ilovepi wrote:
What property are you testing? Will the test be brittle, due to changes in the textual IR format? Splitting the individual aspects you're checking w/ CHECK-SAME may make it easier to follow what's being tested.
Ditto for the other checks.
https://github.com/llvm/llvm-project/pull/138989
More information about the llvm-commits
mailing list