[clang] Change placeholder from undef to poison#120446
Merged
Merged
Conversation
Call `insertvalue` with a `poison` operand instead of `undef`.
Member
|
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: Pedro Lobo (pedroclobo) ChangesCall Full diff: https://github.com/llvm/llvm-project/pull/120446.diff 2 Files Affected:
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index d587daac5a88a9..90651c3bafe26e 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -3454,7 +3454,7 @@ llvm::Value *MicrosoftCXXABI::EmitNonNullMemberPointerConversion(
if (inheritanceModelHasOnlyOneField(IsFunc, DstInheritance)) {
Dst = FirstField;
} else {
- Dst = llvm::UndefValue::get(ConvertMemberPointerType(DstTy));
+ Dst = llvm::PoisonValue::get(ConvertMemberPointerType(DstTy));
unsigned Idx = 0;
Dst = Builder.CreateInsertValue(Dst, FirstField, Idx++);
if (inheritanceModelHasNVOffsetField(IsFunc, DstInheritance))
diff --git a/clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp b/clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
index 2ac1961465d8a8..fc8a31e0350e5f 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
@@ -647,7 +647,7 @@ void (Multiple::*convertB2FuncToMultiple(void (B2::*mp)()))() {
// CHECK: br i1 %{{.*}} label %{{.*}}, label %{{.*}}
//
// memptr.convert: ; preds = %entry
-// CHECK: insertvalue { ptr, i32 } undef, ptr %[[mp]], 0
+// CHECK: insertvalue { ptr, i32 } poison, ptr %[[mp]], 0
// CHECK: insertvalue { ptr, i32 } %{{.*}}, i32 4, 1
// CHECK: br label
//
@@ -705,7 +705,7 @@ void (D::*convertCToD(void (C::*mp)()))() {
// CHECK: %[[nv_adj:.*]] = select i1 %[[is_nvbase]], i32 %[[nv_disp]], i32 0
// CHECK: %[[dst_adj:.*]] = select i1 %[[is_nvbase]], i32 4, i32 0
// CHECK: %[[adj:.*]] = sub nsw i32 %[[nv_adj]], %[[dst_adj]]
-// CHECK: insertvalue { ptr, i32, i32 } undef, ptr {{.*}}, 0
+// CHECK: insertvalue { ptr, i32, i32 } poison, ptr {{.*}}, 0
// CHECK: insertvalue { ptr, i32, i32 } {{.*}}, i32 %[[adj]], 1
// CHECK: insertvalue { ptr, i32, i32 } {{.*}}, i32 {{.*}}, 2
// CHECK: br label
|
Member
Author
|
cc @nunoplopes |
This was referenced Jun 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Call
insertvaluewith apoisonoperand instead ofundef.