[SimplifyCFG] Refine metadata handling during instruction hoisting#158448
Merged
[SimplifyCFG] Refine metadata handling during instruction hoisting#158448
Conversation
Member
|
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-llvm-transforms Author: William Moses (wsmoses) ChangesFull diff: https://github.com/llvm/llvm-project/pull/158448.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 5a842f9b49c1b..6d6e32d51b62e 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3387,11 +3387,13 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
// Metadata can be dependent on the condition we are hoisting above.
// Strip all UB-implying metadata on the instruction. Drop the debug loc
// to avoid making it appear as if the condition is a constant, which would
- // be misleading while debugging.
+ // be misleading while debugging. However, make sure to keep debug info
+ // for calls as inlinable function calls in a function with debug info must
+ // have a !dbg location.
// Similarly strip attributes that maybe dependent on condition we are
// hoisting above.
for (auto &I : make_early_inc_range(*ThenBB)) {
- if (!SpeculatedStoreValue || &I != SpeculatedStore) {
+ if (!SpeculatedStoreValue || &I != SpeculatedStore && !isa<CallBase>(&I)) {
I.setDebugLoc(DebugLoc::getDropped());
}
I.dropUBImplyingAttrsAndMetadata();
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
wsmoses
added a commit
to wsmoses/llvm-project
that referenced
this pull request
Sep 13, 2025
wsmoses
added a commit
to wsmoses/llvm-project
that referenced
this pull request
Sep 13, 2025
Member
Author
|
Yeah, though I'm a bit unsure how to set one up for this part of the pass |
Member
Author
|
@fhahn okay figured it out, can you give it a review? |
nikic
reviewed
Sep 14, 2025
nikic
approved these changes
Sep 14, 2025
…ating-call.ll Co-authored-by: Nikita Popov <npopov@redhat.com>
giordano
pushed a commit
to JuliaLang/llvm-project
that referenced
this pull request
Sep 15, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
giordano
pushed a commit
to JuliaLang/llvm-project
that referenced
this pull request
Sep 15, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
wsmoses
added a commit
to wsmoses/llvm-project
that referenced
this pull request
Sep 15, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
giordano
pushed a commit
to JuliaLang/llvm-project
that referenced
this pull request
Sep 15, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
Zentrik
pushed a commit
to JuliaLang/llvm-project
that referenced
this pull request
Sep 29, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
yuyichao
pushed a commit
to yuyichao/llvm-project
that referenced
this pull request
Nov 7, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
yuyichao
pushed a commit
to yuyichao/llvm-project
that referenced
this pull request
Dec 4, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
yuyichao
pushed a commit
to yuyichao/llvm-project
that referenced
this pull request
Dec 29, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
yuyichao
pushed a commit
to yuyichao/llvm-project
that referenced
this pull request
Dec 29, 2025
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
giordano
pushed a commit
to JuliaLang/llvm-project
that referenced
this pull request
Mar 9, 2026
…lvm#158448) Co-authored-by: Nikita Popov <npopov@redhat.com> (cherry picked from commit c44e015)
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.
No description provided.