[PATCH] D52206: [LLVM-C] Add support for ConstantExpr in LLVMGetNumIndices and LLVMGetIndices

whitequark via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 18:51:34 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342434: [LLVM-C] Add support for ConstantExpr in LLVMGetNumIndices and LLVMGetIndices (authored by whitequark, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D52206

Files:
  llvm/trunk/lib/IR/Core.cpp


Index: llvm/trunk/lib/IR/Core.cpp
===================================================================
--- llvm/trunk/lib/IR/Core.cpp
+++ llvm/trunk/lib/IR/Core.cpp
@@ -2632,6 +2632,8 @@
     return EV->getNumIndices();
   if (auto *IV = dyn_cast<InsertValueInst>(I))
     return IV->getNumIndices();
+  if (auto *CE = dyn_cast<ConstantExpr>(I))
+    return CE->getIndices().size();
   llvm_unreachable(
     "LLVMGetNumIndices applies only to extractvalue and insertvalue!");
 }
@@ -2642,6 +2644,8 @@
     return EV->getIndices().data();
   if (auto *IV = dyn_cast<InsertValueInst>(I))
     return IV->getIndices().data();
+  if (auto *CE = dyn_cast<ConstantExpr>(I))
+    return CE->getIndices().data();
   llvm_unreachable(
     "LLVMGetIndices applies only to extractvalue and insertvalue!");
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52206.165881.patch
Type: text/x-patch
Size: 799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/44b7b790/attachment.bin>


More information about the llvm-commits mailing list