Skip to content

Commit 7be867f

Browse files
nikictru
authored andcommitted
[SystemZ] Remove incorrect areInlineCompatible hook (llvm#152494)
This reverts llvm#132976. The PR incorrectly claimed that this makes inlining more liberal, referencing the string comparison in TargetTransformInfoImpl.h. However, the implementation that actually applies is the one in BasicTTIImpl.h, which performs a feature subset comparison. As such, this regressed inlining, most concerningly of functions without +vector into functions with +vector. Revert the change to restore the previous behavior. (cherry picked from commit 18e4f77)
1 parent 3e55c84 commit 7be867f

File tree

3 files changed

+9
-26
lines changed

3 files changed

+9
-26
lines changed

llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -436,20 +436,6 @@ bool SystemZTTIImpl::isLSRCostLess(
436436
C2.ScaleCost, C2.SetupCost);
437437
}
438438

439-
bool SystemZTTIImpl::areInlineCompatible(const Function *Caller,
440-
const Function *Callee) const {
441-
const TargetMachine &TM = getTLI()->getTargetMachine();
442-
443-
const FeatureBitset &CallerBits =
444-
TM.getSubtargetImpl(*Caller)->getFeatureBits();
445-
const FeatureBitset &CalleeBits =
446-
TM.getSubtargetImpl(*Callee)->getFeatureBits();
447-
448-
// Support only equal feature bitsets. Restriction should be relaxed in the
449-
// future to allow inlining when callee's bits are subset of the caller's.
450-
return CallerBits == CalleeBits;
451-
}
452-
453439
unsigned SystemZTTIImpl::getNumberOfRegisters(unsigned ClassID) const {
454440
bool Vector = (ClassID == 1);
455441
if (!Vector)

llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ class SystemZTTIImpl final : public BasicTTIImplBase<SystemZTTIImpl> {
6565
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
6666
const TargetTransformInfo::LSRCost &C2) const override;
6767

68-
bool areInlineCompatible(const Function *Caller,
69-
const Function *Callee) const override;
70-
7168
/// @}
7269

7370
/// \name Vector TTI Implementations

llvm/test/Transforms/Inline/SystemZ/inline-target-attr.ll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ entry:
1212

1313
declare i32 @baz(...) #0
1414

15-
define i32 @bar() #1 {
15+
define i32 @features_subset() #1 {
1616
entry:
1717
%call = call i32 @foo()
1818
ret i32 %call
19-
; CHECK-LABEL: bar
20-
; CHECK: call i32 @foo()
19+
; CHECK-LABEL: features_subset
20+
; CHECK: call i32 (...) @baz()
2121
}
2222

23-
define i32 @qux() #0 {
23+
define i32 @features_equal() #0 {
2424
entry:
2525
%call = call i32 @foo()
2626
ret i32 %call
27-
; CHECK-LABEL: qux
27+
; CHECK-LABEL: features_equal
2828
; CHECK: call i32 (...) @baz()
2929
}
3030

31-
define i32 @quux() #2 {
31+
define i32 @features_different() #2 {
3232
entry:
33-
%call = call i32 @bar()
33+
%call = call i32 @foo()
3434
ret i32 %call
35-
; CHECK-LABEL: quux
36-
; CHECK: call i32 @bar()
35+
; CHECK-LABEL: features_different
36+
; CHECK: call i32 @foo()
3737
}
3838

3939

0 commit comments

Comments
 (0)