[PATCH] D76283: [IRBuilder] Use preferred target type for len argument of memory intrinsic functions

Konstantin Schwarz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 07:25:15 PDT 2020


kschwarz created this revision.
kschwarz added reviewers: rjmccall, gchatelet, aemerson.
Herald added subscribers: cfe-commits, jfb.
Herald added a project: clang.

The IR builder hard-coded the type of the `len` argument of the memory function instrinsics to i64 for several builder functions.

During instruction selection of these intrinsics to the corresponding C library functions SelectionDAG ignores the type of the len argument and uses the targets preferred type.
GlobalISel however translates these calls using the actual types of the intrinsic, which will miscompile on 32-bit architectures.

Using the preferred type when creating the intrinsic call in the first place fixes this issue.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76283

Files:
  clang/test/CodeGen/c11atomics-ios.c
  clang/test/CodeGen/c11atomics.c
  clang/test/CodeGen/x86-atomic-long_double.c
  clang/test/CodeGenCXX/pod-member-memcpys.cpp
  clang/test/CodeGenCXX/pr20897.cpp
  llvm/include/llvm/IR/IRBuilder.h
  llvm/test/Transforms/MemCpyOpt/form-memset.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76283.250743.patch
Type: text/x-patch
Size: 24675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200317/eacf54af/attachment-0001.bin>


More information about the cfe-commits mailing list