From 768c2b6bfe3f865e912ad2eadadc64c33c25f4cf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 14 Aug 2002 22:11:52 +0000 Subject: 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. llvm-svn: 3337 --- llvm/lib/Transforms/ExprTypeConvert.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/ExprTypeConvert.cpp b/llvm/lib/Transforms/ExprTypeConvert.cpp index 98bc9425f45..ede89563717 100644 --- a/llvm/lib/Transforms/ExprTypeConvert.cpp +++ b/llvm/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; -- cgit v1.2.3