Integrate LLVM at llvm/llvm-project@c50faffb4eec Updates LLVM usage to match [c50faffb4eec](https://github.com/llvm/llvm-project/commit/c50faffb4eec) PiperOrigin-RevId: 393825475
diff --git a/SUBMODULE_VERSIONS.txt b/SUBMODULE_VERSIONS.txt index 8af113a..9584d61 100644 --- a/SUBMODULE_VERSIONS.txt +++ b/SUBMODULE_VERSIONS.txt
@@ -4,7 +4,7 @@ aa533abfd4232b01f9e57041d70114d5a77e6de0 third_party/googletest 88b845dee001723c4a0db1fe5477de735b6d3bb0 third_party/liburing acd6f6f014c25e46363e718381e0b35205df2d83 third_party/libyaml -3383ec5fdd04be095678e0bd8bd1ce341f4f9294 third_party/llvm-project +c50faffb4eeca004109a1591e56cd7cac2ed1083 third_party/llvm-project 21edc2e26a736871748c4ddd8acfb6bfb0da9041 third_party/mlir-hlo 3f701faace7addc75d16dea8a6cd769fa5b3f260 third_party/musl 4c7697dbe973ed01ae6fbec37d186ebd05982e1f third_party/pybind11
diff --git a/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp b/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp index 586b289..3f17b8e 100644 --- a/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp +++ b/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp
@@ -62,14 +62,17 @@ // name in its public definition. auto publicName = entryFuncOp.getName().str(); auto privateName = "_" + publicName; - entryFuncOp.setName(privateName); + mlir::StringAttr privateNameAttr = + mlir::StringAttr::get(entryFuncOp.getContext(), privateName); + entryFuncOp.setName(privateNameAttr); entryFuncOp.setPrivate(); // Create the wrapper function that conforms to the IREE native ABI and // marshals arguments/results to the original function. auto wrapperFuncOp = createWrapperFunc(entryFuncOp); wrapperFuncOp.setPublic(); - wrapperFuncOp.setName(publicName); + wrapperFuncOp.setName( + mlir::StringAttr::get(entryFuncOp.getContext(), publicName)); moduleOp.insert(Block::iterator(entryFuncOp), wrapperFuncOp); wrapperFuncOp.getOperation()->setAttr("iree.abi.stub",
diff --git a/iree/compiler/Bindings/TFLite/Transforms/MaterializeShapeSupport.cpp b/iree/compiler/Bindings/TFLite/Transforms/MaterializeShapeSupport.cpp index 3ff5296..8327bf6 100644 --- a/iree/compiler/Bindings/TFLite/Transforms/MaterializeShapeSupport.cpp +++ b/iree/compiler/Bindings/TFLite/Transforms/MaterializeShapeSupport.cpp
@@ -181,7 +181,9 @@ IREE::Util::GlobalOp dirtyGlobalOp, OpBuilder &moduleBuilder) { // Clone the entire entry function with all its IR. auto calcFuncOp = cast<FuncOp>(moduleBuilder.clone(*funcOp.getOperation())); - calcFuncOp.setName(namePrefix.str() + "_calculate_shapes"); + mlir::StringAttr nameAttr = mlir::StringAttr::get( + loc.getContext(), namePrefix.str() + "_calculate_shapes"); + calcFuncOp.setName(nameAttr); calcFuncOp.setPrivate(); // TODO(benvanik): find a better way to strip these attributes. calcFuncOp->removeAttr("iree.abi.stub");
diff --git a/iree/compiler/Dialect/Flow/IR/FlowOps.cpp b/iree/compiler/Dialect/Flow/IR/FlowOps.cpp index 1d8a835..c2440e6 100644 --- a/iree/compiler/Dialect/Flow/IR/FlowOps.cpp +++ b/iree/compiler/Dialect/Flow/IR/FlowOps.cpp
@@ -647,7 +647,7 @@ })); } -StringRef DispatchOp::executable() { return entry_point().getRootReference(); } +StringAttr DispatchOp::executable() { return entry_point().getRootReference(); } FunctionType DispatchOp::getEntryPointType() { SmallVector<Type, 8> argTypes(operand_type_range{operands()});
diff --git a/iree/compiler/Dialect/Flow/IR/FlowOps.td b/iree/compiler/Dialect/Flow/IR/FlowOps.td index ee24714..09e1dfc 100644 --- a/iree/compiler/Dialect/Flow/IR/FlowOps.td +++ b/iree/compiler/Dialect/Flow/IR/FlowOps.td
@@ -561,7 +561,7 @@ ]; let extraClassDeclaration = [{ - StringRef executable(); + StringAttr executable(); FunctionType getEntryPointType(); // StreamableOpInterface:
diff --git a/iree/compiler/Dialect/Flow/Transforms/InjectDispatchTracing.cpp b/iree/compiler/Dialect/Flow/Transforms/InjectDispatchTracing.cpp index 000a0df..2e7e475 100644 --- a/iree/compiler/Dialect/Flow/Transforms/InjectDispatchTracing.cpp +++ b/iree/compiler/Dialect/Flow/Transforms/InjectDispatchTracing.cpp
@@ -36,7 +36,7 @@ void runOnOperation() override { for (auto dispatchOp : getOperation().getOps<DispatchOp>()) { std::string entryPointName = - dispatchOp.entry_point().getRootReference().str(); + dispatchOp.entry_point().getRootReference().getValue().str(); for (FlatSymbolRefAttr nestedRef : dispatchOp.entry_point().getNestedReferences()) { entryPointName = (entryPointName + "::" + nestedRef.getValue()).str();
diff --git a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertStreamOps.cpp b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertStreamOps.cpp index 1cca4f8..9f4331f 100644 --- a/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertStreamOps.cpp +++ b/iree/compiler/Dialect/HAL/Conversion/FlowToHAL/ConvertStreamOps.cpp
@@ -574,7 +574,7 @@ auto tensorValue = subspanOp.result(); auto bufferValue = schedulingState.loadGlobal( IREE::HAL::BufferType::get(rewriter.getContext()), - subspanOp.runtime_buffer().getLeafReference(), rewriter); + subspanOp.runtime_buffer().getLeafReference().getValue(), rewriter); auto runtimeRange = subspanOp.runtime_range(); auto offsetValue = schedulingState.lookupOrCreateIndex(runtimeRange.getOffset(), rewriter); @@ -913,7 +913,8 @@ variantOp.getBlock().getOps<IREE::HAL::ExecutableEntryPointOp>(); auto entryPointIt = llvm::find_if(entryPointOps, [&](IREE::HAL::ExecutableEntryPointOp op) { - return op.getName() == dispatchOp.entry_point().getLeafReference(); + return op.getNameAttr() == + dispatchOp.entry_point().getLeafReference(); }); if (entryPointIt == entryPointOps.end()) { return variantOp.emitError()
diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToHAL/ConvertConstantOps.cpp b/iree/compiler/Dialect/HAL/Conversion/HALToHAL/ConvertConstantOps.cpp index 461af44..a4e6688 100644 --- a/iree/compiler/Dialect/HAL/Conversion/HALToHAL/ConvertConstantOps.cpp +++ b/iree/compiler/Dialect/HAL/Conversion/HALToHAL/ConvertConstantOps.cpp
@@ -25,7 +25,7 @@ ConversionPatternRewriter &rewriter) const override { auto bufferValue = rewriter.createOrFold<IREE::Util::GlobalLoadOp>( op.getLoc(), IREE::HAL::BufferType::get(rewriter.getContext()), - op.runtime_buffer().getLeafReference()); + op.runtime_buffer().getLeafReference().getValue()); auto offsetValue = rewriter.createOrFold<mlir::ConstantIndexOp>( op.getLoc(), op.runtime_range().getOffset()); auto lengthValue = rewriter.createOrFold<mlir::ConstantIndexOp>(
diff --git a/iree/compiler/Dialect/HAL/Conversion/HALToVM/ConvertConstantOps.cpp b/iree/compiler/Dialect/HAL/Conversion/HALToVM/ConvertConstantOps.cpp index 1746f4b..a493449 100644 --- a/iree/compiler/Dialect/HAL/Conversion/HALToVM/ConvertConstantOps.cpp +++ b/iree/compiler/Dialect/HAL/Conversion/HALToVM/ConvertConstantOps.cpp
@@ -43,9 +43,9 @@ ConversionPatternRewriter &rewriter) const override { // I don't like this, but I can't figure out what to do. // Matches the logic above. - auto rodataName = - (op.constant().getRootReference() + op.constant().getLeafReference()) - .str(); + auto rodataName = (op.constant().getRootReference().getValue() + + op.constant().getLeafReference().getValue()) + .str(); rewriter.replaceOpWithNewOp<IREE::VM::ConstRefRodataOp>(op, rodataName); return success(); }
diff --git a/iree/compiler/Dialect/HAL/Target/TargetBackend.cpp b/iree/compiler/Dialect/HAL/Target/TargetBackend.cpp index 70f50b6..b0ed628 100644 --- a/iree/compiler/Dialect/HAL/Target/TargetBackend.cpp +++ b/iree/compiler/Dialect/HAL/Target/TargetBackend.cpp
@@ -42,7 +42,7 @@ Operation *op, Operation *moduleOp, DenseMap<StringRef, Operation *> &targetSymbolMap, SymbolTable *optionalSymbolTable) { - StringRef originalName = SymbolTable::getSymbolName(op); + StringRef originalName = SymbolTable::getSymbolName(op).getValue(); // Iteratively try suffixes until we find one that isn't used. std::string disambiguatedName; @@ -56,7 +56,9 @@ SymbolTableCollection symbolTable; SymbolUserMap symbolUsers(symbolTable, moduleOp); - symbolUsers.replaceAllUsesWith(op, disambiguatedName); + mlir::StringAttr nameAttr = + mlir::StringAttr::get(op->getContext(), disambiguatedName); + symbolUsers.replaceAllUsesWith(op, nameAttr); SymbolTable::setSymbolName(op, disambiguatedName); } @@ -120,7 +122,7 @@ } } } - targetSymbolMap[SymbolTable::getSymbolName(op)] = op; + targetSymbolMap[SymbolTable::getSymbolName(op).getValue()] = op; } if (!targetBlock.empty() && targetBlock.back().hasTrait<OpTrait::IsTerminator>()) { @@ -195,8 +197,10 @@ if (!linkedInterfaceOp) { linkedInterfaceOp = dyn_cast<IREE::HAL::InterfaceOp>( linkedExecutableBuilder.clone(*sourceInterfaceOp)); - linkedInterfaceOp.setName( + mlir::StringAttr nameAttr = mlir::StringAttr::get( + linkedInterfaceOp.getContext(), llvm::formatv("io_{0}", linkedInterfaceOps.size()).str()); + linkedInterfaceOp.setName(nameAttr); linkedInterfaceOps.push_back(linkedInterfaceOp); }
diff --git a/iree/compiler/Dialect/HAL/Transforms/MaterializeConstantPoolBuffers.cpp b/iree/compiler/Dialect/HAL/Transforms/MaterializeConstantPoolBuffers.cpp index 552e2e3..db42861 100644 --- a/iree/compiler/Dialect/HAL/Transforms/MaterializeConstantPoolBuffers.cpp +++ b/iree/compiler/Dialect/HAL/Transforms/MaterializeConstantPoolBuffers.cpp
@@ -97,7 +97,8 @@ // uploading 1:1 today all the offsets are the same as their storage ones. auto variableSymRef = SymbolRefAttr::get(context, globalOp.getName()); for (auto spanOp : poolOp.getOps<ConstantPoolSpanOp>()) { - if (spanOp.storage_buffer().getLeafReference() != storageOp.getName()) { + if (spanOp.storage_buffer().getLeafReference() != + storageOp.getNameAttr()) { continue; } spanOp.runtime_bufferAttr(variableSymRef);
diff --git a/iree/compiler/Dialect/HAL/Transforms/MaterializeInterfaces.cpp b/iree/compiler/Dialect/HAL/Transforms/MaterializeInterfaces.cpp index 6847b26..ac887b9 100644 --- a/iree/compiler/Dialect/HAL/Transforms/MaterializeInterfaces.cpp +++ b/iree/compiler/Dialect/HAL/Transforms/MaterializeInterfaces.cpp
@@ -640,8 +640,7 @@ case DispatchBinding::Type::CONSTANT_STORAGE: attrs.push_back(IREE::HAL::ExConstantStorageAttr::get( builder.getStringAttr(usage.bindingOp.getName()), - builder.getStringAttr( - usage.constant.constantBuffer.getLeafReference()), + usage.constant.constantBuffer.getLeafReference(), builder.getIndexAttr(usage.constant.minimumOffset), builder.getIndexAttr(usage.constant.maximumOffset - usage.constant.minimumOffset + 1)));
diff --git a/iree/compiler/Dialect/HAL/Transforms/MaterializeResourceCaches.cpp b/iree/compiler/Dialect/HAL/Transforms/MaterializeResourceCaches.cpp index 4aa0596..921be4c 100644 --- a/iree/compiler/Dialect/HAL/Transforms/MaterializeResourceCaches.cpp +++ b/iree/compiler/Dialect/HAL/Transforms/MaterializeResourceCaches.cpp
@@ -212,7 +212,7 @@ executableVariantOp.getOps<IREE::HAL::ExecutableEntryPointOp>()) { auto interfaceOp = SymbolTable::lookupNearestSymbolFrom<IREE::HAL::InterfaceOp>( - executableOp, entryPointOp.interface()); + executableOp, entryPointOp.interfaceAttr()); assert(interfaceOp && "must have an interface available"); auto executableLayoutGlobalOp = defineExecutableLayoutOp( executableOp.getLoc(), interfaceOp.getExecutableSetLayoutsAttr(), @@ -226,9 +226,8 @@ auto executableValue = caseBuilder.createOrFold<ExecutableCreateOp>( loc, ExecutableType::get(loc.getContext()), deviceValue, SymbolRefAttr::get( - loc.getContext(), executableOp.sym_name(), - {SymbolRefAttr::get(loc.getContext(), - executableVariantOp.sym_name())}), + executableOp.sym_nameAttr(), + {SymbolRefAttr::get(executableVariantOp.sym_nameAttr())}), executableLayoutValues); caseBuilder.create<IREE::HAL::ReturnOp>(loc, executableValue);
diff --git a/iree/compiler/Dialect/Util/IR/UtilOpFolders.cpp b/iree/compiler/Dialect/Util/IR/UtilOpFolders.cpp index bbfae17..4e6f0f2 100644 --- a/iree/compiler/Dialect/Util/IR/UtilOpFolders.cpp +++ b/iree/compiler/Dialect/Util/IR/UtilOpFolders.cpp
@@ -87,7 +87,7 @@ OpFoldResult GlobalLoadOp::fold(ArrayRef<Attribute> operands) { auto globalOp = - SymbolTable::lookupNearestSymbolFrom<GlobalOp>(*this, global()); + SymbolTable::lookupNearestSymbolFrom<GlobalOp>(*this, globalAttr()); if (!globalOp) return {}; if (globalOp->getAttr("noinline")) { // Inlining of the constant has been disabled.
diff --git a/iree/compiler/Dialect/Util/IR/UtilOps.cpp b/iree/compiler/Dialect/Util/IR/UtilOps.cpp index 634ef75..7002e39 100644 --- a/iree/compiler/Dialect/Util/IR/UtilOps.cpp +++ b/iree/compiler/Dialect/Util/IR/UtilOps.cpp
@@ -672,7 +672,7 @@ IREE::Util::GlobalOp GlobalAddressOp::getGlobalOp() { return SymbolTable::lookupNearestSymbolFrom<IREE::Util::GlobalOp>( - getOperation()->getParentOp(), global()); + getOperation()->getParentOp(), globalAttr()); } void GlobalAddressOp::getAsmResultNames( @@ -697,7 +697,7 @@ IREE::Util::GlobalOp GlobalLoadOp::getGlobalOp() { return SymbolTable::lookupNearestSymbolFrom<IREE::Util::GlobalOp>( - getOperation()->getParentOp(), global()); + getOperation()->getParentOp(), globalAttr()); } bool GlobalLoadOp::isGlobalImmutable() { return !getGlobalOp().is_mutable(); } @@ -712,7 +712,7 @@ // HACK: works around the lack of symbol side effects in mlir by only saying // we have a side-effect if the variable we are loading is mutable. auto globalOp = - SymbolTable::lookupNearestSymbolFrom<GlobalOp>(*this, global()); + SymbolTable::lookupNearestSymbolFrom<GlobalOp>(*this, globalAttr()); assert(globalOp); if (globalOp.is_mutable()) { effects.emplace_back(MemoryEffects::Read::get()); @@ -746,7 +746,7 @@ IREE::Util::GlobalOp GlobalStoreOp::getGlobalOp() { return SymbolTable::lookupNearestSymbolFrom<IREE::Util::GlobalOp>( - getOperation()->getParentOp(), global()); + getOperation()->getParentOp(), globalAttr()); } static LogicalResult verifyGlobalStoreOp(GlobalStoreOp op) {
diff --git a/iree/compiler/Dialect/VM/Conversion/ImportUtils.cpp b/iree/compiler/Dialect/VM/Conversion/ImportUtils.cpp index 01e2177..809a13d 100644 --- a/iree/compiler/Dialect/VM/Conversion/ImportUtils.cpp +++ b/iree/compiler/Dialect/VM/Conversion/ImportUtils.cpp
@@ -30,7 +30,9 @@ // TODO(benvanik): verify that the imports match. if (!existingOp) { auto clonedOp = cast<IREE::VM::ImportOp>(targetBuilder.clone(*importOp)); - clonedOp.setName(fullName); + mlir::StringAttr fullNameAttr = + mlir::StringAttr::get(clonedOp.getContext(), fullName); + clonedOp.setName(fullNameAttr); clonedOp.setPrivate(); } });
diff --git a/iree/compiler/Dialect/VM/IR/VMOps.cpp b/iree/compiler/Dialect/VM/IR/VMOps.cpp index 532ee38..a8e47b8 100644 --- a/iree/compiler/Dialect/VM/IR/VMOps.cpp +++ b/iree/compiler/Dialect/VM/IR/VMOps.cpp
@@ -374,7 +374,7 @@ template <typename T> static void addMemoryEffectsForGlobal( - Operation *op, StringRef global, + Operation *op, mlir::FlatSymbolRefAttr global, SmallVectorImpl<MemoryEffects::EffectInstance> &effects) { // HACK: works around the lack of symbol side effects in mlir by only saying // we have a side-effect if the variable we are loading is mutable. @@ -388,27 +388,27 @@ void GlobalLoadI32Op::getEffects( SmallVectorImpl<MemoryEffects::EffectInstance> &effects) { - addMemoryEffectsForGlobal<GlobalI32Op>(*this, global(), effects); + addMemoryEffectsForGlobal<GlobalI32Op>(*this, globalAttr(), effects); } void GlobalLoadI64Op::getEffects( SmallVectorImpl<MemoryEffects::EffectInstance> &effects) { - addMemoryEffectsForGlobal<GlobalI64Op>(*this, global(), effects); + addMemoryEffectsForGlobal<GlobalI64Op>(*this, globalAttr(), effects); } void GlobalLoadF32Op::getEffects( SmallVectorImpl<MemoryEffects::EffectInstance> &effects) { - addMemoryEffectsForGlobal<GlobalF32Op>(*this, global(), effects); + addMemoryEffectsForGlobal<GlobalF32Op>(*this, globalAttr(), effects); } void GlobalLoadF64Op::getEffects( SmallVectorImpl<MemoryEffects::EffectInstance> &effects) { - addMemoryEffectsForGlobal<GlobalF64Op>(*this, global(), effects); + addMemoryEffectsForGlobal<GlobalF64Op>(*this, globalAttr(), effects); } void GlobalLoadRefOp::getEffects( SmallVectorImpl<MemoryEffects::EffectInstance> &effects) { - addMemoryEffectsForGlobal<GlobalRefOp>(*this, global(), effects); + addMemoryEffectsForGlobal<GlobalRefOp>(*this, globalAttr(), effects); } static LogicalResult verifyGlobalLoadOp(Operation *op) {
diff --git a/iree/compiler/Dialect/VM/Transforms/DeduplicateRodata.cpp b/iree/compiler/Dialect/VM/Transforms/DeduplicateRodata.cpp index 326ddbc..d2c2d58 100644 --- a/iree/compiler/Dialect/VM/Transforms/DeduplicateRodata.cpp +++ b/iree/compiler/Dialect/VM/Transforms/DeduplicateRodata.cpp
@@ -82,7 +82,7 @@ // Point all duplicates at the base op. for (auto duplicateOp : bucketOps) { if (failed(symbolTable.replaceAllSymbolUses( - duplicateOp, baseOp.getName(), moduleOp))) { + duplicateOp, baseOp.getNameAttr(), moduleOp))) { duplicateOp.emitError() << "failed to replace duplicate rodata op with base op " << baseOp.getName();
diff --git a/iree/compiler/Dialect/VM/Transforms/OrdinalAllocation.cpp b/iree/compiler/Dialect/VM/Transforms/OrdinalAllocation.cpp index 8f6f9db..2506607 100644 --- a/iree/compiler/Dialect/VM/Transforms/OrdinalAllocation.cpp +++ b/iree/compiler/Dialect/VM/Transforms/OrdinalAllocation.cpp
@@ -104,7 +104,7 @@ // ordinals we just assigned. SmallVector<Operation *, 32> deadOps; getOperation().walk([&](IREE::VM::GlobalAddressOp op) { - auto *globalOp = symbolTable.lookupNearestSymbolFrom(op, op.global()); + auto *globalOp = symbolTable.lookupNearestSymbolFrom(op, op.globalAttr()); assert(globalOp); auto ordinal = globalOp->getAttrOfType<IntegerAttr>("ordinal").getInt();
diff --git a/third_party/llvm-project b/third_party/llvm-project index 3383ec5..c50faff 160000 --- a/third_party/llvm-project +++ b/third_party/llvm-project
@@ -1 +1 @@ -Subproject commit 3383ec5fdd04be095678e0bd8bd1ce341f4f9294 +Subproject commit c50faffb4eeca004109a1591e56cd7cac2ed1083