Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

John Regehr regehr

🎯
Focusing
View GitHub Profile
View nops.txt
; result 1:
%0:i8 = var ; 0
; result 2:
%0:i8 = var ; 0
%1:i8 = add 255:i8, %0
%2:i8 = add 1:i8, %1
; result 3:
%0:i8 = var ; 0
View gist:82c8e3661e710e4762a30035dc54f45b
; result 1:
%0:i8 = var ; 0
; result 2:
%0:i8 = var ; 0
%1:i8 = add 0:i8, %0
; result 3:
%0:i8 = var ; 0
%1:i8 = mul 1:i8, %0
View gist:19b2ef7206922df5d455c1280dc7e8b7
#include <stdio.h>
static unsigned f(unsigned i) { return i * 40; }
static unsigned setbit(unsigned i, unsigned b) { return i | (1U << b); }
static unsigned clearbit(unsigned i, unsigned b) { return i & ~(1U << b); }
static void testbit(unsigned b) {
printf("bit %d : ", b);
View gist:cd7a4ab7b45092c873ae50085f4ed7f6
static APInt XXXones(const KnownBits &x, const KnownBits &y) {
const int WIDTH = x.One.getBitWidth();
const APInt t0 = operator+(y.Zero, APInt(WIDTH, 1));
const APInt t1 = operator+(t0, x.One);
const APInt t2 = (APInt::getSignedMinValue(WIDTH).isOneValue()) ? (x.Zero) : (x.Zero);
const APInt t3 = operator+(x.One, t2);
const APInt t4 = ~x.One;
const APInt t5 = (t4.isNegative()) ? (x.Zero) : (x.Zero);
const APInt t6 = operator-(y.Zero, t5);
APInt t7 = APInt::getAllOnesValue(WIDTH);
View gist:24560ea4352e11bf6c74a0bc70b8f0e1
#include <iostream>
#include <random>
#include <functional>
#include <map>
namespace {
bool enumerate;
std::random_device rd;
View gist:b2b724ea337c71a2aa7e70315a18c5d1
----------------------------------------
define i64 @slice(i64 %0) {
%1:
%2 = shl i64 9223372036854775807, %0
ret i64 %2
}
=>
define i64 @slice(i64 %rdi) {
%0:
ret i64 -2246371524778917889
View gist:9ccc4fd236e59ea89a1d2503b1951fb5
{
"arch": "amd64",
"os": "linux",
"functions": [
{
"address": 0,
"name": "slice",
"parameters": [
{
"name": "rdi",
View gist:20b66a92d0533e7b7559bcffb1ba8a80
{
"arch": "amd64",
"os": "linux",
"functions": [
{
"address": 0,
"name": "slice",
"parameters": [
{
"name": "edi",
View gist:6a67100cd1f44973fec6d4e20eb45e43
regehr@john-home:~/mctoll/llvm-project/llvm/tools/llvm-mctoll$ creduce --help
creduce 2.10.0 (fb91843) -- a C and C++ program reducer
C-Reduce requires an "interestingness test" and one or more files to
reduce, which must be writable. The interestingness test is an
executable program (usually a shell script) that returns 0 when a
partially reduced file is interesting (a candidate for further
reduction) and returns non-zero when a partially reduced file is not
interesting (not a candidate for further reduction -- all
uninteresting files are discarded).
View gist:ec1237ebe8ade092e4b02424ef4d791d
regehr@john-home:~/remill-build$ ./tools/lift/remill-lift-4.0 -ir_out /dev/stdout --bytes 4889f9b802000000d3c0c3 --slice_inputs RSP,EDI --slice_outputs RAX
; ModuleID = 'lifted_code'
source_filename = "lifted_code"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu-elf"
%struct.Memory = type opaque
%struct.State = type { %struct.ArchState, [32 x %union.VectorReg], %struct.ArithFlags, %union.anon, %struct.Segments, %struct.AddressSpace, %struct.GPR, %struct.X87Stack, %struct.MMX, %struct.FPUStatusFlags, %union.anon, %union.FPU, %struct.SegmentCaches }
%struct.ArchState = type { i32, i32, %union.anon }
%union.VectorReg = type { %union.vec512_t }
You can’t perform that action at this time.