<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><br><div></div><div><br></div><div>Example for the optimization from 181.mcf, refresh_potential():</div><div><br></div><div>IR before opt </div><div><div style="margin: 0px; font-family: Menlo;">while.body6:                                      ; preds = %while.body6.lr.ph, %if.end</div><div style="margin: 0px; font-family: Menlo;">  %checksum.152 = phi i64 [ %checksum.057, %while.body6.lr.ph ], [ %checksum.2, %if.end ]</div><div style="margin: 0px; font-family: Menlo;">  %node.251 = phi %struct.node* [ %node.155, %while.body6.lr.ph ], [ %12, %if.end ]</div><div style="margin: 0px; font-family: Menlo;">  %orientation = getelementptr inbounds %struct.node* %node.251, i64 0, i32 7</div><div style="margin: 0px; font-family: Menlo;">  %3 = load i64* %orientation, align 8, !tbaa !13</div><div style="margin: 0px; font-family: Menlo;">  %cmp7 = icmp eq i64 %3, 1</div><div style="margin: 0px; font-family: Menlo;">  br i1 %cmp7, label %if.then, label %if.else</div><div style="margin: 0px; font-family: Menlo; min-height: 21px;"><br></div><div style="margin: 0px; font-family: Menlo;">if.then:                                          ; preds = %while.body6</div><div style="margin: 0px; font-family: Menlo;">  %basic_arc = getelementptr inbounds %struct.node* %node.251, i64 0, i32 8</div><div style="margin: 0px; font-family: Menlo;">  %4 = load %struct.arc** %basic_arc, align 8, !tbaa !14</div><div style="margin: 0px; font-family: Menlo;">  %cost = getelementptr inbounds %struct.arc* %4, i64 0, i32 4</div><div style="margin: 0px; font-family: Menlo;">  %5 = load i64* %cost, align 8, !tbaa !15</div><div style="margin: 0px; font-family: Menlo;">  %pred = getelementptr inbounds %struct.node* %node.251, i64 0, i32 2</div><div style="margin: 0px; font-family: Menlo;">  %6 = load %struct.node** %pred, align 8, !tbaa !17</div><div style="margin: 0px; font-family: Menlo;">  %potential8 = getelementptr inbounds %struct.node* %6, i64 0, i32 11</div><div style="margin: 0px; font-family: Menlo;">  %7 = load i64* %potential8, align 8, !tbaa !11</div><div style="margin: 0px; font-family: Menlo;">  %add = add nsw i64 %7, %5</div><div style="margin: 0px; font-family: Menlo;">  %potential9 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 11</div><div style="margin: 0px; font-family: Menlo;">  store i64 %add, i64* %potential9, align 8, !tbaa !11</div><div style="margin: 0px; font-family: Menlo;">  br label %if.end</div><div style="margin: 0px; font-family: Menlo; min-height: 21px;"><br></div><div style="margin: 0px; font-family: Menlo;">if.else:                                          ; preds = %while.body6</div><div style="margin: 0px; font-family: Menlo;">  %pred10 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 2</div><div style="margin: 0px; font-family: Menlo;">  %8 = load %struct.node** %pred10, align 8, !tbaa !17</div><div style="margin: 0px; font-family: Menlo;">  %potential11 = getelementptr inbounds %struct.node* %8, i64 0, i32 11</div><div style="margin: 0px; font-family: Menlo;">  %9 = load i64* %potential11, align 8, !tbaa !11</div><div style="margin: 0px; font-family: Menlo;">  %basic_arc12 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 8</div><div style="margin: 0px; font-family: Menlo;">  %10 = load %struct.arc** %basic_arc12, align 8, !tbaa !14</div><div style="margin: 0px; font-family: Menlo;">  %cost13 = getelementptr inbounds %struct.arc* %10, i64 0, i32 4</div><div style="margin: 0px; font-family: Menlo;">  %11 = load i64* %cost13, align 8, !tbaa !15</div><div style="margin: 0px; font-family: Menlo;">  %sub = sub nsw i64 %9, %11</div><div style="margin: 0px; font-family: Menlo;">  %potential14 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 11</div><div style="margin: 0px; font-family: Menlo;">  store i64 %sub, i64* %potential14, align 8, !tbaa !11</div><div style="margin: 0px; font-family: Menlo;">  %inc = add nsw i64 %checksum.152, 1</div><div style="margin: 0px; font-family: Menlo;">  br label %if.end</div><div style="margin: 0px; font-family: Menlo; min-height: 21px;"><br></div><div style="margin: 0px; font-family: Menlo;">if.end:                                           ; preds = %if.else, %if.then</div><div style="margin: 0px; font-family: Menlo;">  %checksum.2 = phi i64 [ %checksum.152, %if.then ], [ %inc, %if.else ]</div><div style="margin: 0px; font-family: Menlo;">  %child15 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 3</div><div style="margin: 0px; font-family: Menlo;">  %12 = load %struct.node** %child15, align 8, !tbaa !12</div><div style="margin: 0px; font-family: Menlo;">  %tobool = icmp eq %struct.node* %12, null</div><div style="margin: 0px; font-family: Menlo;">  br i1 %tobool, label %while.cond5.while.cond16.preheader_crit_edge, label %while.body6</div></div><div><br></div><div>IR after:</div><div><div style="margin: 0px; font-family: Menlo;">while.body6:                                      ; preds = %while.body6.lr.ph, %if.end</div><div style="margin: 0px; font-family: Menlo;">  %checksum.152 = phi i64 [ %checksum.057, %while.body6.lr.ph ], [ %checksum.2, %if.end ]</div><div style="margin: 0px; font-family: Menlo;">  %node.251 = phi %struct.node* [ %node.155, %while.body6.lr.ph ], [ %13, %if.end ]</div><div style="margin: 0px; font-family: Menlo;">  %orientation = getelementptr inbounds %struct.node* %node.251, i64 0, i32 7</div><div style="margin: 0px; font-family: Menlo;">  %3 = load i64* %orientation, align 8, !tbaa !13</div><div style="margin: 0px; font-family: Menlo;">  %cmp7 = icmp eq i64 %3, 1</div><div style="margin: 0px; font-family: Menlo;">  %4 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 8</div><div style="margin: 0px; font-family: Menlo;">  %5 = load %struct.arc** %4, align 8, !tbaa !14</div><div style="margin: 0px; font-family: Menlo;">  %6 = getelementptr inbounds %struct.arc* %5, i64 0, i32 4</div><div style="margin: 0px; font-family: Menlo;">  %7 = load i64* %6, align 8, !tbaa !15</div><div style="margin: 0px; font-family: Menlo;">  %8 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 2</div><div style="margin: 0px; font-family: Menlo;">  %9 = load %struct.node** %8, align 8, !tbaa !17</div><div style="margin: 0px; font-family: Menlo;">  %10 = getelementptr inbounds %struct.node* %9, i64 0, i32 11</div><div style="margin: 0px; font-family: Menlo;">  %11 = load i64* %10, align 8, !tbaa !11</div><div style="margin: 0px; font-family: Menlo;">  br i1 %cmp7, label %if.then, label %if.else</div><div style="margin: 0px; font-family: Menlo; min-height: 21px;"><br></div><div style="margin: 0px; font-family: Menlo;">if.then:                                          ; preds = %while.body6</div><div style="margin: 0px; font-family: Menlo;">  %add = add nsw i64 %11, %7</div><div style="margin: 0px; font-family: Menlo;">  br label %if.end</div><div style="margin: 0px; font-family: Menlo; min-height: 21px;"><br></div><div style="margin: 0px; font-family: Menlo;">if.else:                                          ; preds = %while.body6</div><div style="margin: 0px; font-family: Menlo;">  %sub = sub nsw i64 %11, %7</div><div style="margin: 0px; font-family: Menlo;">  %inc = add nsw i64 %checksum.152, 1</div><div style="margin: 0px; font-family: Menlo;">  br label %if.end</div><div style="margin: 0px; font-family: Menlo; min-height: 21px;"><br></div><div style="margin: 0px; font-family: Menlo;">if.end:                                           ; preds = %if.else, %if.then</div><div style="margin: 0px; font-family: Menlo;">  %add.sink = phi i64 [ %sub, %if.else ], [ %add, %if.then ]</div><div style="margin: 0px; font-family: Menlo;">  %checksum.2 = phi i64 [ %checksum.152, %if.then ], [ %inc, %if.else ]</div><div style="margin: 0px; font-family: Menlo;">  %12 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 11</div><div style="margin: 0px; font-family: Menlo;">  store i64 %add.sink, i64* %12, align 8, !tbaa !11</div><div style="margin: 0px; font-family: Menlo;">  %child15 = getelementptr inbounds %struct.node* %node.251, i64 0, i32 3</div><div style="margin: 0px; font-family: Menlo;">  %13 = load %struct.node** %child15, align 8, !tbaa !12</div><div style="margin: 0px; font-family: Menlo;">  %tobool = icmp eq %struct.node* %13, null</div><div style="margin: 0px; font-family: Menlo;">  br i1 %tobool, label %while.cond5.while.cond16.preheader_crit_edge, label %while.body6</div></div></body></html>