Repository navigation
InlineEntryPointsPass: ignore null pointers when checking for generic AS - #1676
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request avoids converting null pointer address space casts into instructions in BitcastUtils.cpp and ignores null pointer constants when checking for generic address spaces in InlineEntryPointsPass.cpp. The review feedback suggests using Constant::getNullValue to simplify the null pointer retrieval and avoid an explicit cast.
Comment on lines
+898
to
+899
| I->setOperand(OperandId, ConstantPointerNull::get( | ||
| cast<PointerType>(CstExpr->getType()))); |
There was a problem hiding this comment.
dneto0
requested changes
Oct 15, 2026
dneto0
left a comment
Collaborator
There was a problem hiding this comment.
Code LGTM. I'd like a test as well.
Clang materializes non-generic null pointers via an addrspacecast from generic address space (addrspacecast (ptr addrspace(4) null to ptr)). When RemoveCstExprFromFunction expanded this constant expression, InlineEntryPointsPass::RequiresInlining saw the generic ConstantPointerNull operand and falsely triggered exhaustive inlining of the entire module even when generic address space was not used. Fold addrspacecast of ConstantPointerNull to ConstantPointerNull in the destination address space in RemoveCstExprFromFunction, and ignore ConstantPointerNull operands in RequiresInlining.
rjodinchr
force-pushed
the
ineline-entryptrs-generic-as
branch
from
October 16, 2026 07:15
f3aa841 to
76d70a2
Compare
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.
Clang materializes non-generic null pointers via an addrspacecast from generic address space (addrspacecast (ptr addrspace(4) null to ptr)). When RemoveCstExprFromFunction expanded this constant expression, InlineEntryPointsPass::RequiresInlining saw the generic ConstantPointerNull operand and falsely triggered exhaustive inlining of the entire module even when generic address space was not used.
Fold addrspacecast of ConstantPointerNull to ConstantPointerNull in the destination address space in RemoveCstExprFromFunction, and ignore ConstantPointerNull operands in RequiresInlining.