xref: /llvm-project/llvm/test/Transforms/InstCombine/shl-twice-constant.ll (revision 27eaa8a40ef338bea611f693fa8e810b1fc8d78d)
1*27eaa8a4SMaurice Heumann; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2*27eaa8a4SMaurice Heumann; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3*27eaa8a4SMaurice Heumann
4*27eaa8a4SMaurice Heumann@c = external constant i8
5*27eaa8a4SMaurice Heumann@c2 = external constant i8
6*27eaa8a4SMaurice Heumann
7*27eaa8a4SMaurice Heumanndefine i64 @testfunc() {
8*27eaa8a4SMaurice Heumann; CHECK-LABEL: @testfunc(
9*27eaa8a4SMaurice Heumann; CHECK-NEXT:    [[SHL1:%.*]] = shl nuw i64 1, ptrtoint (ptr @c2 to i64)
10*27eaa8a4SMaurice Heumann; CHECK-NEXT:    [[SHL2:%.*]] = shl i64 [[SHL1]], ptrtoint (ptr @c to i64)
11*27eaa8a4SMaurice Heumann; CHECK-NEXT:    ret i64 [[SHL2]]
12*27eaa8a4SMaurice Heumann;
13*27eaa8a4SMaurice Heumann  %shl1 = shl i64 1, ptrtoint (ptr @c2 to i64)
14*27eaa8a4SMaurice Heumann  %shl2 = shl i64 %shl1, ptrtoint (ptr @c to i64)
15*27eaa8a4SMaurice Heumann  ret i64 %shl2
16*27eaa8a4SMaurice Heumann}
17