diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2014-11-01 23:46:05 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2014-11-01 23:46:05 +0000 |
| commit | 634ca236dcac149af695b047c5c3f2a7af7391bd (patch) | |
| tree | 2a71cd30e3270a555f26c546cc98f491932c3119 /llvm/test/Transforms | |
| parent | eed309da88417bc5f07d49f1b2b6e6b8186f8142 (diff) | |
| download | bcm5719-llvm-634ca236dcac149af695b047c5c3f2a7af7391bd.tar.gz bcm5719-llvm-634ca236dcac149af695b047c5c3f2a7af7391bd.zip | |
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.
llvm-svn: 221069
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/overflow-mul.ll | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/overflow-mul.ll b/llvm/test/Transforms/InstCombine/overflow-mul.ll index cbb2f5f9500..6d8d40bcac3 100644 --- a/llvm/test/Transforms/InstCombine/overflow-mul.ll +++ b/llvm/test/Transforms/InstCombine/overflow-mul.ll @@ -173,3 +173,16 @@ define <4 x i32> @pr20113(<4 x i16> %a, <4 x i16> %b) { %vcgez.i = sext <4 x i1> %tmp to <4 x i32> ret <4 x i32> %vcgez.i } + +@pr21445_data = external global i32 +define i1 @pr21445(i8 %a) { +; CHECK-LABEL: @pr21445( +; CHECK-NEXT: %[[umul:.*]] = call { i8, i1 } @llvm.umul.with.overflow.i8(i8 %a, i8 ptrtoint (i32* @pr21445_data to i8)) +; CHECK-NEXT: %[[cmp:.*]] = extractvalue { i8, i1 } %[[umul]], 1 +; CHECK-NEXT: ret i1 %[[cmp]] + %ext = zext i8 %a to i32 + %mul = mul i32 %ext, zext (i8 ptrtoint (i32* @pr21445_data to i8) to i32) + %and = and i32 %mul, 255 + %cmp = icmp ne i32 %mul, %and + ret i1 %cmp +} |

