mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
[Attributes] Merge calls to getFnAttribute/hasFnAttribute using Attribute::isValid. NFC
Rather than calling hasFnAttribute and then calling getFnAttribute if the attribute exists, its better to just call getFnAttribute and then check if we got a valid attribute back.
This commit is contained in:
parent
2a46a04b28
commit
95cc907e21
@ -1937,21 +1937,19 @@ static void adjustCallerStackProbes(Function &Caller, const Function &Callee) {
|
||||
/// that is no larger.
|
||||
static void
|
||||
adjustCallerStackProbeSize(Function &Caller, const Function &Callee) {
|
||||
if (Callee.hasFnAttribute("stack-probe-size")) {
|
||||
uint64_t CalleeStackProbeSize;
|
||||
Callee.getFnAttribute("stack-probe-size")
|
||||
.getValueAsString()
|
||||
.getAsInteger(0, CalleeStackProbeSize);
|
||||
if (Caller.hasFnAttribute("stack-probe-size")) {
|
||||
uint64_t CallerStackProbeSize;
|
||||
Caller.getFnAttribute("stack-probe-size")
|
||||
.getValueAsString()
|
||||
.getAsInteger(0, CallerStackProbeSize);
|
||||
Attribute CalleeAttr = Callee.getFnAttribute("stack-probe-size");
|
||||
if (CalleeAttr.isValid()) {
|
||||
Attribute CallerAttr = Caller.getFnAttribute("stack-probe-size");
|
||||
if (CallerAttr.isValid()) {
|
||||
uint64_t CallerStackProbeSize, CalleeStackProbeSize;
|
||||
CallerAttr.getValueAsString().getAsInteger(0, CallerStackProbeSize);
|
||||
CalleeAttr.getValueAsString().getAsInteger(0, CalleeStackProbeSize);
|
||||
|
||||
if (CallerStackProbeSize > CalleeStackProbeSize) {
|
||||
Caller.addFnAttr(Callee.getFnAttribute("stack-probe-size"));
|
||||
Caller.addFnAttr(CalleeAttr);
|
||||
}
|
||||
} else {
|
||||
Caller.addFnAttr(Callee.getFnAttribute("stack-probe-size"));
|
||||
Caller.addFnAttr(CalleeAttr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1967,18 +1965,15 @@ adjustCallerStackProbeSize(Function &Caller, const Function &Callee) {
|
||||
/// handled as part of inline cost analysis.
|
||||
static void
|
||||
adjustMinLegalVectorWidth(Function &Caller, const Function &Callee) {
|
||||
if (Caller.hasFnAttribute("min-legal-vector-width")) {
|
||||
if (Callee.hasFnAttribute("min-legal-vector-width")) {
|
||||
uint64_t CallerVectorWidth;
|
||||
Caller.getFnAttribute("min-legal-vector-width")
|
||||
.getValueAsString()
|
||||
.getAsInteger(0, CallerVectorWidth);
|
||||
uint64_t CalleeVectorWidth;
|
||||
Callee.getFnAttribute("min-legal-vector-width")
|
||||
.getValueAsString()
|
||||
.getAsInteger(0, CalleeVectorWidth);
|
||||
Attribute CallerAttr = Caller.getFnAttribute("min-legal-vector-width");
|
||||
if (CallerAttr.isValid()) {
|
||||
Attribute CalleeAttr = Callee.getFnAttribute("min-legal-vector-width");
|
||||
if (CalleeAttr.isValid()) {
|
||||
uint64_t CallerVectorWidth, CalleeVectorWidth;
|
||||
CallerAttr.getValueAsString().getAsInteger(0, CallerVectorWidth);
|
||||
CalleeAttr.getValueAsString().getAsInteger(0, CalleeVectorWidth);
|
||||
if (CallerVectorWidth < CalleeVectorWidth)
|
||||
Caller.addFnAttr(Callee.getFnAttribute("min-legal-vector-width"));
|
||||
Caller.addFnAttr(CalleeAttr);
|
||||
} else {
|
||||
// If the callee doesn't have the attribute then we don't know anything
|
||||
// and must drop the attribute from the caller.
|
||||
|
Loading…
Reference in New Issue
Block a user