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

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 15:13:55 PDT 2016


mehdi_amini added inline comments.

================
Comment at: utils/TableGen/CodeGenDAGPatterns.cpp:2011
@@ -2013,3 +2010,3 @@
     if (!OnlyOnRHSOfCommutative(getChild(getNumChildren()-1))) {
-      bool Skip = isCommIntrinsic ? 1 : 0; // First operand is intrinsic id.
+      unsigned Skip = isCommIntrinsic ? 1 : 0; // First operand is intrinsic id.
       for (unsigned i = Skip, e = getNumChildren()-1; i != e; ++i)
----------------
Eugene.Zelenko wrote:
> compnerd wrote:
> > Is this used in the rest of the scope?
> No, it used only in loop.
(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!";
```


Repository:
  rL LLVM

https://reviews.llvm.org/D24325





More information about the llvm-commits mailing list