diff options
author | David Sehr <sehr@chromium.org> | 2013-05-08 09:28:31 -0700 |
---|---|---|
committer | David Sehr <sehr@chromium.org> | 2013-05-08 09:28:31 -0700 |
commit | 8c9803a8981992ffd6bb1a901c9c3a52f2aedfce (patch) | |
tree | 1e47699dab33d564f63e44a4ad87aeb396fa39b3 /include | |
parent | 77cc10ffb869891e7eff5a5fa1be4437c3360cf8 (diff) |
Insert denominator zero checks for NaCl
This IR pass for ARM inserts a comparison and a branch to trap if the
denominator of a DIV or REM instruction is zero. This makes ARM fault
identically to x86 in this case.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=2833
R=eliben@chromium.org
Review URL: https://codereview.chromium.org/14607004
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/InitializePasses.h | 1 | ||||
-rw-r--r-- | include/llvm/Transforms/NaCl.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h index 9bcc8bf2a0..1f81c9770e 100644 --- a/include/llvm/InitializePasses.h +++ b/include/llvm/InitializePasses.h @@ -286,6 +286,7 @@ void initializeExpandTlsPass(PassRegistry&); void initializeExpandVarArgsPass(PassRegistry&); void initializeFlattenGlobalsPass(PassRegistry&); void initializeGlobalCleanupPass(PassRegistry&); +void initializeInsertDivideCheckPass(PassRegistry&); void initializeNaClCcRewritePass(PassRegistry&); void initializePNaClABIVerifyModulePass(PassRegistry&); void initializePNaClABIVerifyFunctionsPass(PassRegistry&); diff --git a/include/llvm/Transforms/NaCl.h b/include/llvm/Transforms/NaCl.h index ba765c1c21..edd641e901 100644 --- a/include/llvm/Transforms/NaCl.h +++ b/include/llvm/Transforms/NaCl.h @@ -30,6 +30,7 @@ ModulePass *createFlattenGlobalsPass(); ModulePass *createGlobalCleanupPass(); ModulePass *createResolveAliasesPass(); ModulePass *createStripMetadataPass(); +FunctionPass *createInsertDivideCheckPass(); Instruction *PhiSafeInsertPt(Use *U); void PhiSafeReplaceUses(Use *U, Value *NewVal); |