aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-06-29 17:56:31 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-06-29 17:56:31 -0700
commit7e6b35b1f14efaa250dfcf9d90aba90fda227ba4 (patch)
treeaa2ffebf7b6df616a312d1d847be27103b910338 /lib/Analysis
parentf2518db25a8d0cacebb82d2f8872b00014a03bc8 (diff)
PNaCl ABI: Remove use of @llvm.memset.p0i8.i64 (64-bit intrinsic variant)
Convert calls to this intrinsic to use the 32-bit variant instead. Do the same for the memcpy and memmove intrinsics too. Change the PNaCl ABI verifier to check this argument. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3530 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/18226003
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/NaCl/PNaClABIVerifyModule.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
index 7922d84a51..aece2f94a7 100644
--- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
+++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
@@ -198,9 +198,6 @@ bool PNaClABIVerifyModule::isWhitelistedIntrinsic(const Function *F,
case Intrinsic::ctlz:
case Intrinsic::cttz: return isWhitelistedCountBits(F, 2);
case Intrinsic::ctpop: return isWhitelistedCountBits(F, 1);
- case Intrinsic::memcpy:
- case Intrinsic::memmove:
- case Intrinsic::memset:
case Intrinsic::nacl_read_tp:
case Intrinsic::nacl_setjmp:
case Intrinsic::nacl_longjmp:
@@ -209,6 +206,14 @@ bool PNaClABIVerifyModule::isWhitelistedIntrinsic(const Function *F,
case Intrinsic::stacksave:
case Intrinsic::trap:
return true;
+ case Intrinsic::memcpy:
+ case Intrinsic::memmove:
+ case Intrinsic::memset:
+ // Disallow the variant with the 64-bit "size" argument.
+ // TODO(mseaborn): Check all arguments' types and check the
+ // intrinsics' full names too.
+ // See https://code.google.com/p/nativeclient/issues/detail?id=3530
+ return F->getFunctionType()->getParamType(2)->isIntegerTy(32);
// (2) Known to be never allowed.
case Intrinsic::not_intrinsic: