diff options
author | Tobias Grosser <tobias@grosser.es> | 2014-11-04 09:18:24 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2014-11-04 09:18:24 +0000 |
commit | 477a1dce2be06a2c78049e0c76f4eb2455121959 (patch) | |
tree | 5daa93bc323d1ebb9b8e2fe9bb78dcda8dc596df /polly/lib/CodeGen/RuntimeDebugBuilder.cpp | |
parent | 34ec84ec7f20a2c2ec2c37e53a9f182810371994 (diff) | |
download | bcm5719-llvm-477a1dce2be06a2c78049e0c76f4eb2455121959.tar.gz bcm5719-llvm-477a1dce2be06a2c78049e0c76f4eb2455121959.zip |
Use argument type directly from fflush if available in translation unit
When our RuntimeDebugBuilder calles fflush(NULL) to flush all output streams, it
is important that the types we use in the call match the ones used in a
declaration of fflush possible already available in the translation unit.
As we just pass on a NULL pointer, the type of the pointer value does not really
matter. However, as LLVM complains in case of mismatched types, we make sure
to create a NULL pointer of identical type.
No test case, as RuntimeDebugBuilder is not permanently used in Polly. Calls to
it are until now only used to add informative output during debugging sessions.
llvm-svn: 221251
Diffstat (limited to 'polly/lib/CodeGen/RuntimeDebugBuilder.cpp')
-rw-r--r-- | polly/lib/CodeGen/RuntimeDebugBuilder.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp index f539d5e9bd3..7794c91f9be 100644 --- a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp +++ b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp @@ -43,7 +43,13 @@ void RuntimeDebugBuilder::createFlush(PollyIRBuilder &Builder) { F = Function::Create(Ty, Linkage, Name, M); } - Builder.CreateCall(F, Constant::getNullValue(Builder.getInt8PtrTy())); + // fflush(NULL) flushes _all_ open output streams. + // + // fflush is declared as 'int fflush(FILE *stream)'. As we only pass on a NULL + // pointer, the type we point to does conceptually not matter. However, if + // fflush is already declared in this translation unit, we use the very same + // type to ensure that LLVM does not complain about mismatching types. + Builder.CreateCall(F, Constant::getNullValue(F->arg_begin()->getType())); } void RuntimeDebugBuilder::createStrPrinter(PollyIRBuilder &Builder, |