diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-07-29 03:27:26 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-07-29 03:27:26 +0000 |
commit | d536f2328ededb3aae6563c721c6134c735f1918 (patch) | |
tree | 3d65c25e2093384cf070d6f3b8be9f9eaffbac78 /llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | |
parent | c7de3a101885c5b9b167a82b0be37dfb23551aa2 (diff) | |
download | llvm-d536f2328ededb3aae6563c721c6134c735f1918.zip llvm-d536f2328ededb3aae6563c721c6134c735f1918.tar.gz llvm-d536f2328ededb3aae6563c721c6134c735f1918.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
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<Constant>(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<ConstantExpr>(C)) - if (Constant *FoldedC = ConstantFoldConstantExpression(CE, DL, TLI)) - C = FoldedC; + if (Constant *FoldedC = ConstantFoldConstant(C, DL, TLI)) + C = FoldedC; return C; } |