From 527db3f26b2b5fc3855ff671344e9691cbd54d37 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Tue, 30 Apr 2013 10:36:33 +0000 Subject: [PATCH] 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 --- lib/Transforms/InstCombine/InstCombineSelect.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) || -- 2.34.1