Home | History | Annotate | Download | only in NVPTX
      1 ; RUN: opt < %s -separate-const-offset-from-gep -value-tracking-dom-conditions -reassociate-geps-verify-no-dead-code -S | FileCheck %s
      2 
      3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      4 target triple = "nvptx64-unknown-unknown"
      5 
      6 ; if (i == 4)
      7 ;   p = &input[i | 3];
      8 ;
      9 ; =>
     10 ;
     11 ; if (i == 4) {
     12 ;   base = &input[i];
     13 ;   p = &base[3];
     14 ; }
     15 ;
     16 ; We should treat (i | 3) as (i + 3) because i is guaranteed to be 4, which
     17 ; does not share any set bits with 3.
     18 define float* @guarded_or(float* %input, i64 %i) {
     19 ; CHECK-LABEL: @guarded_or(
     20 entry:
     21   %is4 = icmp eq i64 %i, 4
     22   br i1 %is4, label %then, label %exit
     23 
     24 then:
     25   %or = or i64 %i, 3
     26   %p = getelementptr inbounds float, float* %input, i64 %or
     27 ; CHECK: [[base:[^ ]+]] = getelementptr float, float* %input, i64 %i
     28 ; CHECK: getelementptr inbounds float, float* [[base]], i64 3
     29   ret float* %p
     30 
     31 exit:
     32   ret float* null
     33 }
     34