[PATCH] D13029: [PatternMatch] Switch to using ValueTracking::matchSelectPattern for min/max matching
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 11:48:22 PDT 2015
majnemer added inline comments.
================
Comment at: include/llvm/IR/PatternMatch.h:959-962
@@ -957,5 +958,6 @@
template <typename OpTy> bool match(OpTy *V) {
- // Look for "(x pred y) ? x : y" or "(x pred y) ? y : x".
- auto *SI = dyn_cast<SelectInst>(V);
- if (!SI)
+ // matchSelectPattern can get expensive, so do some early bailout checks
+ // first.
+ if (!isa<SelectInst>(V) ||
+ !isa<CmpInst>(cast<SelectInst>(V)->getCondition()))
return false;
----------------
Unless I'm mistaken, isn't this what `llvm::matchSelectPattern` already does? I'd be surprised if the extra call frame matters here.
Repository:
rL LLVM
http://reviews.llvm.org/D13029
More information about the llvm-commits
mailing list