[llvm-commits] [llvm] r90290 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstCombine/sext-2.ll
Mon P Wang
wangmp at apple.com
Tue Dec 1 21:00:00 PST 2009
Author: wangmp
Date: Tue Dec 1 22:59:58 2009
New Revision: 90290
URL: http://llvm.org/viewvc/llvm-project?rev=90290&view=rev
Log:
Fixed an assertion failure for tracking sext of a vector of integers
Added:
llvm/trunk/test/Transforms/InstCombine/sext-2.ll
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=90290&r1=90289&r2=90290&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Tue Dec 1 22:59:58 2009
@@ -659,7 +659,7 @@
switch (Operator::getOpcode(V)) {
default: break;
case Instruction::SExt:
- Tmp = TyBits-cast<IntegerType>(U->getOperand(0)->getType())->getBitWidth();
+ Tmp = TyBits - U->getOperand(0)->getType()->getScalarSizeInBits();
return ComputeNumSignBits(U->getOperand(0), TD, Depth+1) + Tmp;
case Instruction::AShr:
Added: llvm/trunk/test/Transforms/InstCombine/sext-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sext-2.ll?rev=90290&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/sext-2.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/sext-2.ll Tue Dec 1 22:59:58 2009
@@ -0,0 +1,14 @@
+; Checks to see that instcombine can handle a sign extension of i1
+
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+define void @test(<2 x i16> %srcA, <2 x i16> %srcB, <2 x i16>* %dst) nounwind {
+entry:
+; CHECK-NOT: tmask
+; CHECK: ret
+ %cmp = icmp eq <2 x i16> %srcB, %srcA;
+ %sext = sext <2 x i1> %cmp to <2 x i16>;
+ %tmask = ashr <2 x i16> %sext, <i16 15, i16 15> ;
+ store <2 x i16> %tmask, <2 x i16>* %dst;
+ ret void
+}
More information about the llvm-commits
mailing list