[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-29 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added a comment. @spatel Since I don't have commit access, can you land this patch? Please use "Hirochika Matsumoto as my identity. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122077/new/ https://reviews.llvm.org/D122077

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-29 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 418869. hkmatsumoto added a comment. Create ctpop(X) > 1 instead of ctpop(X) >= 2 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122077/new/ https://reviews.llvm.org/D122077 Files:

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-29 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added inline comments. Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:915 +/// Fold (icmp eq ctpop(X) 1) | (icmp eq X 0) into (icmp ult ctpop(X) 2) and +/// fold (icmp ne ctpop(X) 1) & (icmp ne X 0) into (icmp uge ctpop(X) 2). +static Value

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-29 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 418832. hkmatsumoto added a comment. Sync with main branch Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122077/new/ https://reviews.llvm.org/D122077 Files:

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-26 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added a comment. In D122077#3405085 , @spatel wrote: > A few changes for tests suggested inline. > > There might be some generalization of ctpop analysis that we can make as a > follow-up patch. > For example, I was looking at a "wrong

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-26 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added inline comments. Comment at: llvm/test/Transforms/InstCombine/ispow2.ll:540 - -define i1 @isnot_pow2_ctpop_wrong_pred1(i32 %x) { -; CHECK-LABEL: @isnot_pow2_ctpop_wrong_pred1( Renamed to is_pow2or0_ctpop. Comment at:

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-26 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 418405. hkmatsumoto added a comment. Reflect code reviews - Move all added tests to ispow2.ll from icmp-or.ll since now that they contain tests for "and" operand - Add tests to confirm extra uses don't affect the optimization - Add negative

[PATCH] D122417: [Clang][NFC] Prefer using variadic isa<> over non-variadic isa<>s

2022-03-24 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 417982. hkmatsumoto added a comment. Correct unintended typo: Cxx -> CXX Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122417/new/ https://reviews.llvm.org/D122417 Files:

[PATCH] D122417: [Clang][NFC] Prefer using variadic isa<> over non-variadic isa<>s

2022-03-24 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto created this revision. Herald added subscribers: usaxena95, kadircet, arphaman. Herald added a project: All. hkmatsumoto requested review of this revision. Herald added projects: clang, clang-tools-extra. Herald added a subscriber: cfe-commits. Given that isa(A) is equivalent to

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-23 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto marked 3 inline comments as done. hkmatsumoto added inline comments. Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:921 + if (IsAnd && + match(Cmp0, m_ICmp(Pred0, m_Intrinsic(m_Value(X)), + m_SpecificInt(1))) &&

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-23 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 417705. hkmatsumoto added a comment. Reflect code reviews - Factor out pattern matching code and exit early if it didn't match - Rename foldOrOfCtpop to foldIsPowerOf2OrZero - Rename 2 tests in ispow2.ll to is_pow2_or_zero(_logical) to inform that this

[PATCH] D121627: [IROutliner][NFC] Fix typo in doc of findOrCreatePHIInBlock

2022-03-21 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added a comment. Since I don't have commit access, can you land this patch for me? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121627/new/ https://reviews.llvm.org/D121627 ___ cfe-commits

[PATCH] D121627: [IROutliner][NFC] Fix typo in doc of findOrCreatePHIInBlock

2022-03-20 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 416786. hkmatsumoto added a comment. Remove trailing space as well Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121627/new/ https://reviews.llvm.org/D121627 Files:

[PATCH] D121627: [IROutliner][NFC] Fix typo in doc of findOrCreatePHIInBlock

2022-03-20 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121627/new/ https://reviews.llvm.org/D121627 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-20 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added inline comments. Comment at: llvm/test/Transforms/InstCombine/ispow2.ll:538 ; Negative test - wrong predicate (but this could reduce). xbolva00 wrote: > hkmatsumoto wrote: > > xbolva00 wrote: > > > Now reduced. > > Since this is almost the

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-20 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 416763. hkmatsumoto added a comment. Address code review, removing "but this could reduce" from comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122077/new/ https://reviews.llvm.org/D122077 Files:

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-20 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto added inline comments. Comment at: llvm/test/Transforms/InstCombine/ispow2.ll:538 ; Negative test - wrong predicate (but this could reduce). xbolva00 wrote: > Now reduced. Since this is almost the first time contributing to LLVM, I'm not sure

[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

2022-03-20 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto updated this revision to Diff 416762. hkmatsumoto added a comment. Address code reviews - Fold (icmp ne ctpop(X) 1) & (icmp ne X 0) into (icmp ugt ctpop(X) 1) as well foldOrOfCtpop folds the aforementioned pattern into (icmp **uge** ctpop(X) 2) and that is later transformed into

[PATCH] D121627: [IROutliner][NFC] Fix typo in doc of findOrCreatePHIInBlock

2022-03-14 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto created this revision. Herald added subscribers: ormris, hiraditya. Herald added a project: All. hkmatsumoto requested review of this revision. Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Repository: rG LLVM Github Monorepo

[PATCH] D114424: [Diagnostic] Clarify -Winfinite-recursion message

2021-11-23 Thread Hirochika Matsumoto via Phabricator via cfe-commits
hkmatsumoto created this revision. hkmatsumoto requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D114424 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td