[InstCombine] Fix visitSwitchInst to use right operand types for sub cstexpr
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 19 Dec 2014 14:23:15 +0000 (14:23 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 19 Dec 2014 14:23:15 +0000 (14:23 +0000)
commitcba407d019a696d73e731f8e30c660bce1f9df12
treef17c66f040a0a8b325d1743ae06a3698228f1a07
parent6500a9867f02c0be6c884acd5f5e5e85ac70cc22
[InstCombine] Fix visitSwitchInst to use right operand types for sub cstexpr

The visitSwitchInst generates SUB constant expressions to recompute the
switch condition. When truncating the condition to a smaller type, SUB
expressions should use the previous type (before trunc) for both
operands. This fixes an assertion crash.

Differential Revision: http://reviews.llvm.org/D6644

rdar://problem/19191835

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224574 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/narrow-switch.ll