[llvm] 5b465ad - [InstCombine] add/adjust tests for select-gep; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 06:25:28 PDT 2020


Author: Sanjay Patel
Date: 2020-03-10T09:25:13-04:00
New Revision: 5b465ad29024bc0d89304010da3b4bdb05c24a9e

URL: https://github.com/llvm/llvm-project/commit/5b465ad29024bc0d89304010da3b4bdb05c24a9e
DIFF: https://github.com/llvm/llvm-project/commit/5b465ad29024bc0d89304010da3b4bdb05c24a9e.diff

LOG: [InstCombine] add/adjust tests for select-gep; NFC

Goes with D75807

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/getelementptr.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll
index 0ecf6fe32745..04a85f7a5120 100644
--- a/llvm/test/Transforms/InstCombine/getelementptr.ll
+++ b/llvm/test/Transforms/InstCombine/getelementptr.ll
@@ -1216,11 +1216,26 @@ define i32* @test_gep_inbounds_of_gep(i32* %base) {
 
 define i32* @PR45084(i1 %cond) {
 ; CHECK-LABEL: @PR45084(
-; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[COND:%.*]], %struct.f* @g0, %struct.f* @g1
+; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[COND:%.*]], %struct.f* @g0, %struct.f* @g1, !prof !0
 ; CHECK-NEXT:    [[GEP:%.*]] = getelementptr inbounds [[STRUCT_F:%.*]], %struct.f* [[SEL]], i64 0, i32 0
 ; CHECK-NEXT:    ret i32* [[GEP]]
 ;
-  %sel = select i1 %cond, %struct.f* @g0, %struct.f* @g1
+  %sel = select i1 %cond, %struct.f* @g0, %struct.f* @g1, !prof !0
   %gep = getelementptr inbounds %struct.f, %struct.f* %sel, i64 0, i32 0
   ret i32* %gep
 }
+
+define i32* @PR45084_extra_use(i1 %cond, %struct.f** %p) {
+; CHECK-LABEL: @PR45084_extra_use(
+; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[COND:%.*]], %struct.f* @g0, %struct.f* @g1
+; CHECK-NEXT:    store %struct.f* [[SEL]], %struct.f** [[P:%.*]], align 8
+; CHECK-NEXT:    [[GEP:%.*]] = getelementptr [[STRUCT_F:%.*]], %struct.f* [[SEL]], i64 0, i32 0
+; CHECK-NEXT:    ret i32* [[GEP]]
+;
+  %sel = select i1 %cond, %struct.f* @g0, %struct.f* @g1
+  store %struct.f* %sel, %struct.f** %p
+  %gep = getelementptr %struct.f, %struct.f* %sel, i64 0, i32 0
+  ret i32* %gep
+}
+
+!0 = !{!"branch_weights", i32 2, i32 10}


        


More information about the llvm-commits mailing list