diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-24 22:46:11 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-24 22:46:11 +0000 |
commit | 9b61c550c2f1fa889163a338f5d6c02b50fe961c (patch) | |
tree | db2081af02933bd7b35a87d9340756fab4b111e7 /lib | |
parent | 93c65e6e661eda75711363bdd5ca15909920e1f0 (diff) | |
download | external_llvm-9b61c550c2f1fa889163a338f5d6c02b50fe961c.zip external_llvm-9b61c550c2f1fa889163a338f5d6c02b50fe961c.tar.gz external_llvm-9b61c550c2f1fa889163a338f5d6c02b50fe961c.tar.bz2 |
SimplifyCFG: GEPs with constant indices are cheap enough to be executed unconditionally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index fb660db..c670885 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -247,6 +247,11 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB, if (PBB->getFirstNonPHIOrDbg() != I) return false; break; + case Instruction::GetElementPtr: + // GEPs are cheap if all indices are constant. + if (!cast<GetElementPtrInst>(I)->hasAllConstantIndices()) + return false; + break; case Instruction::Add: case Instruction::Sub: case Instruction::And: |