[PATCH] D154575: [X86] Prevent infinite loop in SelectionDAG when lowering negations
Maurice Heumann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 04:17:50 PDT 2023
momo5502 added inline comments.
================
Comment at: llvm/test/CodeGen/X86/select-neg.ll:16
+ %.neg = add i32 %0, 1
+ ret i32 %.neg
+}
----------------
RKSimon wrote:
> Can this not be reduced any further?
I'm afraid not. The ADD and the first XOR are needed for sure.
I think the second XOR and the PtrToInt is needed as that bug only gets triggered due to a reassociation step that switches the two XORs.
SelectionDAG loops between 3 states:
1. SUB -> ADD
2. XOR reassociation
3. ADD -> SUB
I was not able to trigger the infinte loop without ressociation step inbetween and I was not able to trigger that reassociation without the PtrToInt.
However, I extracted and reduced that bug from a 1.5k line LL file, so I was pretty happy with a 5 instruction sample :D
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154575/new/
https://reviews.llvm.org/D154575
More information about the llvm-commits
mailing list