[llvm-commits] [llvm] r110597 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCalls.cpp test/Transforms/InstCombine/intrinsics.ll
Eli Friedman
eli.friedman at gmail.com
Mon Aug 9 13:49:43 PDT 2010
Author: efriedma
Date: Mon Aug 9 15:49:43 2010
New Revision: 110597
URL: http://llvm.org/viewvc/llvm-project?rev=110597&view=rev
Log:
PR7853: fix a silly mistake introduced in r101899, and add a test to make sure
it doesn't regress again.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/test/Transforms/InstCombine/intrinsics.ll
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=110597&r1=110596&r2=110597&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Mon Aug 9 15:49:43 2010
@@ -538,7 +538,7 @@
// X + 0 -> {X, false}
if (RHS->isZero()) {
Constant *V[] = {
- UndefValue::get(II->getCalledValue()->getType()),
+ UndefValue::get(II->getArgOperand(0)->getType()),
ConstantInt::getFalse(II->getContext())
};
Constant *Struct = ConstantStruct::get(II->getContext(), V, 2, false);
Modified: llvm/trunk/test/Transforms/InstCombine/intrinsics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/intrinsics.ll?rev=110597&r1=110596&r2=110597&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/intrinsics.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/intrinsics.ll Mon Aug 9 15:49:43 2010
@@ -10,16 +10,16 @@
declare i32 @llvm.ctpop.i32(i32) nounwind readnone
declare i8 @llvm.ctlz.i8(i8) nounwind readnone
-define i8 @test1(i8 %A, i8 %B) {
+define i8 @uaddtest1(i8 %A, i8 %B) {
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %A, i8 %B)
%y = extractvalue %overflow.result %x, 0
ret i8 %y
-; CHECK: @test1
+; CHECK: @uaddtest1
; CHECK-NEXT: %y = add i8 %A, %B
; CHECK-NEXT: ret i8 %y
}
-define i8 @test2(i8 %A, i8 %B, i1* %overflowPtr) {
+define i8 @uaddtest2(i8 %A, i8 %B, i1* %overflowPtr) {
%and.A = and i8 %A, 127
%and.B = and i8 %B, 127
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %and.A, i8 %and.B)
@@ -27,7 +27,7 @@
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @test2
+; CHECK: @uaddtest2
; CHECK-NEXT: %and.A = and i8 %A, 127
; CHECK-NEXT: %and.B = and i8 %B, 127
; CHECK-NEXT: %1 = add nuw i8 %and.A, %and.B
@@ -35,7 +35,7 @@
; CHECK-NEXT: ret i8 %1
}
-define i8 @test3(i8 %A, i8 %B, i1* %overflowPtr) {
+define i8 @uaddtest3(i8 %A, i8 %B, i1* %overflowPtr) {
%or.A = or i8 %A, -128
%or.B = or i8 %B, -128
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %or.A, i8 %or.B)
@@ -43,7 +43,7 @@
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @test3
+; CHECK: @uaddtest3
; CHECK-NEXT: %or.A = or i8 %A, -128
; CHECK-NEXT: %or.B = or i8 %B, -128
; CHECK-NEXT: %1 = add i8 %or.A, %or.B
@@ -51,34 +51,44 @@
; CHECK-NEXT: ret i8 %1
}
-define i8 @test4(i8 %A, i1* %overflowPtr) {
+define i8 @uaddtest4(i8 %A, i1* %overflowPtr) {
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 undef, i8 %A)
%y = extractvalue %overflow.result %x, 0
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @test4
+; CHECK: @uaddtest4
; CHECK-NEXT: ret i8 undef
}
-define i8 @test5(i8 %A, i1* %overflowPtr) {
+define i8 @uaddtest5(i8 %A, i1* %overflowPtr) {
+ %x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 0, i8 %A)
+ %y = extractvalue %overflow.result %x, 0
+ %z = extractvalue %overflow.result %x, 1
+ store i1 %z, i1* %overflowPtr
+ ret i8 %y
+; CHECK: @uaddtest5
+; CHECK: ret i8 %A
+}
+
+define i8 @umultest1(i8 %A, i1* %overflowPtr) {
%x = call %overflow.result @llvm.umul.with.overflow.i8(i8 0, i8 %A)
%y = extractvalue %overflow.result %x, 0
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @test5
+; CHECK: @umultest1
; CHECK-NEXT: store i1 false, i1* %overflowPtr
; CHECK-NEXT: ret i8 0
}
-define i8 @test6(i8 %A, i1* %overflowPtr) {
+define i8 @umultest2(i8 %A, i1* %overflowPtr) {
%x = call %overflow.result @llvm.umul.with.overflow.i8(i8 1, i8 %A)
%y = extractvalue %overflow.result %x, 0
%z = extractvalue %overflow.result %x, 1
store i1 %z, i1* %overflowPtr
ret i8 %y
-; CHECK: @test6
+; CHECK: @umultest2
; CHECK-NEXT: store i1 false, i1* %overflowPtr
; CHECK-NEXT: ret i8 %A
}
More information about the llvm-commits
mailing list