Skip to content

Commit 7e1b5aa

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:d32509928ba6 into amd-gfx:de1faa086235
Local branch amd-gfx de1faa0 Merged main:c5492e3c65e4 into amd-gfx:88041b2310c7 Remote branch main d325099 [RISCV] Rewrite an isel pattern to make it more amenable to GISel. NFC
2 parents de1faa0 + d325099 commit 7e1b5aa

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

flang/lib/Optimizer/CodeGen/CodeGen.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,12 +1613,13 @@ struct EmboxCommonConversion : public fir::FIROpConversion<OP> {
16131613
if (gepArgs.size() != 1)
16141614
fir::emitFatalError(loc,
16151615
"corrupted substring GEP in fir.embox/fir.rebox");
1616-
mlir::Type outterOffsetTy = gepArgs[0].get<mlir::Value>().getType();
1616+
mlir::Type outterOffsetTy =
1617+
llvm::cast<mlir::Value>(gepArgs[0]).getType();
16171618
mlir::Value cast =
16181619
this->integerCast(loc, rewriter, outterOffsetTy, *substringOffset);
16191620

16201621
gepArgs[0] = rewriter.create<mlir::LLVM::AddOp>(
1621-
loc, outterOffsetTy, gepArgs[0].get<mlir::Value>(), cast);
1622+
loc, outterOffsetTy, llvm::cast<mlir::Value>(gepArgs[0]), cast);
16221623
}
16231624
}
16241625
mlir::Type llvmPtrTy = ::getLlvmPtrType(resultTy.getContext());

flang/lib/Optimizer/Transforms/AddAliasTags.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void AddAliasTagsPass::runOnAliasInterface(fir::FirAliasTagOpInterface op,
227227
source.kind == fir::AliasAnalysis::SourceKind::Argument) {
228228
LLVM_DEBUG(llvm::dbgs().indent(2)
229229
<< "Found reference to dummy argument at " << *op << "\n");
230-
std::string name = getFuncArgName(source.origin.u.get<mlir::Value>());
230+
std::string name = getFuncArgName(llvm::cast<mlir::Value>(source.origin.u));
231231
if (!name.empty())
232232
tag = state.getFuncTreeWithScope(func, scopeOp)
233233
.dummyArgDataTree.getTag(name);
@@ -240,7 +240,7 @@ void AddAliasTagsPass::runOnAliasInterface(fir::FirAliasTagOpInterface op,
240240
} else if (enableGlobals &&
241241
source.kind == fir::AliasAnalysis::SourceKind::Global &&
242242
!source.isBoxData()) {
243-
mlir::SymbolRefAttr glbl = source.origin.u.get<mlir::SymbolRefAttr>();
243+
mlir::SymbolRefAttr glbl = llvm::cast<mlir::SymbolRefAttr>(source.origin.u);
244244
const char *name = glbl.getRootReference().data();
245245
LLVM_DEBUG(llvm::dbgs().indent(2) << "Found reference to global " << name
246246
<< " at " << *op << "\n");
@@ -250,8 +250,7 @@ void AddAliasTagsPass::runOnAliasInterface(fir::FirAliasTagOpInterface op,
250250
} else if (enableDirect &&
251251
source.kind == fir::AliasAnalysis::SourceKind::Global &&
252252
source.isBoxData()) {
253-
if (source.origin.u.is<mlir::SymbolRefAttr>()) {
254-
mlir::SymbolRefAttr glbl = source.origin.u.get<mlir::SymbolRefAttr>();
253+
if (auto glbl = llvm::dyn_cast<mlir::SymbolRefAttr>(source.origin.u)) {
255254
const char *name = glbl.getRootReference().data();
256255
LLVM_DEBUG(llvm::dbgs().indent(2) << "Found reference to direct " << name
257256
<< " at " << *op << "\n");
@@ -269,7 +268,7 @@ void AddAliasTagsPass::runOnAliasInterface(fir::FirAliasTagOpInterface op,
269268
source.kind == fir::AliasAnalysis::SourceKind::Allocate) {
270269
std::optional<llvm::StringRef> name;
271270
mlir::Operation *sourceOp =
272-
source.origin.u.get<mlir::Value>().getDefiningOp();
271+
llvm::cast<mlir::Value>(source.origin.u).getDefiningOp();
273272
if (auto alloc = mlir::dyn_cast_or_null<fir::AllocaOp>(sourceOp))
274273
name = alloc.getUniqName();
275274
else if (auto alloc = mlir::dyn_cast_or_null<fir::AllocMemOp>(sourceOp))

flang/lib/Optimizer/Transforms/StackArrays.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ class InsertionPoint {
7676
/// Get contained pointer type or nullptr
7777
template <class T>
7878
T *tryGetPtr() const {
79-
if (location.is<T *>())
80-
return location.get<T *>();
79+
// Use llvm::dyn_cast_if_present because location may be null here.
80+
if (T *ptr = llvm::dyn_cast_if_present<T *>(location))
81+
return ptr;
8182
return nullptr;
8283
}
8384

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 522255
19+
#define LLVM_MAIN_REVISION 522257
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,9 +1348,10 @@ def add_like : PatFrags<(ops node:$lhs, node:$rhs),
13481348

13491349
// negate of low bit can be done via two (compressible) shifts. The negate
13501350
// is never compressible since rs1 and rd can't be the same register.
1351-
def : Pat<(XLenVT (sub 0, (and_oneuse GPR:$rs, 1))),
1352-
(SRAI (XLenVT (SLLI $rs, (ImmSubFromXLen (XLenVT 1)))),
1353-
(ImmSubFromXLen (XLenVT 1)))>;
1351+
def : Pat<(i32 (sub 0, (and_oneuse GPR:$rs, 1))),
1352+
(SRAI (i32 (SLLI $rs, 31)), 31)>, Requires<[IsRV32]>;
1353+
def : Pat<(i64 (sub 0, (and_oneuse GPR:$rs, 1))),
1354+
(SRAI (i64 (SLLI $rs, 63)), 63)>, Requires<[IsRV64]>;
13541355

13551356
// AND with leading/trailing ones mask exceeding simm32/simm12.
13561357
def : Pat<(i64 (and GPR:$rs, immop_oneuse<LeadingOnesMask>:$mask)),

0 commit comments

Comments
 (0)