Skip to content

IndVarSimplify: strip redundant getDataLayout (NFC) #125546

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
Feb 3, 2025

Conversation

artagnon
Copy link
Contributor

@artagnon artagnon commented Feb 3, 2025

DataLayout is already available as a member variable.

DataLayout is already available as a member variable.
@llvmbot
Copy link
Member

llvmbot commented Feb 3, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

Changes

DataLayout is already available as a member variable.


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/IndVarSimplify.cpp (-3)
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index bfd618ccdd3795e..9619dfdbf412317 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1460,7 +1460,6 @@ bool IndVarSimplify::canonicalizeExitCondition(Loop *L) {
     if (!match(LHS, m_ZExt(m_Value(LHSOp))) || !ICmp->isSigned())
       continue;
 
-    const DataLayout &DL = ExitingBB->getDataLayout();
     const unsigned InnerBitWidth = DL.getTypeSizeInBits(LHSOp->getType());
     const unsigned OuterBitWidth = DL.getTypeSizeInBits(RHS->getType());
     auto FullCR = ConstantRange::getFull(InnerBitWidth);
@@ -1536,8 +1535,6 @@ bool IndVarSimplify::canonicalizeExitCondition(Loop *L) {
         DeadInsts.push_back(LHS);
     };
 
-
-    const DataLayout &DL = ExitingBB->getDataLayout();
     const unsigned InnerBitWidth = DL.getTypeSizeInBits(LHSOp->getType());
     const unsigned OuterBitWidth = DL.getTypeSizeInBits(RHS->getType());
     auto FullCR = ConstantRange::getFull(InnerBitWidth);

@artagnon artagnon requested a review from dtcxzyw February 3, 2025 18:24
@artagnon artagnon merged commit a29ed04 into llvm:main Feb 3, 2025
10 checks passed
@artagnon artagnon deleted the ivs-dl-member-nfc branch February 3, 2025 19:28
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
DataLayout is already available as a member variable.
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