<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">
<span>Dear all,<br>
</span>
<div><br>
</div>
<div> Hi! I encounter an interesting assertion failure when implementing my Pass, which is defined with the member functions shown below:<br>
</div>
<div>======================My Pass======================================<br>
</div>
<div>bool MYPass::runOnModule(Module &M)<br>
</div>
<div>{<br>
</div>
<div> for (auto &F : M)<br>
</div>
<div> {<br>
</div>
<div> SE = &getAnalysis<ScalarEvolutionWrapperPass>(F).getSE();<br>
</div>
<div> ......<br>
</div>
<div> }<br>
</div>
<div> }<br>
</div>
<div> return false;<br>
</div>
<div>}<br>
</div>
<div><br>
</div>
<div>void MYPass::getAnalysisUsage(AnalysisUsage &AU) const<br>
</div>
<div>{<br>
</div>
<div> AU.setPreservesAll();<br>
</div>
<div> AU.addRequired<LoopInfoWrapperPass>();<br>
</div>
<div> AU.addRequired<ScalarEvolutionWrapperPass>();<br>
</div>
<div> AU.addRequired<LoopAccessLegacyAnalysis>();<br>
</div>
<div> AU.addRequired<DominatorTreeWrapperPass>();<br>
</div>
<div> AU.addRequired<OptimizationRemarkEmitterWrapperPass>(); <br>
</div>
<div>}</div>
<div>===================================================================<br>
</div>
<div><br>
</div>
<div> Then, I got the assert failure when running the pass on the following code<br>
</div>
<div>======================Target Code with Assertion Failure==============================<br>
</div>
<div>void f ( int A[50][100]) {<br>
</div>
<div> int N = 100;<br>
</div>
<div> int M = 50;<br>
</div>
<div> int B[50][100];<br>
</div>
<div> for ( int j = 0; j < N; j++ )<br>
</div>
<div> for ( int i = 0; i < M; i++ )<br>
</div>
<div> B[i][j]=i;<br>
</div>
<div> for ( int j = 1; j < N; j++ )<br>
</div>
<div> for ( int i = 1; i < M; i++ )<br>
</div>
<div> A[i][j] = i%2? A[i-1][j]:B[i][j];<br>
</div>
<div> return;<br>
</div>
<div>}<br>
</div>
<div>======================================================================<br>
</div>
<div> The thing made this failture interesting is that I got no failure when running the pass on the other code, e.g.<br>
</div>
<div>===========================Target Code without Assertion Failure=====================================<br>
</div>
<div>void f ( int A[50][100],int B[50][100]) {<br>
</div>
<div> int N = 100;<br>
</div>
<div> int M = 50;<br>
</div>
<div> for ( int j = 0; j < N; j++ )<br>
</div>
<div> for ( int i = 0; i < M; i++ )<br>
</div>
<div> B[i][j]=i;<br>
</div>
<div> for ( int j = 1; j < N; j++ )<br>
</div>
<div> for ( int i = 1; i < M; i++ )<br>
</div>
<div> A[i][j] = i%2? A[i-1][j]:B[i][j];<br>
</div>
<div> return;<br>
</div>
<div>}<br>
</div>
<div><br>
</div>
<div> I am confused by this situation because this failure has not occurred before and it shoud not be effected by the target code.</div>
<div> Thanks in advance for your time and suggestion!!!^_^<br>
</div>
<div><br>
</div>
<div>Best regards,<br>
</div>
<div>------------------------------------------<br>
</div>
<div>Tingyuan LIANG<br>
</div>
<div>MPhil Student<br>
</div>
<div>Department of Electronic and Computer Engineering<br>
</div>
<div>The Hong Kong University of Science and Technology<br>
</div>
<span></span><br>
</body>
</html>