diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-11-03 20:21:32 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-11-03 20:21:32 +0000 |
commit | 1e16fa302e2c3f68ea8187e8b782397e0b24cd0f (patch) | |
tree | 9823bb9f7600846f641e9961cd0b8759e7d8e789 /llvm/lib/Transforms | |
parent | 1ae35b902ba0482ef80fa3f778efd719c9626b41 (diff) | |
download | bcm5719-llvm-1e16fa302e2c3f68ea8187e8b782397e0b24cd0f.tar.gz bcm5719-llvm-1e16fa302e2c3f68ea8187e8b782397e0b24cd0f.zip |
EarlyCSE should ignore calls to @llvm.assume
EarlyCSE uses a simple generation scheme for handling memory-based
dependencies, and calls to @llvm.assume (which are marked as writing to memory
to ensure the preservation of control dependencies) disturb that scheme
unnecessarily. Skipping calls to @llvm.assume is legal, and the alternative
(adding AA calls in EarlyCSE) is likely undesirable (we have GVN for that).
Fixes PR21448.
llvm-svn: 221175
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index 131a8cb3dcb..6f166b8ee7f 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -21,6 +21,8 @@ #include "llvm/IR/DataLayout.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/PatternMatch.h" #include "llvm/Pass.h" #include "llvm/Support/Debug.h" #include "llvm/Support/RecyclingAllocator.h" @@ -28,6 +30,7 @@ #include "llvm/Transforms/Utils/Local.h" #include <deque> using namespace llvm; +using namespace llvm::PatternMatch; #define DEBUG_TYPE "early-cse" @@ -435,6 +438,15 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { continue; } + // Skip assume intrinsics, they don't really have side effects (although + // they're marked as such to ensure preservation of control dependencies), + // and this pass will not disturb any of the assumption's control + // dependencies. + if (match(Inst, m_Intrinsic<Intrinsic::assume>())) { + DEBUG(dbgs() << "EarlyCSE skipping assumption: " << *Inst << '\n'); + continue; + } + // If the instruction can be simplified (e.g. X+0 = X) then replace it with // its simpler value. if (Value *V = SimplifyInstruction(Inst, DL, TLI, DT, AT)) { |