<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Amaury,<div class=""><br class=""></div><div class="">I am seeing cases where this change has actually the opposite effect than was what intended, if I understood correctly.</div><div class=""><br class=""></div><div class="">In particular, I am seeing a case where we used to generate brcond(setcc(and)) from brcond(xor(and)), but now we end up with brcond(or(xor)). Thus, we failed to produce br_cc.</div><div class=""><br class=""></div><div class="">Attached a reproducer:</div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">llc -mtriple powerpc-- reduced.ll -o - -debug-only=isel</span></div></div><div class=""><br class=""></div><div class="">You’ll see in the debug output those diffs:</div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Optimized legalized selection DAG: %bb.3 't1_false1.split:false1.split'</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> SelectionDAG has 16 nodes:</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">   t0: ch = EntryToken</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-        t8: i1,ch = CopyFromReg t0, Register:i1 %3</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+          t8: i1,ch = CopyFromReg t0, Register:i1 %3</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+        t16: i1 = xor t8, Constant:i1<-1></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">           t2: f32,ch = CopyFromReg t0, Register:f32 %0</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">           t4: f32,ch = CopyFromReg t0, Register:f32 %1</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-        t6: i1 = setcc t2, t4, setolt:ch</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-      t9: i1 = and t8, t6</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-    t18: ch = br_cc t0, setne:ch, t9, Constant:i1<-1>, BasicBlock:ch<true2.exitStub 0x7fbf0885d538></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-  t15: ch = br t18, BasicBlock:ch<false2.exitStub 0x7fbf0885d5f8></span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+        t21: i1 = setcc t2, t4, setuge:ch</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+      t18: i1 = or t16, t21</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+    t19: ch = brcond t0, t18, BasicBlock:ch<true2.exitStub 0x7fbf78053138> ### <— we don’t get a br_cc anymore</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">+  t15: ch = br t19, BasicBlock:ch<false2.exitStub 0x7fbf780531f8></span></div></div><div class=""><br class=""></div><div class="">Note: The codegen for Powerpc seems to somehow recover, but I see performance regressions because of that with our out-of-tree target</div><div class=""><br class=""></div><div class="">Do you want me to file a PR?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">-Quentin<br class=""><div></div></div></body></html>