Mani, Suresh via llvm-dev
2020-May-15 11:07 UTC
[llvm-dev] Issues with new Attributor (replaceAllUses fails with type mismatch)
[AMD Official Use Only - Internal Distribution Only] Hi , There seems to be some issue with attributor, exactly in File Attributor.cpp, Function Attributor::rewriteFunctionSignatures(), Line No: 1600 (approrimate). The llvm source code at above address is as follows: // Eliminate the instructions *after* we visited all of them. for (auto &CallSitePair : CallSitePairs) { CallBase &OldCB = *CallSitePair.first; CallBase &NewCB = *CallSitePair.second; ModifiedFns.insert(OldCB.getFunction()); CGUpdater.replaceCallSite(OldCB, NewCB); OldCB.replaceAllUsesWith(&NewCB); <---------------------------------------- Failing location OldCB.eraseFromParent(); } Failure symptom: Assertion failed: New->getType() == getType() && "replaceAllUses of value with new value of different type!" Snaps for IR from failing llvm IR and debug info while debugging is as follows: Sample situation1: Original code in IR -- %133 = call i32 (i32, ...) bitcast (void (i32)* @set_yydebug to i32 (i32, ...)*)(i32 1) #21 Attribute info ---- attributes #21 = { nounwind } Debug info: OldCB-------------------- %133 = call i32 (i32, ...) bitcast (void (i32)* @0 to i32 (i32, ...)*)(i32 1) #27 NewCB-------------------- call void @set_yydebug() #27 OldCB.replaceAllUsesWith(&NewCB); fails because of a type mismatch b/w OldCB (i32) and NewCB (void) . ------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sample situation 2: Original code in IR -- %63 = tail call %struct.cv* bitcast (%struct.cv.231* (i8, i64, i32*)* @Perl_find_runcv_where to %struct.cv* (i8, i64, i32*)*)(i8 zeroext 1, i64 %62, i32* null) #14 Attribute info ---- attributes #14 = { nounwind } Debug info: OldCB --- %63 = tail call %struct.cv.231* @Perl_find_runcv_where(i8 zeroext 1, i64 %62) #14 NewCB ---%64 = tail call %struct.cv* bitcast (%struct.cv.231* (i8, i64, i32*)* @15 to %struct.cv* (i8, i64, i32*)*)(i8 zeroext 1, i64 %62, i32* noalias align 536870912 null) #14 And hence OldCB.replaceAllUsesWith(&NewCB); fails ------------------------------------------------------------------------------------------------------------------------------------------------------------------ The complete IR file is very huge, and had no luck in getting a reduced test case. Thanks M Suresh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200515/44b9e60d/attachment.html>
Mani, Suresh via llvm-dev
2020-May-15 12:17 UTC
[llvm-dev] Issues with new Attributor (replaceAllUses fails with type mismatch)
[AMD Public Use] Hi , Please ignore the earlier header of Internal and Official use only. Thanks M Suresh From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Mani, Suresh via llvm-dev Sent: Friday, May 15, 2020 4:37 PM To: llvm-dev at lists.llvm.org Subject: [llvm-dev] Issues with new Attributor (replaceAllUses fails with type mismatch) [CAUTION: External Email] [AMD Official Use Only - Internal Distribution Only] Hi , There seems to be some issue with attributor, exactly in File Attributor.cpp, Function Attributor::rewriteFunctionSignatures(), Line No: 1600 (approrimate). The llvm source code at above address is as follows: // Eliminate the instructions *after* we visited all of them. for (auto &CallSitePair : CallSitePairs) { CallBase &OldCB = *CallSitePair.first; CallBase &NewCB = *CallSitePair.second; ModifiedFns.insert(OldCB.getFunction()); CGUpdater.replaceCallSite(OldCB, NewCB); OldCB.replaceAllUsesWith(&NewCB); <---------------------------------------- Failing location OldCB.eraseFromParent(); } Failure symptom: Assertion failed: New->getType() == getType() && "replaceAllUses of value with new value of different type!" Snaps for IR from failing llvm IR and debug info while debugging is as follows: Sample situation1: Original code in IR -- %133 = call i32 (i32, ...) bitcast (void (i32)* @set_yydebug to i32 (i32, ...)*)(i32 1) #21 Attribute info ---- attributes #21 = { nounwind } Debug info: OldCB-------------------- %133 = call i32 (i32, ...) bitcast (void (i32)* @0 to i32 (i32, ...)*)(i32 1) #27 NewCB-------------------- call void @set_yydebug() #27 OldCB.replaceAllUsesWith(&NewCB); fails because of a type mismatch b/w OldCB (i32) and NewCB (void) . ------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sample situation 2: Original code in IR -- %63 = tail call %struct.cv* bitcast (%struct.cv.231* (i8, i64, i32*)* @Perl_find_runcv_where to %struct.cv* (i8, i64, i32*)*)(i8 zeroext 1, i64 %62, i32* null) #14 Attribute info ---- attributes #14 = { nounwind } Debug info: OldCB --- %63 = tail call %struct.cv.231* @Perl_find_runcv_where(i8 zeroext 1, i64 %62) #14 NewCB ---%64 = tail call %struct.cv* bitcast (%struct.cv.231* (i8, i64, i32*)* @15 to %struct.cv* (i8, i64, i32*)*)(i8 zeroext 1, i64 %62, i32* noalias align 536870912 null) #14 And hence OldCB.replaceAllUsesWith(&NewCB); fails ------------------------------------------------------------------------------------------------------------------------------------------------------------------ The complete IR file is very huge, and had no luck in getting a reduced test case. Thanks M Suresh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200515/49ce64b3/attachment.html>
Johannes Doerfert via llvm-dev
2020-May-15 23:12 UTC
[llvm-dev] Issues with new Attributor (replaceAllUses fails with type mismatch)
Hi Suresh, thanks for reporting this! I thought I fixed this with 8d94d3c3b44c3a27a69b153cef9be4b8e481150e. Did you run before or after that commit? Cheers, Johannes On 5/15/20 7:17 AM, Mani, Suresh via llvm-dev wrote:> [AMD Public Use] > > Hi , > > Please ignore the earlier header of Internal and Official use only. > > Thanks > M Suresh > > From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Mani, Suresh via llvm-dev > Sent: Friday, May 15, 2020 4:37 PM > To: llvm-dev at lists.llvm.org > Subject: [llvm-dev] Issues with new Attributor (replaceAllUses fails with type mismatch) > > [CAUTION: External Email] > > [AMD Official Use Only - Internal Distribution Only] > > Hi , > > There seems to be some issue with attributor, exactly in File Attributor.cpp, Function Attributor::rewriteFunctionSignatures(), Line No: 1600 (approrimate). > > The llvm source code at above address is as follows: > > // Eliminate the instructions *after* we visited all of them. > for (auto &CallSitePair : CallSitePairs) { > CallBase &OldCB = *CallSitePair.first; > CallBase &NewCB = *CallSitePair.second; > ModifiedFns.insert(OldCB.getFunction()); > CGUpdater.replaceCallSite(OldCB, NewCB); > OldCB.replaceAllUsesWith(&NewCB); <---------------------------------------- Failing location > OldCB.eraseFromParent(); > } > > Failure symptom: > Assertion failed: New->getType() == getType() && "replaceAllUses of value with new value of different type!" > > Snaps for IR from failing llvm IR and debug info while debugging is as follows: > > Sample situation1: > Original code in IR -- %133 = call i32 (i32, ...) bitcast (void (i32)* @set_yydebug to i32 (i32, ...)*)(i32 1) #21 > Attribute info ---- attributes #21 = { nounwind } > > Debug info: > OldCB-------------------- %133 = call i32 (i32, ...) bitcast (void (i32)* @0 to i32 (i32, ...)*)(i32 1) #27 > NewCB-------------------- call void @set_yydebug() #27 > > > OldCB.replaceAllUsesWith(&NewCB); fails because of a type mismatch b/w OldCB (i32) and NewCB (void) . > ------------------------------------------------------------------------------------------------------------------------------------------------------------------ > > > Sample situation 2: > > Original code in IR -- %63 = tail call %struct.cv* bitcast (%struct.cv.231* (i8, i64, i32*)* @Perl_find_runcv_where to %struct.cv* (i8, i64, i32*)*)(i8 zeroext 1, i64 %62, i32* null) #14 > Attribute info ---- attributes #14 = { nounwind } > > Debug info: > OldCB --- %63 = tail call %struct.cv.231* @Perl_find_runcv_where(i8 zeroext 1, i64 %62) #14 > NewCB ---%64 = tail call %struct.cv* bitcast (%struct.cv.231* (i8, i64, i32*)* @15 to %struct.cv* (i8, i64, i32*)*)(i8 zeroext 1, i64 %62, i32* noalias align 536870912 null) #14 > > And hence OldCB.replaceAllUsesWith(&NewCB); fails > ------------------------------------------------------------------------------------------------------------------------------------------------------------------ > > The complete IR file is very huge, and had no luck in getting a reduced test case. > > Thanks > M Suresh > > > > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200515/0d6575e3/attachment.html>