Skip to content

[CodeGen] Fix compiler conditional combination #94297

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

Conversation

keith
Copy link
Member

@keith keith commented Jun 4, 2024

Previously this assumed that LLVM_ENABLE_ABI_BREAKING_CHECKS would
always be enabled in this case, if it's not TTI does not exist.

Introduced in 7652a59

Previously this assumed that `LLVM_ENABLE_ABI_BREAKING_CHECKS` would
always be enabled in this case, if it's not `TTI` does not exist.

Introduced in 7652a59
@keith keith requested a review from paperchalice June 4, 2024 00:38
@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label Jun 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 4, 2024

@llvm/pr-subscribers-llvm-selectiondag

Author: Keith Smiley (keith)

Changes

Previously this assumed that LLVM_ENABLE_ABI_BREAKING_CHECKS would
always be enabled in this case, if it's not TTI does not exist.

Introduced in 7652a59


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

1 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (+2-2)
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 91e14af190257..31ba833abe29d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -536,7 +536,7 @@ void SelectionDAGISel::initializeAnalysisResults(
 
   SP = &FAM.getResult<SSPLayoutAnalysis>(Fn);
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
   TTI = &FAM.getResult<TargetIRAnalysis>(Fn);
 #endif
 }
@@ -590,7 +590,7 @@ void SelectionDAGISel::initializeAnalysisResults(MachineFunctionPass &MFP) {
 
   SP = &MFP.getAnalysis<StackProtector>().getLayoutInfo();
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
   TTI = &MFP.getAnalysis<TargetTransformInfoWrapperPass>().getTTI(Fn);
 #endif
 }

Copy link
Contributor

@paperchalice paperchalice left a comment

Choose a reason for hiding this comment

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

Thanks! Sorry for my lack of rigor.

@keith
Copy link
Member Author

keith commented Jun 4, 2024

no problem! I only found it since it broke the bazel build. I'm not sure where else this happens in practice

@paperchalice paperchalice merged commit cac5d0e into llvm:main Jun 4, 2024
6 of 8 checks passed
@keith keith deleted the ks/codegen-fix-compiler-conditional-combination branch June 4, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants