diff options
author | Chris Lattner <sabre@nondot.org> | 2011-01-03 23:38:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-01-03 23:38:13 +0000 |
commit | e508dd4c75705f325764e1197854c0e83266a7ea (patch) | |
tree | d779457fcb395e7ce59e38f2f0dac349cd0b9e76 /lib | |
parent | 7158e08b8e619f4dcac9834c57f5f8afd6eea2eb (diff) |
Duncan deftly points out that readnone functions aren't
invalidated by stores, so they can be handled as 'simple'
operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/EarlyCSE.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/EarlyCSE.cpp b/lib/Transforms/Scalar/EarlyCSE.cpp index 6c2ea39896..3d3f17b26f 100644 --- a/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/lib/Transforms/Scalar/EarlyCSE.cpp @@ -56,6 +56,9 @@ namespace { } static bool canHandle(Instruction *Inst) { + // This can only handle non-void readnone functions. + if (CallInst *CI = dyn_cast<CallInst>(Inst)) + return CI->doesNotAccessMemory() && !CI->getType()->isVoidTy(); return isa<CastInst>(Inst) || isa<BinaryOperator>(Inst) || isa<GetElementPtrInst>(Inst) || isa<CmpInst>(Inst) || isa<SelectInst>(Inst) || isa<ExtractElementInst>(Inst) || @@ -105,7 +108,8 @@ unsigned DenseMapInfo<SimpleValue>::getHashValue(SimpleValue Val) { Res ^= *I; } else { // nothing extra to hash in. - assert((isa<BinaryOperator>(Inst) || isa<GetElementPtrInst>(Inst) || + assert((isa<CallInst>(Inst) || + isa<BinaryOperator>(Inst) || isa<GetElementPtrInst>(Inst) || isa<SelectInst>(Inst) || isa<ExtractElementInst>(Inst) || isa<InsertElementInst>(Inst) || isa<ShuffleVectorInst>(Inst)) && "Invalid/unknown instruction"); |