[llvm] r342434 - [LLVM-C] Add support for ConstantExpr in LLVMGetNumIndices and LLVMGetIndices
whitequark via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 17 18:47:25 PDT 2018
Author: whitequark
Date: Mon Sep 17 18:47:25 2018
New Revision: 342434
URL: http://llvm.org/viewvc/llvm-project?rev=342434&view=rev
Log:
[LLVM-C] Add support for ConstantExpr in LLVMGetNumIndices and LLVMGetIndices
Summary:
ConstantExpr supports getIndices, but prior to this patch
LLVMGetNumIndices and LLVMGetIndices would error on them.
Reviewers: whitequark
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D52206
Modified:
llvm/trunk/lib/IR/Core.cpp
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=342434&r1=342433&r2=342434&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Mon Sep 17 18:47:25 2018
@@ -2632,6 +2632,8 @@ unsigned LLVMGetNumIndices(LLVMValueRef
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 @@ const unsigned *LLVMGetIndices(LLVMValue
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!");
}
More information about the llvm-commits
mailing list