This is an archive of the discontinued LLVM Phabricator instance.

Fix InstCombine address space assert
ClosedPublic

Authored by EwanCrawford on Jul 31 2018, 6:09 AM.

Details

Summary

Workaround bug where the InstCombine pass was asserting on the IR added in lit test, where we have a bitcast instruction after a GEP from an addrspace cast.

The second bitcast in the test was getting combined into bitcast <16 x i32>* %0 to <16 x i32> addrspace(3)*, which looks like it should be an addrspace cast instruction instead. Otherwise if control flow is allowed to continue as it is now we create a GEP instruction <badref> = getelementptr inbounds <16 x i32>, <16 x i32>* %0, i32 0. However because the type of this instruction doesn't match the address space we hit an assert when replacing the bitcast with that GEP.

void llvm::Value::doRAUW(llvm::Value*, bool): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed.

Diff Detail

Repository
rL LLVM

Event Timeline

EwanCrawford created this revision.Jul 31 2018, 6:09 AM
spatel accepted this revision.Jul 31 2018, 7:31 AM

LGTM.

I updated the assertions in the test file here:
rL338388

Please use the script to auto-generate the CHECK lines in the new test.

This revision is now accepted and ready to land.Jul 31 2018, 7:31 AM

Thanks for taking a look @spatel, updated the test using generate script.

This revision was automatically updated to reflect the committed changes.