[PATCH] Added instruction combine to transform few more negative values addition to subtraction (Part 2)

Dinesh Dwivedi dinesh.d at samsung.com
Fri Jun 20 11:47:03 PDT 2014


forgot to reply for else if part.

================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:998
@@ +997,3 @@
+       // ADD(ADD(X, 1), RHS) == ADD(X, ADD(RHS, 1)) == SUB(RHS, OR(Z, ~C1))
+       else if (!C1->countTrailingZeros()) {
+         if (match(Y, m_And(m_Value(Z), m_APInt(C2))) && (*C1 == *C2)) {
----------------
Dinesh Dwivedi wrote:
> Jingyue Wu wrote:
> > Jingyue Wu wrote:
> > > Nit: I prefer
> > > ```
> > > C1->countTrailingZeros() == 0
> > > ```
> > > because C1->countTrailingZeros() is not a boolean. 
> > Nit: Does LLVM coding standard say anything about: 
> > ```
> > } else if {
> > ```
> > or
> > ```
> > }
> > else if {
> > ```
> > 
> > The first style seems more commonly used. 
> will update it.
For else if, I have used clang-format on it. But may be because of comments, it left 
else in next line. I will move comments after else if line, if you say so.

http://reviews.llvm.org/D4209






More information about the llvm-commits mailing list