1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Don't assume something which might be a constant expression is an instruction.

Based on PR9429, but no testcase because I can't figure out how to trigger it
anymore given other changes to the relevant code.

llvm-svn: 128781
This commit is contained in:
Eli Friedman 2011-04-02 22:11:56 +00:00
parent fd520474ca
commit 823b0d6c77

View File

@ -729,9 +729,9 @@ bool llvm::isPowerOfTwo(Value *V, const TargetData *TD, unsigned Depth) {
// copying a sign bit (sdiv int_min, 2).
if (match(V, m_LShr(m_Value(), m_Value())) ||
match(V, m_UDiv(m_Value(), m_Value()))) {
BinaryOperator *BO = cast<BinaryOperator>(V);
if (BO->isExact())
return isPowerOfTwo(BO->getOperand(0), TD, Depth);
PossiblyExactOperator *PEO = cast<PossiblyExactOperator>(V);
if (PEO->isExact())
return isPowerOfTwo(PEO->getOperand(0), TD, Depth);
}
return false;