Skip to content

Instantly share code, notes, and snippets.

View chandlerc's full-sized avatar

Chandler Carruth chandlerc

View GitHub Profile
; ModuleID = 'reduced.test.ll'
source_filename = "reduced.test.ll"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-macosx12.0.0"
@global = global { [2 x [1024 x [1024 x i8]]], [7 x [32 x i8]] } zeroinitializer
@global.1 = dso_local global { ptr, [24 x i8] } zeroinitializer
@global.2 = global { [2 x [1024 x [1024 x i8]]], [13 x [32 x i8]] } zeroinitializer
define ptr @wobble(ptr %arg) {
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-macosx12.0.0"
@_ZN4absl14flags_internal12_GLOBAL__N_115specified_flagsE = external dso_local global { ptr, [24 x i8] }
declare ptr @_ZN4absl9MutexLockD1Ev(ptr)
define void @_ZN4absl14flags_internal20ParseCommandLineImplEiPPcNS0_14ArgvListActionENS0_16UsageFlagsActionENS0_15OnUndefinedFlagE(ptr %0, ptr %1, i1 %2, i64 %3, i8 %4, i8 %5, i64 %6, i1 %7, i1 %8, i1 %9, i64 %10, ptr %11, ptr %12, ptr %13, i1 %14, i1 %15) personality ptr null {
%17 = load i64, ptr null, align 8
br label %18
> llc -fast-isel -function-sections -data-sections --relocation-model=pic reduced.test.ll -o - | tee /dev/stderr | clang -fpie -fdata-sections -ffunction-sections -O1 -o reduced.test -x assembler -; and otool -t -v reduced.test
reduced.test:
(__TEXT,__text) section
_my_function:
0000000100003e88 stp x29, x30, [sp, #-0x10]!
0000000100003e8c adrp x8, 517 ; 0x100208000
0000000100003e90 add x9, x8, #0xe0
0000000100003e94 str x0, [x9]
0000000100003e98 tbnz w1, #0x0, 0x100003ea8
0000000100003e9c ldr x0, [x8, #0xe0]
; ModuleID = '<stdin>'
source_filename = "/tmp/RISCVAttributeParser-87fe8d.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"struct.llvm::RISCVAttributeParser::DisplayHandler" = type { i32, { i64, i64 } }
%"struct.std::__1::__libcpp_debug_info" = type { i8*, i32, i8*, i8* }
%"class.llvm::Error" = type { %"class.llvm::ErrorInfoBase"* }
%"class.llvm::ErrorInfoBase" = type { i32 (...)** }
%"class.llvm::ELFAttributeParser" = type { i32 (...)**, %"class.llvm::StringRef", %"class.std::__1::unordered_map", %"class.std::__1::unordered_map.15", %"class.llvm::ScopedPrinter"*, %"class.llvm::ArrayRef", %"class.llvm::DataExtractor", %"class.llvm::DataExtractor::Cursor" }
@chandlerc
chandlerc / keybase.md
Created June 20, 2018 18:10
Keybase proof

Keybase proof

I hereby claim:

  • I am chandlerc on github.
  • I am chandlerc (https://keybase.io/chandlerc) on keybase.
  • I have a public key ASDFO1yHMQupYTVLfF8svO5CT8Cq1XCYX24GMo9dowLgJAo

To claim this, I am signing this object:

@chandlerc
chandlerc / bench.h
Created July 22, 2017 04:13 — forked from thoughtpolice/bench.h
Intel ERMSB benchmarking
/* bench.h - benchmark harness
Written in 2014 by Austin Seipp <aseipp@pobox.com>
To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to this software to
the public domain worldwide. This software is distributed without
any warranty.
You should have received a copy of the CC0 Public Domain Dedication
#!/bin/bash
SIZE=$(($RANDOM % 400))
SEED=$RANDOM
CMD="./bin/llc -o /dev/null $ARGS"
set pipefail
if ! ./bin/llvm-stress -size=$SIZE -seed=$SEED | $CMD; then
./bin/llvm-stress -size=$SIZE -seed=$SEED > /tmp/stress_crash_${SIZE}_${SEED}.ll
echo "CRASH: $CMD /tmp/stress_crash_${SIZE}_${SEED}.ll"
#define noinline foobar
#define __clang_internal_attribute_test_macro__noinline 1
#define __clang_internal_attribute_test_macro__foobar 0
#define __my_has_attribute(x) __clang_internal_attribute_test_macro__ ## x
#if __my_has_attribute(noinline)
#error found the feature test macro
#else
#error found something else
#endif
#define FOO BAZ
#define FOOBAR 1
#define BAZBAR 0
#define M(x) x ## BAR
#if M(FOO)
#error not pre-expanded
#else
#error pre-expanded
#endif
Partitioning of alloca: %a = alloca [2000 x i8]
partition #0 [0,42) (splittable)
used by: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %b, i32 2000, i32 1, i1 false)
used by: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b, i8* %src, i32 2000, i32 1, i1 false)
partition #1 [42,43)
used by: store i8 0, i8* %c
used by: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %b, i32 2000, i32 1, i1 false)
used by: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b, i8* %src, i32 2000, i32 1, i1 false)
partition #2 [43,142) (splittable)
used by: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %b, i32 2000, i32 1, i1 false)