<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hello,</p>
<p><br>
</p>
<p>I'm working on a sanitizer-like project and my modified module is getting past the verifier but crashing in CodeGen.  I'm hoping someone can give me a hint towards the problem.</p>
<p><br>
</p>
<p>Specifically the assertion that is failing is: </p>
<p><br>
</p>
<p></p>
<div>llvm/CodeGen/MachineOperand.h:411: int64_t llvm::MachineOperand::getImm() const: Assertion `isImm() && "Wrong MachineOperand accessor"' failed.</div>
<div><br>
</div>
<p></p>
<p>My pass is an IPO transformation.  I haven't modified anything in CodeGen.</p>
<p><br>
</p>
<p>I reduced the crash-causing module as much as possible.  It is here: <a href="https://gist.github.com/scottcarr/72cf5cc3396e8a7156bc" id="LPlnk527616" title="https://gist.github.com/scottcarr/72cf5cc3396e8a7156bc
Ctrl+Click or tap to follow the link">https://gist.github.com/scottcarr/72cf5cc3396e8a7156bc</a></p>
<p><br>
</p>
<p>If I compile this module with the command:</p>
<p><br>
</p>
clang -c mk_sched_worker_free.ll
<p></p>
<div><br>
</div>
<div>The command completes without error.  If I compile with optimizations like:</div>
<div><br>
</div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">clang -c -O3 mk_sched_worker_free.ll</span><br>
</div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;"><br>
</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">Then I trip the assertion and the compilation aborts.</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;"><br>
</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">I'm using a pretty new LLVM (3.9) but not the very latest commit.
  If anyone could give me a hint as to what is wrong with this module or tell me if this seems like a bug in CodeGen that'd be a big help.</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;"><br>
</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">Thank you,</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">Scott A Carr</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">PhD Candidate</span></div>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols; font-size: 16px;">Purdue University</span></div>
</div>
</body>
</html>