[PATCH] D127115: [RFC][DAGCombine] Make sure combined nodes are added back to the worklist in topological order.
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 17 05:02:46 PDT 2023
RKSimon added inline comments.
================
Comment at: llvm/test/CodeGen/X86/add-and-not.ll:305
+; X64-NEXT: addq %rdi, %rax
; X64-NEXT: retq
%old = ptrtoint ptr %a to i64
----------------
```
SelectionDAG has 14 nodes:
t0: ch,glue = EntryToken
t2: i64,ch = CopyFromReg t0, Register:i64 %0
t15: i32 = truncate t2
t16: i32 = xor t15, Constant:i32<-1>
t19: i32 = and t16, Constant:i32<1>
t20: i64 = zero_extend t19
t6: i64 = add t2, t20
t9: ch,glue = CopyToReg t0, Register:i64 $rax, t6
t10: ch = X86ISD::RET_FLAG t9, TargetConstant:i32<0>, Register:i64 $rax, t9:1
```
================
Comment at: llvm/test/CodeGen/X86/dagcombine-select.ll:217
+; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
+; CHECK-NEXT: shrl %cl, %eax
; CHECK-NEXT: retq
----------------
Looks like the truncate means we're now failing to call foldBinOpIntoSelect before:
```
SelectionDAG has 15 nodes:
t0: ch,glue = EntryToken
t2: i32,ch = CopyFromReg t0, Register:i32 %0
t3: i8 = truncate t2
t4: i1 = truncate t2
t7: i32 = select t4, Constant:i32<2>, Constant:i32<3>
t9: i8 = truncate t7
t10: i32 = shl Constant:i32<1>, t9
t13: ch,glue = CopyToReg t0, Register:i32 $eax, t10
t14: ch = X86ISD::RET_FLAG t13, TargetConstant:i32<0>, Register:i32 $eax, t13:1
```
becomes:
```
SelectionDAG has 14 nodes:
t0: ch,glue = EntryToken
t2: i32,ch = CopyFromReg t0, Register:i32 %0
t23: i8 = truncate t2
t25: i8 = and t23, Constant:i8<1>
t22: i8 = xor t25, Constant:i8<3>
t10: i32 = shl Constant:i32<1>, t22
t13: ch,glue = CopyToReg t0, Register:i32 $eax, t10
t14: ch = X86ISD::RET_FLAG t13, TargetConstant:i32<0>, Register:i32 $eax, t13:1
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127115/new/
https://reviews.llvm.org/D127115
More information about the llvm-commits
mailing list