[llvm-bugs] [Bug 38150] New: X86InstrInfo::analyzeBranch doesn't preserve undef/kill flags on $eflags
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 12 07:46:41 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38150
Bug ID: 38150
Summary: X86InstrInfo::analyzeBranch doesn't preserve
undef/kill flags on $eflags
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: francisvm at yahoo.com
CC: llvm-bugs at lists.llvm.org
Created attachment 20551
--> https://bugs.llvm.org/attachment.cgi?id=20551&action=edit
branchfolding-operands.mir
llc -run-pass branch-folder will transform this:
> bb.0:
> JE_1 %bb.1, implicit undef $eflags
> JMP_1 %bb.2
> bb.1:
> RET 2, undef $eax
> bb.2:
> RET 0, undef $eax
into
> bb.0:
> JNE_1 %bb.2, implicit $eflags
> bb.1:
> RET 2, undef $eax
> bb.2:
> RET 0, undef $eax
It drops the undef from the $eflags which causes the machine verifier to
complain.
I tracked this down to:
* when X86InstrInfo::analyzeBranchImpl changes the branch to its opposite
because it only copies the MBB operand
* when BranchFolding::TailMergeBlocks calls removeBranch then insertBranch.
Analyze branch doesn’t keep the eflags operand in the Cond vector returned by
analyze branch, so insertBranch won’t be able to re-insert it with the correct
operands.
Attached MIR test.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180712/86efd5e2/attachment.html>
More information about the llvm-bugs
mailing list