Skip to content

[TargetLowering] Use getShiftAmountConstant. NFC #123802

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
Jan 21, 2025

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Jan 21, 2025

Previously we always used the pointer size which might need to be legalized on some targets.

Previously we always used the pointer size which might need to be
legalized on some targets.
@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label Jan 21, 2025
Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

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

LGTM

@llvmbot
Copy link
Member

llvmbot commented Jan 21, 2025

@llvm/pr-subscribers-llvm-selectiondag

Author: Craig Topper (topperc)

Changes

Previously we always used the pointer size which might need to be legalized on some targets.


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

1 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp (+3-6)
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 368800d8b46a87..5861a95c090b1d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -10959,12 +10959,9 @@ void TargetLowering::forceExpandWideMUL(SelectionDAG &DAG, const SDLoc &dl,
     // The high part is obtained by SRA'ing all but one of the bits of low
     // part.
     unsigned LoSize = VT.getFixedSizeInBits();
-    HiLHS = DAG.getNode(
-        ISD::SRA, dl, VT, LHS,
-        DAG.getConstant(LoSize - 1, dl, getPointerTy(DAG.getDataLayout())));
-    HiRHS = DAG.getNode(
-        ISD::SRA, dl, VT, RHS,
-        DAG.getConstant(LoSize - 1, dl, getPointerTy(DAG.getDataLayout())));
+    SDValue Shift = DAG.getShiftAmountConstant(LoSize - 1, VT, dl);
+    HiLHS = DAG.getNode(ISD::SRA, dl, VT, LHS, Shift);
+    HiRHS = DAG.getNode(ISD::SRA, dl, VT, RHS, Shift);
   } else {
     HiLHS = DAG.getConstant(0, dl, VT);
     HiRHS = DAG.getConstant(0, dl, VT);

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

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

LGTM

@topperc topperc merged commit cdd3214 into llvm:main Jan 21, 2025
8 of 9 checks passed
@topperc topperc deleted the pr/shiftamount branch January 21, 2025 20:05
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 21, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-debian running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/16/builds/12382

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Input file: /b/1/llvm-clang-x86_64-expensive-checks-debian/build/test/tools/llvm-gsymutil/ARM_AArch64/Output/macho-gsym-merged-callsites-dsym.yaml.tmp/merged_callsites.dSYM
Output file (aarch64): /b/1/llvm-clang-x86_64-expensive-checks-debian/build/test/tools/llvm-gsymutil/ARM_AArch64/Output/macho-gsym-merged-callsites-dsym.yaml.tmp/call_sites_dSYM.gsym
error: line table has addresses that do not monotonically increase:
0x0000000100000338      5     15      1   0             0       0  is_stmt prologue_end
0x000000010000033c      6     20      1   0             0       0  is_stmt
0x0000000100000340      7     19      1   0             0       0  is_stmt
0x0000000100000348      8      5      1   0             0       0  is_stmt
0x0000000100000348      8      5      1   0             0       0  is_stmt end_sequence
0x0000000100000338     12     15      1   0             0       0  is_stmt prologue_end
0x000000010000033c     13     20      1   0             0       0  is_stmt
0x0000000100000340     14     19      1   0             0       0  is_stmt
0x0000000100000348     15      5      1   0             0       0  is_stmt
0x0000000100000348     15      5      1   0             0       0  is_stmt end_sequence

0x0000004f: DW_TAG_subprogram
              DW_AT_low_pc	(0x0000000100000338)
              DW_AT_high_pc	(0x000000010000034c)
              DW_AT_APPLE_omit_frame_ptr	(true)
              DW_AT_LLVM_stmt_sequence	(0x0000003b)
              DW_AT_frame_base	(DW_OP_reg31)
              DW_AT_call_all_calls	(true)
              DW_AT_name	("function4_copy1")
              DW_AT_decl_file	("/tmp/tst/out/merged_funcs_test.cpp")
              DW_AT_decl_line	(4)
              DW_AT_type	(0x0000000000000048 "int")
              DW_AT_external	(true)
              DW_AT_APPLE_optimized	(true)
error: line table has addresses that do not monotonically increase:
0x0000000100000338      5     15      1   0             0       0  is_stmt prologue_end
0x000000010000033c      6     20      1   0             0       0  is_stmt
0x0000000100000340      7     19      1   0             0       0  is_stmt
0x0000000100000348      8      5      1   0             0       0  is_stmt
0x0000000100000348      8      5      1   0             0       0  is_stmt end_sequence
0x0000000100000338     12     15      1   0             0       0  is_stmt prologue_end
0x000000010000033c     13     20      1   0             0       0  is_stmt
0x0000000100000340     14     19      1   0             0       0  is_stmt
0x0000000100000348     15      5      1   0             0       0  is_stmt
0x0000000100000348     15      5      1   0             0       0  is_stmt end_sequence

0x0000009a: DW_TAG_subprogram
              DW_AT_low_pc	(0x0000000100000338)
              DW_AT_high_pc	(0x000000010000034c)
              DW_AT_APPLE_omit_frame_ptr	(true)
              DW_AT_LLVM_stmt_sequence	(0x00000056)
              DW_AT_frame_base	(DW_OP_reg31)
...

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.

5 participants