-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[VectorCombine][X86] Use updated getVectorInstrCost hook #137823
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
lukel97
merged 8 commits into
llvm:main
from
lukel97:vector-combine/scalarizeBinOpOfSplats-insertelement-cost
May 27, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1b9607a
[VectorCombine][X86] Use updated getVectorInstrCost hook
lukel97 7f011c4
Update phaseordering tests
lukel97 20a5d81
Merge remote-tracking branch 'origin/main' into vector-combine/scalar…
lukel97 b155053
Plumb through constant folded base vector to avoid x86 regressions
lukel97 33afffe
Add RISC-V test case
lukel97 269892a
Remove negative test comments
lukel97 89bccad
Merge branch 'main' of github.com:llvm/llvm-project into vector-combi…
lukel97 44fb80a
Merge branch 'main' into vector-combine/scalarizeBinOpOfSplats-insert…
lukel97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
llvm/test/Transforms/VectorCombine/RISCV/binop-scalarize.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: opt < %s -S -p vector-combine -mtriple=riscv64 -mattr=+v | FileCheck %s | ||
|
||
define <4 x i32> @add_constant_load(ptr %p) { | ||
; CHECK-LABEL: define <4 x i32> @add_constant_load( | ||
; CHECK-SAME: ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] { | ||
; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4 | ||
; CHECK-NEXT: [[V_SCALAR:%.*]] = add i32 [[X]], 42 | ||
; CHECK-NEXT: [[V:%.*]] = insertelement <4 x i32> poison, i32 [[V_SCALAR]], i64 0 | ||
; CHECK-NEXT: ret <4 x i32> [[V]] | ||
; | ||
%x = load i32, ptr %p | ||
%ins = insertelement <4 x i32> poison, i32 %x, i32 0 | ||
%v = add <4 x i32> %ins, splat (i32 42) | ||
ret <4 x i32> %v | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reasoning behind this no longer being scalarized is that at SSE2 and above double and <2 x double> have the same fadd cost:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving a note here that this still generates the same code ultimately because DAGCombine will scalarize it either way