diff --git a/bazel/import_llvm.bzl b/bazel/import_llvm.bzl index 08b84a691..0915e64c4 100644 --- a/bazel/import_llvm.bzl +++ b/bazel/import_llvm.bzl @@ -7,7 +7,7 @@ load( def import_llvm(name): """Imports LLVM.""" - LLVM_COMMIT = "13c761789753862a7cc31a2a26f23010afa668b9" + LLVM_COMMIT = "e2402615a5a76d46a433dfcc1de10b38a1263c9d" new_git_repository( name = name, diff --git a/patches/llvm.patch b/patches/llvm.patch index 8b54ffba7..f218a6979 100644 --- a/patches/llvm.patch +++ b/patches/llvm.patch @@ -1,669 +1,154 @@ Auto generated patch. Do not edit or delete it, even if empty. -diff -ruN --strip-trailing-cr a/flang/include/flang/Optimizer/Builder/HLFIRTools.h b/flang/include/flang/Optimizer/Builder/HLFIRTools.h ---- a/flang/include/flang/Optimizer/Builder/HLFIRTools.h -+++ b/flang/include/flang/Optimizer/Builder/HLFIRTools.h -@@ -513,12 +513,6 @@ - Entity loadElementAt(mlir::Location loc, fir::FirOpBuilder &builder, - Entity entity, mlir::ValueRange oneBasedIndices); +diff -ruN --strip-trailing-cr a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp +--- a/clang/lib/CodeGen/CGDebugInfo.cpp ++++ b/clang/lib/CodeGen/CGDebugInfo.cpp +@@ -2016,15 +2016,13 @@ + // First element is always return type. For 'void' functions it is NULL. + Elts.push_back(Args[0]); --/// Return a vector of extents for the given entity. --/// The function creates new operations, but tries to clean-up --/// after itself. --llvm::SmallVector --genExtentsVector(mlir::Location loc, fir::FirOpBuilder &builder, Entity entity); -- - } // namespace hlfir - - #endif // FORTRAN_OPTIMIZER_BUILDER_HLFIRTOOLS_H -diff -ruN --strip-trailing-cr a/flang/lib/Optimizer/Builder/HLFIRTools.cpp b/flang/lib/Optimizer/Builder/HLFIRTools.cpp ---- a/flang/lib/Optimizer/Builder/HLFIRTools.cpp -+++ b/flang/lib/Optimizer/Builder/HLFIRTools.cpp -@@ -1421,15 +1421,3 @@ - return loadTrivialScalar(loc, builder, - getElementAt(loc, builder, entity, oneBasedIndices)); - } -- --llvm::SmallVector --hlfir::genExtentsVector(mlir::Location loc, fir::FirOpBuilder &builder, -- hlfir::Entity entity) { -- entity = hlfir::derefPointersAndAllocatables(loc, builder, entity); -- mlir::Value shape = hlfir::genShape(loc, builder, entity); -- llvm::SmallVector extents = -- hlfir::getExplicitExtentsFromShape(shape, builder); -- if (shape.getUses().empty()) -- shape.getDefiningOp()->erase(); -- return extents; --} -diff -ruN --strip-trailing-cr a/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp b/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp ---- a/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp -+++ b/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp -@@ -37,79 +37,6 @@ +- const bool HasExplicitObjectParameter = ThisPtr.isNull(); +- +- // "this" pointer is always first argument. For explicit "this" +- // parameters, it will already be in Args[1]. +- if (!HasExplicitObjectParameter) { ++ // "this" pointer is always first argument. ++ // ThisPtr may be null if the member function has an explicit 'this' ++ // parameter. ++ if (!ThisPtr.isNull()) { + llvm::DIType *ThisPtrType = getOrCreateType(ThisPtr, Unit); + TypeCache[ThisPtr.getAsOpaquePtr()].reset(ThisPtrType); +- ThisPtrType = +- DBuilder.createObjectPointerType(ThisPtrType, /*Implicit=*/true); ++ ThisPtrType = DBuilder.createObjectPointerType(ThisPtrType); + Elts.push_back(ThisPtrType); + } - namespace { +@@ -2032,13 +2030,6 @@ + for (unsigned i = 1, e = Args.size(); i != e; ++i) + Elts.push_back(Args[i]); --// Helper class to generate operations related to computing --// product of values. --class ProductFactory { --public: -- ProductFactory(mlir::Location loc, fir::FirOpBuilder &builder) -- : loc(loc), builder(builder) {} -- -- // Generate an update of the inner product value: -- // acc += v1 * v2, OR -- // acc += CONJ(v1) * v2, OR -- // acc ||= v1 && v2 -- // -- // CONJ parameter specifies whether the first complex product argument -- // needs to be conjugated. -- template -- mlir::Value genAccumulateProduct(mlir::Value acc, mlir::Value v1, -- mlir::Value v2) { -- mlir::Type resultType = acc.getType(); -- acc = castToProductType(acc, resultType); -- v1 = castToProductType(v1, resultType); -- v2 = castToProductType(v2, resultType); -- mlir::Value result; -- if (mlir::isa(resultType)) { -- result = builder.create( -- loc, acc, builder.create(loc, v1, v2)); -- } else if (mlir::isa(resultType)) { -- if constexpr (CONJ) -- result = fir::IntrinsicLibrary{builder, loc}.genConjg(resultType, v1); -- else -- result = v1; -- -- result = builder.create( -- loc, acc, builder.create(loc, result, v2)); -- } else if (mlir::isa(resultType)) { -- result = builder.create( -- loc, acc, builder.create(loc, v1, v2)); -- } else if (mlir::isa(resultType)) { -- result = builder.create( -- loc, acc, builder.create(loc, v1, v2)); -- } else { -- llvm_unreachable("unsupported type"); -- } -- -- return builder.createConvert(loc, resultType, result); +- // Attach FlagObjectPointer to the explicit "this" parameter. +- if (HasExplicitObjectParameter) { +- assert(Elts.size() >= 2 && Args.size() >= 2 && +- "Expected at least return type and object parameter."); +- Elts[1] = DBuilder.createObjectPointerType(Args[1], /*Implicit=*/false); - } - --private: -- mlir::Location loc; -- fir::FirOpBuilder &builder; -- -- mlir::Value castToProductType(mlir::Value value, mlir::Type type) { -- if (mlir::isa(type)) -- return builder.createConvert(loc, builder.getIntegerType(1), value); -- -- // TODO: the multiplications/additions by/of zero resulting from -- // complex * real are optimized by LLVM under -fno-signed-zeros -- // -fno-honor-nans. -- // We can make them disappear by default if we: -- // * either expand the complex multiplication into real -- // operations, OR -- // * set nnan nsz fast-math flags to the complex operations. -- if (fir::isa_complex(type) && !fir::isa_complex(value.getType())) { -- mlir::Value zeroCmplx = fir::factory::createZeroValue(builder, loc, type); -- fir::factory::Complex helper(builder, loc); -- mlir::Type partType = helper.getComplexPartType(type); -- return helper.insertComplexPart(zeroCmplx, -- castToProductType(value, partType), -- /*isImagPart=*/false); -- } -- return builder.createConvert(loc, type, value); -- } --}; -- - class TransposeAsElementalConversion - : public mlir::OpRewritePattern { - public: -@@ -163,8 +90,11 @@ - static mlir::Value genResultShape(mlir::Location loc, - fir::FirOpBuilder &builder, - hlfir::Entity array) { -- llvm::SmallVector inExtents = -- hlfir::genExtentsVector(loc, builder, array); -+ mlir::Value inShape = hlfir::genShape(loc, builder, array); -+ llvm::SmallVector inExtents = -+ hlfir::getExplicitExtentsFromShape(inShape, builder); -+ if (inShape.getUses().empty()) -+ inShape.getDefiningOp()->erase(); - - // transpose indices - assert(inExtents.size() == 2 && "checked in TransposeOp::validate"); -@@ -207,7 +137,7 @@ - mlir::Value resultShape, dimExtent; - llvm::SmallVector arrayExtents; - if (isTotalReduction) -- arrayExtents = hlfir::genExtentsVector(loc, builder, array); -+ arrayExtents = genArrayExtents(loc, builder, array); - else - std::tie(resultShape, dimExtent) = - genResultShapeForPartialReduction(loc, builder, array, dimVal); -@@ -233,8 +163,7 @@ - // If DIM is not present, do total reduction. - - // Initial value for the reduction. -- mlir::Value reductionInitValue = -- fir::factory::createZeroValue(builder, loc, elementType); -+ mlir::Value reductionInitValue = genInitValue(loc, builder, elementType); - - // The reduction loop may be unordered if FastMathFlags::reassoc - // transformations are allowed. The integer reduction is always -@@ -335,6 +264,17 @@ - } + llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts); - private: -+ static llvm::SmallVector -+ genArrayExtents(mlir::Location loc, fir::FirOpBuilder &builder, -+ hlfir::Entity array) { -+ mlir::Value inShape = hlfir::genShape(loc, builder, array); -+ llvm::SmallVector inExtents = -+ hlfir::getExplicitExtentsFromShape(inShape, builder); -+ if (inShape.getUses().empty()) -+ inShape.getDefiningOp()->erase(); -+ return inExtents; -+ } -+ - // Return fir.shape specifying the shape of the result - // of a SUM reduction with DIM=dimVal. The second return value - // is the extent of the DIM dimension. -@@ -343,7 +283,7 @@ - fir::FirOpBuilder &builder, - hlfir::Entity array, int64_t dimVal) { - llvm::SmallVector inExtents = -- hlfir::genExtentsVector(loc, builder, array); -+ genArrayExtents(loc, builder, array); - assert(dimVal > 0 && dimVal <= static_cast(inExtents.size()) && - "DIM must be present and a positive constant not exceeding " - "the array's rank"); -@@ -353,6 +293,26 @@ - return {builder.create(loc, inExtents), dimExtent}; - } - -+ // Generate the initial value for a SUM reduction with the given -+ // data type. -+ static mlir::Value genInitValue(mlir::Location loc, -+ fir::FirOpBuilder &builder, -+ mlir::Type elementType) { -+ if (auto ty = mlir::dyn_cast(elementType)) { -+ const llvm::fltSemantics &sem = ty.getFloatSemantics(); -+ return builder.createRealConstant(loc, elementType, -+ llvm::APFloat::getZero(sem)); -+ } else if (auto ty = mlir::dyn_cast(elementType)) { -+ mlir::Value initValue = genInitValue(loc, builder, ty.getElementType()); -+ return fir::factory::Complex{builder, loc}.createComplex(ty, initValue, -+ initValue); -+ } else if (mlir::isa(elementType)) { -+ return builder.createIntegerConstant(loc, elementType, 0); -+ } -+ -+ llvm_unreachable("unsupported SUM reduction type"); -+ } -+ - // Generate scalar addition of the two values (of the same data type). - static mlir::Value genScalarAdd(mlir::Location loc, - fir::FirOpBuilder &builder, -@@ -610,10 +570,16 @@ - static std::tuple - genResultShape(mlir::Location loc, fir::FirOpBuilder &builder, - hlfir::Entity input1, hlfir::Entity input2) { -- llvm::SmallVector input1Extents = -- hlfir::genExtentsVector(loc, builder, input1); -- llvm::SmallVector input2Extents = -- hlfir::genExtentsVector(loc, builder, input2); -+ mlir::Value input1Shape = hlfir::genShape(loc, builder, input1); -+ llvm::SmallVector input1Extents = -+ hlfir::getExplicitExtentsFromShape(input1Shape, builder); -+ if (input1Shape.getUses().empty()) -+ input1Shape.getDefiningOp()->erase(); -+ mlir::Value input2Shape = hlfir::genShape(loc, builder, input2); -+ llvm::SmallVector input2Extents = -+ hlfir::getExplicitExtentsFromShape(input2Shape, builder); -+ if (input2Shape.getUses().empty()) -+ input2Shape.getDefiningOp()->erase(); + return DBuilder.createSubroutineType(EltTypeArray, OriginalFunc->getFlags(), +@@ -5127,7 +5118,7 @@ + llvm::DIType *CachedTy = getTypeOrNull(QualTy); + if (CachedTy) + Ty = CachedTy; +- return DBuilder.createObjectPointerType(Ty, /*Implicit=*/true); ++ return DBuilder.createObjectPointerType(Ty); + } - llvm::SmallVector newExtents; - mlir::Value innerProduct1Extent, innerProduct2Extent; -@@ -661,6 +627,60 @@ - innerProductExtent[0]}; - } + void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable( +diff -ruN --strip-trailing-cr a/clang/test/CodeGenCXX/debug-info-object-pointer.cpp b/clang/test/CodeGenCXX/debug-info-object-pointer.cpp +--- a/clang/test/CodeGenCXX/debug-info-object-pointer.cpp ++++ b/clang/test/CodeGenCXX/debug-info-object-pointer.cpp +@@ -5,11 +5,12 @@ + // CHECK: !DIDerivedType(tag: DW_TAG_pointer_type + // CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer + // ++// // FIXME: DIFlagObjectPointer not attached to the explicit object ++// // argument in the subprogram declaration. + // CHECK: !DISubprogram(name: "explicit_this", + // flags: DIFlagPrototyped +-// +-// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type +-// CHECK-SAME: flags: DIFlagObjectPointer) ++// CHECK-NOT: DIFlagObjectPointer ++// CHECK-NOT: DIFlagArtificial + // + // CHECK: !DILocalVariable(name: "this", arg: 1 + // CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer +diff -ruN --strip-trailing-cr a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h +--- a/llvm/include/llvm/IR/DIBuilder.h ++++ b/llvm/include/llvm/IR/DIBuilder.h +@@ -662,9 +662,9 @@ + /// Create a uniqued clone of \p Ty with FlagArtificial set. + static DIType *createArtificialType(DIType *Ty); -+ static mlir::Value castToProductType(mlir::Location loc, -+ fir::FirOpBuilder &builder, -+ mlir::Value value, mlir::Type type) { -+ if (mlir::isa(type)) -+ return builder.createConvert(loc, builder.getIntegerType(1), value); -+ -+ // TODO: the multiplications/additions by/of zero resulting from -+ // complex * real are optimized by LLVM under -fno-signed-zeros -+ // -fno-honor-nans. -+ // We can make them disappear by default if we: -+ // * either expand the complex multiplication into real -+ // operations, OR -+ // * set nnan nsz fast-math flags to the complex operations. -+ if (fir::isa_complex(type) && !fir::isa_complex(value.getType())) { -+ mlir::Value zeroCmplx = fir::factory::createZeroValue(builder, loc, type); -+ fir::factory::Complex helper(builder, loc); -+ mlir::Type partType = helper.getComplexPartType(type); -+ return helper.insertComplexPart( -+ zeroCmplx, castToProductType(loc, builder, value, partType), -+ /*isImagPart=*/false); -+ } -+ return builder.createConvert(loc, type, value); -+ } -+ -+ // Generate an update of the inner product value: -+ // acc += v1 * v2, OR -+ // acc ||= v1 && v2 -+ static mlir::Value genAccumulateProduct(mlir::Location loc, -+ fir::FirOpBuilder &builder, -+ mlir::Type resultType, -+ mlir::Value acc, mlir::Value v1, -+ mlir::Value v2) { -+ acc = castToProductType(loc, builder, acc, resultType); -+ v1 = castToProductType(loc, builder, v1, resultType); -+ v2 = castToProductType(loc, builder, v2, resultType); -+ mlir::Value result; -+ if (mlir::isa(resultType)) -+ result = builder.create( -+ loc, acc, builder.create(loc, v1, v2)); -+ else if (mlir::isa(resultType)) -+ result = builder.create( -+ loc, acc, builder.create(loc, v1, v2)); -+ else if (mlir::isa(resultType)) -+ result = builder.create( -+ loc, acc, builder.create(loc, v1, v2)); -+ else if (mlir::isa(resultType)) -+ result = builder.create( -+ loc, acc, builder.create(loc, v1, v2)); -+ else -+ llvm_unreachable("unsupported type"); -+ -+ return builder.createConvert(loc, resultType, result); -+ } -+ - static mlir::LogicalResult - genContiguousMatmul(mlir::Location loc, fir::FirOpBuilder &builder, - hlfir::Entity result, mlir::Value resultShape, -@@ -728,9 +748,9 @@ - hlfir::loadElementAt(loc, builder, lhs, {I, K}); - hlfir::Entity rhsElementValue = - hlfir::loadElementAt(loc, builder, rhs, {K, J}); -- mlir::Value productValue = -- ProductFactory{loc, builder}.genAccumulateProduct( -- resultElementValue, lhsElementValue, rhsElementValue); -+ mlir::Value productValue = genAccumulateProduct( -+ loc, builder, resultElementType, resultElementValue, -+ lhsElementValue, rhsElementValue); - builder.create(loc, productValue, resultElement); - return {}; - }; -@@ -765,9 +785,9 @@ - hlfir::loadElementAt(loc, builder, lhs, {J, K}); - hlfir::Entity rhsElementValue = - hlfir::loadElementAt(loc, builder, rhs, {K}); -- mlir::Value productValue = -- ProductFactory{loc, builder}.genAccumulateProduct( -- resultElementValue, lhsElementValue, rhsElementValue); -+ mlir::Value productValue = genAccumulateProduct( -+ loc, builder, resultElementType, resultElementValue, -+ lhsElementValue, rhsElementValue); - builder.create(loc, productValue, resultElement); - return {}; - }; -@@ -797,9 +817,9 @@ - hlfir::loadElementAt(loc, builder, lhs, {K}); - hlfir::Entity rhsElementValue = - hlfir::loadElementAt(loc, builder, rhs, {K, J}); -- mlir::Value productValue = -- ProductFactory{loc, builder}.genAccumulateProduct( -- resultElementValue, lhsElementValue, rhsElementValue); -+ mlir::Value productValue = genAccumulateProduct( -+ loc, builder, resultElementType, resultElementValue, -+ lhsElementValue, rhsElementValue); - builder.create(loc, productValue, resultElement); - return {}; - }; -@@ -865,9 +885,9 @@ - hlfir::loadElementAt(loc, builder, lhs, lhsIndices); - hlfir::Entity rhsElementValue = - hlfir::loadElementAt(loc, builder, rhs, rhsIndices); -- mlir::Value productValue = -- ProductFactory{loc, builder}.genAccumulateProduct( -- reductionArgs[0], lhsElementValue, rhsElementValue); -+ mlir::Value productValue = genAccumulateProduct( -+ loc, builder, resultElementType, reductionArgs[0], lhsElementValue, -+ rhsElementValue); - return {productValue}; - }; - llvm::SmallVector innerProductValue = -@@ -884,73 +904,6 @@ - } - }; - --class DotProductConversion -- : public mlir::OpRewritePattern { --public: -- using mlir::OpRewritePattern::OpRewritePattern; -- -- llvm::LogicalResult -- matchAndRewrite(hlfir::DotProductOp product, -- mlir::PatternRewriter &rewriter) const override { -- hlfir::Entity op = hlfir::Entity{product}; -- if (!op.isScalar()) -- return rewriter.notifyMatchFailure(product, "produces non-scalar result"); -- -- mlir::Location loc = product.getLoc(); -- fir::FirOpBuilder builder{rewriter, product.getOperation()}; -- hlfir::Entity lhs = hlfir::Entity{product.getLhs()}; -- hlfir::Entity rhs = hlfir::Entity{product.getRhs()}; -- mlir::Type resultElementType = product.getType(); -- bool isUnordered = mlir::isa(resultElementType) || -- mlir::isa(resultElementType) || -- static_cast(builder.getFastMathFlags() & -- mlir::arith::FastMathFlags::reassoc); -- -- mlir::Value extent = genProductExtent(loc, builder, lhs, rhs); -- -- auto genBody = [&](mlir::Location loc, fir::FirOpBuilder &builder, -- mlir::ValueRange oneBasedIndices, -- mlir::ValueRange reductionArgs) -- -> llvm::SmallVector { -- hlfir::Entity lhsElementValue = -- hlfir::loadElementAt(loc, builder, lhs, oneBasedIndices); -- hlfir::Entity rhsElementValue = -- hlfir::loadElementAt(loc, builder, rhs, oneBasedIndices); -- mlir::Value productValue = -- ProductFactory{loc, builder}.genAccumulateProduct( -- reductionArgs[0], lhsElementValue, rhsElementValue); -- return {productValue}; -- }; -- -- mlir::Value initValue = -- fir::factory::createZeroValue(builder, loc, resultElementType); -- -- llvm::SmallVector result = hlfir::genLoopNestWithReductions( -- loc, builder, {extent}, -- /*reductionInits=*/{initValue}, genBody, isUnordered); -- -- rewriter.replaceOp(product, result[0]); -- return mlir::success(); -- } -- --private: -- static mlir::Value genProductExtent(mlir::Location loc, -- fir::FirOpBuilder &builder, -- hlfir::Entity input1, -- hlfir::Entity input2) { -- llvm::SmallVector input1Extents = -- hlfir::genExtentsVector(loc, builder, input1); -- llvm::SmallVector input2Extents = -- hlfir::genExtentsVector(loc, builder, input2); -- -- assert(input1Extents.size() == 1 && input2Extents.size() == 1 && -- "hlfir.dot_product arguments must be vectors"); -- llvm::SmallVector extent = -- fir::factory::deduceOptimalExtents(input1Extents, input2Extents); -- return extent[0]; -- } --}; -- - class SimplifyHLFIRIntrinsics - : public hlfir::impl::SimplifyHLFIRIntrinsicsBase { - public: -@@ -986,8 +939,6 @@ - if (forceMatmulAsElemental || this->allowNewSideEffects) - patterns.insert>(context); +- /// Create a uniqued clone of \p Ty with FlagObjectPointer set. +- /// If \p Implicit is true, also set FlagArtificial. +- static DIType *createObjectPointerType(DIType *Ty, bool Implicit); ++ /// Create a uniqued clone of \p Ty with FlagObjectPointer and ++ /// FlagArtificial set. ++ static DIType *createObjectPointerType(DIType *Ty); -- patterns.insert(context); -- - if (mlir::failed(mlir::applyPatternsGreedily( - getOperation(), std::move(patterns), config))) { - mlir::emitError(getOperation()->getLoc(), -diff -ruN --strip-trailing-cr a/flang/test/HLFIR/simplify-hlfir-intrinsics-dotproduct.fir b/flang/test/HLFIR/simplify-hlfir-intrinsics-dotproduct.fir ---- a/flang/test/HLFIR/simplify-hlfir-intrinsics-dotproduct.fir -+++ b/flang/test/HLFIR/simplify-hlfir-intrinsics-dotproduct.fir -@@ -1,144 +0,0 @@ --// Test hlfir.dot_product simplification to a reduction loop: --// RUN: fir-opt --simplify-hlfir-intrinsics %s | FileCheck %s -- --func.func @dot_product_integer(%arg0: !hlfir.expr, %arg1: !hlfir.expr) -> i32 { -- %res = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr, !hlfir.expr) -> i32 -- return %res : i32 --} --// CHECK-LABEL: func.func @dot_product_integer( --// CHECK-SAME: %[[VAL_0:.*]]: !hlfir.expr, --// CHECK-SAME: %[[VAL_1:.*]]: !hlfir.expr) -> i32 { --// CHECK: %[[VAL_2:.*]] = arith.constant 1 : index --// CHECK: %[[VAL_3:.*]] = arith.constant 0 : i32 --// CHECK: %[[VAL_4:.*]] = hlfir.shape_of %[[VAL_0]] : (!hlfir.expr) -> !fir.shape<1> --// CHECK: %[[VAL_5:.*]] = hlfir.get_extent %[[VAL_4]] {dim = 0 : index} : (!fir.shape<1>) -> index --// CHECK: %[[VAL_6:.*]] = fir.do_loop %[[VAL_7:.*]] = %[[VAL_2]] to %[[VAL_5]] step %[[VAL_2]] unordered iter_args(%[[VAL_8:.*]] = %[[VAL_3]]) -> (i32) { --// CHECK: %[[VAL_9:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_7]] : (!hlfir.expr, index) -> i16 --// CHECK: %[[VAL_10:.*]] = hlfir.apply %[[VAL_1]], %[[VAL_7]] : (!hlfir.expr, index) -> i32 --// CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_9]] : (i16) -> i32 --// CHECK: %[[VAL_12:.*]] = arith.muli %[[VAL_11]], %[[VAL_10]] : i32 --// CHECK: %[[VAL_13:.*]] = arith.addi %[[VAL_8]], %[[VAL_12]] : i32 --// CHECK: fir.result %[[VAL_13]] : i32 --// CHECK: } --// CHECK: return %[[VAL_6]] : i32 --// CHECK: } -- --func.func @dot_product_real(%arg0: !hlfir.expr, %arg1: !hlfir.expr) -> f32 { -- %res = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr, !hlfir.expr) -> f32 -- return %res : f32 --} --// CHECK-LABEL: func.func @dot_product_real( --// CHECK-SAME: %[[VAL_0:.*]]: !hlfir.expr, --// CHECK-SAME: %[[VAL_1:.*]]: !hlfir.expr) -> f32 { --// CHECK: %[[VAL_2:.*]] = arith.constant 1 : index --// CHECK: %[[VAL_3:.*]] = arith.constant 0.000000e+00 : f32 --// CHECK: %[[VAL_4:.*]] = hlfir.shape_of %[[VAL_0]] : (!hlfir.expr) -> !fir.shape<1> --// CHECK: %[[VAL_5:.*]] = hlfir.get_extent %[[VAL_4]] {dim = 0 : index} : (!fir.shape<1>) -> index --// CHECK: %[[VAL_6:.*]] = fir.do_loop %[[VAL_7:.*]] = %[[VAL_2]] to %[[VAL_5]] step %[[VAL_2]] iter_args(%[[VAL_8:.*]] = %[[VAL_3]]) -> (f32) { --// CHECK: %[[VAL_9:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_7]] : (!hlfir.expr, index) -> f32 --// CHECK: %[[VAL_10:.*]] = hlfir.apply %[[VAL_1]], %[[VAL_7]] : (!hlfir.expr, index) -> f16 --// CHECK: %[[VAL_11:.*]] = fir.convert %[[VAL_10]] : (f16) -> f32 --// CHECK: %[[VAL_12:.*]] = arith.mulf %[[VAL_9]], %[[VAL_11]] : f32 --// CHECK: %[[VAL_13:.*]] = arith.addf %[[VAL_8]], %[[VAL_12]] : f32 --// CHECK: fir.result %[[VAL_13]] : f32 --// CHECK: } --// CHECK: return %[[VAL_6]] : f32 --// CHECK: } -- --func.func @dot_product_complex(%arg0: !hlfir.expr>, %arg1: !hlfir.expr>) -> complex { -- %res = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr>, !hlfir.expr>) -> complex -- return %res : complex --} --// CHECK-LABEL: func.func @dot_product_complex( --// CHECK-SAME: %[[VAL_0:.*]]: !hlfir.expr>, --// CHECK-SAME: %[[VAL_1:.*]]: !hlfir.expr>) -> complex { --// CHECK: %[[VAL_2:.*]] = arith.constant 1 : index --// CHECK: %[[VAL_3:.*]] = arith.constant 0.000000e+00 : f32 --// CHECK: %[[VAL_4:.*]] = hlfir.shape_of %[[VAL_0]] : (!hlfir.expr>) -> !fir.shape<1> --// CHECK: %[[VAL_5:.*]] = hlfir.get_extent %[[VAL_4]] {dim = 0 : index} : (!fir.shape<1>) -> index --// CHECK: %[[VAL_6:.*]] = fir.undefined complex --// CHECK: %[[VAL_7:.*]] = fir.insert_value %[[VAL_6]], %[[VAL_3]], [0 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_8:.*]] = fir.insert_value %[[VAL_7]], %[[VAL_3]], [1 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_9:.*]] = fir.do_loop %[[VAL_10:.*]] = %[[VAL_2]] to %[[VAL_5]] step %[[VAL_2]] iter_args(%[[VAL_11:.*]] = %[[VAL_8]]) -> (complex) { --// CHECK: %[[VAL_12:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_10]] : (!hlfir.expr>, index) -> complex --// CHECK: %[[VAL_13:.*]] = hlfir.apply %[[VAL_1]], %[[VAL_10]] : (!hlfir.expr>, index) -> complex --// CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_13]] : (complex) -> complex --// CHECK: %[[VAL_15:.*]] = fir.extract_value %[[VAL_12]], [1 : index] : (complex) -> f32 --// CHECK: %[[VAL_16:.*]] = arith.negf %[[VAL_15]] : f32 --// CHECK: %[[VAL_17:.*]] = fir.insert_value %[[VAL_12]], %[[VAL_16]], [1 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_18:.*]] = fir.mulc %[[VAL_17]], %[[VAL_14]] : complex --// CHECK: %[[VAL_19:.*]] = fir.addc %[[VAL_11]], %[[VAL_18]] : complex --// CHECK: fir.result %[[VAL_19]] : complex --// CHECK: } --// CHECK: return %[[VAL_9]] : complex --// CHECK: } -- --func.func @dot_product_real_complex(%arg0: !hlfir.expr, %arg1: !hlfir.expr>) -> complex { -- %res = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr, !hlfir.expr>) -> complex -- return %res : complex --} --// CHECK-LABEL: func.func @dot_product_real_complex( --// CHECK-SAME: %[[VAL_0:.*]]: !hlfir.expr, --// CHECK-SAME: %[[VAL_1:.*]]: !hlfir.expr>) -> complex { --// CHECK: %[[VAL_2:.*]] = arith.constant 1 : index --// CHECK: %[[VAL_3:.*]] = arith.constant 0.000000e+00 : f32 --// CHECK: %[[VAL_4:.*]] = hlfir.shape_of %[[VAL_0]] : (!hlfir.expr) -> !fir.shape<1> --// CHECK: %[[VAL_5:.*]] = hlfir.get_extent %[[VAL_4]] {dim = 0 : index} : (!fir.shape<1>) -> index --// CHECK: %[[VAL_6:.*]] = fir.undefined complex --// CHECK: %[[VAL_7:.*]] = fir.insert_value %[[VAL_6]], %[[VAL_3]], [0 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_8:.*]] = fir.insert_value %[[VAL_7]], %[[VAL_3]], [1 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_9:.*]] = fir.do_loop %[[VAL_10:.*]] = %[[VAL_2]] to %[[VAL_5]] step %[[VAL_2]] iter_args(%[[VAL_11:.*]] = %[[VAL_8]]) -> (complex) { --// CHECK: %[[VAL_12:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_10]] : (!hlfir.expr, index) -> f32 --// CHECK: %[[VAL_13:.*]] = hlfir.apply %[[VAL_1]], %[[VAL_10]] : (!hlfir.expr>, index) -> complex --// CHECK: %[[VAL_14:.*]] = fir.undefined complex --// CHECK: %[[VAL_15:.*]] = fir.insert_value %[[VAL_14]], %[[VAL_3]], [0 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_16:.*]] = fir.insert_value %[[VAL_15]], %[[VAL_3]], [1 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_17:.*]] = fir.insert_value %[[VAL_16]], %[[VAL_12]], [0 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_13]] : (complex) -> complex --// CHECK: %[[VAL_19:.*]] = fir.extract_value %[[VAL_17]], [1 : index] : (complex) -> f32 --// CHECK: %[[VAL_20:.*]] = arith.negf %[[VAL_19]] : f32 --// CHECK: %[[VAL_21:.*]] = fir.insert_value %[[VAL_17]], %[[VAL_20]], [1 : index] : (complex, f32) -> complex --// CHECK: %[[VAL_22:.*]] = fir.mulc %[[VAL_21]], %[[VAL_18]] : complex --// CHECK: %[[VAL_23:.*]] = fir.addc %[[VAL_11]], %[[VAL_22]] : complex --// CHECK: fir.result %[[VAL_23]] : complex --// CHECK: } --// CHECK: return %[[VAL_9]] : complex --// CHECK: } -- --func.func @dot_product_logical(%arg0: !hlfir.expr>, %arg1: !hlfir.expr>) -> !fir.logical<4> { -- %res = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr>, !hlfir.expr>) -> !fir.logical<4> -- return %res : !fir.logical<4> --} --// CHECK-LABEL: func.func @dot_product_logical( --// CHECK-SAME: %[[VAL_0:.*]]: !hlfir.expr>, --// CHECK-SAME: %[[VAL_1:.*]]: !hlfir.expr>) -> !fir.logical<4> { --// CHECK: %[[VAL_2:.*]] = arith.constant 1 : index --// CHECK: %[[VAL_3:.*]] = arith.constant false --// CHECK: %[[VAL_4:.*]] = hlfir.shape_of %[[VAL_0]] : (!hlfir.expr>) -> !fir.shape<1> --// CHECK: %[[VAL_5:.*]] = hlfir.get_extent %[[VAL_4]] {dim = 0 : index} : (!fir.shape<1>) -> index --// CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_3]] : (i1) -> !fir.logical<4> --// CHECK: %[[VAL_7:.*]] = fir.do_loop %[[VAL_8:.*]] = %[[VAL_2]] to %[[VAL_5]] step %[[VAL_2]] unordered iter_args(%[[VAL_9:.*]] = %[[VAL_6]]) -> (!fir.logical<4>) { --// CHECK: %[[VAL_10:.*]] = hlfir.apply %[[VAL_0]], %[[VAL_8]] : (!hlfir.expr>, index) -> !fir.logical<1> --// CHECK: %[[VAL_11:.*]] = hlfir.apply %[[VAL_1]], %[[VAL_8]] : (!hlfir.expr>, index) -> !fir.logical<4> --// CHECK: %[[VAL_12:.*]] = fir.convert %[[VAL_9]] : (!fir.logical<4>) -> i1 --// CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_10]] : (!fir.logical<1>) -> i1 --// CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_11]] : (!fir.logical<4>) -> i1 --// CHECK: %[[VAL_15:.*]] = arith.andi %[[VAL_13]], %[[VAL_14]] : i1 --// CHECK: %[[VAL_16:.*]] = arith.ori %[[VAL_12]], %[[VAL_15]] : i1 --// CHECK: %[[VAL_17:.*]] = fir.convert %[[VAL_16]] : (i1) -> !fir.logical<4> --// CHECK: fir.result %[[VAL_17]] : !fir.logical<4> --// CHECK: } --// CHECK: return %[[VAL_7]] : !fir.logical<4> --// CHECK: } -- --func.func @dot_product_known_dim(%arg0: !hlfir.expr<10xf32>, %arg1: !hlfir.expr) -> f32 { -- %res1 = hlfir.dot_product %arg0 %arg1 : (!hlfir.expr<10xf32>, !hlfir.expr) -> f32 -- %res2 = hlfir.dot_product %arg1 %arg0 : (!hlfir.expr, !hlfir.expr<10xf32>) -> f32 -- %res = arith.addf %res1, %res2 : f32 -- return %res : f32 --} --// CHECK-LABEL: func.func @dot_product_known_dim( --// CHECK: %[[VAL_2:.*]] = arith.constant 1 : index --// CHECK: %[[VAL_4:.*]] = arith.constant 10 : index --// CHECK: fir.do_loop %{{.*}} = %[[VAL_2]] to %[[VAL_4]] step %[[VAL_2]] --// CHECK: fir.do_loop %{{.*}} = %[[VAL_2]] to %[[VAL_4]] step %[[VAL_2]] -diff -ruN --strip-trailing-cr a/libcxx/include/__config b/libcxx/include/__config ---- a/libcxx/include/__config -+++ b/libcxx/include/__config -@@ -1166,9 +1166,7 @@ - # define _LIBCPP_NOESCAPE - # endif + /// Create a permanent forward-declared type. + DICompositeType *createForwardDecl(unsigned Tag, StringRef Name, +diff -ruN --strip-trailing-cr a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h +--- a/llvm/include/llvm-c/DebugInfo.h ++++ b/llvm/include/llvm-c/DebugInfo.h +@@ -870,16 +870,13 @@ + LLVMMetadataRef Ty); --// FIXME: Expand this to [[__gnu__::__nodebug__]] again once the testcase reported in --// https://github.com/llvm/llvm-project/pull/118710 has been analyzed --# define _LIBCPP_NODEBUG -+# define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]] + /** +- * Create a uniqued DIType* clone with FlagObjectPointer. If \c Implicit +- * is true, then also set FlagArtificial. ++ * Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set. + * \param Builder The DIBuilder. + * \param Type The underlying type to which this pointer points. +- * \param Implicit Indicates whether this pointer was implicitly generated +- * (i.e., not spelled out in source). + */ +-LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, +- LLVMMetadataRef Type, +- LLVMBool Implicit); ++LLVMMetadataRef ++LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, ++ LLVMMetadataRef Type); - # if __has_attribute(__standalone_debug__) - # define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) -diff -ruN --strip-trailing-cr a/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp ---- a/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp -+++ b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp -@@ -27,7 +27,7 @@ - check_factories.registerCheck("libcpp-header-exportable-declarations"); - check_factories.registerCheck("libcpp-hide-from-abi"); - check_factories.registerCheck("libcpp-internal-ftms"); -- // check_factories.registerCheck("libcpp-nodebug-on-aliases"); -+ check_factories.registerCheck("libcpp-nodebug-on-aliases"); - check_factories.registerCheck("libcpp-cpp-version-check"); - check_factories.registerCheck("libcpp-robust-against-adl"); - check_factories.registerCheck("libcpp-uglify-attributes"); -diff -ruN --strip-trailing-cr a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ---- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp -+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp -@@ -1140,8 +1140,6 @@ + /** + * Create debugging information entry for a qualified +diff -ruN --strip-trailing-cr a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp +--- a/llvm/lib/IR/DebugInfo.cpp ++++ b/llvm/lib/IR/DebugInfo.cpp +@@ -1432,11 +1432,10 @@ + PropertyAttributes, unwrapDI(Ty))); + } - setTargetDAGCombine(ISD::SCALAR_TO_VECTOR); +-LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, +- LLVMMetadataRef Type, +- LLVMBool Implicit) { +- return wrap(unwrap(Builder)->createObjectPointerType(unwrapDI(Type), +- Implicit)); ++LLVMMetadataRef ++LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, ++ LLVMMetadataRef Type) { ++ return wrap(unwrap(Builder)->createObjectPointerType(unwrapDI(Type))); + } -- setTargetDAGCombine(ISD::SHL); -- - // In case of strict alignment, avoid an excessive number of byte wide stores. - MaxStoresPerMemsetOptSize = 8; - MaxStoresPerMemset = -@@ -26473,43 +26471,6 @@ - return NVCAST; + LLVMMetadataRef +diff -ruN --strip-trailing-cr a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp +--- a/llvm/lib/IR/DIBuilder.cpp ++++ b/llvm/lib/IR/DIBuilder.cpp +@@ -644,15 +644,11 @@ + return createTypeWithFlags(Ty, DINode::FlagArtificial); } --/// If the operand is a bitwise AND with a constant RHS, and the shift has a --/// constant RHS and is the only use, we can pull it out of the shift, i.e. --/// --/// (shl (and X, C1), C2) -> (and (shl X, C2), (shl C1, C2)) --/// --/// We prefer this canonical form to match existing isel patterns. --static SDValue performSHLCombine(SDNode *N, -- TargetLowering::DAGCombinerInfo &DCI, -- SelectionDAG &DAG) { -- if (DCI.isBeforeLegalizeOps()) -- return SDValue(); -- -- SDValue Op0 = N->getOperand(0); -- if (Op0.getOpcode() != ISD::AND || !Op0.hasOneUse()) -- return SDValue(); -- -- SDValue C1 = Op0->getOperand(1); -- SDValue C2 = N->getOperand(1); -- if (!isa(C1) || !isa(C2)) -- return SDValue(); -- -- // Might be folded into shifted op, do not lower. -- if (N->hasOneUse()) { -- unsigned UseOpc = N->user_begin()->getOpcode(); -- if (UseOpc == ISD::ADD || UseOpc == ISD::SUB || UseOpc == ISD::SETCC || -- UseOpc == AArch64ISD::ADDS || UseOpc == AArch64ISD::SUBS) -- return SDValue(); -- } -- -- SDLoc DL(N); -- EVT VT = N->getValueType(0); -- SDValue X = Op0->getOperand(0); -- SDValue NewRHS = DAG.getNode(ISD::SHL, DL, VT, C1, C2); -- SDValue NewShift = DAG.getNode(ISD::SHL, DL, VT, X, C2); -- return DAG.getNode(ISD::AND, DL, VT, NewShift, NewRHS); --} -- - SDValue AArch64TargetLowering::PerformDAGCombine(SDNode *N, - DAGCombinerInfo &DCI) const { - SelectionDAG &DAG = DCI.DAG; -@@ -26855,8 +26816,6 @@ - return performCTLZCombine(N, DAG, Subtarget); - case ISD::SCALAR_TO_VECTOR: - return performScalarToVectorCombine(N, DCI, DAG); -- case ISD::SHL: -- return performSHLCombine(N, DCI, DAG); - } - return SDValue(); +-DIType *DIBuilder::createObjectPointerType(DIType *Ty, bool Implicit) { ++DIType *DIBuilder::createObjectPointerType(DIType *Ty) { + // FIXME: Restrict this to the nodes where it's valid. + if (Ty->isObjectPointer()) + return Ty; +- DINode::DIFlags Flags = DINode::FlagObjectPointer; +- +- if (Implicit) +- Flags |= DINode::FlagArtificial; +- ++ DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial; + return createTypeWithFlags(Ty, Flags); } + diff -ruN --strip-trailing-cr a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp -@@ -4979,7 +4979,7 @@ +@@ -4972,7 +4972,7 @@ // the subvector length. const unsigned VecVF = getNumElements(Vec->getType()); SmallVector Mask(VecVF, PoisonMaskElem); @@ -672,7 +157,7 @@ diff -ruN --strip-trailing-cr a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp for (unsigned I : seq(SubVecVF)) Mask[I + Index] = I + VecVF; if (Generator) { -@@ -13956,11 +13956,12 @@ +@@ -13976,11 +13976,12 @@ Instruction *InsElt; if (auto *VecTy = dyn_cast(Scalar->getType())) { assert(SLPReVec && "FixedVectorType is not expected."); @@ -688,387 +173,6 @@ diff -ruN --strip-trailing-cr a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp } else { Vec = Builder.CreateInsertElement(Vec, Scalar, Builder.getInt32(Pos)); InsElt = dyn_cast(Vec); -diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/AArch64/const-shift-of-constmasked.ll b/llvm/test/CodeGen/AArch64/const-shift-of-constmasked.ll ---- a/llvm/test/CodeGen/AArch64/const-shift-of-constmasked.ll -+++ b/llvm/test/CodeGen/AArch64/const-shift-of-constmasked.ll -@@ -190,7 +190,8 @@ - define i8 @test_i8_7_mask_shl_1(i8 %a0) { - ; CHECK-LABEL: test_i8_7_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: ubfiz w0, w0, #1, #3 -+; CHECK-NEXT: and w8, w0, #0x7 -+; CHECK-NEXT: lsl w0, w8, #1 - ; CHECK-NEXT: ret - %t0 = and i8 %a0, 7 - %t1 = shl i8 %t0, 1 -@@ -199,7 +200,8 @@ - define i8 @test_i8_7_mask_shl_4(i8 %a0) { - ; CHECK-LABEL: test_i8_7_mask_shl_4: - ; CHECK: // %bb.0: --; CHECK-NEXT: ubfiz w0, w0, #4, #3 -+; CHECK-NEXT: and w8, w0, #0x7 -+; CHECK-NEXT: lsl w0, w8, #4 - ; CHECK-NEXT: ret - %t0 = and i8 %a0, 7 - %t1 = shl i8 %t0, 4 -@@ -227,8 +229,8 @@ - define i8 @test_i8_28_mask_shl_1(i8 %a0) { - ; CHECK-LABEL: test_i8_28_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #1 --; CHECK-NEXT: and w0, w8, #0x38 -+; CHECK-NEXT: and w8, w0, #0x1c -+; CHECK-NEXT: lsl w0, w8, #1 - ; CHECK-NEXT: ret - %t0 = and i8 %a0, 28 - %t1 = shl i8 %t0, 1 -@@ -237,8 +239,8 @@ - define i8 @test_i8_28_mask_shl_2(i8 %a0) { - ; CHECK-LABEL: test_i8_28_mask_shl_2: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #2 --; CHECK-NEXT: and w0, w8, #0x70 -+; CHECK-NEXT: and w8, w0, #0x1c -+; CHECK-NEXT: lsl w0, w8, #2 - ; CHECK-NEXT: ret - %t0 = and i8 %a0, 28 - %t1 = shl i8 %t0, 2 -@@ -247,8 +249,8 @@ - define i8 @test_i8_28_mask_shl_3(i8 %a0) { - ; CHECK-LABEL: test_i8_28_mask_shl_3: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #3 --; CHECK-NEXT: and w0, w8, #0xe0 -+; CHECK-NEXT: and w8, w0, #0x1c -+; CHECK-NEXT: lsl w0, w8, #3 - ; CHECK-NEXT: ret - %t0 = and i8 %a0, 28 - %t1 = shl i8 %t0, 3 -@@ -257,8 +259,8 @@ - define i8 @test_i8_28_mask_shl_4(i8 %a0) { - ; CHECK-LABEL: test_i8_28_mask_shl_4: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #4 --; CHECK-NEXT: and w0, w8, #0xc0 -+; CHECK-NEXT: and w8, w0, #0xc -+; CHECK-NEXT: lsl w0, w8, #4 - ; CHECK-NEXT: ret - %t0 = and i8 %a0, 28 - %t1 = shl i8 %t0, 4 -@@ -268,8 +270,8 @@ - define i8 @test_i8_224_mask_shl_1(i8 %a0) { - ; CHECK-LABEL: test_i8_224_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #1 --; CHECK-NEXT: and w0, w8, #0xc0 -+; CHECK-NEXT: and w8, w0, #0x60 -+; CHECK-NEXT: lsl w0, w8, #1 - ; CHECK-NEXT: ret - %t0 = and i8 %a0, 224 - %t1 = shl i8 %t0, 1 -@@ -463,7 +465,8 @@ - define i16 @test_i16_127_mask_shl_1(i16 %a0) { - ; CHECK-LABEL: test_i16_127_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: ubfiz w0, w0, #1, #7 -+; CHECK-NEXT: and w8, w0, #0x7f -+; CHECK-NEXT: lsl w0, w8, #1 - ; CHECK-NEXT: ret - %t0 = and i16 %a0, 127 - %t1 = shl i16 %t0, 1 -@@ -472,7 +475,8 @@ - define i16 @test_i16_127_mask_shl_8(i16 %a0) { - ; CHECK-LABEL: test_i16_127_mask_shl_8: - ; CHECK: // %bb.0: --; CHECK-NEXT: ubfiz w0, w0, #8, #7 -+; CHECK-NEXT: and w8, w0, #0x7f -+; CHECK-NEXT: lsl w0, w8, #8 - ; CHECK-NEXT: ret - %t0 = and i16 %a0, 127 - %t1 = shl i16 %t0, 8 -@@ -500,8 +504,8 @@ - define i16 @test_i16_2032_mask_shl_3(i16 %a0) { - ; CHECK-LABEL: test_i16_2032_mask_shl_3: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #3 --; CHECK-NEXT: and w0, w8, #0x3f80 -+; CHECK-NEXT: and w8, w0, #0x7f0 -+; CHECK-NEXT: lsl w0, w8, #3 - ; CHECK-NEXT: ret - %t0 = and i16 %a0, 2032 - %t1 = shl i16 %t0, 3 -@@ -510,8 +514,8 @@ - define i16 @test_i16_2032_mask_shl_4(i16 %a0) { - ; CHECK-LABEL: test_i16_2032_mask_shl_4: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #4 --; CHECK-NEXT: and w0, w8, #0x7f00 -+; CHECK-NEXT: and w8, w0, #0x7f0 -+; CHECK-NEXT: lsl w0, w8, #4 - ; CHECK-NEXT: ret - %t0 = and i16 %a0, 2032 - %t1 = shl i16 %t0, 4 -@@ -520,8 +524,8 @@ - define i16 @test_i16_2032_mask_shl_5(i16 %a0) { - ; CHECK-LABEL: test_i16_2032_mask_shl_5: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #5 --; CHECK-NEXT: and w0, w8, #0xfe00 -+; CHECK-NEXT: and w8, w0, #0x7f0 -+; CHECK-NEXT: lsl w0, w8, #5 - ; CHECK-NEXT: ret - %t0 = and i16 %a0, 2032 - %t1 = shl i16 %t0, 5 -@@ -530,8 +534,8 @@ - define i16 @test_i16_2032_mask_shl_6(i16 %a0) { - ; CHECK-LABEL: test_i16_2032_mask_shl_6: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #6 --; CHECK-NEXT: and w0, w8, #0xfc00 -+; CHECK-NEXT: and w8, w0, #0x3f0 -+; CHECK-NEXT: lsl w0, w8, #6 - ; CHECK-NEXT: ret - %t0 = and i16 %a0, 2032 - %t1 = shl i16 %t0, 6 -@@ -541,8 +545,8 @@ - define i16 @test_i16_65024_mask_shl_1(i16 %a0) { - ; CHECK-LABEL: test_i16_65024_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #1 --; CHECK-NEXT: and w0, w8, #0xfc00 -+; CHECK-NEXT: and w8, w0, #0x7e00 -+; CHECK-NEXT: lsl w0, w8, #1 - ; CHECK-NEXT: ret - %t0 = and i16 %a0, 65024 - %t1 = shl i16 %t0, 1 -@@ -736,7 +740,8 @@ - define i32 @test_i32_32767_mask_shl_1(i32 %a0) { - ; CHECK-LABEL: test_i32_32767_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: ubfiz w0, w0, #1, #15 -+; CHECK-NEXT: and w8, w0, #0x7fff -+; CHECK-NEXT: lsl w0, w8, #1 - ; CHECK-NEXT: ret - %t0 = and i32 %a0, 32767 - %t1 = shl i32 %t0, 1 -@@ -745,7 +750,8 @@ - define i32 @test_i32_32767_mask_shl_16(i32 %a0) { - ; CHECK-LABEL: test_i32_32767_mask_shl_16: - ; CHECK: // %bb.0: --; CHECK-NEXT: ubfiz w0, w0, #16, #15 -+; CHECK-NEXT: and w8, w0, #0x7fff -+; CHECK-NEXT: lsl w0, w8, #16 - ; CHECK-NEXT: ret - %t0 = and i32 %a0, 32767 - %t1 = shl i32 %t0, 16 -@@ -773,8 +779,8 @@ - define i32 @test_i32_8388352_mask_shl_7(i32 %a0) { - ; CHECK-LABEL: test_i32_8388352_mask_shl_7: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #7 --; CHECK-NEXT: and w0, w8, #0x3fff8000 -+; CHECK-NEXT: and w8, w0, #0x7fff00 -+; CHECK-NEXT: lsl w0, w8, #7 - ; CHECK-NEXT: ret - %t0 = and i32 %a0, 8388352 - %t1 = shl i32 %t0, 7 -@@ -783,8 +789,8 @@ - define i32 @test_i32_8388352_mask_shl_8(i32 %a0) { - ; CHECK-LABEL: test_i32_8388352_mask_shl_8: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #8 --; CHECK-NEXT: and w0, w8, #0x7fff0000 -+; CHECK-NEXT: and w8, w0, #0x7fff00 -+; CHECK-NEXT: lsl w0, w8, #8 - ; CHECK-NEXT: ret - %t0 = and i32 %a0, 8388352 - %t1 = shl i32 %t0, 8 -@@ -793,8 +799,8 @@ - define i32 @test_i32_8388352_mask_shl_9(i32 %a0) { - ; CHECK-LABEL: test_i32_8388352_mask_shl_9: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #9 --; CHECK-NEXT: and w0, w8, #0xfffe0000 -+; CHECK-NEXT: and w8, w0, #0x7fff00 -+; CHECK-NEXT: lsl w0, w8, #9 - ; CHECK-NEXT: ret - %t0 = and i32 %a0, 8388352 - %t1 = shl i32 %t0, 9 -@@ -803,8 +809,8 @@ - define i32 @test_i32_8388352_mask_shl_10(i32 %a0) { - ; CHECK-LABEL: test_i32_8388352_mask_shl_10: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #10 --; CHECK-NEXT: and w0, w8, #0xfffc0000 -+; CHECK-NEXT: and w8, w0, #0x3fff00 -+; CHECK-NEXT: lsl w0, w8, #10 - ; CHECK-NEXT: ret - %t0 = and i32 %a0, 8388352 - %t1 = shl i32 %t0, 10 -@@ -814,8 +820,8 @@ - define i32 @test_i32_4294836224_mask_shl_1(i32 %a0) { - ; CHECK-LABEL: test_i32_4294836224_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w8, w0, #1 --; CHECK-NEXT: and w0, w8, #0xfffc0000 -+; CHECK-NEXT: and w8, w0, #0x7ffe0000 -+; CHECK-NEXT: lsl w0, w8, #1 - ; CHECK-NEXT: ret - %t0 = and i32 %a0, 4294836224 - %t1 = shl i32 %t0, 1 -@@ -1009,7 +1015,8 @@ - define i64 @test_i64_2147483647_mask_shl_1(i64 %a0) { - ; CHECK-LABEL: test_i64_2147483647_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w0, w0, #1 -+; CHECK-NEXT: and x8, x0, #0x7fffffff -+; CHECK-NEXT: lsl x0, x8, #1 - ; CHECK-NEXT: ret - %t0 = and i64 %a0, 2147483647 - %t1 = shl i64 %t0, 1 -@@ -1047,8 +1054,8 @@ - define i64 @test_i64_140737488289792_mask_shl_15(i64 %a0) { - ; CHECK-LABEL: test_i64_140737488289792_mask_shl_15: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl x8, x0, #15 --; CHECK-NEXT: and x0, x8, #0x3fffffff80000000 -+; CHECK-NEXT: and x8, x0, #0x7fffffff0000 -+; CHECK-NEXT: lsl x0, x8, #15 - ; CHECK-NEXT: ret - %t0 = and i64 %a0, 140737488289792 - %t1 = shl i64 %t0, 15 -@@ -1057,8 +1064,8 @@ - define i64 @test_i64_140737488289792_mask_shl_16(i64 %a0) { - ; CHECK-LABEL: test_i64_140737488289792_mask_shl_16: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl x8, x0, #16 --; CHECK-NEXT: and x0, x8, #0x7fffffff00000000 -+; CHECK-NEXT: and x8, x0, #0x7fffffff0000 -+; CHECK-NEXT: lsl x0, x8, #16 - ; CHECK-NEXT: ret - %t0 = and i64 %a0, 140737488289792 - %t1 = shl i64 %t0, 16 -@@ -1067,8 +1074,8 @@ - define i64 @test_i64_140737488289792_mask_shl_17(i64 %a0) { - ; CHECK-LABEL: test_i64_140737488289792_mask_shl_17: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl x8, x0, #17 --; CHECK-NEXT: and x0, x8, #0xfffffffe00000000 -+; CHECK-NEXT: and x8, x0, #0x7fffffff0000 -+; CHECK-NEXT: lsl x0, x8, #17 - ; CHECK-NEXT: ret - %t0 = and i64 %a0, 140737488289792 - %t1 = shl i64 %t0, 17 -@@ -1077,8 +1084,8 @@ - define i64 @test_i64_140737488289792_mask_shl_18(i64 %a0) { - ; CHECK-LABEL: test_i64_140737488289792_mask_shl_18: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl x8, x0, #18 --; CHECK-NEXT: and x0, x8, #0xfffffffc00000000 -+; CHECK-NEXT: and x8, x0, #0x3fffffff0000 -+; CHECK-NEXT: lsl x0, x8, #18 - ; CHECK-NEXT: ret - %t0 = and i64 %a0, 140737488289792 - %t1 = shl i64 %t0, 18 -@@ -1088,8 +1095,8 @@ - define i64 @test_i64_18446744065119617024_mask_shl_1(i64 %a0) { - ; CHECK-LABEL: test_i64_18446744065119617024_mask_shl_1: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl x8, x0, #1 --; CHECK-NEXT: and x0, x8, #0xfffffffc00000000 -+; CHECK-NEXT: and x8, x0, #0x7ffffffe00000000 -+; CHECK-NEXT: lsl x0, x8, #1 - ; CHECK-NEXT: ret - %t0 = and i64 %a0, 18446744065119617024 - %t1 = shl i64 %t0, 1 -diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/AArch64/extract-bits.ll b/llvm/test/CodeGen/AArch64/extract-bits.ll ---- a/llvm/test/CodeGen/AArch64/extract-bits.ll -+++ b/llvm/test/CodeGen/AArch64/extract-bits.ll -@@ -1013,8 +1013,8 @@ - define i32 @c2_i32(i32 %arg) nounwind { - ; CHECK-LABEL: c2_i32: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsr w8, w0, #17 --; CHECK-NEXT: and w0, w8, #0xffc -+; CHECK-NEXT: ubfx w8, w0, #19, #10 -+; CHECK-NEXT: lsl w0, w8, #2 - ; CHECK-NEXT: ret - %tmp0 = lshr i32 %arg, 19 - %tmp1 = and i32 %tmp0, 1023 -@@ -1063,8 +1063,8 @@ - define i64 @c2_i64(i64 %arg) nounwind { - ; CHECK-LABEL: c2_i64: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsr x8, x0, #49 --; CHECK-NEXT: and x0, x8, #0xffc -+; CHECK-NEXT: ubfx x8, x0, #51, #10 -+; CHECK-NEXT: lsl x0, x8, #2 - ; CHECK-NEXT: ret - %tmp0 = lshr i64 %arg, 51 - %tmp1 = and i64 %tmp0, 1023 -@@ -1120,8 +1120,8 @@ - define void @c7_i32(i32 %arg, ptr %ptr) nounwind { - ; CHECK-LABEL: c7_i32: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsr w8, w0, #17 --; CHECK-NEXT: and w8, w8, #0xffc -+; CHECK-NEXT: ubfx w8, w0, #19, #10 -+; CHECK-NEXT: lsl w8, w8, #2 - ; CHECK-NEXT: str w8, [x1] - ; CHECK-NEXT: ret - %tmp0 = lshr i32 %arg, 19 -@@ -1163,8 +1163,8 @@ - define void @c7_i64(i64 %arg, ptr %ptr) nounwind { - ; CHECK-LABEL: c7_i64: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsr x8, x0, #49 --; CHECK-NEXT: and x8, x8, #0xffc -+; CHECK-NEXT: ubfx x8, x0, #51, #10 -+; CHECK-NEXT: lsl x8, x8, #2 - ; CHECK-NEXT: str x8, [x1] - ; CHECK-NEXT: ret - %tmp0 = lshr i64 %arg, 51 -diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/AArch64/fpenv.ll b/llvm/test/CodeGen/AArch64/fpenv.ll ---- a/llvm/test/CodeGen/AArch64/fpenv.ll -+++ b/llvm/test/CodeGen/AArch64/fpenv.ll -@@ -4,11 +4,11 @@ - define void @func_set_rounding_dyn(i32 %rm) { - ; CHECK-LABEL: func_set_rounding_dyn: - ; CHECK: // %bb.0: --; CHECK-NEXT: lsl w9, w0, #22 -+; CHECK-NEXT: sub w9, w0, #1 - ; CHECK-NEXT: mrs x8, FPCR -+; CHECK-NEXT: and w9, w9, #0x3 - ; CHECK-NEXT: and x8, x8, #0xffffffffff3fffff --; CHECK-NEXT: sub w9, w9, #1024, lsl #12 // =4194304 --; CHECK-NEXT: and w9, w9, #0xc00000 -+; CHECK-NEXT: lsl w9, w9, #22 - ; CHECK-NEXT: orr x8, x8, x9 - ; CHECK-NEXT: msr FPCR, x8 - ; CHECK-NEXT: ret -diff -ruN --strip-trailing-cr a/llvm/test/CodeGen/AArch64/xbfiz.ll b/llvm/test/CodeGen/AArch64/xbfiz.ll ---- a/llvm/test/CodeGen/AArch64/xbfiz.ll -+++ b/llvm/test/CodeGen/AArch64/xbfiz.ll -@@ -69,19 +69,3 @@ - %and = and i64 %shl, 4294967295 - ret i64 %and - } -- --define i64 @lsl_zext_i8_i64(i8 %b) { --; CHECK-LABEL: lsl_zext_i8_i64: --; CHECK: ubfiz x0, x0, #1, #8 -- %1 = zext i8 %b to i64 -- %2 = shl i64 %1, 1 -- ret i64 %2 --} -- --define i64 @lsl_zext_i16_i64(i16 %b) { --; CHECK-LABEL: lsl_zext_i16_i64: --; CHECK: ubfiz x0, x0, #1, #16 -- %1 = zext i16 %b to i64 -- %2 = shl i64 %1, 1 -- ret i64 %2 --} diff -ruN --strip-trailing-cr a/llvm/test/Transforms/SLPVectorizer/X86/insert-subvector.ll b/llvm/test/Transforms/SLPVectorizer/X86/insert-subvector.ll --- a/llvm/test/Transforms/SLPVectorizer/X86/insert-subvector.ll +++ b/llvm/test/Transforms/SLPVectorizer/X86/insert-subvector.ll