[Lldb-commits] [lldb] b3fbbab - [lldb] Use byval type

Nikita Popov via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 24 04:56:36 PDT 2022


Author: Nikita Popov
Date: 2022-03-24T12:55:42+01:00
New Revision: b3fbbabdc1f7a52c0cc2756036a132b9aaab5742

URL: https://github.com/llvm/llvm-project/commit/b3fbbabdc1f7a52c0cc2756036a132b9aaab5742
DIFF: https://github.com/llvm/llvm-project/commit/b3fbbabdc1f7a52c0cc2756036a132b9aaab5742.diff

LOG: [lldb] Use byval type

Query byval type instead of pointer element type.

Added: 
    

Modified: 
    lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
index f7f1982f4059a..ec8f8d83c4b37 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
@@ -56,21 +56,19 @@ static bool isRSLargeReturnCall(llvm::CallInst *call_inst) {
              ->getPrimitiveSizeInBits() > 128;
 }
 
-static bool isRSAllocationPtrTy(const llvm::Type *type) {
-  if (!type->isPointerTy())
-    return false;
-  auto ptr_type = type->getPointerElementType();
-
-  return ptr_type->isStructTy() &&
-         ptr_type->getStructName().startswith("struct.rs_allocation");
+static bool isRSAllocationTy(const llvm::Type *type) {
+  return type->isStructTy() &&
+         type->getStructName().startswith("struct.rs_allocation");
 }
 
 static bool isRSAllocationTyCallSite(llvm::CallInst *call_inst) {
   if (!call_inst->hasByValArgument())
     return false;
-  for (const auto *param : call_inst->operand_values())
-    if (isRSAllocationPtrTy(param->getType()))
-      return true;
+  for (unsigned i = 0; i < call_inst->arg_size(); ++i) {
+    if (llvm::Type *ByValTy = call_inst->getParamByValType(i))
+      if (isRSAllocationTy(ByValTy))
+        return true;
+  }
   return false;
 }
 


        


More information about the lldb-commits mailing list