When we have
a = G_OR x, x
or
b = G_AND y, y
We can drop the G_OR/G_AND and just use x/y respectively.
Also update arm64-fallback.ll because there was an or in there which hits this transformation.
Paths
| Differential D77105
[GlobalISel] Implement identity transforms for x op x -> x ClosedPublic Authored by paquette on Mar 30 2020, 4:48 PM.
Details Summary When we have a = G_OR x, x or b = G_AND y, y We can drop the G_OR/G_AND and just use x/y respectively. Also update arm64-fallback.ll because there was an or in there which hits this transformation.
Diff Detail
Event TimelineHerald added subscribers: danielkiss, volkan, hiraditya and 3 others. · View Herald TranscriptMar 30 2020, 4:48 PM This revision is now accepted and ready to land.Mar 30 2020, 5:15 PM Closed by commit rGd5ee72065b9e: [GlobalISel] Implement identity transforms for x op x -> x (authored by paquette). · Explain WhyMar 30 2020, 6:36 PM This revision was automatically updated to reflect the committed changes. Comment Actions Where do these patterns come from? Comment Actions @qcolombet I'm not entirely sure, but patterns like this do hit a couple times in CTMark (but not very frequently, just once or twice.) I'm surprised that they aren't entirely handled by InstCombine, but I'm guessing that they tend to appear in codegen at least once in a while considering they all exist in the DAGCombiner as well. My best guess is that more complex combines simplify things enough that these patterns become obvious and thus can be eliminated.
Revision Contents
Diff 253764 llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-binop-same-val.mir
|