[LLVMdev] Another missed optimization opportunity?

Scott Pakin pakin at lanl.gov
Wed Apr 24 14:19:28 PDT 2013


On 04/24/2013 02:14 PM, Duncan Sands wrote:
> does your bitcode contain data layout information?

Yes:

     ; ModuleID = 'junk.c'
     target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
     target triple = "x86_64-unknown-linux-gnu"

     @myarray = external global i32*

     ; Function Attrs: nounwind uwtable
     define void @update_array() #0 {
       %1 = load i32** @myarray, align 8
       %2 = getelementptr inbounds i32* %1, i64 5
       %3 = load i32* %2, align 4
       %4 = add nsw i32 %3, 1
       store i32 %4, i32* %2, align 4
       %5 = load i32** @myarray, align 8
       %6 = getelementptr inbounds i32* %5, i64 5
       %7 = load i32* %6, align 4
       %8 = add nsw i32 %7, 1
       store i32 %8, i32* %6, align 4
       %9 = load i32** @myarray, align 8
       %10 = getelementptr inbounds i32* %9, i64 5
       %11 = load i32* %10, align 4
       %12 = add nsw i32 %11, 1
       store i32 %12, i32* %10, align 4
       ret void
     }

     attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }

-- Scott



More information about the llvm-dev mailing list