[X86] Don't call hasFnAttribute and getFnAttribute for 'prefer-vector-width' and 'min-legal-vector-width' in getSubtargetImpl
We only need to call getFnAttribute and then check if the Attribute is None or not.
This commit is contained in:
parent
e9d9a61208
commit
ba852e1e19
|
@ -254,8 +254,9 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
|
||||||
|
|
||||||
// Extract prefer-vector-width attribute.
|
// Extract prefer-vector-width attribute.
|
||||||
unsigned PreferVectorWidthOverride = 0;
|
unsigned PreferVectorWidthOverride = 0;
|
||||||
if (F.hasFnAttribute("prefer-vector-width")) {
|
Attribute PreferVecWidthAttr = F.getFnAttribute("prefer-vector-width");
|
||||||
StringRef Val = F.getFnAttribute("prefer-vector-width").getValueAsString();
|
if (!PreferVecWidthAttr.hasAttribute(Attribute::None)) {
|
||||||
|
StringRef Val = PreferVecWidthAttr.getValueAsString();
|
||||||
unsigned Width;
|
unsigned Width;
|
||||||
if (!Val.getAsInteger(0, Width)) {
|
if (!Val.getAsInteger(0, Width)) {
|
||||||
Key += "prefer-vector-width=";
|
Key += "prefer-vector-width=";
|
||||||
|
@ -266,9 +267,9 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
|
||||||
|
|
||||||
// Extract min-legal-vector-width attribute.
|
// Extract min-legal-vector-width attribute.
|
||||||
unsigned RequiredVectorWidth = UINT32_MAX;
|
unsigned RequiredVectorWidth = UINT32_MAX;
|
||||||
if (F.hasFnAttribute("min-legal-vector-width")) {
|
Attribute MinLegalVecWidthAttr = F.getFnAttribute("min-legal-vector-width");
|
||||||
StringRef Val =
|
if (!MinLegalVecWidthAttr.hasAttribute(Attribute::None)) {
|
||||||
F.getFnAttribute("min-legal-vector-width").getValueAsString();
|
StringRef Val = MinLegalVecWidthAttr.getValueAsString();
|
||||||
unsigned Width;
|
unsigned Width;
|
||||||
if (!Val.getAsInteger(0, Width)) {
|
if (!Val.getAsInteger(0, Width)) {
|
||||||
Key += "min-legal-vector-width=";
|
Key += "min-legal-vector-width=";
|
||||||
|
|
Loading…
Reference in New Issue