[PATCH] D33262: [JumpThreading] Teach jump threading how to analyze (and (cmp A, C1), (cmp A, C2)) after InstCombine has turned it into (cmp (add A, C3), C4)
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 01:45:43 PDT 2017
chandlerc added a comment.
Sorry for the drive by review, but I noticed one cleanup below and I have to ask: why is there no test case here? That seems kinda bad. I feel like there should be tests for folding to true, folding to false, and some negative testing that things which *shouldn't* be threaded here aren't....
================
Comment at: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp:647-649
+ match(CmpLHS, m_Add(m_Value(AddLHS), m_ConstantInt(AddConst)))) {
+ if (!isa<Instruction>(AddLHS) ||
+ cast<Instruction>(AddLHS)->getParent() != BB) {
----------------
You can remove all of the `isa<Instruction>` and `cast<Intsruction>` dance by using `m_Instruction` in the pattern match and making `AddLHS` an `Instruction*`.
Repository:
rL LLVM
https://reviews.llvm.org/D33262
More information about the llvm-commits
mailing list