================
@@ -2128,6 +2129,105 @@ static void patchAndReplaceAllUsesWith(Instruction *I, 
Value *Repl) {
   I->replaceAllUsesWith(Repl);
 }
 
+// split load to single byte loads and check if the value can be deduced
+//
+// Example:
+// define i32 @f(i8* %P)
+// 1:  %b2 = getelementptr inbounds i8, i8* %P, i64 1
+// 2:  store i8 0, i8* %b2, align 1
+// 3:  store i8 0, i8* %P, align 1
+// 4:  %s1 = bitcast i8* %P to i16*
+// 5:  %L = load i16, i16* %s1, align 4
----------------
nikic wrote:

```suggestion
// define i32 @f(ptr %P)
// 1:  %b2 = getelementptr inbounds i8, ptr %P, i64 1
// 2:  store i8 0, ptr %b2, align 1
// 3:  store i8 0, ptr %P, align 1
// 5:  %L = load i16, ptr %P, align 4
```

https://github.com/llvm/llvm-project/pull/72364
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to