Skip to content

[LVI] Remove unused get of Range metadata. #94914

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

Merged
merged 1 commit into from
Jun 10, 2024
Merged

Conversation

andjo403
Copy link
Contributor

@andjo403 andjo403 commented Jun 9, 2024

There is no test for this code and it also do not change the result of https://github.com/dtcxzyw/llvm-opt-benchmark when I run it locally.
I have not been able to make a test for this and do not know how to handle the range attribute for this so maybe it shall be removed?

CC @nikic

@andjo403 andjo403 requested a review from nikic as a code owner June 9, 2024 20:48
@llvmbot
Copy link
Member

llvmbot commented Jun 9, 2024

@llvm/pr-subscribers-llvm-analysis

Author: Andreas Jonson (andjo403)

Changes

There is no test for this code and it also do not change the result of https://github.com/dtcxzyw/llvm-opt-benchmark when I run it locally.
I have not been able to make a test for this and do not know how to handle the range attribute for this so maybe it shall be removed?

CC @nikic


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

1 Files Affected:

  • (modified) llvm/lib/Analysis/LazyValueInfo.cpp (-3)
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 6cded828c25f4..8b6e56ce8113d 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -1116,9 +1116,6 @@ LazyValueInfoImpl::getValueFromSimpleICmpCondition(CmpInst::Predicate Pred,
     if (!R)
       return std::nullopt;
     RHSRange = toConstantRange(*R, RHS->getType());
-  } else if (Instruction *I = dyn_cast<Instruction>(RHS)) {
-    if (auto *Ranges = I->getMetadata(LLVMContext::MD_range))
-      RHSRange = getConstantRangeFromMetadata(*Ranges);
   }
 
   ConstantRange TrueValues =

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM. This code predates the ability to use getBlockValue() when reasoning about conditions. It could theoretically still be useful for the cases that currently pass UseBlockValue=false, but these are also less important, and this is a pretty weird special case.

@nikic nikic merged commit dabd634 into llvm:main Jun 10, 2024
9 checks passed
@andjo403 andjo403 deleted the LviRangeRemove branch June 10, 2024 15:44
@HerrCai0907 HerrCai0907 mentioned this pull request Jun 13, 2024
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