Skip to content

Remove unused variable, and unneeded extract element instruction #103489

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 2 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/test/SemaHLSL/BuiltIns/normalize-errors.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -disable-llvm-passes -verify -verify-ignore-unexpected

void test_too_few_arg()
{
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ static bool expandNormalizeIntrinsic(CallInst *Orig) {
return true;
}

Value *Elt = Builder.CreateExtractElement(X, (uint64_t)0);
unsigned XVecSize = XVec->getNumElements();
Value *DotProduct = nullptr;
// use the dot intrinsic corresponding to the vector size
Expand Down
6 changes: 0 additions & 6 deletions llvm/test/CodeGen/DirectX/normalize.ll
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ entry:

define noundef <2 x half> @test_normalize_half2(<2 x half> noundef %p0) {
entry:
; CHECK: extractelement <2 x half> %{{.*}}, i64 0
; EXPCHECK: [[doth2:%.*]] = call half @llvm.dx.dot2.v2f16(<2 x half> %{{.*}}, <2 x half> %{{.*}})
; DOPCHECK: [[doth2:%.*]] = call half @dx.op.dot2.f16(i32 54, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}})
; EXPCHECK: [[rsqrt:%.*]] = call half @llvm.dx.rsqrt.f16(half [[doth2]])
Expand All @@ -37,7 +36,6 @@ entry:

define noundef <3 x half> @test_normalize_half3(<3 x half> noundef %p0) {
entry:
; CHECK: extractelement <3 x half> %{{.*}}, i64 0
; EXPCHECK: [[doth3:%.*]] = call half @llvm.dx.dot3.v3f16(<3 x half> %{{.*}}, <3 x half> %{{.*}})
; DOPCHECK: [[doth3:%.*]] = call half @dx.op.dot3.f16(i32 55, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}})
; EXPCHECK: [[rsqrt:%.*]] = call half @llvm.dx.rsqrt.f16(half [[doth3]])
Expand All @@ -52,7 +50,6 @@ entry:

define noundef <4 x half> @test_normalize_half4(<4 x half> noundef %p0) {
entry:
; CHECK: extractelement <4 x half> %{{.*}}, i64 0
; EXPCHECK: [[doth4:%.*]] = call half @llvm.dx.dot4.v4f16(<4 x half> %{{.*}}, <4 x half> %{{.*}})
; DOPCHECK: [[doth4:%.*]] = call half @dx.op.dot4.f16(i32 56, half %{{.*}}, half %{{.*}}, half %{{.*}}, half %{{.*}})
; EXPCHECK: [[rsqrt:%.*]] = call half @llvm.dx.rsqrt.f16(half [[doth4]])
Expand All @@ -74,7 +71,6 @@ entry:

define noundef <2 x float> @test_normalize_float2(<2 x float> noundef %p0) {
entry:
; CHECK: extractelement <2 x float> %{{.*}}, i64 0
; EXPCHECK: [[dotf2:%.*]] = call float @llvm.dx.dot2.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}})
; DOPCHECK: [[dotf2:%.*]] = call float @dx.op.dot2.f32(i32 54, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}})
; EXPCHECK: [[rsqrt:%.*]] = call float @llvm.dx.rsqrt.f32(float [[dotf2]])
Expand All @@ -89,7 +85,6 @@ entry:

define noundef <3 x float> @test_normalize_float3(<3 x float> noundef %p0) {
entry:
; CHECK: extractelement <3 x float> %{{.*}}, i64 0
; EXPCHECK: [[dotf3:%.*]] = call float @llvm.dx.dot3.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}})
; DOPCHECK: [[dotf3:%.*]] = call float @dx.op.dot3.f32(i32 55, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}})
; EXPCHECK: [[rsqrt:%.*]] = call float @llvm.dx.rsqrt.f32(float [[dotf3]])
Expand All @@ -104,7 +99,6 @@ entry:

define noundef <4 x float> @test_normalize_float4(<4 x float> noundef %p0) {
entry:
; CHECK: extractelement <4 x float> %{{.*}}, i64 0
; EXPCHECK: [[dotf4:%.*]] = call float @llvm.dx.dot4.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}})
; DOPCHECK: [[dotf4:%.*]] = call float @dx.op.dot4.f32(i32 56, float %{{.*}}, float %{{.*}}, float %{{.*}}, float %{{.*}})
; EXPCHECK: [[rsqrt:%.*]] = call float @llvm.dx.rsqrt.f32(float [[dotf4]])
Expand Down
Loading