GetOperandConstants operand can be const (#3126)
diff --git a/source/opt/constants.cpp b/source/opt/constants.cpp
index 0887ec2..6057356 100644
--- a/source/opt/constants.cpp
+++ b/source/opt/constants.cpp
@@ -156,7 +156,7 @@
}
std::vector<const Constant*> ConstantManager::GetOperandConstants(
- Instruction* inst) const {
+ const Instruction* inst) const {
std::vector<const Constant*> constants;
for (uint32_t i = 0; i < inst->NumInOperands(); i++) {
const Operand* operand = &inst->GetInOperand(i);
diff --git a/source/opt/constants.h b/source/opt/constants.h
index 5f2fdc7..9518b5b 100644
--- a/source/opt/constants.h
+++ b/source/opt/constants.h
@@ -597,7 +597,8 @@
// Returns a vector of constants representing each in operand. If an operand
// is not constant its entry is nullptr.
- std::vector<const Constant*> GetOperandConstants(Instruction* inst) const;
+ std::vector<const Constant*> GetOperandConstants(
+ const Instruction* inst) const;
// Records a mapping between |inst| and the constant value generated by it.
// It returns true if a new Constant was successfully mapped, false if |inst|