Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LSR] If there still has some uses of the value, do not set the value #84777

Closed

Conversation

coderchenlin
Copy link
Contributor

with nullpter.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 11, 2024

@llvm/pr-subscribers-llvm-transforms

Author: CL (coderchenlin)

Changes

with nullpter.


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/Local.cpp (+2-2)
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index d3bb89075015e9..2f97de6bb046e4 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -588,10 +588,10 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(
     // dead as we go.
     for (Use &OpU : I->operands()) {
       Value *OpV = OpU.get();
-      OpU.set(nullptr);
-
       if (!OpV->use_empty())
         continue;
+      
+      OpU.set(nullptr);
 
       // If the operand is an instruction that became dead as we nulled out the
       // operand, and if it is 'trivially' dead, delete it in a future loop

Copy link

github-actions bot commented Mar 11, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 8d61f82bd3676bc541edfad1014e3ed599cc1390 52be592989ad8924551625fc3a2ec5465143c446 -- llvm/lib/Transforms/Utils/Local.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 2f97de6bb0..e2615dacc0 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -590,7 +590,7 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(
       Value *OpV = OpU.get();
       if (!OpV->use_empty())
         continue;
-      
+
       OpU.set(nullptr);
 
       // If the operand is an instruction that became dead as we nulled out the

@coderchenlin coderchenlin force-pushed the coderchenlin-fix-delete-dead-phis branch from 829b7dd to 52be592 Compare March 12, 2024 01:06
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.

None yet

2 participants