aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Target/TargetLowering.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index c862371c93..6880708130 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -339,9 +339,11 @@ public:
}
/// getValueType - Return the MVT::ValueType corresponding to this LLVM type.
- /// This is fixed by the LLVM operations except for the pointer size.
- MVT::ValueType getValueType(const Type *Ty) const {
- MVT::ValueType VT = MVT::getValueType(Ty);
+ /// This is fixed by the LLVM operations except for the pointer size. If
+ /// AllowUnknown is true, this will return MVT::Other for types with no MVT
+ /// counterpart (e.g. structs), otherwise it will assert.
+ MVT::ValueType getValueType(const Type *Ty, bool AllowUnknown = false) const {
+ MVT::ValueType VT = MVT::getValueType(Ty, AllowUnknown);
return VT == MVT::iPTR ? PointerTy : VT;
}