[PATCH] D20143: New pass: guard widening
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 20:59:45 PDT 2016
majnemer added a subscriber: majnemer.
================
Comment at: lib/Transforms/Scalar/GuardWidening.cpp:81-95
@@ +80,17 @@
+ /// Used to keep track of which widening potential is more effective.
+ enum WideningScore {
+ /// Don't widen.
+ WS_IllegalOrNegative,
+
+ /// Widening is performance neutral as far as the cycles spent in check
+ /// conditions goes (but can still help, e.g., code layout, having less
+ /// deopt state).
+ WS_Neutral,
+
+ /// Widening is profitable.
+ WS_Positive,
+
+ /// Widening is very profitable. Not significantly different from \c
+ /// WS_Positive, except by the order.
+ WS_VeryPositive
+ };
----------------
Your enum is defined in a class, I think you can forgo the WS prefix if you'd like.
================
Comment at: lib/Transforms/Scalar/GuardWidening.cpp:185-186
@@ +184,4 @@
+ for (auto &I : *BB)
+ if (auto *II = dyn_cast<IntrinsicInst>(&I))
+ if (II->getIntrinsicID() == Intrinsic::experimental_guard)
+ CurrentList.push_back(II);
----------------
`match(&I, m_Intrinsic<Intrinsic::experimental_guard>())` ?
================
Comment at: lib/Transforms/Scalar/GuardWidening.cpp:357-358
@@ +356,4 @@
+
+ IRBuilder<> B(InsertPt);
+ Result = B.CreateAnd(Cond0, Cond1, "wide.chk");
+ }
----------------
Is this saving anything over `BinaryOperator::CreateAnd(Cond0, Cond1, "wide.chk", InsertPt);`?
http://reviews.llvm.org/D20143
More information about the llvm-commits
mailing list