[PATCH] D50465: [InstCombine] Optimize redundant 'signed truncation check pattern'.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 08:08:48 PDT 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1307-1308
 
+// See detailed explaination of the pattern in
+// test/Transforms/InstCombine/signed-truncation-check.ll
+static Value *foldSignedTruncationCheck(BinaryOperator &I,
----------------
It's better to include the comment from the test file directly (or at least a shorter description) instead of asking the reader to jump to another file for documentation.


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1311-1316
+  assert(I.getOpcode() == Instruction::And);
+  // We are looking for an 'and' of two icmp's
+  auto *ICmp0 = dyn_cast<ICmpInst>(I.getOperand(0));
+  auto *ICmp1 = dyn_cast<ICmpInst>(I.getOperand(1));
+  if (!(ICmp0 && ICmp1))
+    return nullptr;
----------------
Can this be moved within InstCombiner::foldAndOfICmps() to eliminate these preliminary checks?

Any chance for shared functionality with foldAndOrOfICmpsOfAndWithPow2() or simplifyRangeCheck()?


Repository:
  rL LLVM

https://reviews.llvm.org/D50465





More information about the llvm-commits mailing list