<div><div>Here is an llvm ir of a module. It seems that "b1" should be eliminated by dead store elimination. But it did not. </div><div><br></div><div>Could anyone explain why and how "b1" can be eliminated?</div>
<div><br></div><div>Thanks,</div><div>-Peng</div><div><br></div><div><div>%0 = type { [3 x [1 x i32]] }</div></div><div><br></div><div>declare %0 @external_fcn3(i32, i32, i32, i32, [3 x [1 x i32]]*)</div></div><div><br></div>
<div><div>define i32 @f3(i32 %a) readnone {</div><div>entry:</div><div> %b1 = alloca [3 x [1 x i32]]</div><div> %b2 = alloca [3 x [1 x i32]]</div><div> %c = alloca %0</div><div> %0 = getelementptr [3 x [1 x i32]]* %b1, i32 0, i32 0, i32 0</div>
<div> store i32 0, i32* %0</div><div> %1 = getelementptr [3 x [1 x i32]]* %b1, i32 0, i32 1, i32 0</div><div> store i32 1, i32* %1</div><div> %2 = getelementptr [3 x [1 x i32]]* %b1, i32 0, i32 2, i32 0</div><div> store i32 2, i32* %2</div>
<div> %3 = call %0 @external_fcn3(i32 100, i32 200, i32 %a, i32 200, [3 x [1 x i32]]* %b1)</div><div> %4 = add i32 %a, 100</div><div> %5 = getelementptr [3 x [1 x i32]]* %b2, i32 0, i32 0, i32 0</div><div> store i32 3, i32* %5</div>
<div> %6 = getelementptr [3 x [1 x i32]]* %b2, i32 0, i32 1, i32 0</div><div> store i32 4, i32* %6</div><div> %7 = getelementptr [3 x [1 x i32]]* %b2, i32 0, i32 2, i32 0</div><div> store i32 5, i32* %7</div><div> %8 = call %0 @external_fcn3(i32 %4, i32 200, i32 %a, i32 200, [3 x [1 x i32]]* %b2)</div>
<div> store %0 %8, %0* %c</div><div> %9 = getelementptr %0* %c, i32 0, i32 0, i32 %a, i32 0</div><div> %10 = load i32* %9</div><div> ret i32 %10</div><div>}</div></div><div><br></div>