================
@@ -3665,62 +3678,59 @@ getDeclareTargetRefPtrSuffix(LLVM::GlobalOp globalOp,
return suffix;
}
-static bool isDeclareTargetLink(mlir::Value value) {
- if (auto addressOfOp = value.getDefiningOp<LLVM::AddressOfOp>()) {
- auto modOp = addressOfOp->getParentOfType<mlir::ModuleOp>();
- Operation *gOp = modOp.lookupSymbol(addressOfOp.getGlobalName());
- if (auto declareTargetGlobal =
- llvm::dyn_cast<mlir::omp::DeclareTargetInterface>(gOp))
+static bool isDeclareTargetLink(Value value) {
+ if (Operation *gOp = getGlobalOpFromValue(value)) {
+ if (auto declareTargetGlobal = dyn_cast<omp::DeclareTargetInterface>(gOp))
----------------
skatrak wrote:
Nit: This change would reduce nesting, but feel free to ignore if you prefer to
leave it as is. The same could be done in `isDeclareTargetTo`.
```suggestion
if (auto declareTargetGlobal =
dyn_cast_if_present<omp::DeclareTargetInterface>(getGlobalOpFromValue(value))) {
```
https://github.com/llvm/llvm-project/pull/119589
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits