[llvm] r212308 - Sink undesirable LTO functions into the old C API

Peter Collingbourne peter at pcc.me.uk
Thu Jul 3 19:01:53 PDT 2014


On Fri, Jul 04, 2014 at 12:58:42AM -0000, Alp Toker wrote:
> -/// Returns 'true' if the bitcode BC is for the specified target triple.
> -bool LTOModule::isTargetMatch(StringRef BC, const char *TriplePrefix) {
> -  std::unique_ptr<MemoryBuffer> Buffer(
> -      MemoryBuffer::getMemBuffer(BC, "", false));
> -  std::string Triple = getBitcodeTargetTriple(Buffer.get(), getGlobalContext());
> -  return strncmp(Triple.c_str(), TriplePrefix, strlen(TriplePrefix)) == 0;
> +bool LTOModule::isBitcodeForTarget(MemoryBuffer *buffer,
> +                                   StringRef triplePrefix) {
> +  return getBitcodeTargetTriple(buffer, getGlobalContext()) == triplePrefix;

This isn't doing the same thing as the original code. You need to check for
a prefix here.

Thanks,
-- 
Peter



More information about the llvm-commits mailing list