From: David Majnemer Date: Tue, 30 Apr 2013 10:36:33 +0000 (+0000) Subject: Fix a bug in foldSelectICmpAndOr. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=527db3f26b2b5fc3855ff671344e9691cbd54d37;p=oota-llvm.git Fix a bug in foldSelectICmpAndOr. Differences in bitwidth between X and Y could exist even if C1 and C2 have the same Log2 representation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180779 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineSelect.cpp b/lib/Transforms/InstCombine/InstCombineSelect.cpp index a34b73ace49..2defe631ae7 100644 --- a/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -401,7 +401,8 @@ static Value *foldSelectICmpAndOr(const SelectInst &SI, Value *TrueVal, } else if (C1Log > C2Log) { V = Builder->CreateLShr(V, C1Log - C2Log); V = Builder->CreateZExtOrTrunc(V, Y->getType()); - } + } else + V = Builder->CreateZExtOrTrunc(V, Y->getType()); ICmpInst::Predicate Pred = IC->getPredicate(); if ((Pred == ICmpInst::ICMP_NE && OrOnFalseVal) ||