Commit 386b52ed by Jim Stichnoth

Subzero: Use Cfg::getOptLevel() instead of ClFlags version.

The opt level (O2 versus Om1) should be tested using Cfg::getOptLevel() instead of getFlags().getOptLevel() whenever possible. This is because if you run "-Om1 -force-O2=foo", and you're compiling foo, the first form tells you O2 while the second form tells you Om1. BUG= none R=eholk@chromium.org Review URL: https://codereview.chromium.org/2210773002 .
parent 35e16002
...@@ -915,7 +915,7 @@ InstCall *TargetLowering::makeHelperCall(RuntimeHelper FuncID, Variable *Dest, ...@@ -915,7 +915,7 @@ InstCall *TargetLowering::makeHelperCall(RuntimeHelper FuncID, Variable *Dest,
} }
bool TargetLowering::shouldOptimizeMemIntrins() { bool TargetLowering::shouldOptimizeMemIntrins() {
return getFlags().getOptLevel() >= Opt_1 || getFlags().getForceMemIntrinOpt(); return Func->getOptLevel() >= Opt_1 || getFlags().getForceMemIntrinOpt();
} }
void TargetLowering::scalarizeArithmetic(InstArithmetic::OpKind Kind, void TargetLowering::scalarizeArithmetic(InstArithmetic::OpKind Kind,
......
...@@ -2222,7 +2222,7 @@ void TargetARM32::lowerAlloca(const InstAlloca *Instr) { ...@@ -2222,7 +2222,7 @@ void TargetARM32::lowerAlloca(const InstAlloca *Instr) {
const uint32_t Alignment = const uint32_t Alignment =
std::max(AlignmentParam, ARM32_STACK_ALIGNMENT_BYTES); std::max(AlignmentParam, ARM32_STACK_ALIGNMENT_BYTES);
const bool OverAligned = Alignment > ARM32_STACK_ALIGNMENT_BYTES; const bool OverAligned = Alignment > ARM32_STACK_ALIGNMENT_BYTES;
const bool OptM1 = getFlags().getOptLevel() == Opt_m1; const bool OptM1 = Func->getOptLevel() == Opt_m1;
const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset(); const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset();
const bool UseFramePointer = const bool UseFramePointer =
hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1; hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1;
...@@ -3326,7 +3326,7 @@ void TargetARM32::lowerArithmetic(const InstArithmetic *Instr) { ...@@ -3326,7 +3326,7 @@ void TargetARM32::lowerArithmetic(const InstArithmetic *Instr) {
return; return;
} }
case InstArithmetic::Mul: { case InstArithmetic::Mul: {
const bool OptM1 = getFlags().getOptLevel() == Opt_m1; const bool OptM1 = Func->getOptLevel() == Opt_m1;
if (!OptM1 && Srcs.hasConstOperand()) { if (!OptM1 && Srcs.hasConstOperand()) {
constexpr std::size_t MaxShifts = 4; constexpr std::size_t MaxShifts = 4;
std::array<StrengthReduction::AggregationElement, MaxShifts> Shifts; std::array<StrengthReduction::AggregationElement, MaxShifts> Shifts;
...@@ -6372,7 +6372,7 @@ void TargetARM32::alignRegisterPow2(Variable *Reg, uint32_t Align, ...@@ -6372,7 +6372,7 @@ void TargetARM32::alignRegisterPow2(Variable *Reg, uint32_t Align,
} }
void TargetARM32::postLower() { void TargetARM32::postLower() {
if (getFlags().getOptLevel() == Opt_m1) if (Func->getOptLevel() == Opt_m1)
return; return;
markRedefinitions(); markRedefinitions();
Context.availabilityUpdate(); Context.availabilityUpdate();
......
...@@ -1229,7 +1229,7 @@ void TargetMIPS32::lowerAlloca(const InstAlloca *Instr) { ...@@ -1229,7 +1229,7 @@ void TargetMIPS32::lowerAlloca(const InstAlloca *Instr) {
const uint32_t Alignment = const uint32_t Alignment =
std::max(AlignmentParam, MIPS32_STACK_ALIGNMENT_BYTES); std::max(AlignmentParam, MIPS32_STACK_ALIGNMENT_BYTES);
const bool OverAligned = Alignment > MIPS32_STACK_ALIGNMENT_BYTES; const bool OverAligned = Alignment > MIPS32_STACK_ALIGNMENT_BYTES;
const bool OptM1 = getFlags().getOptLevel() == Opt_m1; const bool OptM1 = Func->getOptLevel() == Opt_m1;
const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset(); const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset();
const bool UseFramePointer = const bool UseFramePointer =
hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1; hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1;
...@@ -2334,7 +2334,7 @@ void TargetMIPS32::prelowerPhis() { ...@@ -2334,7 +2334,7 @@ void TargetMIPS32::prelowerPhis() {
} }
void TargetMIPS32::postLower() { void TargetMIPS32::postLower() {
if (getFlags().getOptLevel() == Opt_m1) if (Func->getOptLevel() == Opt_m1)
return; return;
// TODO(rkotler): Find two-address non-SSA instructions where Dest==Src0, // TODO(rkotler): Find two-address non-SSA instructions where Dest==Src0,
// and set the IsDestRedefined flag to keep liveness analysis consistent. // and set the IsDestRedefined flag to keep liveness analysis consistent.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment