This is an archive of the discontinued LLVM Phabricator instance.

Resurrect the assertion removed by r227717
ClosedPublic

Authored by jingyue on Feb 1 2015, 8:23 PM.

Details

Summary

MSVC can compile "LoopID->getOperand(0) == LoopID" when LoopID is MDNode*.

Diff Detail

Event Timeline

jingyue updated this revision to Diff 19126.Feb 1 2015, 8:23 PM
jingyue retitled this revision from to Resurrect the assertion removed by r227717.
jingyue updated this object.
jingyue edited the test plan for this revision. (Show Details)
jingyue added a reviewer: mkuper.
jingyue added a subscriber: Unknown Object (MLST).
mkuper edited edge metadata.Feb 1 2015, 10:43 PM

LGTM

(So what was the problem, the constness?)

I suspect the issue you saw is a bug in MSVC. There is a path from MDOperand & to const MDNode *. http://llvm.org/docs/doxygen/html/Metadata_8h_source.html#l00547 defines a type caster from MDOperand & to Metadata *, Metadata is a super class of MDNode, and finally changing constness is a valid implicit cast.

Anyhow, I noticed Loop::getLoopID() returns MDNode * instead of const MDNode *, and using MDNode * seems to work for MSVC. Therefore, I took this approach. Did you confirm it does fix the building error on your end?

Yes, I've confirmed this builds for me..

This revision was automatically updated to reflect the committed changes.