Skip to content

Commit f710612

Browse files
committed
Revert "[clang][codegen] Fix possible crash when setting TBAA metadata on FP math libcalls (#108575)"
This reverts commit a56ca1a. This commit broke code generation for x86 mingw targets, with regards to long double math functions - see #108575 (comment) for details.
1 parent 79ec1e7 commit f710612

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,8 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD,
690690
const CallExpr *E, llvm::Constant *calleeValue) {
691691
CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
692692
CGCallee callee = CGCallee::forDirect(calleeValue, GlobalDecl(FD));
693-
llvm::CallBase *callOrInvoke = nullptr;
694693
RValue Call =
695-
CGF.EmitCall(E->getCallee()->getType(), callee, E, ReturnValueSlot(),
696-
/*Chain=*/nullptr, &callOrInvoke);
694+
CGF.EmitCall(E->getCallee()->getType(), callee, E, ReturnValueSlot());
697695

698696
if (unsigned BuiltinID = FD->getBuiltinID()) {
699697
// Check whether a FP math builtin function, such as BI__builtin_expf
@@ -707,7 +705,8 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD,
707705
// Emit "int" TBAA metadata on FP math libcalls.
708706
clang::QualType IntTy = Context.IntTy;
709707
TBAAAccessInfo TBAAInfo = CGF.CGM.getTBAAAccessInfo(IntTy);
710-
CGF.CGM.DecorateInstructionWithTBAA(callOrInvoke, TBAAInfo);
708+
Instruction *Inst = cast<llvm::Instruction>(Call.getScalarVal());
709+
CGF.CGM.DecorateInstructionWithTBAA(Inst, TBAAInfo);
711710
}
712711
}
713712
return Call;

0 commit comments

Comments
 (0)