From 40a34dd9a3a66b7e05d7616496a7744c615e8f9a Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Sun, 2 Oct 2011 09:12:55 +0000 Subject: Enhance a couple places where we were doing constant folding of instructions, but not load instructions. Noticed by inspection. llvm-svn: 140966 --- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index ffca57b7735..ae42d526ae7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -324,9 +324,14 @@ static Value *SimplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp, } // All operands were constants, fold it. - if (ConstOps.size() == I->getNumOperands()) + if (ConstOps.size() == I->getNumOperands()) { + if (LoadInst *LI = dyn_cast(I)) + if (!LI->isVolatile()) + return ConstantFoldLoadFromConstPtr(ConstOps[0], TD); + return ConstantFoldInstOperands(I->getOpcode(), I->getType(), ConstOps, TD); + } } return 0; -- cgit v1.2.3