This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][OpenMP] Update OpenMPIRBuilderTest to use opaque pointers
ClosedPublic

Authored by TIFitis on Apr 5 2023, 2:56 AM.

Details

Diff Detail

Event Timeline

TIFitis created this revision.Apr 5 2023, 2:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 2:56 AM
TIFitis requested review of this revision.Apr 5 2023, 2:56 AM
TIFitis added inline comments.Apr 5 2023, 3:00 AM
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
4303–4308

This returns false now as isSimpleBinaryReduction expects a single StoreInst user within the block for FirstPrivatized and SecondPrivatized but with the BitCast Inst's removed they have two StoreInst.

TIFitis added subscribers: gysit, zero9178.

@gysit @zero9178 I am looking at updating these tests to use opaque pointers. I have updated all of the ones that had issues except the CreateReductions and CreateTwoReductions tests which I am facing some difficulty in changing.
The source of issues for most if not all of these tests are the deletion of bitcast instructions which are made redundant by opaque pointers.
Any insights or suggestions would be highly appreciated.

zero9178 added a comment.EditedApr 6 2023, 11:09 AM

@gysit @zero9178 I am looking at updating these tests to use opaque pointers. I have updated all of the ones that had issues except the CreateReductions and CreateTwoReductions tests which I am facing some difficulty in changing.
The source of issues for most if not all of these tests are the deletion of bitcast instructions which are made redundant by opaque pointers.
Any insights or suggestions would be highly appreciated.

I am not at all familiar with this code but a quick look at the module revealed that since a bitcast gets deleted, FirstPrivatized gets a new use in the value operand of a store instruction. Looking at isSimpleBinaryReduction, it seems the intention of the test is to check whether a binary instruction is stored into Accum.

What you could do is use findStoredValue instead of findSingleUserInBlock within isSimplyBinaryReduction and adjust the code in findStoredValue to 1) only check uses where AllocaValue is used as the pointer operand (this should filter the new use created by the removal of the bitcast as that is in the value operand position) and 2) add an optional BasicBlock* argument to allow only checking stored values within a basic block (similar to how findSingleUserInBlock) currently does it.

TIFitis updated this revision to Diff 512410.Apr 11 2023, 5:45 AM

Updated tests. All tests are now pass with Opaque pointers enabled.

TIFitis edited the summary of this revision. (Show Details)Apr 11 2023, 6:07 AM
jdoerfert accepted this revision.Apr 11 2023, 9:38 AM

Just browsed the change, seems solid. LG

This revision is now accepted and ready to land.Apr 11 2023, 9:38 AM