[LLVMdev] dead store elimination with external functions
Peng Cheng
gm4cheng at gmail.com
Wed Sep 12 07:21:34 PDT 2012
Here is an llvm ir of a module. It seems that "b1" should be eliminated by
dead store elimination. But it did not.
Could anyone explain why and how "b1" can be eliminated?
Thanks,
-Peng
%0 = type { [3 x [1 x i32]] }
declare %0 @external_fcn3(i32, i32, i32, i32, [3 x [1 x i32]]*)
define i32 @f3(i32 %a) readnone {
entry:
%b1 = alloca [3 x [1 x i32]]
%b2 = alloca [3 x [1 x i32]]
%c = alloca %0
%0 = getelementptr [3 x [1 x i32]]* %b1, i32 0, i32 0, i32 0
store i32 0, i32* %0
%1 = getelementptr [3 x [1 x i32]]* %b1, i32 0, i32 1, i32 0
store i32 1, i32* %1
%2 = getelementptr [3 x [1 x i32]]* %b1, i32 0, i32 2, i32 0
store i32 2, i32* %2
%3 = call %0 @external_fcn3(i32 100, i32 200, i32 %a, i32 200, [3 x [1 x
i32]]* %b1)
%4 = add i32 %a, 100
%5 = getelementptr [3 x [1 x i32]]* %b2, i32 0, i32 0, i32 0
store i32 3, i32* %5
%6 = getelementptr [3 x [1 x i32]]* %b2, i32 0, i32 1, i32 0
store i32 4, i32* %6
%7 = getelementptr [3 x [1 x i32]]* %b2, i32 0, i32 2, i32 0
store i32 5, i32* %7
%8 = call %0 @external_fcn3(i32 %4, i32 200, i32 %a, i32 200, [3 x [1 x
i32]]* %b2)
store %0 %8, %0* %c
%9 = getelementptr %0* %c, i32 0, i32 0, i32 %a, i32 0
%10 = load i32* %9
ret i32 %10
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120912/5c889d87/attachment.html>
More information about the llvm-dev
mailing list