python3kgae updated this revision to Diff 456870.
python3kgae added a comment.

Switch to ImpliedByAnyOf.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132913/new/

https://reviews.llvm.org/D132913

Files:
  clang/include/clang/Driver/Options.td
  clang/test/CodeGenHLSL/float3.hlsl


Index: clang/test/CodeGenHLSL/float3.hlsl
===================================================================
--- /dev/null
+++ clang/test/CodeGenHLSL/float3.hlsl
@@ -0,0 +1,11 @@
+// RUN: %clang --driver-mode=dxc -Tlib_6_7 -fcgl  -Fo - %s | FileCheck %s
+
+// Make sure float3 is not changed into float4.
+// CHECK:<3 x float> @"?foo@@YAT?$__vector@M$02@__clang@@T12@@Z"(<3 x float> 
noundef %a)
+// CHECK:%[[A_ADDR:.+]] = alloca <3 x float>, align 16
+// CHECK-NEXT:store <3 x float> %a, ptr %[[A_ADDR]], align 16
+// CHECK-NEXT:%[[V:[0-9]+]] = load <3 x float>, ptr %[[A_ADDR]], align 16
+// CHECK-NEXT:ret <3 x float> %[[V]]
+float3 foo(float3 a) {
+  return a;
+}
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6155,7 +6155,8 @@
 
 def fpreserve_vec3_type : Flag<["-"], "fpreserve-vec3-type">,
   HelpText<"Preserve 3-component vector type">,
-  MarshallingInfoFlag<CodeGenOpts<"PreserveVec3Type">>;
+  MarshallingInfoFlag<CodeGenOpts<"PreserveVec3Type">>,
+  ImpliedByAnyOf<[hlsl.KeyPath]>;
 def fwchar_type_EQ : Joined<["-"], "fwchar-type=">,
   HelpText<"Select underlying type for wchar_t">,
   Values<"char,short,int">,


Index: clang/test/CodeGenHLSL/float3.hlsl
===================================================================
--- /dev/null
+++ clang/test/CodeGenHLSL/float3.hlsl
@@ -0,0 +1,11 @@
+// RUN: %clang --driver-mode=dxc -Tlib_6_7 -fcgl  -Fo - %s | FileCheck %s
+
+// Make sure float3 is not changed into float4.
+// CHECK:<3 x float> @"?foo@@YAT?$__vector@M$02@__clang@@T12@@Z"(<3 x float> noundef %a)
+// CHECK:%[[A_ADDR:.+]] = alloca <3 x float>, align 16
+// CHECK-NEXT:store <3 x float> %a, ptr %[[A_ADDR]], align 16
+// CHECK-NEXT:%[[V:[0-9]+]] = load <3 x float>, ptr %[[A_ADDR]], align 16
+// CHECK-NEXT:ret <3 x float> %[[V]]
+float3 foo(float3 a) {
+  return a;
+}
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -6155,7 +6155,8 @@
 
 def fpreserve_vec3_type : Flag<["-"], "fpreserve-vec3-type">,
   HelpText<"Preserve 3-component vector type">,
-  MarshallingInfoFlag<CodeGenOpts<"PreserveVec3Type">>;
+  MarshallingInfoFlag<CodeGenOpts<"PreserveVec3Type">>,
+  ImpliedByAnyOf<[hlsl.KeyPath]>;
 def fwchar_type_EQ : Joined<["-"], "fwchar-type=">,
   HelpText<"Select underlying type for wchar_t">,
   Values<"char,short,int">,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to