forked from OSchip/llvm-project
[IndVars] Extend diagnostic -replexitval flag w/ability to bypass hard use hueristic
Note: This does mean that "always" is now more powerful than it was. llvm-svn: 363196
This commit is contained in:
parent
b05ce7f9f7
commit
ae2581cef3
|
@ -100,7 +100,7 @@ static cl::opt<bool> VerifyIndvars(
|
||||||
"verify-indvars", cl::Hidden,
|
"verify-indvars", cl::Hidden,
|
||||||
cl::desc("Verify the ScalarEvolution result after running indvars"));
|
cl::desc("Verify the ScalarEvolution result after running indvars"));
|
||||||
|
|
||||||
enum ReplaceExitVal { NeverRepl, OnlyCheapRepl, AlwaysRepl };
|
enum ReplaceExitVal { NeverRepl, OnlyCheapRepl, NoHardUse, AlwaysRepl };
|
||||||
|
|
||||||
static cl::opt<ReplaceExitVal> ReplaceExitValue(
|
static cl::opt<ReplaceExitVal> ReplaceExitValue(
|
||||||
"replexitval", cl::Hidden, cl::init(OnlyCheapRepl),
|
"replexitval", cl::Hidden, cl::init(OnlyCheapRepl),
|
||||||
|
@ -108,6 +108,8 @@ static cl::opt<ReplaceExitVal> ReplaceExitValue(
|
||||||
cl::values(clEnumValN(NeverRepl, "never", "never replace exit value"),
|
cl::values(clEnumValN(NeverRepl, "never", "never replace exit value"),
|
||||||
clEnumValN(OnlyCheapRepl, "cheap",
|
clEnumValN(OnlyCheapRepl, "cheap",
|
||||||
"only replace exit value when the cost is cheap"),
|
"only replace exit value when the cost is cheap"),
|
||||||
|
clEnumValN(NoHardUse, "noharduse",
|
||||||
|
"only replace exit values when loop def likely dead"),
|
||||||
clEnumValN(AlwaysRepl, "always",
|
clEnumValN(AlwaysRepl, "always",
|
||||||
"always replace exit value whenever possible")));
|
"always replace exit value whenever possible")));
|
||||||
|
|
||||||
|
@ -632,7 +634,8 @@ bool IndVarSimplify::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) {
|
||||||
// Computing the value outside of the loop brings no benefit if it is
|
// Computing the value outside of the loop brings no benefit if it is
|
||||||
// definitely used inside the loop in a way which can not be optimized
|
// definitely used inside the loop in a way which can not be optimized
|
||||||
// away.
|
// away.
|
||||||
if (!isa<SCEVConstant>(ExitValue) && hasHardUserWithinLoop(L, Inst))
|
if (ReplaceExitValue != AlwaysRepl &&
|
||||||
|
!isa<SCEVConstant>(ExitValue) && hasHardUserWithinLoop(L, Inst))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool HighCost = Rewriter.isHighCostExpansion(ExitValue, L, Inst);
|
bool HighCost = Rewriter.isHighCostExpansion(ExitValue, L, Inst);
|
||||||
|
|
Loading…
Reference in New Issue