This is an archive of the discontinued LLVM Phabricator instance.

Refactor: Simplify boolean conditional return statements in lib/Target/SystemZ
ClosedPublic

Authored by LegalizeAdulthood on May 25 2015, 1:43 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

LegalizeAdulthood retitled this revision from to Refactor: Simplify boolean conditional return statements in lib/Target/SystemZ.
LegalizeAdulthood updated this object.
LegalizeAdulthood edited the test plan for this revision. (Show Details)
LegalizeAdulthood added a subscriber: Unknown Object (MLST).
craig.topper added inline comments.
lib/Target/SystemZ/SystemZInstrInfo.cpp
507 ↗(On Diff #26413)

Can this just be on the previous line and still fit 80 columns?

lib/Target/SystemZ/SystemZInstrInfo.cpp
507 ↗(On Diff #26413)

Fixed.

uweigand edited edge metadata.Jul 9 2015, 10:13 AM

Some of these changes make sense to me, but a number of others don't appear to make the code more readable.

The latter are typically of the form:

if (cond1)
  return false;
if (cond2)
  return false;
...
if (condN)
  return false;

return true;

In a sequence like this (which is written this way to be able to easily add/remove further conditions as appropriate, it doesn't really improve maintainability to just transform the *last* condition.

LegalizeAdulthood edited edge metadata.

Update from latest.
Update from comments.
I do not have commit access.

Some of these changes make sense to me, but a number of others don't appear to make the code more readable.

The latter are typically of the form:

if (cond1)
  return false;
if (cond2)
  return false;
...
if (condN)
  return false;

return true;

In a sequence like this (which is written this way to be able to easily add/remove further conditions as appropriate, it doesn't really improve maintainability to just transform the *last* condition.

This should not be a problem anymore.

uweigand accepted this revision.Nov 13 2015, 4:57 AM
uweigand edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Nov 13 2015, 4:57 AM
This revision was automatically updated to reflect the committed changes.