Eliminate extra set of simd variant function attribute.
authorJennifer Yu <jennifer.yu@intel.com>
Wed, 23 Mar 2022 14:34:28 +0000 (07:34 -0700)
committerJennifer Yu <jennifer.yu@intel.com>
Thu, 24 Mar 2022 20:27:28 +0000 (13:27 -0700)
commita6cdac48ffaf1aba9c2055db0ea92f8d25e629d8
treeb224f29e19e73badd9b7a9b68dc8d3b0ae7ea290
parent64838ba3657614f80f8ec78b7967848ca0691411
Eliminate extra set of simd variant function attribute.

Current clang generates extra set of simd variant function attribute
with extra 'v' encoding.
For example:
_ZGVbN2v__Z5add_1Pf vs _ZGVbN2vv__Z5add_1Pf
The problem is due to declaration of ParamAttrs following:
    llvm::SmallVector<ParamAttrTy, 8> ParamAttrs(ParamPositions.size());
where ParamPositions.size() is grown after following assignment:
    Pos = ParamPositions[PVD];
So the PVD is not find in ParamPositions.

The problem is ParamPositions need to set for each FD decl. To fix this

Move ParamPositions's init inside while loop for each FD.

Differential Revision: https://reviews.llvm.org/D122338
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/test/OpenMP/declare_simd_codegen.cpp