Skip to content
This repository was archived by the owner on Jun 1, 2020. It is now read-only.

Commit de740a0

Browse files
committed
Check that optimization actually works
1 parent e2fa0b4 commit de740a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src_llvm/experimental/build_llvm_ir.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ Function* MakeFunction(Module* Mod, std::string name) {
114114

115115
Value *fa = Builder.CreateFAdd(arg1, arg2);
116116
Value *fb = Builder.CreateFAdd(fa, arg3);
117+
Value *fc = Builder.CreateFAdd(arg1, arg2);
118+
Value *fd = Builder.CreateFAdd(fb, fc);
117119

118-
// Add another instruction via the original builder. Note that it goes into
119-
// the end of BB, since Builder still points there.
120-
Builder.CreateRet(fb);
120+
Builder.CreateRet(fd);
121121

122122
return F;
123123
}
@@ -132,7 +132,6 @@ int main(int argc, char** argv) {
132132
std::string funcname = "foo";
133133

134134
Function* Func = MakeFunction(Mod.get(), funcname);
135-
Mod->dump();
136135

137136
// This is required to initialize the MC layer for our (native) target.
138137
InitializeNativeTarget();
@@ -156,6 +155,7 @@ int main(int argc, char** argv) {
156155
return 1;
157156
}
158157
FPM->run(*Func);
158+
Mod->dump();
159159

160160
JIT.addModule(std::move(Mod));
161161

0 commit comments

Comments
 (0)