diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-07-01 00:54:44 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-07-01 00:54:44 +0000 |
commit | c14380d1953acd5a735e1d8bcf18d0f96876da74 (patch) | |
tree | b10d536e874fee69c772bf198cfae53df04fa311 /lib | |
parent | c36a8d2b3d6e543de8d9f210ecd39a9a0641d826 (diff) | |
download | external_llvm-c14380d1953acd5a735e1d8bcf18d0f96876da74.zip external_llvm-c14380d1953acd5a735e1d8bcf18d0f96876da74.tar.gz external_llvm-c14380d1953acd5a735e1d8bcf18d0f96876da74.tar.bz2 |
LoopVectorize: Math functions only read rounding mode
Math functions are mark as readonly because they read the floating point
rounding mode. Because we don't vectorize loops that would contain function
calls that set the rounding mode it is safe to ignore this memory read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index f41bd28..e6e0f6b 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -3520,6 +3520,13 @@ bool LoopVectorizationLegality::canVectorizeMemory() { // but is not a load, then we quit. Notice that we don't handle function // calls that read or write. if (it->mayReadFromMemory()) { + // Many math library functions read the rounding mode. We will only + // vectorize a loop if it contains known function calls that don't set + // the flag. Therefore, it is safe to ignore this read from memory. + CallInst *Call = dyn_cast<CallInst>(it); + if (Call && getIntrinsicIDForCall(Call, TLI)) + continue; + LoadInst *Ld = dyn_cast<LoadInst>(it); if (!Ld) return false; if (!Ld->isSimple() && !IsAnnotatedParallel) { |