[PATCH] D117226: [OpenMPIRBuilder] Detect and fix ambiguous InsertPoints for createParallel.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 07:22:27 PST 2022


Meinersbur created this revision.
Meinersbur added reviewers: jdoerfert, kiranchandramohan, peixin, clementval, Leporacanthicus, kiranktp, AMDChirag, fghanim, jdenny, MatsPetersson.
Herald added subscribers: guansong, hiraditya, yaxunl.
Meinersbur requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.

When a Builder methods accepts multiple InsertPoints, when both point to
the same position, inserting instructions at one position will "move" the
other after the inserted position since the InsertPoint is pegged to the
instruction following the intended InsertPoint. For instance, when
creating a parallel region at Loc and passing the same position as AllocaIP,
creating instructions at Loc will "move" the AllocIP behind the Loc
position.

To avoid this ambiguity, add an assertion checking this condition and
fix the unittests.

In case of AllocaIP, an alternative solution could be to implicitly
split BasicBlock at InsertPoint, using the first as AllocaIP, the second
for inserting the instructions themselves. However, this solution is
specific to AllocaIP since AllocaIP will always have to be first. Hence,
this is an argument to generally handling ambiguous InsertPoints as API
sage error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117226

Files:
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117226.399670.patch
Type: text/x-patch
Size: 3956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220113/5b232c6e/attachment.bin>


More information about the llvm-commits mailing list