我想知道是否可以让 LLVMopt工具详细报告在每个优化级别(如-O1、-O2等)期间成功使用了哪些优化通道。
例如,这是文件的简单位码foo.bc:
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 0, i32* %1, align 4
  store i32 1, i32* %2, align 4
  store i32 1, i32* %3, align 4
  %4 = load i32, i32* %2, align 4
  ret i32 %4
}
这是运行后获得的bitcodeopt -O1 foo.bc -o foo.opt.bc
; Function Attrs: noinline norecurse nounwind …我是 llvm 新学员
后cmake -S llvm -B build -G Xcode -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"
我有一个llvm项目,编译该项目很慢
如何让它编译得更快?
Ninja 是一个选项。
从构建文件夹中,我看到libLLVMWindowsManifest.a
我不需要windows平台版本。
我只需要X86版本
LLVM C 编译器支持闭包“块”,例如
typedef returnType (^MyTypeName)(parameterTypes);
MyTypeName blockName = ^returnType(parameters) {puts("OK");}; 
这是 C 标准的一部分还是只是他们为了支持 Objective-C 而发明的?
我想使用 clang++ 14.0.6 和 mingw ucrt (类似 GCC)而不是clang-cl / clang-cpp 生成应用程序的 PDB 文件。
未生成 PDB 文件。
clang++ -march=native -O3 -g -gcodeview main.cpp -o filecomp.exe
我在 --help、clang github issues 和现有的 SO 问题中查找信息,但到目前为止没有找到任何答案。
大多数人谈论旧版本的 Clang 解决方案对我不起作用,或者 Clang-cl 甚至 Visual Studio 捆绑的 clang-cl 与我的情况无关。
我想知道如何在内存访问时禁用地址清理器插入检查功能。据我所知,地址清理程序通过插入检查功能来检测访问权限或缓冲区溢出等。[(https://github.com/llvm/llvmproject/blob/main/llvm/lib/Transforms/Instrumentation/AddressSanitizer .cpp)]
我想禁用该地址清理程序插入检查功能。是否有任何标志可以禁用插入检查功能?或者,如何禁用地址清理代码进行检查?
谢谢你!祝你今天过得愉快 :)
我希望检查 AddressSanitizer.cpp 中的代码行
我开始使用Linux编程,我不想学习gcc.使用clang可以轻松编译大型嵌套源目录的构建工具是什么?跨平台?Cmake看起来不错,但没有提到如何指定不同的编译器.
编辑:我想和vim一起使用它.
使用LLVM编译器编译以下代码时,它无法正常运行.(我没有增加.)在使用GCC 4.2进行编译时,它可以正常运行.这是LLVM编译器的错误吗?
#include <stdio.h>
#include <string.h>
void BytesFromHexString(unsigned char *data, const char *string) {
    printf("bytes:%s:", string);
    int len = (int)strlen(string);
    for (int i=0; i<len; i+=2) {
        unsigned char x;
        sscanf((char *)(string + i), "%02x", &x);
        printf("%02x", x);
        data[i] = x;
    }
    printf("\n");
}
int main (int argc, const char * argv[])
{
    // insert code here...
    unsigned char data[64];
    BytesFromHexString(data, "4d4f5cb093fc2d3d6b4120658c2d08b51b3846a39b51b663e7284478570bcef9");
    return 0;
}
我试图在我的机器上获得llvm 3.0,但是当我给make -k时,我得到以下错误.
chethan@ubuntu:~/llvm-3.0$ make
make[1]: Entering directory `/home/chethan/llvm-3.0/lib/Support'
llvm[1]: Compiling APFloat.cpp for Release build
In file included from APFloat.cpp:15:
In file included from /home/chethan/llvm-3.0/include/llvm/ADT/APFloat.h:104:
In file included from /home/chethan/llvm-3.0/include/llvm/ADT/APInt.h:18:
In file included from /home/chethan/llvm-3.0/include/llvm/ADT/ArrayRef.h:13:
In file included from /home/chethan/llvm-3.0/include/llvm/ADT/SmallVector.h:17:
/home/chethan/llvm-3.0/include/llvm/Support/type_traits.h:20:10: fatal error: 'utility' file not found
#include <utility>
     ^
1 error generated.
make[1]: *** [/home/chethan/llvm-3.0/lib/Support/Release/APFloat.o] Error 1
make[1]: Leaving directory `/home/chethan/llvm-3.0/lib/Support'
make: *** [all] Error 1
我按照这些步骤在我的机器上构建llvm.
虽然在这种情况下,我只是给了'make',以便在第一次出错时停止.我在我的机器上安装了llvm-gcc 4.2.
今天早上我在家用机器上执行了相同的步骤,并成功构建了llvm-3.0!知道这里可能缺少什么吗?
在我的系统上,我有clang 2.9但是llvm 2.8.有没有什么方法可以指示我的clang 2.9编译器生成一个与llvm 2.8兼容的IR(带标志-emit-llvm)?
我正在使用本指南:http : //llvm.org/releases/3.0/docs/WritingAnLLVMPass.html用于创建llvm传递,但是使用时出现以下错误
opt -load ../../../Debug+Asserts/lib/Hello.so -hello < hello.bc > /dev/null
Error opening '../../../Release/lib/Hello.so': ../../../Release/lib/Hello.so: undefined symbol: _ZN4llvm12PassRegistry12registerPassERKNS_8PassInfoEb
  -load request ignored.
opt: Unknown command line argument '-hello'.  Try: 'opt -help'
请注意,我没有文件夹“ Debug + Asserts”,而是“ Release”
有人知道这是什么问题吗?
也许是因为创建Hello.bc文件时,我使用llvm-clang而不是llvm-gcc?(本指南说使用llvm-gcc,但它不起作用:http ://llvm.org/releases/3.0/docs/GettingStarted.html#tutorial ),或者可能是因为我在使用llvm时选择了2.8版-3.0?