InstCombine: Don't assume that m_ZExt matches an Instruction
authorDavid Majnemer <david.majnemer@gmail.com>
Sat, 1 Nov 2014 23:46:05 +0000 (23:46 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sat, 1 Nov 2014 23:46:05 +0000 (23:46 +0000)
commited297abb0a9317e7b58d66bc8671d6306d6e1fff
tree146167da241b40a83f1e156a871763fdb3070034
parent9f15bb31c1789bed3e8278b15e4bda9698e397f6
InstCombine: Don't assume that m_ZExt matches an Instruction

m_ZExt might bind against a ConstantExpr instead of an Instruction.
Assuming this, using cast<Instruction>, results in InstCombine crashing.

Instead, introduce ZExtOperator to bridge both Instruction and
ConstantExpr ZExts.

This fixes PR21445.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221069 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Operator.h
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/overflow-mul.ll