diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -1759,8 +1759,8 @@ })) return true; - // SROA can look through these but give them a cost. - return false; + // SROA can't look through these, but they may be free. + return Base::visitExtractValue(I); } bool CallAnalyzer::visitInsertValue(InsertValueInst &I) { @@ -1772,8 +1772,8 @@ })) return true; - // SROA can look through these but give them a cost. - return false; + // SROA can't look through these, but they may be free. + return Base::visitInsertValue(I); } /// Try to simplify a call site. diff --git a/llvm/test/Transforms/Inline/X86/extractvalue.ll b/llvm/test/Transforms/Inline/X86/extractvalue.ll --- a/llvm/test/Transforms/Inline/X86/extractvalue.ll +++ b/llvm/test/Transforms/Inline/X86/extractvalue.ll @@ -9,9 +9,9 @@ ; CHECK: Analyzing call of callee... (caller:caller_range) ; CHECK-NEXT: define i32 @callee({ i32, i32 } %arg) { -; CHECK-NEXT: ; cost before = -35, cost after = -30, threshold before = 0, threshold after = 0, cost delta = 5 +; CHECK-NEXT: ; cost before = -35, cost after = -35, threshold before = 0, threshold after = 0, cost delta = 0 ; CHECK-NEXT: %r = extractvalue { i32, i32 } %arg, 0 -; CHECK-NEXT: ; cost before = -30, cost after = -30, threshold before = 0, threshold after = 0, cost delta = 0 +; CHECK-NEXT: ; cost before = -35, cost after = -35, threshold before = 0, threshold after = 0, cost delta = 0 ; CHECK-NEXT: ret i32 %r ; CHECK-NEXT: }