OSDN Git Service

IR: Thread OnlyIfReduced through ConstantExpr::getWithOperands()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Aug 2014 19:45:37 +0000 (19:45 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 19 Aug 2014 19:45:37 +0000 (19:45 +0000)
commite2215571e55bec0e7d6a08a970e53b931a894203
treea3de9168af9414d2c9ea0a2ef8a7c8c56b66de16
parenta96d94aa6e7a7b5ea62c58496d9a4d005dc72705
IR: Thread OnlyIfReduced through ConstantExpr::getWithOperands()

In order to change `ConstantExpr::replaceUsesOfWithOnConstant()` to work
like other constants (e.g., using `ConstantArray::getImpl()`), thread
`OnlyIfReduced` through as necessary.  When `OnlyIfReduced` is false,
there's no functionality change.  When it's true, if there's no constant
folding or type changes `nullptr` is returned instead of the new
constant.

`ConstantExpr::replaceUsesOfWithOnConstant()` will be updated to use the
"true" version in a follow-up commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216015 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Constants.h
lib/IR/Constants.cpp