pr8547.ll 914 B

1234567891011121314151617181920212223242526
  1. ; RUN: opt < %s -instcombine -S | FileCheck %s
  2. ; Converting the 2 shifts to SHL 6 without the AND is wrong. PR 8547.
  3. @g_2 = global i32 0, align 4
  4. @.str = constant [10 x i8] c"g_2 = %d\0A\00"
  5. declare i32 @printf(i8*, ...)
  6. define i32 @main() nounwind {
  7. codeRepl:
  8. br label %for.cond
  9. for.cond: ; preds = %for.cond, %codeRepl
  10. %storemerge = phi i32 [ 0, %codeRepl ], [ 5, %for.cond ]
  11. store i32 %storemerge, i32* @g_2, align 4
  12. %shl = shl i32 %storemerge, 30
  13. %conv2 = lshr i32 %shl, 24
  14. ; CHECK: %0 = shl nuw nsw i32 %storemerge, 6
  15. ; CHECK: %conv2 = and i32 %0, 64
  16. %tobool = icmp eq i32 %conv2, 0
  17. br i1 %tobool, label %for.cond, label %codeRepl2
  18. codeRepl2: ; preds = %for.cond
  19. %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %conv2) nounwind
  20. ret i32 0
  21. }