[PATCH] D110857: X86InstrInfo: Refactor and cleanup optimizeCompareInstr; NFC
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 30 10:41:28 PDT 2021
MatzeB created this revision.
MatzeB added reviewers: RKSimon, craig.topper, nikic, manmanren.
Herald added subscribers: wenlei, pengfei, hiraditya, mcrosier.
MatzeB requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This changes the first part of `optimizeCompareInstr` being split into a loop with a forward scan for cases that re-use zero flags from a producer in case of compare with zero and a backward scan for finding an instruction equivalent to a compare.
The code now uses a single backward scan searching for the next instructions that reads or writes EFLAGS.
Also:
- Add comments giving examples for the 3 cases handled.
- Check `MI` which contains the result of the zero-compare cases, instead of re-checking `IsCmpZero`.
- Tweak coding style in some loops.
This does not change any behavior but prepares for a series of changes that extend the functionality of `optimizeCompareInstr`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110857
Files:
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/optimize-compare.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110857.376270.patch
Type: text/x-patch
Size: 11591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210930/4ed33c1d/attachment.bin>
More information about the llvm-commits
mailing list