snake5

shader compiler IR dump - constant propagation

Dec 23rd, 2017
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LLVM 0.92 KB | None | 0 0
  1. shader:
  2. float4 main() : POSITION { return 1.0 + 2.0 * 3.0 / 4.0 - 0.5 % 1.0; }
  3.  
  4. original IR:
  5. module
  6. {
  7.   struct:00CE3890:main__ret{ [4 x f32] __RetVal:POSITION }
  8.   function 'main'() -> struct:00CE3890:main__ret
  9.   {
  10.     block
  11.     {
  12.       00CF6F00 = mod.f32(f32:0.5,f32:1)
  13.       00CF7130 = mul.f32(f32:2,f32:3)
  14.       00CF7520 = div.f32(00CF7130,f32:4)
  15.       00CF6E90 = add.f32(f32:1,00CF7520)
  16.       00CF6F70 = sub.f32(00CF6E90,00CF6F00)
  17.       00CFF3C0 = cast [4 x f32] 00CF6F70
  18.       00CFF6C0 = aggregate struct:00CE3890:main__ret (00CFF3C0)
  19.       ret struct:00CE3890:main__ret 00CFF6C0
  20.     }
  21.   }
  22. }
  23. optimized IR:
  24. module
  25. {
  26.   struct:00CE3890:main__ret{ [4 x f32] __RetVal:POSITION }
  27.   function 'main'() -> struct:00CE3890:main__ret
  28.   {
  29.     block
  30.     {
  31.       00CFF3C0 = cast [4 x f32] f32:2
  32.       00CFF6C0 = aggregate struct:00CE3890:main__ret (00CFF3C0)
  33.       ret struct:00CE3890:main__ret 00CFF6C0
  34.     }
  35.   }
  36. }
Add Comment
Please, Sign In to add comment