[PATCH] D109635: [WIP][OpenMP] Support construct trait set for Clang
Chi Chun Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 10 15:41:30 PDT 2021
cchen added inline comments.
================
Comment at: clang/lib/AST/OpenMPClause.cpp:2346
- VMI.ConstructTraits.push_back(Selector.Properties.front().Kind);
+ // VMI.ConstructTraits.push_back(Selector.Properties.front().Kind);
}
----------------
I'm now removing this line since the properties are already added at line 2334 and not removing this line would lead to an extra iteration in `OMPContext.cpp` (check out the second diff), and the code will always return false even if the construct trait properties are added.
Diff for OpenMPClause.cpp
```
2333 for (const OMPTraitProperty &Property : Selector.Properties)
2334 VMI.addTrait(Set.Kind, Property.Kind, Property.RawString, ScorePtr);
2335
2336 if (Set.Kind != TraitSet::construct)
2337 continue;
2338
2339 // TODO: This might not hold once we implement SIMD properly.
2340 assert(Selector.Properties.size() == 1 &&
2341 Selector.Properties.front().Kind ==
2342 getOpenMPContextTraitPropertyForSelector(
2343 Selector.Kind) &&
2344 "Ill-formed construct selector!");
2345
2346 // VMI.ConstructTraits.push_back(Selector.Properties.front().Kind);
```
Diff for `lib/Frontend/OpenMP/OMPContext.cpp`:
```
224 unsigned ConstructIdx = 0, NoConstructTraits = Ctx.ConstructTraits.size();
225 for (TraitProperty Property : VMI.ConstructTraits) {
226 assert(getOpenMPContextTraitSetForProperty(Property) ==
227 TraitSet::construct &&
228 "Variant context is ill-formed!");
229
230 // Verify the nesting.
231 bool FoundInOrder = false;
232 while (!FoundInOrder && ConstructIdx != NoConstructTraits)
233 FoundInOrder = (Ctx.ConstructTraits[ConstructIdx++] == Property);
234 if (ConstructMatches)
235 ConstructMatches->push_back(ConstructIdx - 1);
236
237 Optional<bool> Result = HandleTrait(Property, FoundInOrder);
238 if (Result.hasValue())
239 return Result.getValue();
240
241 if (!FoundInOrder) {
242 LLVM_DEBUG(dbgs() << "[" << DEBUG_TYPE << "] Construct property "
243 << getOpenMPContextTraitPropertyName(Property, "")
244 << " was not nested properly.\n");
245 return false;
246 }
247
248 // TODO: Verify SIMD
249 }
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109635/new/
https://reviews.llvm.org/D109635
More information about the cfe-commits
mailing list