Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

Avoid the use of undef given it should be going away eventually and is not reccomended for new use. To remove it we either use function arguments or pass in a personality function declaration where relevant.

Avoid the use of undef given it should be going away eventually and is
not reccomended for new use. To remove it we either use function
arguments or pass in a personality function declaration where relevant.
@llvmbot
Copy link
Member

llvmbot commented Dec 1, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Aiden Grossman (boomanaiden154)

Changes

Avoid the use of undef given it should be going away eventually and is not reccomended for new use. To remove it we either use function arguments or pass in a personality function declaration where relevant.


Full diff: https://github.com/llvm/llvm-project/pull/170179.diff

4 Files Affected:

  • (modified) llvm/test/Transforms/WholeProgramDevirt/calls-to-devirt.ll (+2-2)
  • (modified) llvm/test/Transforms/WholeProgramDevirt/import-indir.ll (+2-2)
  • (modified) llvm/test/Transforms/WholeProgramDevirt/import.ll (+3-3)
  • (modified) llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll (+2-1)
diff --git a/llvm/test/Transforms/WholeProgramDevirt/calls-to-devirt.ll b/llvm/test/Transforms/WholeProgramDevirt/calls-to-devirt.ll
index c6945662690c7..3af72a1efca36 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/calls-to-devirt.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/calls-to-devirt.ll
@@ -41,7 +41,7 @@ define i32 @call1(ptr %obj) #0 {
   ret i32 %result
 }
 
-define i1 @call2(ptr %obj) #0 {
+define i1 @call2(ptr %obj, i32 %arg1) #0 {
   %vtable = load ptr, ptr %obj
   %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 8, metadata !"typeid2")
   %fptr = extractvalue {ptr, i1} %pair, 0
@@ -49,7 +49,7 @@ define i1 @call2(ptr %obj) #0 {
   br i1 %p, label %cont, label %trap
 
 cont:
-  %result = call i1 %fptr(ptr %obj, i32 undef)
+  %result = call i1 %fptr(ptr %obj, i32 %arg1)
   ret i1 %result
 
 trap:
diff --git a/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll b/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
index e4d6f1d52b540..2c33059b6e126 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
@@ -92,7 +92,7 @@ define i1 @f1(ptr %obj) {
 }
 
 ; CHECK: define i1 @f2
-define i1 @f2(ptr %obj) {
+define i1 @f2(ptr %obj, i32 %arg1) {
   %vtable = load ptr, ptr %obj
   %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 4, metadata !"typeid1")
   %fptr = extractvalue {ptr, i1} %pair, 0
@@ -103,7 +103,7 @@ define i1 @f2(ptr %obj) {
 
 cont:
   ; CHECK: call i1 %
-  %result = call i1 %fptr(ptr %obj, i32 undef)
+  %result = call i1 %fptr(ptr %obj, i32 %arg1)
   ret i1 %result
 
 trap:
diff --git a/llvm/test/Transforms/WholeProgramDevirt/import.ll b/llvm/test/Transforms/WholeProgramDevirt/import.ll
index 4e4df5f35a777..812ffbdf7f3fb 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/import.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/import.ll
@@ -40,7 +40,7 @@ define i32 @call1(ptr %obj) #0 {
 ; constant propagation.
 
 ; CHECK: define i1 @call2
-define i1 @call2(ptr %obj) #0 {
+define i1 @call2(ptr %obj, i32 %arg1) #0 {
   %vtable = load ptr, ptr %obj
   %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 8, metadata !"typeid2")
   %fptr = extractvalue {ptr, i1} %pair, 0
@@ -51,8 +51,8 @@ define i1 @call2(ptr %obj) #0 {
 cont:
   ; SINGLE-IMPL: call i1 @singleimpl2
   ; INDIR: call i1 %
-  ; BRANCH-FUNNEL: call i1 @__typeid_typeid2_8_branch_funnel(ptr nest %vtable, ptr %obj, i32 undef)
-  %result = call i1 %fptr(ptr %obj, i32 undef)
+  ; BRANCH-FUNNEL: call i1 @__typeid_typeid2_8_branch_funnel(ptr nest %vtable, ptr %obj, i32 %arg1)
+  %result = call i1 %fptr(ptr %obj, i32 %arg1)
   ret i1 %result
 
 trap:
diff --git a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
index 88d539294777e..ca42368330fcf 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
@@ -15,7 +15,7 @@ define i32 @vf2(ptr %this) readnone {
 }
 
 ; CHECK: define i32 @call
-define i32 @call(ptr %obj) personality ptr undef {
+define i32 @call(ptr %obj) personality ptr @__gxx_personality_v0 {
   %vtable = load ptr, ptr %obj
   %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
@@ -35,5 +35,6 @@ ret:
 
 declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
+declare i32 @__gxx_personality_v0(...)
 
 !0 = !{i32 0, !"typeid"}

Copy link
Contributor

@teresajohnson teresajohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@boomanaiden154 boomanaiden154 merged commit 00276b6 into llvm:main Dec 1, 2025
12 checks passed
@boomanaiden154 boomanaiden154 deleted the wpd-no-undef branch December 1, 2025 19:34
kcloudy0717 pushed a commit to kcloudy0717/llvm-project that referenced this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants