mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
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
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user