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: unassignedb...@nondot.org
Reporter: franci...@yahoo.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs