This is an archive of the discontinued LLVM Phabricator instance.

[LLVM] Fix some Clang-tidy modernize-use-bool-literals and Include What You Use warnings in unittests and utils; other minor fixes
Needs ReviewPublic

Authored by Eugene.Zelenko on Sep 7 2016, 5:16 PM.

Details

Summary

I checked this patch on my own build on RHEL 6. Regressions were OK.

Diff Detail

Repository
rL LLVM

Event Timeline

Eugene.Zelenko retitled this revision from to [LLVM] Fix some Clang-tidy modernize-use-bool-literals and Include What You Use warnings in unittests and utils; other minor fixes.
Eugene.Zelenko updated this object.
Eugene.Zelenko set the repository for this revision to rL LLVM.
Eugene.Zelenko added a subscriber: llvm-commits.
compnerd added inline comments.Sep 9 2016, 1:25 PM
utils/PerfectShuffle/PerfectShuffle.cpp
425

This is horrible. We shouldnt leave dead code, and this should really be moved into a DEBUG() statement. However, that is beyond the scope of this particular change, and that isnt your fault.

utils/TableGen/CodeGenDAGPatterns.cpp
2011

Is this used in the rest of the scope?

Eugene.Zelenko added inline comments.Sep 9 2016, 1:33 PM
utils/TableGen/CodeGenDAGPatterns.cpp
2011

No, it used only in loop.

mehdi_amini added inline comments.Sep 9 2016, 3:13 PM
utils/TableGen/CodeGenDAGPatterns.cpp
2011

(Which reminds that patches uploaded with full context are easier to review)

For this particular change, I rather read:

unsigned FirstChild = isCommIntrinsic ? 1 : 0; // First operand is intrinsic id.
for (unsigned Child = FirstChild, Last = getNumChildren()-1; Child != Last; ++Child)
      if (OnlyOnRHSOfCommutative(getChild(Child))) {
        Reason="Immediate value must be on the RHS of commutative operators!";

Change loop.