Remove redundant initialization of Optional (NFC)

This commit is contained in:
Kazu Hirata 2022-08-20 21:18:28 -07:00
parent 06b551c944
commit 258531b7ac
47 changed files with 58 additions and 58 deletions

View File

@ -1648,7 +1648,7 @@ void BinaryContext::preprocessDebugInfo() {
uint16_t DwarfVersion = LineTable->Prologue.getVersion();
if (DwarfVersion >= 5) {
Optional<MD5::MD5Result> Checksum = None;
Optional<MD5::MD5Result> Checksum;
if (LineTable->Prologue.ContentTypes.HasMD5)
Checksum = LineTable->Prologue.FileNames[0].Checksum;
Optional<const char *> Name =
@ -1686,7 +1686,7 @@ void BinaryContext::preprocessDebugInfo() {
if (Optional<const char *> FName = dwarf::toString(FileNames[I].Name))
FileName = *FName;
assert(FileName != "");
Optional<MD5::MD5Result> Checksum = None;
Optional<MD5::MD5Result> Checksum;
if (DwarfVersion >= 5 && LineTable->Prologue.ContentTypes.HasMD5)
Checksum = LineTable->Prologue.FileNames[I].Checksum;
cantFail(

View File

@ -1890,8 +1890,8 @@ void DWARFRewriter::convertToRangesPatchDebugInfo(
DWARFDie DIE, uint64_t RangesSectionOffset,
SimpleBinaryPatcher &DebugInfoPatcher, uint64_t LowPCToUse,
Optional<uint64_t> RangesBase) {
Optional<AttrInfo> LowPCVal = None;
Optional<AttrInfo> HighPCVal = None;
Optional<AttrInfo> LowPCVal;
Optional<AttrInfo> HighPCVal;
getRangeAttrData(DIE, LowPCVal, HighPCVal);
uint64_t LowPCOffset = LowPCVal->Offset;
uint64_t HighPCOffset = HighPCVal->Offset;

View File

@ -79,7 +79,7 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) {
return;
QualType TypePtr = MatchedDecl->getType();
llvm::Optional<const char *> InitializationString = llvm::None;
llvm::Optional<const char *> InitializationString;
bool AddMathInclude = false;
if (TypePtr->isEnumeralType())

View File

@ -352,7 +352,7 @@ IncludeInserter::calculateIncludePath(const HeaderFile &InsertedHeader,
llvm::Optional<TextEdit>
IncludeInserter::insert(llvm::StringRef VerbatimHeader) const {
llvm::Optional<TextEdit> Edit = None;
llvm::Optional<TextEdit> Edit;
if (auto Insertion = Inserter.insert(VerbatimHeader.trim("\"<>"),
VerbatimHeader.startswith("<")))
Edit = replacementToEdit(Code, *Insertion);

View File

@ -3325,7 +3325,7 @@ reformat(const FormatStyle &Style, StringRef Code,
NextStartColumn, LastStartColumn);
if (!Env)
return {};
llvm::Optional<std::string> CurrentCode = None;
llvm::Optional<std::string> CurrentCode;
tooling::Replacements Fixes;
unsigned Penalty = 0;
for (size_t I = 0, E = Passes.size(); I < E; ++I) {

View File

@ -66,7 +66,7 @@ std::pair<tooling::Replacements, unsigned> QualifierAlignmentFixer::analyze(
NextStartColumn, LastStartColumn);
if (!Env)
return {};
llvm::Optional<std::string> CurrentCode = None;
llvm::Optional<std::string> CurrentCode;
tooling::Replacements Fixes;
for (size_t I = 0, E = Passes.size(); I < E; ++I) {
std::pair<tooling::Replacements, unsigned> PassFixes = Passes[I](*Env);

View File

@ -705,7 +705,7 @@ void FilterAndStoreDiagnosticConsumer::HandleDiagnostic(
}
if (StandaloneDiags) {
llvm::Optional<StoredDiagnostic> StoredDiag = None;
llvm::Optional<StoredDiagnostic> StoredDiag;
if (!ResultDiag) {
StoredDiag.emplace(Level, Info);
ResultDiag = StoredDiag.getPointer();

View File

@ -291,7 +291,7 @@ static Optional<StringRef> findSimilarStr(
size_t Length = LHS.size();
size_t MaxDist = Length < 3 ? Length - 1 : Length / 3;
Optional<std::pair<StringRef, size_t>> SimilarStr = None;
Optional<std::pair<StringRef, size_t>> SimilarStr;
for (StringRef C : Candidates) {
size_t CurDist = LHS.edit_distance(C, true);
if (CurDist <= MaxDist) {

View File

@ -1728,7 +1728,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
// Handle /opt.
bool doGC = debug == DebugKind::None || args.hasArg(OPT_profile);
Optional<ICFLevel> icfLevel = None;
Optional<ICFLevel> icfLevel;
if (args.hasArg(OPT_profile))
icfLevel = ICFLevel::None;
unsigned tailMerge = 1;

View File

@ -357,7 +357,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
offset_t offset = start_offset;
llvm::Optional<MemoryTagMap> memory_tag_map = llvm::None;
llvm::Optional<MemoryTagMap> memory_tag_map;
if (show_memory_tags && base_addr != LLDB_INVALID_ADDRESS)
memory_tag_map =
GetMemoryTags(base_addr, DE.GetByteSize() - offset, exe_scope);

View File

@ -384,7 +384,7 @@ InstructionLengthDecode(const uint8_t *inst_bytes, int bytes_len,
lldb::InstructionControlFlowKind GetControlFlowKind(bool is_exec_mode_64b,
Opcode m_opcode) {
llvm::Optional<InstructionOpcodeAndModrm> ret = llvm::None;
llvm::Optional<InstructionOpcodeAndModrm> ret;
if (m_opcode.GetOpcodeBytes() == nullptr || m_opcode.GetByteSize() <= 0) {
// x86_64 and i386 instructions are categorized as Opcode::Type::eTypeBytes

View File

@ -505,7 +505,7 @@ CPlusPlusNameParser::ParseFullNameImpl() {
Bookmark start_position = SetBookmark();
State state = State::Beginning;
bool continue_parsing = true;
Optional<size_t> last_coloncolon_position = None;
Optional<size_t> last_coloncolon_position;
while (continue_parsing && HasMoreTokens()) {
const auto &token = Peek();

View File

@ -92,7 +92,7 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
return false;
}
llvm::Optional<llvm::Reloc::Model> reloc_model = llvm::None;
llvm::Optional<llvm::Reloc::Model> reloc_model;
assert(m_process_ptr && "no available lldb process");
switch (m_process_ptr->GetTarget().GetArchitecture().GetMachine()) {
case llvm::Triple::ArchType::x86:

View File

@ -25,7 +25,7 @@ size_t HTRBlockMetadata::GetNumInstructions() const {
llvm::Optional<llvm::StringRef>
HTRBlockMetadata::GetMostFrequentlyCalledFunction() const {
size_t max_ncalls = 0;
llvm::Optional<llvm::StringRef> max_name = llvm::None;
llvm::Optional<llvm::StringRef> max_name;
for (const auto &it : m_func_calls) {
ConstString name = it.first;
size_t ncalls = it.second;
@ -316,7 +316,7 @@ HTRBlockLayerUP lldb_private::BasicSuperBlockMerge(IHTRLayer &layer) {
// Each super block always has the same first unit (we call this the
// super block head) This gurantee allows us to use the super block head as
// the unique key mapping to the super block it begins
llvm::Optional<size_t> superblock_head = llvm::None;
llvm::Optional<size_t> superblock_head;
auto construct_next_layer = [&](size_t merge_start, size_t n) -> void {
if (!superblock_head)
return;

View File

@ -4374,7 +4374,7 @@ void TargetProperties::CheckJITObjectsDir() {
else if (!writable)
os << "is not writable";
llvm::Optional<lldb::user_id_t> debugger_id = llvm::None;
llvm::Optional<lldb::user_id_t> debugger_id;
if (m_target)
debugger_id = m_target->GetDebugger().GetID();
Debugger::ReportError(os.str(), debugger_id);

View File

@ -8086,7 +8086,7 @@ unsigned ScalarEvolution::getSmallConstantTripMultiple(const Loop *L) {
SmallVector<BasicBlock *, 8> ExitingBlocks;
L->getExitingBlocks(ExitingBlocks);
Optional<unsigned> Res = None;
Optional<unsigned> Res;
for (auto *ExitingBB : ExitingBlocks) {
unsigned Multiple = getSmallConstantTripMultiple(L, ExitingBB);
if (!Res)
@ -10049,7 +10049,7 @@ SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec,
<< Bound << " (before multiplying by " << M << ")\n");
Bound *= M; // The quadratic equation multiplier.
Optional<APInt> SO = None;
Optional<APInt> SO;
if (BitWidth > 1) {
LLVM_DEBUG(dbgs() << "SolveQuadraticAddRecRange: solving for "
"signed overflow\n");

View File

@ -761,7 +761,7 @@ Error BitcodeAnalyzer::parseBlock(unsigned BlockID, unsigned IndentLevel,
// Keep it for later, when we see a MODULE_HASH record
uint64_t BlockEntryPos = Stream.getCurrentByteNo();
Optional<const char *> BlockName = None;
Optional<const char *> BlockName;
if (DumpRecords) {
O->OS << Indent << "<";
if ((BlockName = GetBlockName(BlockID, BlockInfo, CurStreamType)))

View File

@ -494,7 +494,7 @@ bool DwarfExpression::addExpression(
// and not any other parts of the following DWARF expression.
assert(!IsEmittingEntryValue && "Can't emit entry value around expression");
Optional<DIExpression::ExprOperand> PrevConvertOp = None;
Optional<DIExpression::ExprOperand> PrevConvertOp;
while (ExprCursor) {
auto Op = ExprCursor.take();

View File

@ -1841,7 +1841,7 @@ LegalizerHelper::widenScalarAddSubOverflow(MachineInstr &MI, unsigned TypeIdx,
LLT WideTy) {
unsigned Opcode;
unsigned ExtOpcode;
Optional<Register> CarryIn = None;
Optional<Register> CarryIn;
switch (MI.getOpcode()) {
default:
llvm_unreachable("Unexpected opcode!");

View File

@ -1029,7 +1029,7 @@ Optional<ValueAndVReg> getAnyConstantSplat(Register VReg,
if (!isBuildVectorOp(MI->getOpcode()))
return None;
Optional<ValueAndVReg> SplatValAndReg = None;
Optional<ValueAndVReg> SplatValAndReg;
for (MachineOperand &Op : MI->uses()) {
Register Element = Op.getReg();
auto ElementValAndReg =

View File

@ -553,7 +553,7 @@ public:
// Examine the remaining variable locations: if we can find the same value
// again, we can recover the location.
Optional<LocIdx> NewLoc = None;
Optional<LocIdx> NewLoc;
for (auto Loc : MTracker->locations())
if (Loc.Value == OldValue)
NewLoc = Loc.Idx;
@ -1145,7 +1145,7 @@ bool InstrRefBasedLDV::transferDebugInstrRef(MachineInstr &MI,
// Default machine value number is <None> -- if no instruction defines
// the corresponding value, it must have been optimized out.
Optional<ValueIDNum> NewID = None;
Optional<ValueIDNum> NewID;
// Try to lookup the instruction number, and find the machine value number
// that it defines. It could be an instruction, or a PHI.
@ -1278,7 +1278,7 @@ bool InstrRefBasedLDV::transferDebugInstrRef(MachineInstr &MI,
// Pick a location for the machine value number, if such a location exists.
// (This information could be stored in TransferTracker to make it faster).
Optional<LocIdx> FoundLoc = None;
Optional<LocIdx> FoundLoc;
for (auto Location : MTracker->locations()) {
LocIdx CurL = Location.Idx;
ValueIDNum ID = MTracker->readMLoc(CurL);

View File

@ -926,7 +926,7 @@ Optional<uint64_t> SelectOptimize::computeInstCost(const Instruction *I) {
TTI->getInstructionCost(I, TargetTransformInfo::TCK_Latency);
if (auto OC = ICost.getValue())
return Optional<uint64_t>(*OC);
return Optional<uint64_t>(None);
return Optional<uint64_t>();
}
ScaledNumber<uint64_t>

View File

@ -10489,7 +10489,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
ValueVTs);
MVT VT = ValueVTs[0].getSimpleVT();
MVT RegVT = TLI->getRegisterType(*CurDAG->getContext(), VT);
Optional<ISD::NodeType> AssertOp = None;
Optional<ISD::NodeType> AssertOp;
SDValue ArgValue = getCopyFromParts(DAG, dl, &InVals[0], 1, RegVT, VT,
nullptr, F.getCallingConv(), AssertOp);

View File

@ -197,7 +197,7 @@ static Optional<int> findPreviousSpillSlot(const Value *Val,
// All incoming values should have same known stack slot, otherwise result
// is unknown.
if (const PHINode *Phi = dyn_cast<PHINode>(Val)) {
Optional<int> MergedResult = None;
Optional<int> MergedResult;
for (const auto &IncomingValue : Phi->incoming_values()) {
Optional<int> SpillSlot =

View File

@ -75,7 +75,7 @@ public:
SourceCode(
StringRef FileName, int64_t Line, int Lines,
const Optional<StringRef> &EmbeddedSource = Optional<StringRef>(None))
const Optional<StringRef> &EmbeddedSource = Optional<StringRef>())
: Line(Line), Lines(Lines),
FirstLine(std::max(static_cast<int64_t>(1), Line - Lines / 2)),
LastLine(FirstLine + Lines - 1),

View File

@ -34,7 +34,7 @@ Optional<RoundingMode> convertStrToRoundingMode(StringRef RoundingArg) {
}
Optional<StringRef> convertRoundingModeToStr(RoundingMode UseRounding) {
Optional<StringRef> RoundingStr = None;
Optional<StringRef> RoundingStr;
switch (UseRounding) {
case RoundingMode::Dynamic:
RoundingStr = "round.dynamic";
@ -71,7 +71,7 @@ convertStrToExceptionBehavior(StringRef ExceptionArg) {
Optional<StringRef>
convertExceptionBehaviorToStr(fp::ExceptionBehavior UseExcept) {
Optional<StringRef> ExceptStr = None;
Optional<StringRef> ExceptStr;
switch (UseExcept) {
case fp::ebStrict:
ExceptStr = "fpexcept.strict";

View File

@ -207,7 +207,7 @@ createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) {
for (const std::string &A : Conf.MAttrs)
Features.AddFeature(A);
Optional<Reloc::Model> RelocModel = None;
Optional<Reloc::Model> RelocModel;
if (Conf.RelocModel)
RelocModel = *Conf.RelocModel;
else if (M.getModuleFlag("PIC Level"))

View File

@ -624,7 +624,7 @@ ELFObjectFileBase::getPltAddresses() const {
T->createMCInstrAnalysis(MII.get()));
if (!MIA)
return {};
Optional<SectionRef> Plt = None, RelaPlt = None, GotPlt = None;
Optional<SectionRef> Plt, RelaPlt, GotPlt;
for (const SectionRef &Section : sections()) {
Expected<StringRef> NameOrErr = Section.getName();
if (!NameOrErr) {

View File

@ -80,7 +80,7 @@ Error RemarkLinker::link(StringRef Buffer, Optional<Format> RemarkFormat) {
createRemarkParserFromMeta(
*RemarkFormat, Buffer, /*StrTab=*/None,
PrependPath ? Optional<StringRef>(StringRef(*PrependPath))
: Optional<StringRef>(None));
: Optional<StringRef>());
if (!MaybeParser)
return MaybeParser.takeError();

View File

@ -81,7 +81,7 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const {
// main thread (8MB) before creation.
const llvm::Optional<unsigned> llvm::thread::DefaultStackSize = 8 * 1024 * 1024;
#else
const llvm::Optional<unsigned> llvm::thread::DefaultStackSize = None;
const llvm::Optional<unsigned> llvm::thread::DefaultStackSize;
#endif

View File

@ -1522,7 +1522,7 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I,
int OffsetStride = IsUnscaled ? TII->getMemScale(FirstMI) : 1;
bool IsPromotableZeroStore = isPromotableZeroStoreInst(FirstMI);
Optional<bool> MaybeCanRename = None;
Optional<bool> MaybeCanRename;
if (!EnableRenaming)
MaybeCanRename = {false};

View File

@ -212,7 +212,7 @@ void X86DynAllocaExpander::lower(MachineInstr *MI, Lowering L) {
bool Is64BitAlloca = MI->getOpcode() == X86::DYN_ALLOCA_64;
assert(SlotSize == 4 || SlotSize == 8);
Optional<MachineFunction::DebugInstrOperandPair> InstrNum = None;
Optional<MachineFunction::DebugInstrOperandPair> InstrNum;
if (unsigned Num = MI->peekDebugInstrNum()) {
// Operand 2 of DYN_ALLOCAs contains the stack def.
InstrNum = {Num, 2};

View File

@ -2671,7 +2671,7 @@ void IROutliner::updateOutputMapping(OutlinableRegion &Region,
LoadInst *LI) {
// For and load instructions following the call
Value *Operand = LI->getPointerOperand();
Optional<unsigned> OutputIdx = None;
Optional<unsigned> OutputIdx;
// Find if the operand it is an output register.
for (unsigned ArgIdx = Region.NumExtractedInputs;
ArgIdx < Region.Call->arg_size(); ArgIdx++) {

View File

@ -101,7 +101,7 @@ PreservedAnalyses SyntheticCountsPropagation::run(Module &M,
// parameter.
auto GetCallSiteProfCount = [&](const CallGraphNode *,
const CallGraphNode::CallRecord &Edge) {
Optional<Scaled64> Res = None;
Optional<Scaled64> Res;
if (!Edge.first)
return Res;
CallBase &CB = *cast<CallBase>(*Edge.first);

View File

@ -534,7 +534,7 @@ void ConstantHoistingPass::collectConstantCandidates(Function &Fn) {
// represented in uint64 we return an "empty" APInt. This is then interpreted
// as the value is not in range.
static Optional<APInt> calculateOffsetDiff(const APInt &V1, const APInt &V2) {
Optional<APInt> Res = None;
Optional<APInt> Res;
unsigned BW = V1.getBitWidth() > V2.getBitWidth() ?
V1.getBitWidth() : V2.getBitWidth();
uint64_t LimVal1 = V1.getLimitedValue();

View File

@ -743,7 +743,7 @@ private:
return {false, None};
}
Optional<unsigned> Difference = None;
Optional<unsigned> Difference;
int Diff = TC0 - TC1;
if (Diff > 0)

View File

@ -134,7 +134,7 @@ static Optional<unsigned> calculateIterationsToInvariance(
// Place infinity to map to avoid infinite recursion for cycled Phis. Such
// cycles can never stop on an invariant.
IterationsToInvariance[Phi] = None;
Optional<unsigned> ToInvariance = None;
Optional<unsigned> ToInvariance;
if (L->isLoopInvariant(Input))
ToInvariance = 1u;

View File

@ -2027,7 +2027,7 @@ public:
LookAheadHeuristics LookAhead(*DL, *SE, *this, /*NumLanes=*/2,
RootLookAheadMaxDepth);
int BestScore = Limit;
Optional<int> Index = None;
Optional<int> Index;
for (int I : seq<int>(0, Candidates.size())) {
int Score = LookAhead.getScoreAtLevelRec(Candidates[I].first,
Candidates[I].second,

View File

@ -123,7 +123,7 @@ int main(int argc, char **argv) {
O.DumpBlockinfo = DumpBlockinfo;
ExitOnErr(BA.analyze(
Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(None),
Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(),
CheckHash.empty() ? None : Optional<StringRef>(CheckHash)));
if (Dump)

View File

@ -891,7 +891,7 @@ addMissingWasmCodeSymbols(const WasmObjectFile &Obj,
static void addPltEntries(const ObjectFile &Obj,
std::map<SectionRef, SectionSymbolsTy> &AllSymbols,
StringSaver &Saver) {
Optional<SectionRef> Plt = None;
Optional<SectionRef> Plt;
for (const SectionRef &Section : Obj.sections()) {
Expected<StringRef> SecNameOrErr = Section.getName();
if (!SecNameOrErr) {

View File

@ -7078,7 +7078,7 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printBBAddrMaps() {
Sec.sh_type != SHT_LLVM_BB_ADDR_MAP_V0) {
continue;
}
Optional<const Elf_Shdr *> FunctionSec = None;
Optional<const Elf_Shdr *> FunctionSec;
if (IsRelocatable)
FunctionSec =
unwrapOrError(this->FileName, this->Obj.getSection(Sec.sh_link));

View File

@ -100,7 +100,7 @@ struct InstRegexOp : public SetTheory::Operator {
if (removeParens(Original).find_first_of("|?") != std::string::npos)
FirstMeta = 0;
Optional<Regex> Regexpr = None;
Optional<Regex> Regexpr;
StringRef Prefix = Original.substr(0, FirstMeta);
StringRef PatStr = Original.substr(FirstMeta);
if (!PatStr.empty()) {

View File

@ -4536,7 +4536,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderer(
if (ChildTypes.size() != 1)
return failedImport("Dst pattern child has multiple results");
Optional<LLTCodeGen> OpTyOrNone = None;
Optional<LLTCodeGen> OpTyOrNone;
if (ChildTypes.front().isMachineValueType())
OpTyOrNone = MVTToLLT(ChildTypes.front().getMachineValueType().SimpleTy);
if (!OpTyOrNone)
@ -4968,7 +4968,7 @@ Error GlobalISelEmitter::importDefaultOperandRenderers(
action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder,
DagInit *DefaultOps) const {
for (const auto *DefaultOp : DefaultOps->getArgs()) {
Optional<LLTCodeGen> OpTyOrNone = None;
Optional<LLTCodeGen> OpTyOrNone;
// Look through ValueType operators.
if (const DagInit *DefaultDagOp = dyn_cast<DagInit>(DefaultOp)) {

View File

@ -1455,7 +1455,7 @@ Optional<int64_t> IntegerRelation::getConstantBoundOnDimSize(
/*eqIndices=*/nullptr, /*offset=*/0,
/*num=*/getNumDimVars());
Optional<int64_t> minDiff = None;
Optional<int64_t> minDiff;
unsigned minLbPosition = 0, minUbPosition = 0;
for (auto ubPos : ubIndices) {
for (auto lbPos : lbIndices) {
@ -1538,7 +1538,7 @@ IntegerRelation::computeConstantLowerOrUpperBound(unsigned pos) {
// If it doesn't, there isn't a bound on it.
return None;
Optional<int64_t> minOrMaxConst = None;
Optional<int64_t> minOrMaxConst;
// Take the max across all const lower bounds (or min across all constant
// upper bounds).

View File

@ -46,7 +46,7 @@ MlirLogicalResult mlirInferTypeOpInterfaceInferReturnTypes(
if (!info)
return mlirLogicalResultFailure();
llvm::Optional<Location> maybeLocation = llvm::None;
llvm::Optional<Location> maybeLocation;
if (!mlirLocationIsNull(location))
maybeLocation = unwrap(location);
SmallVector<Value> unwrappedOperands;

View File

@ -1124,10 +1124,10 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst,
// loop nest at 'dstLoopDepth'.
uint64_t minFusedLoopNestComputeCost = std::numeric_limits<uint64_t>::max();
double maxStorageReduction = 0.0;
Optional<uint64_t> sliceMemEstimate = None;
Optional<uint64_t> sliceMemEstimate;
// The best loop depth at which to materialize the slice.
Optional<unsigned> bestDstLoopDepth = None;
Optional<unsigned> bestDstLoopDepth;
// Compute op instance count for the src loop nest without iteration slicing.
uint64_t srcLoopNestCost = getComputeCost(srcLoopIVs[0], srcLoopNestStats);
@ -1260,7 +1260,7 @@ static bool isFusionProfitable(Operation *srcOpInst, Operation *srcStoreOpInst,
auto dstMemSize = getMemoryFootprintBytes(dstForOp);
auto srcMemSize = getMemoryFootprintBytes(srcLoopIVs[0]);
Optional<double> storageReduction = None;
Optional<double> storageReduction;
if (!dstMemSize || !srcMemSize) {
LLVM_DEBUG(llvm::dbgs()

View File

@ -586,7 +586,7 @@ bufferization::getBufferType(Value value, const BufferizationOptions &options) {
// Check value is a new buffer allocation with a memory space attribute. In
// that case we can at least infer the memory space.
Optional<unsigned> memorySpace = None;
Optional<unsigned> memorySpace;
if (auto opResult = value.dyn_cast<OpResult>()) {
if (auto bufferizableOp =
options.dynCastBufferizableOp(opResult.getDefiningOp())) {