[llvm] [AArch64][GlobalISel] Look into array's element (PR #74109)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 02:33:48 PST 2023


================
@@ -621,6 +621,17 @@ bool AArch64RegisterBankInfo::isLoadFromFPType(const MachineInstr &MI) const {
   Type *EltTy = nullptr;
   if (const GlobalValue *GV = dyn_cast<GlobalValue>(LdVal)) {
     EltTy = GV->getValueType();
+    // Look at the first element of the struct to determine its type
+    if (StructType *StructEltTy = dyn_cast<StructType>(EltTy)) {
+      while (isa<StructType>(StructEltTy->getTypeAtIndex(0U))) {
+        StructEltTy = dyn_cast<StructType>(StructEltTy->getTypeAtIndex(0U));
+      }
+      EltTy = StructEltTy->getTypeAtIndex(0U);
+    }
+    // Look at the first element of the array to determine its type
+    if (isa<ArrayType>(EltTy)) {
----------------
davemgreen wrote:

This can drop the brackets, if it's a single statement.

https://github.com/llvm/llvm-project/pull/74109


More information about the llvm-commits mailing list