forked from OSchip/llvm-project
[InstCombine] Remove unnecessary byval check in callee cast fold
The logic for handling this was fixed in
8d7f118ab2
, but the check for byval
on the callee was retained. This resulted in a weird situation
where the transform would work depending on whether the byval
was only on the call or on both the call and the function.
This commit is contained in:
parent
2555ed55a4
commit
6c8adc5054
|
@ -3142,8 +3142,7 @@ bool InstCombinerImpl::transformConstExprCastCall(CallBase &Call) {
|
||||||
//
|
//
|
||||||
// Similarly, avoid folding away bitcasts of byval calls.
|
// Similarly, avoid folding away bitcasts of byval calls.
|
||||||
if (Callee->getAttributes().hasAttrSomewhere(Attribute::InAlloca) ||
|
if (Callee->getAttributes().hasAttrSomewhere(Attribute::InAlloca) ||
|
||||||
Callee->getAttributes().hasAttrSomewhere(Attribute::Preallocated) ||
|
Callee->getAttributes().hasAttrSomewhere(Attribute::Preallocated))
|
||||||
Callee->getAttributes().hasAttrSomewhere(Attribute::ByVal))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto AI = Call.arg_begin();
|
auto AI = Call.arg_begin();
|
||||||
|
|
|
@ -18,7 +18,8 @@ define void @add_byval(i64* %in) {
|
||||||
|
|
||||||
define void @add_byval_2(i64* %in) {
|
define void @add_byval_2(i64* %in) {
|
||||||
; CHECK-LABEL: @add_byval_2(
|
; CHECK-LABEL: @add_byval_2(
|
||||||
; CHECK-NEXT: call void bitcast (void (double*)* @add_byval_callee_2 to void (i64*)*)(i64* byval(i64) [[IN:%.*]])
|
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[IN:%.*]] to double*
|
||||||
|
; CHECK-NEXT: call void @add_byval_callee_2(double* byval(double) [[TMP1]])
|
||||||
; CHECK-NEXT: ret void
|
; CHECK-NEXT: ret void
|
||||||
;
|
;
|
||||||
%tmp = bitcast void (double*)* @add_byval_callee_2 to void (i64*)*
|
%tmp = bitcast void (double*)* @add_byval_callee_2 to void (i64*)*
|
||||||
|
|
Loading…
Reference in New Issue