summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-14 22:11:52 +0000
committerChris Lattner <sabre@nondot.org>2002-08-14 22:11:52 +0000
commitb9a7793ecba7824aaf48626ff6b116512e0b56c4 (patch)
treebcebf22393c75f2b83407af14384373f56b3b5f6 /lib
parentdb6e4d662597d57df7a7f00dc342d8cf7fb5465a (diff)
downloadexternal_llvm-b9a7793ecba7824aaf48626ff6b116512e0b56c4.zip
external_llvm-b9a7793ecba7824aaf48626ff6b116512e0b56c4.tar.gz
external_llvm-b9a7793ecba7824aaf48626ff6b116512e0b56c4.tar.bz2
Avoid creating 'load X, 0' instead of just 'load X'
This _trivial_ change causes GCSE and LICM to be much more effective at hoisting loads. Before it would not be able to eliminate 'load X' if there was just a dominating 'load X, 0' because the expressions were not identical. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 98bc942..ede8956 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -990,6 +990,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
}
assert(LoadedTy->isFirstClassType());
+ if (Indices.size() == 1)
+ Indices.clear(); // Do not generate load X, 0
+
Res = new LoadInst(NewVal, Indices, Name);
assert(Res->getType()->isFirstClassType() && "Load of structure or array!");
break;