This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp (NFC)
ClosedPublic

Authored by saghir on Nov 16 2018, 10:36 AM.

Details

Summary

In the below statement in ParseOpenMP.cpp:

bool IsComma =
1942 (Kind != OMPC_reduction && Kind != OMPC_task_reduction &&
1943 Kind != OMPC_in_reduction && Kind != OMPC_depend && Kind != OMPC_map) ||
1944 (Kind == OMPC_reduction && !InvalidReductionId) ||
1945 (Kind == OMPC_map && Data.MapType != OMPC_MAP_unknown &&
1946 (!MapTypeModifierSpecified ||
1947 Data.MapTypeModifier == OMPC_MAP_always)) ||
1948 (Kind == OMPC_depend && Data.DepKind != OMPC_DEPEND_unknown);

Whenever a map type modifier is specified, the flag MapTypeModifierSpecified is set to true.

In the above statement,

  1. when there is no map type modifier specified, !MapTypeModifierSpecified portion evaluates to true.
  2. when the map type modifier is specified, Data.MapTypeModifier == OMPC_MAP_always is set to true.

So whether a modifier is specified or not, the condition (highlighted in bold) always evaluates to true.

Check for this condition is redundant. Consequently, declaration and all uses of MapTypeModifierSpecified should be removed.

Diff Detail

Event Timeline

saghir created this revision.Nov 16 2018, 10:36 AM
saghir retitled this revision from OpenMP: remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp to [OpenMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp.Nov 16 2018, 10:38 AM
ABataev accepted this revision.Nov 16 2018, 10:40 AM

LG, add NFC to the title.

This revision is now accepted and ready to land.Nov 16 2018, 10:40 AM
saghir retitled this revision from [OpenMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp to [OpenMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp (NFC).Nov 16 2018, 10:55 AM
This revision was automatically updated to reflect the committed changes.