[llvm] r340556 - [ValueTracking] Fix assert message and add test case for r340546 and PR38677.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 23 10:45:53 PDT 2018
Author: ctopper
Date: Thu Aug 23 10:45:53 2018
New Revision: 340556
URL: http://llvm.org/viewvc/llvm-project?rev=340556&view=rev
Log:
[ValueTracking] Fix assert message and add test case for r340546 and PR38677.
The bug was already fixed. This just adds a test case for it.
Added:
llvm/trunk/test/Transforms/InstCombine/pr38677.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=340556&r1=340555&r2=340556&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Thu Aug 23 10:45:53 2018
@@ -2215,7 +2215,7 @@ static bool isSignedMinMaxClamp(const Va
const APInt *&CLow, const APInt *&CHigh) {
assert(isa<Operator>(Select) &&
cast<Operator>(Select)->getOpcode() == Instruction::Select &&
- "Input should be a SelectInst!");
+ "Input should be a Select!");
const Value *LHS, *RHS, *LHS2, *RHS2;
SelectPatternFlavor SPF = matchSelectPattern(Select, LHS, RHS).Flavor;
Added: llvm/trunk/test/Transforms/InstCombine/pr38677.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pr38677.ll?rev=340556&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/pr38677.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/pr38677.ll Thu Aug 23 10:45:53 2018
@@ -0,0 +1,33 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+;RUN: opt -instcombine -S %s | FileCheck %s
+
+ at A = extern_weak global i32, align 4
+ at B = extern_weak global i32, align 4
+
+define i32 @foo(i1 %which) {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 true, label [[FINAL:%.*]], label [[DELAY:%.*]]
+; CHECK: delay:
+; CHECK-NEXT: br label [[FINAL]]
+; CHECK: final:
+; CHECK-NEXT: [[USE2:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), [[DELAY]] ]
+; CHECK-NEXT: [[B7:%.*]] = mul i32 [[USE2]], 2147483647
+; CHECK-NEXT: [[C3:%.*]] = icmp eq i32 [[B7]], 0
+; CHECK-NEXT: store i1 [[C3]], i1* undef, align 1
+; CHECK-NEXT: ret i32 [[USE2]]
+;
+entry:
+ br i1 true, label %final, label %delay
+
+delay: ; preds = %entry
+ br label %final
+
+final: ; preds = %delay, %entry
+ %use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ]
+ %value = select i1 %use2, i32 2, i32 1
+ %B7 = mul i32 %value, 2147483647
+ %C3 = icmp ule i32 %B7, 0
+ store i1 %C3, i1* undef
+ ret i32 %value
+}
More information about the llvm-commits
mailing list