diff options
| author | Nicolai Haehnle <nhaehnle@gmail.com> | 2016-07-11 14:11:51 +0000 | 
|---|---|---|
| committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2016-07-11 14:11:51 +0000 | 
| commit | 889a20cf40c8e61a62e32bef38a0abea6194d6f1 (patch) | |
| tree | 4c0ebca29d0c977d01aa22c55e192b57b70cce90 /llvm/lib/Transforms | |
| parent | 9343f36f8eec31842cbd07a48b62e5acd80d02bc (diff) | |
| download | bcm5719-llvm-889a20cf40c8e61a62e32bef38a0abea6194d6f1.tar.gz bcm5719-llvm-889a20cf40c8e61a62e32bef38a0abea6194d6f1.zip | |
[Sink] Don't move calls to readonly functions across stores
Summary:
Reviewers: hfinkel, majnemer, tstellarAMD, sunfish
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D17279
llvm-svn: 275066
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/Sink.cpp | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/llvm/lib/Transforms/Scalar/Sink.cpp b/llvm/lib/Transforms/Scalar/Sink.cpp index 5fa43bda9d0..d9a296c6312 100644 --- a/llvm/lib/Transforms/Scalar/Sink.cpp +++ b/llvm/lib/Transforms/Scalar/Sink.cpp @@ -76,11 +76,15 @@ static bool isSafeToMove(Instruction *Inst, AliasAnalysis &AA,        Inst->mayThrow())      return false; -  // Convergent operations cannot be made control-dependent on additional -  // values.    if (auto CS = CallSite(Inst)) { +    // Convergent operations cannot be made control-dependent on additional +    // values.      if (CS.hasFnAttr(Attribute::Convergent))        return false; + +    for (Instruction *S : Stores) +      if (AA.getModRefInfo(S, CS) & MRI_Mod) +        return false;    }    return true; | 

