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) .