[all-commits] [llvm/llvm-project] 73e8d9: [BuildLibCalls] Name types to identify when 'int' ...
Björn Pettersson via All-commits
all-commits at lists.llvm.org
Tue Oct 4 03:52:50 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 73e8d95d28f8afa6f45cd0830641f62025584c07
https://github.com/llvm/llvm-project/commit/73e8d95d28f8afa6f45cd0830641f62025584c07
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2022-10-04 (Tue, 04 Oct 2022)
Changed paths:
M llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
M llvm/lib/Transforms/Utils/BuildLibCalls.cpp
Log Message:
-----------
[BuildLibCalls] Name types to identify when 'int' and 'size_t' is assumed. NFC
Lots of BuildLibCalls helpers are using Builder::getInt32Ty to get
a type matching an 'int', and DataLayout::getIntPtrType to get a
type matching 'size_t'. The former is not true for all targets, since
and 'int' isn't always 32 bits. And the latter is a bit weird as well
as the definition of DataLayout::getIntPtrType isn't clearly mapping
it to 'size_t'.
This patch is not aiming at solving any such problems. It is merely
highlighting when a libcall is expecting to use 'int' and 'size_t'
by naming the types as IntTy and SizeTTy when preparing the type
signatures for the emitted libcalls.
Differential Revision: https://reviews.llvm.org/D135064
Commit: aa1b64cc425665a529816505eea272927ab6a589
https://github.com/llvm/llvm-project/commit/aa1b64cc425665a529816505eea272927ab6a589
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2022-10-04 (Tue, 04 Oct 2022)
Changed paths:
M llvm/include/llvm/IR/IRBuilder.h
M llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
M llvm/lib/Transforms/Scalar/MergeICmps.cpp
M llvm/lib/Transforms/Utils/BuildLibCalls.cpp
M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
Log Message:
-----------
[BuildLibCalls] Use TLI to get 'int' and 'size_t' type sizes
Stop assuming that an 'int' is 32 bits in helpers that emit libcalls
to lib functions that had 'int' in the signature. For most targets
this is NFC. For a target with 16 bit 'int' type this could help out
detecting if trying to emit a libcall with incorrect signature.
Similarly we now derive the type mapping to 'size_t' by asking TLI
about the size of 'size_t'. This should be NFC (at least for in-tree
targets) since getSizeTSize(), in TLI, is deriving the size in the
same way as DataLayout::getIntPtrType().
Differential Revision: https://reviews.llvm.org/D135065
Commit: 491ac8f3e81c5b6ecd364b560960cd63dccd3df7
https://github.com/llvm/llvm-project/commit/491ac8f3e81c5b6ecd364b560960cd63dccd3df7
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2022-10-04 (Tue, 04 Oct 2022)
Changed paths:
M llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
M llvm/lib/Transforms/Utils/BuildLibCalls.cpp
M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
Log Message:
-----------
[LibCalls] Cast Char argument to 'int' before calling emitFPutC
The helpers in BuildLibCalls normally expect that the Value
arguments already have the correct type (matching the lib call
signature). And exception has been emitFPutC which casted the Char
argument to 'int' using CreateIntCast. This patch moves the cast to
the caller instead of doing it inside emitFPutC.
I think it makes sense to make the BuildLibCall API:s a bit
more consistent this way, despite the need to handle the int cast
in two different places now.
Differential Revision: https://reviews.llvm.org/D135066
Compare: https://github.com/llvm/llvm-project/compare/825e16969eb7...491ac8f3e81c
More information about the All-commits
mailing list