华为计算微信公众号
华为计算微博
华为计算今日头条
毕昇3.1.0的opt在通过优化"-passes=dse,newgvn"编译特定代码时会生成错误代码
Command Lines:
clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm a.c -o a.bc opt -passes=dse,newgvn a.bc -o a.opt.bc clang a.opt.bc -o a.out ./a.out 4 opt a.bc -o a.opt.bc clang a.opt.bc -o a.out ./a.out -17
Source Code:
#include<stdio.h> struct { int a; } b; short c; unsigned int d() { int e[2][3][9] = {}; unsigned char f; for (c = -17; c < 0; c = 4) { int g; for (; b.a >= 0;) for (f = 0;;) { int h; return e[f][f][0]; } } return e[0][0][1]; } int main() { d(); printf("%d\n", c); return 0; }
我要发帖子
毕昇3.1.0的opt在通过优化"-passes=dse,newgvn"编译特定代码时会生成错误代码
Command Lines:
Source Code:
#include<stdio.h> struct { int a; } b; short c; unsigned int d() { int e[2][3][9] = {}; unsigned char f; for (c = -17; c < 0; c = 4) { int g; for (; b.a >= 0;) for (f = 0;;) { int h; return e[f][f][0]; } } return e[0][0][1]; } int main() { d(); printf("%d\n", c); return 0; }