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

[AMDGPU] Remove legality checks from imm folding in shrink. NFCI. #69539

Merged
merged 3 commits into from
Oct 19, 2023

Conversation

rampitec
Copy link
Collaborator

The immediate legality checks are now embedded into the isOperandLegal(). It is not needed to check it again.

The immediate legality checks are now embedded into the isOperandLegal().
It is not needed to check it again.
@llvmbot
Copy link

llvmbot commented Oct 19, 2023

@llvm/pr-subscribers-backend-amdgpu

Author: Stanislav Mekhanoshin (rampitec)

Changes

The immediate legality checks are now embedded into the isOperandLegal(). It is not needed to check it again.


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

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp (+1-2)
diff --git a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
index 4159dc694c1e037..88c75a0f86a6c13 100644
--- a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
+++ b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
@@ -104,8 +104,7 @@ bool SIShrinkInstructions::foldImmediates(MachineInstr &MI,
         bool ConstantFolded = false;
 
         if (TII->isOperandLegal(MI, Src0Idx, &MovSrc)) {
-          if (MovSrc.isImm() &&
-              (isInt<32>(MovSrc.getImm()) || isUInt<32>(MovSrc.getImm()))) {
+          if (MovSrc.isImm()) {
             Src0.ChangeToImmediate(MovSrc.getImm());
             ConstantFolded = true;
           } else if (MovSrc.isFI()) {

The immediate legality checks are now embedded into the isOperandLegal().
It is not needed to check it again.
@rampitec rampitec changed the title [AMDGPU] Remove legalicty checks from imm folding in shrink. NFCI. [AMDGPU] Remove legality checks from imm folding in shrink. NFCI. Oct 19, 2023
Copy link
Contributor

@jayfoad jayfoad left a comment

Choose a reason for hiding this comment

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

Seems obvious.

@rampitec rampitec merged commit 906d3ff into llvm:main Oct 19, 2023
3 checks passed
@rampitec rampitec deleted the shrink-fold-checks branch October 19, 2023 10:52
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