diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-07-29 03:27:31 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-07-29 03:27:31 +0000 |
commit | 57b94c8d6a249da464995e651e057645ad6b4c1b (patch) | |
tree | 6ac9c8587cacbca4a1877ea3aa15adcc73bcb199 /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | d536f2328ededb3aae6563c721c6134c735f1918 (diff) | |
download | llvm-57b94c8d6a249da464995e651e057645ad6b4c1b.zip llvm-57b94c8d6a249da464995e651e057645ad6b4c1b.tar.gz llvm-57b94c8d6a249da464995e651e057645ad6b4c1b.tar.bz2 |
[ConstantFolding] Use ConstantExpr::getWithOperands
ConstantExpr::getWithOperands does much of the hard work that
ConstantFoldInstOperandsImpl tries to do but more completely.
This lets us fold ExtractValue/InsertValue expressions.
llvm-svn: 277100
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 7ee3e8c..c7f656a 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -938,6 +938,9 @@ Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, Type *DestTy, Ops[0], Ops.slice(1)); } + if (auto *CE = dyn_cast<ConstantExpr>(InstOrCE)) + return CE->getWithOperands(Ops); + switch (Opcode) { default: return nullptr; case Instruction::ICmp: |