From d536f2328ededb3aae6563c721c6134c735f1918 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 29 Jul 2016 03:27:26 +0000 Subject: [ConstnatFolding] Teach the folder how to fold ConstantVector A ConstantVector can have ConstantExpr operands and vice versa. However, the folder had no ability to fold ConstantVectors which, in some cases, was an optimization barrier. Instead, rephrase the folder in terms of Constants instead of ConstantExprs and teach callers how to deal with failure. llvm-svn: 277099 --- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index d41c449..840feca 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -161,9 +161,8 @@ Value *InstCombiner::EvaluateInDifferentType(Value *V, Type *Ty, if (Constant *C = dyn_cast(V)) { C = ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/); // If we got a constantexpr back, try to simplify it with DL info. - if (ConstantExpr *CE = dyn_cast(C)) - if (Constant *FoldedC = ConstantFoldConstantExpression(CE, DL, TLI)) - C = FoldedC; + if (Constant *FoldedC = ConstantFoldConstant(C, DL, TLI)) + C = FoldedC; return C; } -- cgit v1.1