-
-
Save nikic/85824a0d14225cd1af5a8b0e25982c0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git llvm/lib/Transforms/Scalar/SCCP.cpp llvm/lib/Transforms/Scalar/SCCP.cpp | |
index 6d640fe8f9f4..9d794b31bddf 100644 | |
--- llvm/lib/Transforms/Scalar/SCCP.cpp | |
+++ llvm/lib/Transforms/Scalar/SCCP.cpp | |
@@ -58,6 +58,7 @@ | |
#include "llvm/Transforms/Utils/Local.h" | |
#include "llvm/Transforms/Utils/PredicateInfo.h" | |
#include <cassert> | |
+#include <queue> | |
#include <utility> | |
#include <vector> | |
@@ -148,7 +149,7 @@ class SCCPSolver : public InstVisitor<SCCPSolver> { | |
SmallVector<Value *, 64> InstWorkList; | |
// The BasicBlock work list | |
- SmallVector<BasicBlock *, 64> BBWorkList; | |
+ std::queue<BasicBlock *> BBWorkList; | |
/// KnownFeasibleEdges - Entries in this set are edges which have already had | |
/// PHI nodes retriggered. | |
@@ -191,7 +192,7 @@ public: | |
if (!BBExecutable.insert(BB).second) | |
return false; | |
LLVM_DEBUG(dbgs() << "Marking Block Executable: " << BB->getName() << '\n'); | |
- BBWorkList.push_back(BB); // Add the block to the work list! | |
+ BBWorkList.push(BB); // Add the block to the work list! | |
return true; | |
} | |
@@ -1367,8 +1368,8 @@ void SCCPSolver::Solve() { | |
// Process the basic block work list. | |
while (!BBWorkList.empty()) { | |
- BasicBlock *BB = BBWorkList.back(); | |
- BBWorkList.pop_back(); | |
+ BasicBlock *BB = BBWorkList.front(); | |
+ BBWorkList.pop(); | |
LLVM_DEBUG(dbgs() << "\nPopped off BBWL: " << *BB << '\n'); | |
diff --git llvm/test/Transforms/SCCP/conditions-ranges-with-undef.ll llvm/test/Transforms/SCCP/conditions-ranges-with-undef.ll | |
index f142a426cc13..6861d210ca84 100644 | |
--- llvm/test/Transforms/SCCP/conditions-ranges-with-undef.ll | |
+++ llvm/test/Transforms/SCCP/conditions-ranges-with-undef.ll | |
@@ -82,8 +82,7 @@ define void @val_singlecrfromundef_range(i1 %cond) { | |
; CHECK-NEXT: br label [[TRUE:%.*]] | |
; CHECK: true: | |
; CHECK-NEXT: call void @use(i1 false) | |
-; CHECK-NEXT: [[P_127:%.*]] = and i32 10, 127 | |
-; CHECK-NEXT: call void @use.i32(i32 [[P_127]]) | |
+; CHECK-NEXT: call void @use.i32(i32 10) | |
; CHECK-NEXT: ret void | |
; | |
entry: | |
diff --git llvm/test/Transforms/SCCP/float-nan-simplification.ll llvm/test/Transforms/SCCP/float-nan-simplification.ll | |
index 1cedbaa69e44..0e1acccba0ef 100644 | |
--- llvm/test/Transforms/SCCP/float-nan-simplification.ll | |
+++ llvm/test/Transforms/SCCP/float-nan-simplification.ll | |
@@ -17,8 +17,7 @@ define float @test1(float %a, i1 %bc) { | |
; CHECK: exit: | |
; CHECK-NEXT: [[P:%.*]] = phi float [ [[A:%.*]], [[BB1]] ], [ 0x7FF8000000000000, [[BB2]] ] | |
; CHECK-NEXT: [[V_1:%.*]] = fmul float [[P]], 0.000000e+00 | |
-; CHECK-NEXT: [[V_2:%.*]] = fadd float [[V_1]], 0xFFF8000000000000 | |
-; CHECK-NEXT: ret float [[V_2]] | |
+; CHECK-NEXT: ret float 0xFFF8000000000000 | |
; | |
entry: | |
br i1 %bc, label %bb1, label %bb2 | |
diff --git llvm/test/Transforms/SCCP/widening.ll llvm/test/Transforms/SCCP/widening.ll | |
index 8e4f3b520596..ff23e0d3405f 100644 | |
--- llvm/test/Transforms/SCCP/widening.ll | |
+++ llvm/test/Transforms/SCCP/widening.ll | |
@@ -17,10 +17,8 @@ define void @test_2_incoming_constants(i32 %x) { | |
; SCCP: exit: | |
; SCCP-NEXT: [[P:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 1, [[BB1]] ] | |
; SCCP-NEXT: [[A:%.*]] = add i32 [[P]], 1 | |
-; SCCP-NEXT: [[T_1:%.*]] = icmp ult i32 [[A]], 20 | |
-; SCCP-NEXT: call void @use(i1 [[T_1]]) | |
-; SCCP-NEXT: [[F_1:%.*]] = icmp ugt i32 [[A]], 10 | |
-; SCCP-NEXT: call void @use(i1 [[F_1]]) | |
+; SCCP-NEXT: call void @use(i1 true) | |
+; SCCP-NEXT: call void @use(i1 false) | |
; SCCP-NEXT: ret void | |
; | |
; IPSCCP-LABEL: @test_2_incoming_constants( | |
@@ -32,10 +30,8 @@ define void @test_2_incoming_constants(i32 %x) { | |
; IPSCCP: exit: | |
; IPSCCP-NEXT: [[P:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 1, [[BB1]] ] | |
; IPSCCP-NEXT: [[A:%.*]] = add i32 [[P]], 1 | |
-; IPSCCP-NEXT: [[T_1:%.*]] = icmp ult i32 [[A]], 20 | |
-; IPSCCP-NEXT: call void @use(i1 [[T_1]]) | |
-; IPSCCP-NEXT: [[F_1:%.*]] = icmp ugt i32 [[A]], 10 | |
-; IPSCCP-NEXT: call void @use(i1 [[F_1]]) | |
+; IPSCCP-NEXT: call void @use(i1 true) | |
+; IPSCCP-NEXT: call void @use(i1 false) | |
; IPSCCP-NEXT: ret void | |
; | |
entry: | |
@@ -209,9 +205,12 @@ define void @rotated_loop_2(i32 %x) { | |
; SCCP: exit: | |
; SCCP-NEXT: [[P:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ 3, [[BB1]] ], [ 2, [[BB2]] ], [ 5, [[BB3]] ], [ [[A:%.*]], [[EXIT]] ] | |
; SCCP-NEXT: [[A]] = add i32 [[P]], 1 | |
-; SCCP-NEXT: call void @use(i1 true) | |
-; SCCP-NEXT: call void @use(i1 false) | |
-; SCCP-NEXT: br i1 false, label [[EXIT]], label [[EXIT_1:%.*]] | |
+; SCCP-NEXT: [[T_1:%.*]] = icmp ult i32 [[A]], 20 | |
+; SCCP-NEXT: call void @use(i1 [[T_1]]) | |
+; SCCP-NEXT: [[F_1:%.*]] = icmp ugt i32 [[A]], 10 | |
+; SCCP-NEXT: call void @use(i1 [[F_1]]) | |
+; SCCP-NEXT: [[C_4:%.*]] = icmp ult i32 [[A]], 2 | |
+; SCCP-NEXT: br i1 [[C_4]], label [[EXIT]], label [[EXIT_1:%.*]] | |
; SCCP: exit.1: | |
; SCCP-NEXT: ret void | |
; | |
@@ -230,9 +229,12 @@ define void @rotated_loop_2(i32 %x) { | |
; IPSCCP: exit: | |
; IPSCCP-NEXT: [[P:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ 3, [[BB1]] ], [ 2, [[BB2]] ], [ 5, [[BB3]] ], [ [[A:%.*]], [[EXIT]] ] | |
; IPSCCP-NEXT: [[A]] = add i32 [[P]], 1 | |
-; IPSCCP-NEXT: call void @use(i1 true) | |
-; IPSCCP-NEXT: call void @use(i1 false) | |
-; IPSCCP-NEXT: br i1 false, label [[EXIT]], label [[EXIT_1:%.*]] | |
+; IPSCCP-NEXT: [[T_1:%.*]] = icmp ult i32 [[A]], 20 | |
+; IPSCCP-NEXT: call void @use(i1 [[T_1]]) | |
+; IPSCCP-NEXT: [[F_1:%.*]] = icmp ugt i32 [[A]], 10 | |
+; IPSCCP-NEXT: call void @use(i1 [[F_1]]) | |
+; IPSCCP-NEXT: [[C_4:%.*]] = icmp ult i32 [[A]], 2 | |
+; IPSCCP-NEXT: br i1 [[C_4]], label [[EXIT]], label [[EXIT_1:%.*]] | |
; IPSCCP: exit.1: | |
; IPSCCP-NEXT: ret void | |
; | |
@@ -744,11 +746,10 @@ define i8* @wobble(%struct.blam.2* %arg, i32 %arg1) align 2 { | |
; IPSCCP-NEXT: [[C_2:%.*]] = icmp eq i32 [[TMP11]], 8 | |
; IPSCCP-NEXT: br i1 [[C_2]], label [[BB39:%.*]], label [[BB58:%.*]] | |
; IPSCCP: bb39: | |
-; IPSCCP-NEXT: [[TMP40:%.*]] = add nsw i32 [[TMP11]], -1 | |
; IPSCCP-NEXT: [[TMP41:%.*]] = trunc i32 [[TMP3]] to i16 | |
; IPSCCP-NEXT: store i16 [[TMP41]], i16* bitcast ([4 x i8]* @global.11 to i16*), align 1 | |
; IPSCCP-NEXT: [[TMP42:%.*]] = getelementptr inbounds [[STRUCT_BLAM_2]], %struct.blam.2* [[ARG]], i32 0, i32 0 | |
-; IPSCCP-NEXT: [[TMP43:%.*]] = add i32 [[TMP7]], [[TMP40]] | |
+; IPSCCP-NEXT: [[TMP43:%.*]] = add i32 [[TMP7]], 7 | |
; IPSCCP-NEXT: [[TMP44:%.*]] = mul i32 [[TMP43]], 4 | |
; IPSCCP-NEXT: [[TMP45:%.*]] = add i32 [[TMP44]], 2 | |
; IPSCCP-NEXT: [[TMP46:%.*]] = call dereferenceable(1) i8* @spam(%struct.baz.1* [[TMP42]], i32 [[TMP45]]) | |
@@ -763,14 +764,13 @@ define i8* @wobble(%struct.blam.2* %arg, i32 %arg1) align 2 { | |
; IPSCCP-NEXT: [[TMP55:%.*]] = icmp sgt i32 [[TMP48]], [[TMP54]] | |
; IPSCCP-NEXT: br i1 [[TMP55]], label [[BB56:%.*]], label [[BB60:%.*]] | |
; IPSCCP: bb56: | |
-; IPSCCP-NEXT: [[TMP57:%.*]] = add nsw i32 [[TMP40]], -1 | |
; IPSCCP-NEXT: br label [[BB60]] | |
; IPSCCP: bb58: | |
; IPSCCP-NEXT: [[TMP59:%.*]] = bitcast i16* [[TMP33]] to i8* | |
; IPSCCP-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @global.11, i64 0, i64 0), i8* align 2 [[TMP59]], i64 4, i1 false) | |
; IPSCCP-NEXT: br label [[BB60]] | |
; IPSCCP: bb60: | |
-; IPSCCP-NEXT: [[TMP61:%.*]] = phi i32 [ [[TMP57]], [[BB56]] ], [ [[TMP40]], [[BB39]] ], [ [[TMP11]], [[BB58]] ] | |
+; IPSCCP-NEXT: [[TMP61:%.*]] = phi i32 [ 6, [[BB56]] ], [ 7, [[BB39]] ], [ [[TMP11]], [[BB58]] ] | |
; IPSCCP-NEXT: [[TMP62:%.*]] = getelementptr inbounds [[STRUCT_BLAM_2]], %struct.blam.2* [[ARG]], i32 0, i32 0 | |
; IPSCCP-NEXT: [[TMP63:%.*]] = add i32 [[TMP7]], 1 | |
; IPSCCP-NEXT: [[TMP64:%.*]] = mul i32 [[TMP63]], 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment