This is an archive of the discontinued LLVM Phabricator instance.

Fix not correct imm operand assertion for SUB32ri in X86CondBrFolding::analyzeCompare
ClosedPublic

Authored by craig.topper on Nov 7 2018, 11:55 PM.

Details

Summary

When doing X86CondBrFolding::analyzeCompare, it will meet the SUB32ri instruction as below to use the global address for its operand,

%733:gr32 = SUB32ri %62:gr32(tied-def 0), @img2buf_normal, implicit-def $eflags
JNE_1 %bb.41, implicit $eflags

so the assertion "assert(MI.getOperand(ValueIndex).isImm() && "Expecting Imm operand")" is not correct and change the assert to if make X86CondBrFolding::analyzeCompare return false as not finding the compare for this

Diff Detail

Event Timeline

Jianping created this revision.Nov 7 2018, 11:55 PM
Jianping updated this revision to Diff 174909.Nov 21 2018, 5:46 AM

update diff with format-patch -U999999

Anything that I need to follow up on this code review ? Thanks

This comment was removed by Jianping.

to reproduce this assertion , need to register the X86CondBrFoldingPass to make it can be run with llc --run-pass X86CondBrFolding on small mir test case, please look at https://reviews.llvm.org/D55412

Thanks

craig.topper commandeered this revision.Dec 7 2018, 2:23 PM
craig.topper edited reviewers, added: Jianping; removed: craig.topper.

Commandeering so I can rebase this relative to D55412.

Rebase to include the test file from the other patch with the XFAIL removed.

Jianping accepted this revision.Dec 11 2018, 12:01 AM
This revision is now accepted and ready to land.Dec 11 2018, 12:01 AM
This revision was automatically updated to reflect the committed changes.