[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)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 08:16:34 PDT 2017


craig.topper added inline comments.


================
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) {
----------------
chandlerc wrote:
> 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*`.
AddLHS isn't always an instruction. It might be a livein to the block including an argument to the function and we need to handle that.


Repository:
  rL LLVM

https://reviews.llvm.org/D33262





More information about the llvm-commits mailing list