diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-03-17 23:48:02 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-03-17 23:48:02 +0000 |
commit | 0f5063c7547ec908318471fb3d58ed4461ee0a8f (patch) | |
tree | 8ce4a75fb163db2e4da2d90d992ca2808c130c3e /llvm/lib/Transforms/Utils/BuildLibCalls.cpp | |
parent | 573624a9c22395b5bfd89e6fd84e0bbe0e0a7104 (diff) | |
download | bcm5719-llvm-0f5063c7547ec908318471fb3d58ed4461ee0a8f.tar.gz bcm5719-llvm-0f5063c7547ec908318471fb3d58ed4461ee0a8f.zip |
[BuildLibCalls] emitPutChar should infer function attributes for putchar
When InstCombine calls into SimplifyLibCalls and it createa putChar calls, we don't infer the attributes. And since SimplifyLibCalls doesn't use InstCombine's IRBuilder the calls doesn't end up in the worklist on this iteration of InstCombine. So it gets picked up on the next iteration where it causes an IR change. This of course causes InstCombine to run another iteration.
So this patch just gets the attributes right the first time. We already did this for puts and some other libcalls.
Differential Revision: https://reviews.llvm.org/D31094
llvm-svn: 298171
Diffstat (limited to 'llvm/lib/Transforms/Utils/BuildLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BuildLibCalls.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp index 4f6bfcfe524..240fb70f6b5 100644 --- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp @@ -920,6 +920,7 @@ Value *llvm::emitPutChar(Value *Char, IRBuilder<> &B, Module *M = B.GetInsertBlock()->getModule(); Value *PutChar = M->getOrInsertFunction("putchar", B.getInt32Ty(), B.getInt32Ty(), nullptr); + inferLibFuncAttributes(*M->getFunction("putchar"), *TLI); CallInst *CI = B.CreateCall(PutChar, B.CreateIntCast(Char, B.getInt32Ty(), |